From bc9b2532456d7ec643bde8b8f633874b085c4b56 Mon Sep 17 00:00:00 2001 From: gkjohnson Date: Sat, 30 Sep 2023 15:51:10 +0000 Subject: [PATCH] update builds --- example/bundle/edgeProjection.59721e0c.js | 3 + example/bundle/edgeProjection.59721e0c.js.map | 1 + example/bundle/edgeProjection.html | 1 + example/bundle/floorProjection.6ab05ec7.js | 2 + .../bundle/floorProjection.6ab05ec7.js.map | 1 + example/bundle/floorProjection.99e62bf6.js | 2 + .../bundle/floorProjection.99e62bf6.js.map | 1 + example/bundle/floorProjection.html | 1 + .../bundle/projectionAsync.worker.15f44cdc.js | 187 ++++++++++++++++++ .../projectionAsync.worker.15f44cdc.js.map | 1 + .../bundle/projectionAsync.worker.28971622.js | 2 + .../projectionAsync.worker.28971622.js.map | 1 + .../bundle/silhouetteAsync.worker.f555f2b4.js | 2 + .../silhouetteAsync.worker.f555f2b4.js.map | 1 + .../bundle/silhouetteProjection.4adac46b.js | 187 ++++++++++++++++++ .../silhouetteProjection.4adac46b.js.map | 1 + .../bundle/silhouetteProjection.b08c1309.js | 4 + .../silhouetteProjection.b08c1309.js.map | 1 + .../bundle/silhouetteProjection.e215f6e5.js | 2 + .../silhouetteProjection.e215f6e5.js.map | 1 + example/bundle/silhouetteProjection.html | 1 + 21 files changed, 403 insertions(+) create mode 100644 example/bundle/edgeProjection.59721e0c.js create mode 100644 example/bundle/edgeProjection.59721e0c.js.map create mode 100644 example/bundle/edgeProjection.html create mode 100644 example/bundle/floorProjection.6ab05ec7.js create mode 100644 example/bundle/floorProjection.6ab05ec7.js.map create mode 100644 example/bundle/floorProjection.99e62bf6.js create mode 100644 example/bundle/floorProjection.99e62bf6.js.map create mode 100644 example/bundle/floorProjection.html create mode 100644 example/bundle/projectionAsync.worker.15f44cdc.js create mode 100644 example/bundle/projectionAsync.worker.15f44cdc.js.map create mode 100644 example/bundle/projectionAsync.worker.28971622.js create mode 100644 example/bundle/projectionAsync.worker.28971622.js.map create mode 100644 example/bundle/silhouetteAsync.worker.f555f2b4.js create mode 100644 example/bundle/silhouetteAsync.worker.f555f2b4.js.map create mode 100644 example/bundle/silhouetteProjection.4adac46b.js create mode 100644 example/bundle/silhouetteProjection.4adac46b.js.map create mode 100644 example/bundle/silhouetteProjection.b08c1309.js create mode 100644 example/bundle/silhouetteProjection.b08c1309.js.map create mode 100644 example/bundle/silhouetteProjection.e215f6e5.js create mode 100644 example/bundle/silhouetteProjection.e215f6e5.js.map create mode 100644 example/bundle/silhouetteProjection.html diff --git a/example/bundle/edgeProjection.59721e0c.js b/example/bundle/edgeProjection.59721e0c.js new file mode 100644 index 0000000..a53ad2f --- /dev/null +++ b/example/bundle/edgeProjection.59721e0c.js @@ -0,0 +1,3 @@ +let e,r,t,o,n,i,s,a,l,d,c,g;function p(e,r,t,o){Object.defineProperty(e,r,{get:t,set:o,enumerable:!0,configurable:!0})}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},w={},f={},m=u.parcelRequire6c98;null==m&&((m=function(e){if(e in w)return w[e].exports;if(e in f){var r=f[e];delete f[e];var t={id:e,exports:{}};return w[e]=t,r.call(t.exports,t,t.exports),t.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,r){f[e]=r},u.parcelRequire6c98=m),m.register("27Lyk",function(e,r){p(e.exports,"register",()=>t,e=>t=e),p(e.exports,"resolve",()=>o,e=>o=e);var t,o,n={};t=function(e){for(var r=Object.keys(e),t=0;t{if(e.message)throw Error(`${P}: Could not create Web Worker with error "${e.message}"`);throw Error(`${P}: Could not create Web Worker.`)}}generate(e,r={}){if(this.running)throw Error(`${P}: Already running job.`);if(null===this.worker)throw Error(`${P}: Worker has been disposed.`);let{worker:t}=this;return this.running=!0,new Promise((o,n)=>{t.onerror=e=>{n(Error(`${P}: ${e.message}`)),this.running=!1},t.onmessage=e=>{this.running=!1;let{data:i}=e;if(i.error)n(Error(i.error)),t.onmessage=null;else if(i.result){let e=new y.BufferGeometry;e.setAttribute("position",new y.BufferAttribute(i.result,3,!1)),o(e),t.onmessage=null}else r.onProgress&&r.onProgress(i.progress)};let i=e.index?e.index.array.slice():null,s=e.attributes.position.array.slice(),a=[s.buffer];i&&a.push(i.buffer),t.postMessage({index:i,position:s,options:{...r,onProgress:null,includedProgressCallback:!!r.onProgress}},a)})}dispose(){this.worker.terminate(),this.worker=null}}var O=m("fNPnQ");const F={displayModel:"color",displayEdges:!1,displayProjection:!0,sortEdges:!0,includeIntersectionEdges:!1,useWorker:!1,rotate:()=>{a.quaternion.random(),a.position.set(0,0,0),a.updateMatrixWorld(!0);let e=new y.Box3;e.setFromObject(i,!0),e.getCenter(a.position).multiplyScalar(-1),a.position.y=Math.max(0,-e.min.y)+1},regenerate:()=>{C=S()}};let C=null;function*S(e=30){c.innerText="processing: --";let r=window.performance.now(),t=[];i.updateWorldMatrix(!0,!0),i.traverse(e=>{if(e.geometry){let r=e.geometry.clone();for(let t in r.applyMatrix4(e.matrixWorld),r.attributes)"position"!==t&&r.deleteAttribute(t);t.push(r)}});let o=(0,E.mergeGeometries)(t,!1),n=window.performance.now()-r;yield,r=window.performance.now();let a=null;if(F.useWorker)for(g.generate(o,{sortEdges:F.sortEdges,includeIntersectionEdges:F.includeIntersectionEdges,onProgress:e=>{c.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`}}).then(e=>{a=e});null===a;)yield;else{let r=new j.ProjectionGenerator;r.sortEdges=F.sortEdges,r.iterationTime=e,r.angleThreshold=50,r.includeIntersectionEdges=F.includeIntersectionEdges;let t=r.generate(o,{onProgress:(e,r)=>{c.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`,F.displayProjection&&(s.geometry.dispose(),s.geometry=r.getLineGeometry())}}),n=t.next();for(;!n.done;)n=t.next(),yield;a=n.value}let l=window.performance.now()-r;s.geometry.dispose(),s.geometry=a,c.innerText=`merge geometry : ${n.toFixed(2)}ms +edge trimming : ${l.toFixed(2)}ms`}!async function(){c=document.getElementById("output"),(e=new y.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(15658734,1),document.body.appendChild(e.domElement),t=new y.Scene;let p=new y.DirectionalLight(16777215,3.5);p.position.set(1,2,3),t.add(p);let u=new y.AmbientLight(11583173,.5);t.add(u),a=new y.Group,t.add(a);let w=await new(0,x.GLTFLoader)().setMeshoptDecoder(v.MeshoptDecoder).loadAsync("https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/nasa-m2020/Perseverance.glb");i=w.scene;let f=new y.MeshStandardMaterial({polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});(l=i.clone()).traverse(e=>{e.material&&(e.material=f)});let m=new y.MeshBasicMaterial({polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});(d=i.clone()).traverse(e=>{e.material&&(e.material=m)}),a.updateMatrixWorld(!0);let E=new y.Box3;E.setFromObject(i,!0),E.getCenter(a.position).multiplyScalar(-1),a.position.y=Math.max(0,-E.min.y)+1,a.add(i,l,d),n=new y.Group,i.traverse(e=>{if(e.geometry){let r=(0,O.generateEdges)(e.geometry,void 0,50),t=r.flatMap(e=>[e.start,e.end]),o=new y.BufferGeometry;o.setFromPoints(t);let i=new y.LineSegments(o,new y.LineBasicMaterial({color:197379}));i.position.copy(e.position),i.quaternion.copy(e.quaternion),i.scale.copy(e.scale),n.add(i)}}),a.add(n),s=new y.LineSegments(new y.BufferGeometry,new y.LineBasicMaterial({color:197379})),t.add(s),(r=new y.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.01,50)).position.setScalar(3.5),r.updateProjectionMatrix(),new b.OrbitControls(r,e.domElement),(o=new h.GUI).add(F,"displayModel",["none","color","shaded white"]),o.add(F,"displayProjection"),o.add(F,"sortEdges"),o.add(F,"includeIntersectionEdges"),o.add(F,"useWorker"),o.add(F,"rotate"),o.add(F,"regenerate"),g=new L,C=S(),function o(){if(requestAnimationFrame(o),C){let e=C.next();e.done&&(C=null)}i.visible="color"===F.displayModel,l.visible="shaded white"===F.displayModel,d.visible="white"===F.displayModel,n.visible=F.displayEdges,s.visible=F.displayProjection,e.render(t,r)}(),window.addEventListener("resize",function(){r.aspect=window.innerWidth/window.innerHeight,r.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}(); +//# sourceMappingURL=edgeProjection.59721e0c.js.map diff --git a/example/bundle/edgeProjection.59721e0c.js.map b/example/bundle/edgeProjection.59721e0c.js.map new file mode 100644 index 0000000..c0cb477 --- /dev/null +++ b/example/bundle/edgeProjection.59721e0c.js.map @@ -0,0 +1 @@ +{"mappings":"IGkDI,EAAU,EAAQ,EAAO,EACzB,EAAO,EAAO,EAAY,EAAO,EAAkB,EACnD,EACA,E,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,Q,S,C,C,C,E,E,E,O,C,W,I,E,A,G,E,G,E,E,O,C,U,I,E,A,G,E,GFnDJ,IAcA,EACA,EAfI,EAAU,CAAC,EAcf,EAbA,SAAkB,CAAK,EAErB,IAAK,IADD,EAAO,OAAO,IAAA,CAAK,GACd,EAAI,EAAG,EAAI,EAAK,MAAA,CAAQ,IAC/B,CAAO,CAAC,CAAI,CAAC,EAAE,CAAC,CAAG,CAAK,CAAC,CAAI,CAAC,EAAE,CAAC,AAErC,EASA,EARA,SAAiB,CAAE,EACjB,IAAI,EAAW,CAAO,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jB,EAAI,GAAA,CAAK,EAAQ,cAEjB,EAAS,IAAI,EAEb,EAAO,IAEP,AA2HD,SAAS,IAIR,GAFA,sBAAuB,GAElB,EAAO,CAEX,IAAM,EAAM,EAAK,IAAjB,EACK,CAAA,EAAI,IAAA,EAER,CAAA,EAAO,IAFR,CAMD,CAEA,EAAM,OAAA,CAAU,AAAwB,UAAxB,EAAO,YAAA,CACvB,EAAiB,OAAA,CAAU,AAAwB,iBAAxB,EAAO,YAAA,CAClC,EAAW,OAAA,CAAU,AAAwB,UAAxB,EAAO,YAAA,CAC5B,EAAM,OAAA,CAAU,EAAO,YAAvB,CACA,EAAW,OAAA,CAAU,EAAO,iBAA5B,CAEA,EAAS,MAAA,CAAQ,EAAO,EAEzB,IAhJC,OAAO,gBAAA,CAAkB,SAAU,WAElC,EAAO,MAAA,CAAS,OAAO,UAAA,CAAa,OAAO,WAA3C,CACA,EAAO,sBAAP,GAEA,EAAS,OAAA,CAAS,OAAO,UAAA,CAAY,OAAO,WAA5C,CAED,EAAG,CAAA,EAEJ","sources":["","node_modules/@parcel/runtime-js/lib/helpers/bundle-manifest.js","node_modules/@parcel/runtime-js/lib/runtime-bcd703c5375c41c4.js","example/edgeProjection.js","src/worker/ProjectionGeneratorWorker.js","node_modules/@parcel/runtime-js/lib/runtime-7569578f85288298.js","node_modules/@parcel/runtime-js/lib/helpers/get-worker-url.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"27Lyk\", function(module, exports) {\n\n$parcel$export(module.exports, \"register\", () => $18c11f3350a906ea$export$6503ec6e8aabbaf, (v) => $18c11f3350a906ea$export$6503ec6e8aabbaf = v);\n$parcel$export(module.exports, \"resolve\", () => $18c11f3350a906ea$export$f7ad0328861e2f03, (v) => $18c11f3350a906ea$export$f7ad0328861e2f03 = v);\nvar $18c11f3350a906ea$export$6503ec6e8aabbaf;\nvar $18c11f3350a906ea$export$f7ad0328861e2f03;\n\"use strict\";\nvar $18c11f3350a906ea$var$mapping = {};\nfunction $18c11f3350a906ea$var$register(pairs) {\n var keys = Object.keys(pairs);\n for(var i = 0; i < keys.length; i++)$18c11f3350a906ea$var$mapping[keys[i]] = pairs[keys[i]];\n}\nfunction $18c11f3350a906ea$var$resolve(id) {\n var resolved = $18c11f3350a906ea$var$mapping[id];\n if (resolved == null) throw new Error(\"Could not resolve bundle with id \" + id);\n return resolved;\n}\n$18c11f3350a906ea$export$6503ec6e8aabbaf = $18c11f3350a906ea$var$register;\n$18c11f3350a906ea$export$f7ad0328861e2f03 = $18c11f3350a906ea$var$resolve;\n\n});\n\nvar $b26644ce480f0b84$exports = {};\n\n(parcelRequire(\"27Lyk\")).register(JSON.parse('{\"gEVFf\":\"edgeProjection.59721e0c.js\",\"8zbCD\":\"projectionAsync.worker.28971622.js\",\"J4nAg\":\"projectionAsync.worker.15f44cdc.js\",\"4qUe1\":\"silhouetteProjection.4adac46b.js\",\"kElIp\":\"silhouetteProjection.e215f6e5.js\",\"eFNPD\":\"floorProjection.99e62bf6.js\"}'));\n\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $jiuw3 = parcelRequire(\"jiuw3\");\n\nvar $5Rd1x = parcelRequire(\"5Rd1x\");\n\nvar $7lx9d = parcelRequire(\"7lx9d\");\n\nvar $7ePFa = parcelRequire(\"7ePFa\");\n\nvar $kp7Te = parcelRequire(\"kp7Te\");\n\nvar $4CEV9 = parcelRequire(\"4CEV9\");\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $5c260663d40074f0$var$NAME = \"ProjectionGeneratorWorker\";\nvar $deac5b03489e8ef8$exports = {};\nvar $56b621a6dd25b2cb$exports = {};\n\"use strict\";\n$56b621a6dd25b2cb$exports = function(workerUrl, origin, isESM) {\n if (origin === self.location.origin) // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? \"import \" + JSON.stringify(workerUrl) + \";\" : \"importScripts(\" + JSON.stringify(workerUrl) + \");\";\n return URL.createObjectURL(new Blob([\n source\n ], {\n type: \"application/javascript\"\n }));\n }\n};\n\n\n\nlet $deac5b03489e8ef8$var$url = new URL((parcelRequire(\"27Lyk\")).resolve(\"8zbCD\"), import.meta.url);\n$deac5b03489e8ef8$exports = $56b621a6dd25b2cb$exports($deac5b03489e8ef8$var$url.toString(), $deac5b03489e8ef8$var$url.origin, true);\n\n\nclass $5c260663d40074f0$export$58847e466a6b9214 {\n constructor(){\n this.running = false;\n this.worker = new Worker($deac5b03489e8ef8$exports);\n this.worker.onerror = (e)=>{\n if (e.message) throw new Error(`${$5c260663d40074f0$var$NAME}: Could not create Web Worker with error \"${e.message}\"`);\n else throw new Error(`${$5c260663d40074f0$var$NAME}: Could not create Web Worker.`);\n };\n }\n generate(geometry, options = {}) {\n if (this.running) throw new Error(`${$5c260663d40074f0$var$NAME}: Already running job.`);\n if (this.worker === null) throw new Error(`${$5c260663d40074f0$var$NAME}: Worker has been disposed.`);\n const { worker: worker } = this;\n this.running = true;\n return new Promise((resolve, reject)=>{\n worker.onerror = (e)=>{\n reject(new Error(`${$5c260663d40074f0$var$NAME}: ${e.message}`));\n this.running = false;\n };\n worker.onmessage = (e)=>{\n this.running = false;\n const { data: data } = e;\n if (data.error) {\n reject(new Error(data.error));\n worker.onmessage = null;\n } else if (data.result) {\n const geometry = new (0, $ilwiq.BufferGeometry)();\n geometry.setAttribute(\"position\", new (0, $ilwiq.BufferAttribute)(data.result, 3, false));\n resolve(geometry);\n worker.onmessage = null;\n } else if (options.onProgress) options.onProgress(data.progress);\n };\n const index = geometry.index ? geometry.index.array.slice() : null;\n const position = geometry.attributes.position.array.slice();\n const transfer = [\n position.buffer\n ];\n if (index) transfer.push(index.buffer);\n worker.postMessage({\n index: index,\n position: position,\n options: {\n ...options,\n onProgress: null,\n includedProgressCallback: Boolean(options.onProgress)\n }\n }, transfer);\n });\n }\n dispose() {\n this.worker.terminate();\n this.worker = null;\n }\n}\n\n\n\nvar $fNPnQ = parcelRequire(\"fNPnQ\");\nconst $c9fdec40e3bbb10a$var$params = {\n displayModel: \"color\",\n displayEdges: false,\n displayProjection: true,\n sortEdges: true,\n includeIntersectionEdges: false,\n useWorker: false,\n rotate: ()=>{\n $c9fdec40e3bbb10a$var$group.quaternion.random();\n $c9fdec40e3bbb10a$var$group.position.set(0, 0, 0);\n $c9fdec40e3bbb10a$var$group.updateMatrixWorld(true);\n const box = new (0, $ilwiq.Box3)();\n box.setFromObject($c9fdec40e3bbb10a$var$model, true);\n box.getCenter($c9fdec40e3bbb10a$var$group.position).multiplyScalar(-1);\n $c9fdec40e3bbb10a$var$group.position.y = Math.max(0, -box.min.y) + 1;\n },\n regenerate: ()=>{\n $c9fdec40e3bbb10a$var$task = $c9fdec40e3bbb10a$var$updateEdges();\n }\n};\nconst $c9fdec40e3bbb10a$var$ANGLE_THRESHOLD = 50;\nlet $c9fdec40e3bbb10a$var$renderer, $c9fdec40e3bbb10a$var$camera, $c9fdec40e3bbb10a$var$scene, $c9fdec40e3bbb10a$var$gui, $c9fdec40e3bbb10a$var$controls;\nlet $c9fdec40e3bbb10a$var$lines, $c9fdec40e3bbb10a$var$model, $c9fdec40e3bbb10a$var$projection, $c9fdec40e3bbb10a$var$group, $c9fdec40e3bbb10a$var$shadedWhiteModel, $c9fdec40e3bbb10a$var$whiteModel;\nlet $c9fdec40e3bbb10a$var$outputContainer;\nlet $c9fdec40e3bbb10a$var$worker;\nlet $c9fdec40e3bbb10a$var$task = null;\n$c9fdec40e3bbb10a$var$init();\nasync function $c9fdec40e3bbb10a$var$init() {\n $c9fdec40e3bbb10a$var$outputContainer = document.getElementById(\"output\");\n const bgColor = 0xeeeeee;\n // renderer setup\n $c9fdec40e3bbb10a$var$renderer = new (0, $ilwiq.WebGLRenderer)({\n antialias: true\n });\n $c9fdec40e3bbb10a$var$renderer.setPixelRatio(window.devicePixelRatio);\n $c9fdec40e3bbb10a$var$renderer.setSize(window.innerWidth, window.innerHeight);\n $c9fdec40e3bbb10a$var$renderer.setClearColor(bgColor, 1);\n document.body.appendChild($c9fdec40e3bbb10a$var$renderer.domElement);\n // scene setup\n $c9fdec40e3bbb10a$var$scene = new (0, $ilwiq.Scene)();\n // lights\n const light = new (0, $ilwiq.DirectionalLight)(0xffffff, 3.5);\n light.position.set(1, 2, 3);\n $c9fdec40e3bbb10a$var$scene.add(light);\n const ambientLight = new (0, $ilwiq.AmbientLight)(0xb0bec5, 0.5);\n $c9fdec40e3bbb10a$var$scene.add(ambientLight);\n // load model\n $c9fdec40e3bbb10a$var$group = new (0, $ilwiq.Group)();\n $c9fdec40e3bbb10a$var$scene.add($c9fdec40e3bbb10a$var$group);\n const gltf = await new (0, $7lx9d.GLTFLoader)().setMeshoptDecoder((0, $kp7Te.MeshoptDecoder)).loadAsync(\"https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/nasa-m2020/Perseverance.glb\");\n $c9fdec40e3bbb10a$var$model = gltf.scene;\n const whiteMaterial = new (0, $ilwiq.MeshStandardMaterial)({\n polygonOffset: true,\n polygonOffsetFactor: 1,\n polygonOffsetUnits: 1\n });\n $c9fdec40e3bbb10a$var$shadedWhiteModel = $c9fdec40e3bbb10a$var$model.clone();\n $c9fdec40e3bbb10a$var$shadedWhiteModel.traverse((c)=>{\n if (c.material) c.material = whiteMaterial;\n });\n const whiteBasicMaterial = new (0, $ilwiq.MeshBasicMaterial)({\n polygonOffset: true,\n polygonOffsetFactor: 1,\n polygonOffsetUnits: 1\n });\n $c9fdec40e3bbb10a$var$whiteModel = $c9fdec40e3bbb10a$var$model.clone();\n $c9fdec40e3bbb10a$var$whiteModel.traverse((c)=>{\n if (c.material) c.material = whiteBasicMaterial;\n });\n $c9fdec40e3bbb10a$var$group.updateMatrixWorld(true);\n // center model\n const box = new (0, $ilwiq.Box3)();\n box.setFromObject($c9fdec40e3bbb10a$var$model, true);\n box.getCenter($c9fdec40e3bbb10a$var$group.position).multiplyScalar(-1);\n $c9fdec40e3bbb10a$var$group.position.y = Math.max(0, -box.min.y) + 1;\n $c9fdec40e3bbb10a$var$group.add($c9fdec40e3bbb10a$var$model, $c9fdec40e3bbb10a$var$shadedWhiteModel, $c9fdec40e3bbb10a$var$whiteModel);\n // generate geometry line segments\n $c9fdec40e3bbb10a$var$lines = new (0, $ilwiq.Group)();\n $c9fdec40e3bbb10a$var$model.traverse((c)=>{\n if (c.geometry) {\n const edges = (0, $fNPnQ.generateEdges)(c.geometry, undefined, $c9fdec40e3bbb10a$var$ANGLE_THRESHOLD);\n const points = edges.flatMap((line)=>[\n line.start,\n line.end\n ]);\n const geom = new (0, $ilwiq.BufferGeometry)();\n geom.setFromPoints(points);\n const geomLines = new (0, $ilwiq.LineSegments)(geom, new (0, $ilwiq.LineBasicMaterial)({\n color: 0x030303\n }));\n geomLines.position.copy(c.position);\n geomLines.quaternion.copy(c.quaternion);\n geomLines.scale.copy(c.scale);\n $c9fdec40e3bbb10a$var$lines.add(geomLines);\n }\n });\n $c9fdec40e3bbb10a$var$group.add($c9fdec40e3bbb10a$var$lines);\n // create projection display mesh\n $c9fdec40e3bbb10a$var$projection = new (0, $ilwiq.LineSegments)(new (0, $ilwiq.BufferGeometry)(), new (0, $ilwiq.LineBasicMaterial)({\n color: 0x030303\n }));\n $c9fdec40e3bbb10a$var$scene.add($c9fdec40e3bbb10a$var$projection);\n // camera setup\n $c9fdec40e3bbb10a$var$camera = new (0, $ilwiq.PerspectiveCamera)(75, window.innerWidth / window.innerHeight, 0.01, 50);\n $c9fdec40e3bbb10a$var$camera.position.setScalar(3.5);\n $c9fdec40e3bbb10a$var$camera.updateProjectionMatrix();\n // controls\n $c9fdec40e3bbb10a$var$controls = new (0, $5Rd1x.OrbitControls)($c9fdec40e3bbb10a$var$camera, $c9fdec40e3bbb10a$var$renderer.domElement);\n $c9fdec40e3bbb10a$var$gui = new (0, $jiuw3.GUI)();\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"displayModel\", [\n \"none\",\n \"color\",\n \"shaded white\"\n ]);\n // gui.add( params, 'displayEdges' );\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"displayProjection\");\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"sortEdges\");\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"includeIntersectionEdges\");\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"useWorker\");\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"rotate\");\n $c9fdec40e3bbb10a$var$gui.add($c9fdec40e3bbb10a$var$params, \"regenerate\");\n $c9fdec40e3bbb10a$var$worker = new (0, $5c260663d40074f0$export$58847e466a6b9214)();\n $c9fdec40e3bbb10a$var$task = $c9fdec40e3bbb10a$var$updateEdges();\n $c9fdec40e3bbb10a$var$render();\n window.addEventListener(\"resize\", function() {\n $c9fdec40e3bbb10a$var$camera.aspect = window.innerWidth / window.innerHeight;\n $c9fdec40e3bbb10a$var$camera.updateProjectionMatrix();\n $c9fdec40e3bbb10a$var$renderer.setSize(window.innerWidth, window.innerHeight);\n }, false);\n}\nfunction* $c9fdec40e3bbb10a$var$updateEdges(runTime = 30) {\n $c9fdec40e3bbb10a$var$outputContainer.innerText = \"processing: --\";\n // transform and merge geometries to project into a single model\n let timeStart = window.performance.now();\n const geometries = [];\n $c9fdec40e3bbb10a$var$model.updateWorldMatrix(true, true);\n $c9fdec40e3bbb10a$var$model.traverse((c)=>{\n if (c.geometry) {\n const clone = c.geometry.clone();\n clone.applyMatrix4(c.matrixWorld);\n for(const key in clone.attributes)if (key !== \"position\") clone.deleteAttribute(key);\n geometries.push(clone);\n }\n });\n const mergedGeometry = (0, $7ePFa.mergeGeometries)(geometries, false);\n const mergeTime = window.performance.now() - timeStart;\n yield;\n // generate the candidate edges\n timeStart = window.performance.now();\n let geometry = null;\n if (!$c9fdec40e3bbb10a$var$params.useWorker) {\n const generator = new (0, $4CEV9.ProjectionGenerator)();\n generator.sortEdges = $c9fdec40e3bbb10a$var$params.sortEdges;\n generator.iterationTime = runTime;\n generator.angleThreshold = $c9fdec40e3bbb10a$var$ANGLE_THRESHOLD;\n generator.includeIntersectionEdges = $c9fdec40e3bbb10a$var$params.includeIntersectionEdges;\n const task = generator.generate(mergedGeometry, {\n onProgress: (p, data)=>{\n $c9fdec40e3bbb10a$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n if ($c9fdec40e3bbb10a$var$params.displayProjection) {\n $c9fdec40e3bbb10a$var$projection.geometry.dispose();\n $c9fdec40e3bbb10a$var$projection.geometry = data.getLineGeometry();\n }\n }\n });\n let result = task.next();\n while(!result.done){\n result = task.next();\n yield;\n }\n geometry = result.value;\n } else {\n $c9fdec40e3bbb10a$var$worker.generate(mergedGeometry, {\n sortEdges: $c9fdec40e3bbb10a$var$params.sortEdges,\n includeIntersectionEdges: $c9fdec40e3bbb10a$var$params.includeIntersectionEdges,\n onProgress: (p)=>{\n $c9fdec40e3bbb10a$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n }\n }).then((result)=>{\n geometry = result;\n });\n while(geometry === null)yield;\n }\n const trimTime = window.performance.now() - timeStart;\n $c9fdec40e3bbb10a$var$projection.geometry.dispose();\n $c9fdec40e3bbb10a$var$projection.geometry = geometry;\n $c9fdec40e3bbb10a$var$outputContainer.innerText = `merge geometry : ${mergeTime.toFixed(2)}ms\\n` + `edge trimming : ${trimTime.toFixed(2)}ms`;\n}\nfunction $c9fdec40e3bbb10a$var$render() {\n requestAnimationFrame($c9fdec40e3bbb10a$var$render);\n if ($c9fdec40e3bbb10a$var$task) {\n const res = $c9fdec40e3bbb10a$var$task.next();\n if (res.done) $c9fdec40e3bbb10a$var$task = null;\n }\n $c9fdec40e3bbb10a$var$model.visible = $c9fdec40e3bbb10a$var$params.displayModel === \"color\";\n $c9fdec40e3bbb10a$var$shadedWhiteModel.visible = $c9fdec40e3bbb10a$var$params.displayModel === \"shaded white\";\n $c9fdec40e3bbb10a$var$whiteModel.visible = $c9fdec40e3bbb10a$var$params.displayModel === \"white\";\n $c9fdec40e3bbb10a$var$lines.visible = $c9fdec40e3bbb10a$var$params.displayEdges;\n $c9fdec40e3bbb10a$var$projection.visible = $c9fdec40e3bbb10a$var$params.displayProjection;\n $c9fdec40e3bbb10a$var$renderer.render($c9fdec40e3bbb10a$var$scene, $c9fdec40e3bbb10a$var$camera);\n}\n\n\n//# sourceMappingURL=edgeProjection.59721e0c.js.map\n","\"use strict\";\n\nvar mapping = {};\nfunction register(pairs) {\n var keys = Object.keys(pairs);\n for (var i = 0; i < keys.length; i++) {\n mapping[keys[i]] = pairs[keys[i]];\n }\n}\nfunction resolve(id) {\n var resolved = mapping[id];\n if (resolved == null) {\n throw new Error('Could not resolve bundle with id ' + id);\n }\n return resolved;\n}\nmodule.exports.register = register;\nmodule.exports.resolve = resolve;","require('./helpers/bundle-manifest').register(JSON.parse(\"{\\\"gEVFf\\\":\\\"edgeProjection.59721e0c.js\\\",\\\"8zbCD\\\":\\\"projectionAsync.worker.28971622.js\\\",\\\"J4nAg\\\":\\\"projectionAsync.worker.15f44cdc.js\\\",\\\"4qUe1\\\":\\\"silhouetteProjection.4adac46b.js\\\",\\\"kElIp\\\":\\\"silhouetteProjection.e215f6e5.js\\\",\\\"eFNPD\\\":\\\"floorProjection.99e62bf6.js\\\"}\"));","import {\n\tBox3,\n\tWebGLRenderer,\n\tScene,\n\tDirectionalLight,\n\tAmbientLight,\n\tGroup,\n\tMeshStandardMaterial,\n\tMeshBasicMaterial,\n\tBufferGeometry,\n\tLineSegments,\n\tLineBasicMaterial,\n\tPerspectiveCamera,\n} from 'three';\nimport { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js';\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';\nimport { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';\nimport { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';\nimport { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';\nimport { ProjectionGenerator } from '..';\nimport { ProjectionGeneratorWorker } from '../src/worker/ProjectionGeneratorWorker.js';\nimport { generateEdges } from '../src/utils/generateEdges.js';\n\nconst params = {\n\tdisplayModel: 'color',\n\tdisplayEdges: false,\n\tdisplayProjection: true,\n\tsortEdges: true,\n\tincludeIntersectionEdges: false,\n\tuseWorker: false,\n\trotate: () => {\n\n\t\tgroup.quaternion.random();\n\t\tgroup.position.set( 0, 0, 0 );\n\t\tgroup.updateMatrixWorld( true );\n\n\t\tconst box = new Box3();\n\t\tbox.setFromObject( model, true );\n\t\tbox.getCenter( group.position ).multiplyScalar( - 1 );\n\t\tgroup.position.y = Math.max( 0, - box.min.y ) + 1;\n\n\t},\n\tregenerate: () => {\n\n\t\ttask = updateEdges();\n\n\t},\n};\n\nconst ANGLE_THRESHOLD = 50;\nlet renderer, camera, scene, gui, controls;\nlet lines, model, projection, group, shadedWhiteModel, whiteModel;\nlet outputContainer;\nlet worker;\nlet task = null;\n\ninit();\n\nasync function init() {\n\n\toutputContainer = document.getElementById( 'output' );\n\n\tconst bgColor = 0xeeeeee;\n\n\t// renderer setup\n\trenderer = new WebGLRenderer( { antialias: true } );\n\trenderer.setPixelRatio( window.devicePixelRatio );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\trenderer.setClearColor( bgColor, 1 );\n\tdocument.body.appendChild( renderer.domElement );\n\n\t// scene setup\n\tscene = new Scene();\n\n\t// lights\n\tconst light = new DirectionalLight( 0xffffff, 3.5 );\n\tlight.position.set( 1, 2, 3 );\n\tscene.add( light );\n\n\tconst ambientLight = new AmbientLight( 0xb0bec5, 0.5 );\n\tscene.add( ambientLight );\n\n\t// load model\n\tgroup = new Group();\n\tscene.add( group );\n\n\tconst gltf = await new GLTFLoader()\n\t\t.setMeshoptDecoder( MeshoptDecoder )\n\t\t.loadAsync( 'https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/nasa-m2020/Perseverance.glb' );\n\tmodel = gltf.scene;\n\n\tconst whiteMaterial = new MeshStandardMaterial( {\n\t\tpolygonOffset: true,\n\t\tpolygonOffsetFactor: 1,\n\t\tpolygonOffsetUnits: 1,\n\t} );\n\tshadedWhiteModel = model.clone();\n\tshadedWhiteModel.traverse( c => {\n\n\t\tif ( c.material ) {\n\n\t\t\tc.material = whiteMaterial;\n\n\t\t}\n\n\t} );\n\n\tconst whiteBasicMaterial = new MeshBasicMaterial( {\n\t\tpolygonOffset: true,\n\t\tpolygonOffsetFactor: 1,\n\t\tpolygonOffsetUnits: 1,\n\t} );\n\twhiteModel = model.clone();\n\twhiteModel.traverse( c => {\n\n\t\tif ( c.material ) {\n\n\t\t\tc.material = whiteBasicMaterial;\n\n\t\t}\n\n\t} );\n\n\tgroup.updateMatrixWorld( true );\n\n\t// center model\n\tconst box = new Box3();\n\tbox.setFromObject( model, true );\n\tbox.getCenter( group.position ).multiplyScalar( - 1 );\n\tgroup.position.y = Math.max( 0, - box.min.y ) + 1;\n\tgroup.add( model, shadedWhiteModel, whiteModel );\n\n\t// generate geometry line segments\n\tlines = new Group();\n\tmodel.traverse( c => {\n\n\t\tif ( c.geometry ) {\n\n\t\t\tconst edges = generateEdges( c.geometry, undefined, ANGLE_THRESHOLD );\n\t\t\tconst points = edges.flatMap( line => [ line.start, line.end ] );\n\t\t\tconst geom = new BufferGeometry();\n\t\t\tgeom.setFromPoints( points );\n\n\t\t\tconst geomLines = new LineSegments( geom, new LineBasicMaterial( { color: 0x030303 } ) );\n\t\t\tgeomLines.position.copy( c.position );\n\t\t\tgeomLines.quaternion.copy( c.quaternion );\n\t\t\tgeomLines.scale.copy( c.scale );\n\t\t\tlines.add( geomLines );\n\n\t\t}\n\n\t} );\n\tgroup.add( lines );\n\n\t// create projection display mesh\n\tprojection = new LineSegments( new BufferGeometry(), new LineBasicMaterial( { color: 0x030303 } ) );\n\tscene.add( projection );\n\n\t// camera setup\n\tcamera = new PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.01, 50 );\n\tcamera.position.setScalar( 3.5 );\n\tcamera.updateProjectionMatrix();\n\n\t// controls\n\tcontrols = new OrbitControls( camera, renderer.domElement );\n\n\tgui = new GUI();\n\tgui.add( params, 'displayModel', [\n\t\t'none',\n\t\t'color',\n\t\t'shaded white',\n\t\t// 'white',\n\t] );\n\t// gui.add( params, 'displayEdges' );\n\tgui.add( params, 'displayProjection' );\n\tgui.add( params, 'sortEdges' );\n\tgui.add( params, 'includeIntersectionEdges' );\n\tgui.add( params, 'useWorker' );\n\tgui.add( params, 'rotate' );\n\tgui.add( params, 'regenerate' );\n\n\tworker = new ProjectionGeneratorWorker();\n\n\ttask = updateEdges();\n\n\trender();\n\n\twindow.addEventListener( 'resize', function () {\n\n\t\tcamera.aspect = window.innerWidth / window.innerHeight;\n\t\tcamera.updateProjectionMatrix();\n\n\t\trenderer.setSize( window.innerWidth, window.innerHeight );\n\n\t}, false );\n\n}\n\nfunction* updateEdges( runTime = 30 ) {\n\n\toutputContainer.innerText = 'processing: --';\n\n\t// transform and merge geometries to project into a single model\n\tlet timeStart = window.performance.now();\n\tconst geometries = [];\n\tmodel.updateWorldMatrix( true, true );\n\tmodel.traverse( c => {\n\n\t\tif ( c.geometry ) {\n\n\t\t\tconst clone = c.geometry.clone();\n\t\t\tclone.applyMatrix4( c.matrixWorld );\n\t\t\tfor ( const key in clone.attributes ) {\n\n\t\t\t\tif ( key !== 'position' ) {\n\n\t\t\t\t\tclone.deleteAttribute( key );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgeometries.push( clone );\n\n\t\t}\n\n\t} );\n\tconst mergedGeometry = mergeGeometries( geometries, false );\n\tconst mergeTime = window.performance.now() - timeStart;\n\n\tyield;\n\n\t// generate the candidate edges\n\ttimeStart = window.performance.now();\n\n\tlet geometry = null;\n\tif ( ! params.useWorker ) {\n\n\t\tconst generator = new ProjectionGenerator();\n\t\tgenerator.sortEdges = params.sortEdges;\n\t\tgenerator.iterationTime = runTime;\n\t\tgenerator.angleThreshold = ANGLE_THRESHOLD;\n\t\tgenerator.includeIntersectionEdges = params.includeIntersectionEdges;\n\n\t\tconst task = generator.generate( mergedGeometry, {\n\n\t\t\tonProgress: ( p, data ) => {\n\n\t\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\t\t\t\tif ( params.displayProjection ) {\n\n\t\t\t\t\tprojection.geometry.dispose();\n\t\t\t\t\tprojection.geometry = data.getLineGeometry();\n\n\t\t\t\t}\n\n\n\t\t\t},\n\n\t\t} );\n\n\t\tlet result = task.next();\n\t\twhile ( ! result.done ) {\n\n\t\t\tresult = task.next();\n\t\t\tyield;\n\n\t\t}\n\n\t\tgeometry = result.value;\n\n\t} else {\n\n\t\tworker\n\t\t\t.generate( mergedGeometry, {\n\t\t\t\tsortEdges: params.sortEdges,\n\t\t\t\tincludeIntersectionEdges: params.includeIntersectionEdges,\n\t\t\t\tonProgress: p => {\n\n\t\t\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\n\t\t\t\t},\n\t\t\t} )\n\t\t\t.then( result => {\n\n\t\t\t\tgeometry = result;\n\n\t\t\t} );\n\n\t\twhile ( geometry === null ) {\n\n\t\t\tyield;\n\n\t\t}\n\n\t}\n\n\tconst trimTime = window.performance.now() - timeStart;\n\n\tprojection.geometry.dispose();\n\tprojection.geometry = geometry;\n\toutputContainer.innerText =\n\t\t`merge geometry : ${ mergeTime.toFixed( 2 ) }ms\\n` +\n\t\t`edge trimming : ${ trimTime.toFixed( 2 ) }ms`;\n\n}\n\n\nfunction render() {\n\n\trequestAnimationFrame( render );\n\n\tif ( task ) {\n\n\t\tconst res = task.next();\n\t\tif ( res.done ) {\n\n\t\t\ttask = null;\n\n\t\t}\n\n\t}\n\n\tmodel.visible = params.displayModel === 'color';\n\tshadedWhiteModel.visible = params.displayModel === 'shaded white';\n\twhiteModel.visible = params.displayModel === 'white';\n\tlines.visible = params.displayEdges;\n\tprojection.visible = params.displayProjection;\n\n\trenderer.render( scene, camera );\n\n}\n","import { BufferAttribute, BufferGeometry } from 'three';\n\nconst NAME = 'ProjectionGeneratorWorker';\nexport class ProjectionGeneratorWorker {\n\n\tconstructor() {\n\n\t\tthis.running = false;\n\t\tthis.worker = new Worker( new URL( './projectionAsync.worker.js', import.meta.url ), { type: 'module' } );\n\t\tthis.worker.onerror = e => {\n\n\t\t\tif ( e.message ) {\n\n\t\t\t\tthrow new Error( `${ NAME }: Could not create Web Worker with error \"${ e.message }\"` );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( `${ NAME }: Could not create Web Worker.` );\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tgenerate( geometry, options = {} ) {\n\n\t\tif ( this.running ) {\n\n\t\t\tthrow new Error( `${ NAME }: Already running job.` );\n\n\t\t}\n\n\t\tif ( this.worker === null ) {\n\n\t\t\tthrow new Error( `${ NAME }: Worker has been disposed.` );\n\n\t\t}\n\n\t\tconst { worker } = this;\n\t\tthis.running = true;\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tworker.onerror = e => {\n\n\t\t\t\treject( new Error( `${ NAME }: ${ e.message }` ) );\n\t\t\t\tthis.running = false;\n\n\t\t\t};\n\n\t\t\tworker.onmessage = e => {\n\n\t\t\t\tthis.running = false;\n\t\t\t\tconst { data } = e;\n\n\t\t\t\tif ( data.error ) {\n\n\t\t\t\t\treject( new Error( data.error ) );\n\t\t\t\t\tworker.onmessage = null;\n\n\t\t\t\t} else if ( data.result ) {\n\n\t\t\t\t\tconst geometry = new BufferGeometry();\n\t\t\t\t\tgeometry.setAttribute( 'position', new BufferAttribute( data.result, 3, false ) );\n\t\t\t\t\tresolve( geometry );\n\t\t\t\t\tworker.onmessage = null;\n\n\t\t\t\t} else if ( options.onProgress ) {\n\n\t\t\t\t\toptions.onProgress( data.progress );\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t\tconst index = geometry.index ? geometry.index.array.slice() : null;\n\t\t\tconst position = geometry.attributes.position.array.slice();\n\t\t\tconst transfer = [ position.buffer ];\n\t\t\tif ( index ) {\n\n\t\t\t\ttransfer.push( index.buffer );\n\n\t\t\t}\n\n\t\t\tworker.postMessage( {\n\t\t\t\tindex,\n\t\t\t\tposition,\n\t\t\t\toptions: {\n\t\t\t\t\t...options,\n\t\t\t\t\tonProgress: null,\n\t\t\t\t\tincludedProgressCallback: Boolean( options.onProgress ),\n\t\t\t\t},\n\t\t\t}, transfer );\n\n\t\t} );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.worker.terminate();\n\t\tthis.worker = null;\n\n\t}\n\n}\n","let workerURL = require('./helpers/get-worker-url');\nlet url = new __parcel__URL__(require('./helpers/bundle-manifest').resolve(\"8zbCD\"));\nmodule.exports = workerURL(url.toString(), url.origin, true);","\"use strict\";\n\nmodule.exports = function (workerUrl, origin, isESM) {\n if (origin === self.location.origin) {\n // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n } else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? 'import ' + JSON.stringify(workerUrl) + ';' : 'importScripts(' + JSON.stringify(workerUrl) + ');';\n return URL.createObjectURL(new Blob([source], {\n type: 'application/javascript'\n }));\n }\n};"],"names":["$c9fdec40e3bbb10a$var$renderer","$c9fdec40e3bbb10a$var$camera","$c9fdec40e3bbb10a$var$scene","$c9fdec40e3bbb10a$var$gui","$c9fdec40e3bbb10a$var$lines","$c9fdec40e3bbb10a$var$model","$c9fdec40e3bbb10a$var$projection","$c9fdec40e3bbb10a$var$group","$c9fdec40e3bbb10a$var$shadedWhiteModel","$c9fdec40e3bbb10a$var$whiteModel","$c9fdec40e3bbb10a$var$outputContainer","$c9fdec40e3bbb10a$var$worker","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$18c11f3350a906ea$export$6503ec6e8aabbaf","$18c11f3350a906ea$export$f7ad0328861e2f03","$18c11f3350a906ea$var$mapping","pairs","keys","i","length","resolved","JSON","parse","$ilwiq","$jiuw3","$5Rd1x","$7lx9d","$7ePFa","$kp7Te","$4CEV9","$5c260663d40074f0$var$NAME","$deac5b03489e8ef8$exports","$56b621a6dd25b2cb$exports","workerUrl","origin","isESM","location","source","stringify","URL","createObjectURL","Blob","type","$deac5b03489e8ef8$var$url","resolve","url","toString","$5c260663d40074f0$export$58847e466a6b9214","constructor","running","worker","Worker","onerror","message","generate","geometry","options","Promise","reject","onmessage","data","error","result","BufferGeometry","setAttribute","BufferAttribute","onProgress","progress","index","array","slice","position","attributes","transfer","buffer","push","postMessage","includedProgressCallback","Boolean","dispose","terminate","$fNPnQ","$c9fdec40e3bbb10a$var$params","displayModel","displayEdges","displayProjection","sortEdges","includeIntersectionEdges","useWorker","rotate","quaternion","random","updateMatrixWorld","box","Box3","setFromObject","getCenter","multiplyScalar","y","Math","max","min","regenerate","$c9fdec40e3bbb10a$var$task","$c9fdec40e3bbb10a$var$updateEdges","runTime","innerText","timeStart","performance","now","geometries","updateWorldMatrix","traverse","c","clone","key","applyMatrix4","matrixWorld","deleteAttribute","mergedGeometry","mergeGeometries","mergeTime","p","parseFloat","toFixed","then","generator","ProjectionGenerator","iterationTime","angleThreshold","task","getLineGeometry","next","done","value","trimTime","$c9fdec40e3bbb10a$var$init","document","getElementById","WebGLRenderer","antialias","setPixelRatio","devicePixelRatio","setSize","innerWidth","innerHeight","setClearColor","body","appendChild","domElement","Scene","light","DirectionalLight","add","ambientLight","AmbientLight","Group","gltf","GLTFLoader","setMeshoptDecoder","MeshoptDecoder","loadAsync","scene","whiteMaterial","MeshStandardMaterial","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","material","whiteBasicMaterial","MeshBasicMaterial","edges","generateEdges","undefined","points","flatMap","line","start","end","geom","setFromPoints","geomLines","LineSegments","LineBasicMaterial","color","copy","scale","PerspectiveCamera","setScalar","updateProjectionMatrix","OrbitControls","GUI","$c9fdec40e3bbb10a$var$render","requestAnimationFrame","res","visible","render","addEventListener","aspect"],"version":3,"file":"edgeProjection.59721e0c.js.map"} \ No newline at end of file diff --git a/example/bundle/edgeProjection.html b/example/bundle/edgeProjection.html new file mode 100644 index 0000000..1d33c5a --- /dev/null +++ b/example/bundle/edgeProjection.html @@ -0,0 +1 @@ +three-edge-projection - Projected Edge Generation
Accelerated geometry edge projection and clipping onto
the XZ plane for orthographic vector views.
\ No newline at end of file diff --git a/example/bundle/floorProjection.6ab05ec7.js b/example/bundle/floorProjection.6ab05ec7.js new file mode 100644 index 0000000..6033940 --- /dev/null +++ b/example/bundle/floorProjection.6ab05ec7.js @@ -0,0 +1,2 @@ +let e,t,n,i,o,r,s,l,a;var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c={},p={},g=d.parcelRequire6c98;null==g&&((g=function(e){if(e in c)return c[e].exports;if(e in p){var t=p[e];delete p[e];var n={id:e,exports:{}};return c[e]=n,t.call(n.exports,n,n.exports),n.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){p[e]=t},d.parcelRequire6c98=g);var u=(g("ilwiq"),g("ilwiq")),w=g("5Rd1x");class m extends w.OrbitControls{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons={LEFT:u.MOUSE.PAN,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.ROTATE},this.touches={ONE:u.TOUCH.PAN,TWO:u.TOUCH.DOLLY_ROTATE}}}var f=g("7lx9d"),y=g("7ePFa"),h=g("kp7Te"),x=g("4CEV9");let T=null;!async function(){a=document.getElementById("output"),(e=new u.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1118481,1),document.body.appendChild(e.domElement),n=new u.Scene;let d=new u.DirectionalLight(16777215,3.5);d.position.set(1,2,3),n.add(d);let c=new u.AmbientLight(11583173,.5);n.add(c),s=new u.Group,n.add(s);let p=await new(0,f.GLTFLoader)().setMeshoptDecoder(h.MeshoptDecoder).loadAsync("https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/3d-home-layout/scene.glb");o=p.scene,s.updateMatrixWorld(!0);let g=new u.Box3;g.setFromObject(o,!0),g.getCenter(s.position).multiplyScalar(-1),s.position.y=Math.max(0,-g.min.y)+1,s.add(o),o.visible=!1,l=new u.Mesh(new u.BufferGeometry,new u.MeshBasicMaterial({color:"#eee",polygonOffset:!0,polygonOffsetFactor:3,polygonOffsetUnits:3,side:u.DoubleSide})),r=new u.LineSegments(new u.BufferGeometry,new u.LineBasicMaterial({color:197379})),n.add(r,l),(t=new u.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.01,50)).position.setScalar(5.5),t.updateProjectionMatrix(),(i=new m(t,e.domElement)).zoomToCursor=!0,i.maxPolarAngle=Math.PI/3,T=function*(){let e,t,n;a.innerText="processing: --",l.visible=!1,r.visible=!1;let i=[];o.updateWorldMatrix(!0,!0),o.traverse(e=>{if(e.geometry){let t=e.geometry.clone();for(let n in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==n&&t.deleteAttribute(n);i.push(t)}});let s=(0,y.mergeGeometries)(i,!1);for(yield,(n=new x.SilhouetteGenerator).sortTriangles=!0,t=(e=n.generate(s,{onProgress:(e,t)=>{a.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`,l.geometry.dispose(),l.geometry=t.getGeometry(),l.visible=!0}})).next();!t.done;)t=e.next(),yield;for(l.geometry.dispose(),l.geometry=t.value,l.visible=!0,a.innerText="generating intersection edges...",(n=new x.ProjectionGenerator).angleThreshold=50,t=(e=n.generate(s,{onProgress:(e,t)=>{a.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`,r.geometry.dispose(),r.geometry=t.getLineGeometry(),r.visible=!0}})).next();!t.done;)t=e.next(),yield;r.geometry.dispose(),r.geometry=t.value,r.visible=!0,a.innerText=""}(),function i(){if(requestAnimationFrame(i),T){let e=T.next();e.done&&(T=null)}e.render(n,t)}(),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}(); +//# sourceMappingURL=floorProjection.6ab05ec7.js.map diff --git a/example/bundle/floorProjection.6ab05ec7.js.map b/example/bundle/floorProjection.6ab05ec7.js.map new file mode 100644 index 0000000..0e590f6 --- /dev/null +++ b/example/bundle/floorProjection.6ab05ec7.js.map @@ -0,0 +1 @@ +{"mappings":"ICsBI,EAAU,EAAQ,EAAY,EAC9B,EAAO,EAAU,EAAO,EACxB,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,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AC,CACtF,EAAS,QAAA,CAAS,OAAlB,GACA,EAAS,QAAA,CAAW,EAAK,eAAzB,GACA,EAAS,OAAA,CAAU,CAAA,CAEpB,CAED,EAAA,EAEc,IAAd,GACQ,CAAE,EAAO,IAAA,EAEhB,EAAS,EAAK,IAAd,GACA,MAID,EAAS,QAAA,CAAS,OAAlB,GACA,EAAS,QAAA,CAAW,EAAO,KAA3B,CACA,EAAS,OAAA,CAAU,CAAA,EACnB,EAAgB,SAAA,CAAY,EAE7B,IA1GC,AA6GD,SAAS,IAIR,GAFA,sBAAuB,GAElB,EAAO,CAEX,IAAM,EAAM,EAAK,IAAjB,EACK,CAAA,EAAI,IAAA,EAER,CAAA,EAAO,IAFR,CAMD,CAEA,EAAS,MAAA,CAAQ,EAAO,EAEzB,IA5HC,OAAO,gBAAA,CAAkB,SAAU,WAElC,EAAO,MAAA,CAAS,OAAO,UAAA,CAAa,OAAO,WAA3C,CACA,EAAO,sBAAP,GAEA,EAAS,OAAA,CAAS,OAAO,UAAA,CAAY,OAAO,WAA5C,CAED,EAAG,CAAA,EAEJ","sources":["","example/floorProjection.js","node_modules/three/examples/jsm/controls/MapControls.js"],"sourcesContent":["var $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $5Rd1x = parcelRequire(\"5Rd1x\");\n// MapControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - left mouse, or arrow keys / touch: one-finger move\nclass $e0db4e8792e33c17$export$7628ccdac312035f extends (0, $5Rd1x.OrbitControls) {\n constructor(object, domElement){\n super(object, domElement);\n this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up\n this.mouseButtons = {\n LEFT: (0, $ilwiq.MOUSE).PAN,\n MIDDLE: (0, $ilwiq.MOUSE).DOLLY,\n RIGHT: (0, $ilwiq.MOUSE).ROTATE\n };\n this.touches = {\n ONE: (0, $ilwiq.TOUCH).PAN,\n TWO: (0, $ilwiq.TOUCH).DOLLY_ROTATE\n };\n }\n}\n\n\n\nvar $7lx9d = parcelRequire(\"7lx9d\");\n\nvar $7ePFa = parcelRequire(\"7ePFa\");\n\nvar $kp7Te = parcelRequire(\"kp7Te\");\n\nvar $4CEV9 = parcelRequire(\"4CEV9\");\nconst $63fee0271f901c43$var$ANGLE_THRESHOLD = 50;\nlet $63fee0271f901c43$var$renderer, $63fee0271f901c43$var$camera, $63fee0271f901c43$var$scene, $63fee0271f901c43$var$gui, $63fee0271f901c43$var$controls;\nlet $63fee0271f901c43$var$model, $63fee0271f901c43$var$outlines, $63fee0271f901c43$var$group, $63fee0271f901c43$var$silhouette;\nlet $63fee0271f901c43$var$outputContainer;\nlet $63fee0271f901c43$var$task = null;\n$63fee0271f901c43$var$init();\nasync function $63fee0271f901c43$var$init() {\n $63fee0271f901c43$var$outputContainer = document.getElementById(\"output\");\n const bgColor = 0x111111;\n // renderer setup\n $63fee0271f901c43$var$renderer = new (0, $ilwiq.WebGLRenderer)({\n antialias: true\n });\n $63fee0271f901c43$var$renderer.setPixelRatio(window.devicePixelRatio);\n $63fee0271f901c43$var$renderer.setSize(window.innerWidth, window.innerHeight);\n $63fee0271f901c43$var$renderer.setClearColor(bgColor, 1);\n document.body.appendChild($63fee0271f901c43$var$renderer.domElement);\n // scene setup\n $63fee0271f901c43$var$scene = new (0, $ilwiq.Scene)();\n // lights\n const light = new (0, $ilwiq.DirectionalLight)(0xffffff, 3.5);\n light.position.set(1, 2, 3);\n $63fee0271f901c43$var$scene.add(light);\n const ambientLight = new (0, $ilwiq.AmbientLight)(0xb0bec5, 0.5);\n $63fee0271f901c43$var$scene.add(ambientLight);\n // load model\n $63fee0271f901c43$var$group = new (0, $ilwiq.Group)();\n $63fee0271f901c43$var$scene.add($63fee0271f901c43$var$group);\n const gltf = await new (0, $7lx9d.GLTFLoader)().setMeshoptDecoder((0, $kp7Te.MeshoptDecoder)).loadAsync(\"https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/3d-home-layout/scene.glb\");\n $63fee0271f901c43$var$model = gltf.scene;\n $63fee0271f901c43$var$group.updateMatrixWorld(true);\n // center model\n const box = new (0, $ilwiq.Box3)();\n box.setFromObject($63fee0271f901c43$var$model, true);\n box.getCenter($63fee0271f901c43$var$group.position).multiplyScalar(-1);\n $63fee0271f901c43$var$group.position.y = Math.max(0, -box.min.y) + 1;\n $63fee0271f901c43$var$group.add($63fee0271f901c43$var$model);\n $63fee0271f901c43$var$model.visible = false;\n // create projection display mesh\n $63fee0271f901c43$var$silhouette = new (0, $ilwiq.Mesh)(new (0, $ilwiq.BufferGeometry)(), new (0, $ilwiq.MeshBasicMaterial)({\n color: \"#eee\",\n polygonOffset: true,\n polygonOffsetFactor: 3,\n polygonOffsetUnits: 3,\n side: (0, $ilwiq.DoubleSide)\n }));\n $63fee0271f901c43$var$outlines = new (0, $ilwiq.LineSegments)(new (0, $ilwiq.BufferGeometry)(), new (0, $ilwiq.LineBasicMaterial)({\n color: 0x030303\n }));\n $63fee0271f901c43$var$scene.add($63fee0271f901c43$var$outlines, $63fee0271f901c43$var$silhouette);\n // camera setup\n $63fee0271f901c43$var$camera = new (0, $ilwiq.PerspectiveCamera)(75, window.innerWidth / window.innerHeight, 0.01, 50);\n $63fee0271f901c43$var$camera.position.setScalar(5.5);\n $63fee0271f901c43$var$camera.updateProjectionMatrix();\n // controls\n $63fee0271f901c43$var$controls = new (0, $e0db4e8792e33c17$export$7628ccdac312035f)($63fee0271f901c43$var$camera, $63fee0271f901c43$var$renderer.domElement);\n $63fee0271f901c43$var$controls.zoomToCursor = true;\n $63fee0271f901c43$var$controls.maxPolarAngle = Math.PI / 3;\n $63fee0271f901c43$var$task = $63fee0271f901c43$var$updateProjection();\n $63fee0271f901c43$var$render();\n window.addEventListener(\"resize\", function() {\n $63fee0271f901c43$var$camera.aspect = window.innerWidth / window.innerHeight;\n $63fee0271f901c43$var$camera.updateProjectionMatrix();\n $63fee0271f901c43$var$renderer.setSize(window.innerWidth, window.innerHeight);\n }, false);\n}\nfunction* $63fee0271f901c43$var$updateProjection() {\n $63fee0271f901c43$var$outputContainer.innerText = \"processing: --\";\n $63fee0271f901c43$var$silhouette.visible = false;\n $63fee0271f901c43$var$outlines.visible = false;\n // transform and merge geometries to project into a single model\n const geometries = [];\n $63fee0271f901c43$var$model.updateWorldMatrix(true, true);\n $63fee0271f901c43$var$model.traverse((c)=>{\n if (c.geometry) {\n const clone = c.geometry.clone();\n clone.applyMatrix4(c.matrixWorld);\n for(const key in clone.attributes)if (key !== \"position\") clone.deleteAttribute(key);\n geometries.push(clone);\n }\n });\n const mergedGeometry = (0, $7ePFa.mergeGeometries)(geometries, false);\n yield;\n // generate the silhouette\n let task, result, generator;\n generator = new (0, $4CEV9.SilhouetteGenerator)();\n generator.sortTriangles = true;\n task = generator.generate(mergedGeometry, {\n onProgress: (p, data)=>{\n $63fee0271f901c43$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n $63fee0271f901c43$var$silhouette.geometry.dispose();\n $63fee0271f901c43$var$silhouette.geometry = data.getGeometry();\n $63fee0271f901c43$var$silhouette.visible = true;\n }\n });\n result = task.next();\n while(!result.done){\n result = task.next();\n yield;\n }\n $63fee0271f901c43$var$silhouette.geometry.dispose();\n $63fee0271f901c43$var$silhouette.geometry = result.value;\n $63fee0271f901c43$var$silhouette.visible = true;\n $63fee0271f901c43$var$outputContainer.innerText = \"generating intersection edges...\";\n // generate the edges\n generator = new (0, $4CEV9.ProjectionGenerator)();\n generator.angleThreshold = $63fee0271f901c43$var$ANGLE_THRESHOLD;\n task = generator.generate(mergedGeometry, {\n onProgress: (p, data)=>{\n $63fee0271f901c43$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n $63fee0271f901c43$var$outlines.geometry.dispose();\n $63fee0271f901c43$var$outlines.geometry = data.getLineGeometry();\n $63fee0271f901c43$var$outlines.visible = true;\n }\n });\n result = task.next();\n while(!result.done){\n result = task.next();\n yield;\n }\n $63fee0271f901c43$var$outlines.geometry.dispose();\n $63fee0271f901c43$var$outlines.geometry = result.value;\n $63fee0271f901c43$var$outlines.visible = true;\n $63fee0271f901c43$var$outputContainer.innerText = \"\";\n}\nfunction $63fee0271f901c43$var$render() {\n requestAnimationFrame($63fee0271f901c43$var$render);\n if ($63fee0271f901c43$var$task) {\n const res = $63fee0271f901c43$var$task.next();\n if (res.done) $63fee0271f901c43$var$task = null;\n }\n $63fee0271f901c43$var$renderer.render($63fee0271f901c43$var$scene, $63fee0271f901c43$var$camera);\n}\n\n\n//# sourceMappingURL=floorProjection.6ab05ec7.js.map\n","import {\n\tBox3,\n\tWebGLRenderer,\n\tScene,\n\tDirectionalLight,\n\tAmbientLight,\n\tGroup,\n\tBufferGeometry,\n\tLineSegments,\n\tLineBasicMaterial,\n\tPerspectiveCamera,\n\tMeshBasicMaterial,\n\tMesh,\n\tDoubleSide,\n} from 'three';\nimport { MapControls } from 'three/examples/jsm/controls/MapControls.js';\nimport { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';\nimport { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';\nimport { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';\nimport { ProjectionGenerator, SilhouetteGenerator } from '../src';\n\nconst ANGLE_THRESHOLD = 50;\nlet renderer, camera, scene, gui, controls;\nlet model, outlines, group, silhouette;\nlet outputContainer;\nlet task = null;\n\ninit();\n\nasync function init() {\n\n\toutputContainer = document.getElementById( 'output' );\n\n\tconst bgColor = 0x111111;\n\n\t// renderer setup\n\trenderer = new WebGLRenderer( { antialias: true } );\n\trenderer.setPixelRatio( window.devicePixelRatio );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\trenderer.setClearColor( bgColor, 1 );\n\tdocument.body.appendChild( renderer.domElement );\n\n\t// scene setup\n\tscene = new Scene();\n\n\t// lights\n\tconst light = new DirectionalLight( 0xffffff, 3.5 );\n\tlight.position.set( 1, 2, 3 );\n\tscene.add( light );\n\n\tconst ambientLight = new AmbientLight( 0xb0bec5, 0.5 );\n\tscene.add( ambientLight );\n\n\t// load model\n\tgroup = new Group();\n\tscene.add( group );\n\n\tconst gltf = await new GLTFLoader()\n\t\t.setMeshoptDecoder( MeshoptDecoder )\n\t\t.loadAsync( 'https://raw.githubusercontent.com/gkjohnson/3d-demo-data/main/models/3d-home-layout/scene.glb' );\n\tmodel = gltf.scene;\n\tgroup.updateMatrixWorld( true );\n\n\t// center model\n\tconst box = new Box3();\n\tbox.setFromObject( model, true );\n\tbox.getCenter( group.position ).multiplyScalar( - 1 );\n\tgroup.position.y = Math.max( 0, - box.min.y ) + 1;\n\tgroup.add( model );\n\tmodel.visible = false;\n\n\t// create projection display mesh\n\tsilhouette = new Mesh( new BufferGeometry(), new MeshBasicMaterial( {\n\t\tcolor: '#eee',\n\t\tpolygonOffset: true,\n\t\tpolygonOffsetFactor: 3,\n\t\tpolygonOffsetUnits: 3,\n\t\tside: DoubleSide,\n\t} ) );\n\toutlines = new LineSegments( new BufferGeometry(), new LineBasicMaterial( { color: 0x030303 } ) );\n\tscene.add( outlines, silhouette );\n\n\t// camera setup\n\tcamera = new PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.01, 50 );\n\tcamera.position.setScalar( 5.5 );\n\tcamera.updateProjectionMatrix();\n\n\t// controls\n\tcontrols = new MapControls( camera, renderer.domElement );\n\tcontrols.zoomToCursor = true;\n\tcontrols.maxPolarAngle = Math.PI / 3;\n\n\ttask = updateProjection();\n\n\trender();\n\n\twindow.addEventListener( 'resize', function () {\n\n\t\tcamera.aspect = window.innerWidth / window.innerHeight;\n\t\tcamera.updateProjectionMatrix();\n\n\t\trenderer.setSize( window.innerWidth, window.innerHeight );\n\n\t}, false );\n\n}\n\nfunction* updateProjection() {\n\n\toutputContainer.innerText = 'processing: --';\n\tsilhouette.visible = false;\n\toutlines.visible = false;\n\n\t// transform and merge geometries to project into a single model\n\tconst geometries = [];\n\tmodel.updateWorldMatrix( true, true );\n\tmodel.traverse( c => {\n\n\t\tif ( c.geometry ) {\n\n\t\t\tconst clone = c.geometry.clone();\n\t\t\tclone.applyMatrix4( c.matrixWorld );\n\t\t\tfor ( const key in clone.attributes ) {\n\n\t\t\t\tif ( key !== 'position' ) {\n\n\t\t\t\t\tclone.deleteAttribute( key );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgeometries.push( clone );\n\n\t\t}\n\n\t} );\n\tconst mergedGeometry = mergeGeometries( geometries, false );\n\n\tyield;\n\n\t// generate the silhouette\n\tlet task, result, generator;\n\tgenerator = new SilhouetteGenerator();\n\tgenerator.sortTriangles = true;\n\ttask = generator.generate( mergedGeometry, {\n\n\t\tonProgress: ( p, data ) => {\n\n\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\t\t\tsilhouette.geometry.dispose();\n\t\t\tsilhouette.geometry = data.getGeometry();\n\t\t\tsilhouette.visible = true;\n\n\t\t},\n\n\t} );\n\n\tresult = task.next();\n\twhile ( ! result.done ) {\n\n\t\tresult = task.next();\n\t\tyield;\n\n\t}\n\n\tsilhouette.geometry.dispose();\n\tsilhouette.geometry = result.value;\n\tsilhouette.visible = true;\n\toutputContainer.innerText = 'generating intersection edges...';\n\n\t// generate the edges\n\tgenerator = new ProjectionGenerator();\n\tgenerator.angleThreshold = ANGLE_THRESHOLD;\n\ttask = generator.generate( mergedGeometry, {\n\n\t\tonProgress: ( p, data ) => {\n\n\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\t\t\toutlines.geometry.dispose();\n\t\t\toutlines.geometry = data.getLineGeometry();\n\t\t\toutlines.visible = true;\n\n\t\t},\n\n\t} );\n\n\tresult = task.next();\n\twhile ( ! result.done ) {\n\n\t\tresult = task.next();\n\t\tyield;\n\n\t}\n\n\toutlines.geometry.dispose();\n\toutlines.geometry = result.value;\n\toutlines.visible = true;\n\toutputContainer.innerText = '';\n\n}\n\n\nfunction render() {\n\n\trequestAnimationFrame( render );\n\n\tif ( task ) {\n\n\t\tconst res = task.next();\n\t\tif ( res.done ) {\n\n\t\t\ttask = null;\n\n\t\t}\n\n\t}\n\n\trenderer.render( scene, camera );\n\n}\n","import { MOUSE, TOUCH } from 'three';\n\nimport { OrbitControls } from './OrbitControls.js';\n\n// MapControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - left mouse, or arrow keys / touch: one-finger move\n\nclass MapControls extends OrbitControls {\n\n\tconstructor( object, domElement ) {\n\n\t\tsuper( object, domElement );\n\n\t\tthis.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up\n\n\t\tthis.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.ROTATE };\n\n\t\tthis.touches = { ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE };\n\n\t}\n\n}\n\nexport { MapControls };\n"],"names":["$63fee0271f901c43$var$renderer","$63fee0271f901c43$var$camera","$63fee0271f901c43$var$scene","$63fee0271f901c43$var$controls","$63fee0271f901c43$var$model","$63fee0271f901c43$var$outlines","$63fee0271f901c43$var$group","$63fee0271f901c43$var$silhouette","$63fee0271f901c43$var$outputContainer","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$ilwiq","$5Rd1x","$e0db4e8792e33c17$export$7628ccdac312035f","OrbitControls","constructor","object","domElement","screenSpacePanning","mouseButtons","LEFT","MOUSE","PAN","MIDDLE","DOLLY","RIGHT","ROTATE","touches","ONE","TOUCH","TWO","DOLLY_ROTATE","$7lx9d","$7ePFa","$kp7Te","$4CEV9","$63fee0271f901c43$var$task","$63fee0271f901c43$var$init","document","getElementById","WebGLRenderer","antialias","setPixelRatio","devicePixelRatio","setSize","innerWidth","innerHeight","setClearColor","body","appendChild","Scene","light","DirectionalLight","position","set","add","ambientLight","AmbientLight","Group","gltf","GLTFLoader","setMeshoptDecoder","MeshoptDecoder","loadAsync","scene","updateMatrixWorld","box","Box3","setFromObject","getCenter","multiplyScalar","y","Math","max","min","visible","Mesh","BufferGeometry","MeshBasicMaterial","color","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","side","DoubleSide","LineSegments","LineBasicMaterial","PerspectiveCamera","setScalar","updateProjectionMatrix","zoomToCursor","maxPolarAngle","PI","$63fee0271f901c43$var$updateProjection","task","result","generator","innerText","geometries","updateWorldMatrix","traverse","c","geometry","clone","key","applyMatrix4","matrixWorld","attributes","deleteAttribute","push","mergedGeometry","mergeGeometries","SilhouetteGenerator","sortTriangles","generate","onProgress","p","data","parseFloat","toFixed","dispose","getGeometry","next","done","value","ProjectionGenerator","angleThreshold","getLineGeometry","$63fee0271f901c43$var$render","requestAnimationFrame","res","render","addEventListener","aspect"],"version":3,"file":"floorProjection.6ab05ec7.js.map"} \ No newline at end of file diff --git a/example/bundle/floorProjection.99e62bf6.js b/example/bundle/floorProjection.99e62bf6.js new file mode 100644 index 0000000..9f19f92 --- /dev/null +++ b/example/bundle/floorProjection.99e62bf6.js @@ -0,0 +1,2 @@ +function e(e,a,t,i){Object.defineProperty(e,a,{get:t,set:i,enumerable:!0,configurable:!0})}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},t={},i={},r=a.parcelRequire6c98;null==r&&((r=function(e){if(e in t)return t[e].exports;if(e in i){var a=i[e];delete i[e];var r={id:e,exports:{}};return t[e]=r,a.call(r.exports,r,r.exports),r.exports}var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(e,a){i[e]=a},a.parcelRequire6c98=r),r.register("7lx9d",function(a,t){e(a.exports,"GLTFLoader",()=>b);var i=r("ilwiq"),s=r("7ePFa");class b extends i.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new p(e)}),this.register(function(e){return new k(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new T(e)}),this.register(function(e){return new f(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new d(e)}),this.register(function(e){return new A(e)}),this.register(function(e){return new h(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new c(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new j(e)})}load(e,a,t,r){let s;let b=this;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:(0,i.LoaderUtils).extractUrlBase(e),this.manager.itemStart(e);let n=function(a){r?r(a):console.error(a),b.manager.itemError(e),b.manager.itemEnd(e)},o=new i.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(t){try{b.parse(t,s,function(t){a(t),b.manager.itemEnd(e)},n)}catch(e){n(e)}},t,n)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,a,t,i){let r;let s={},b={},n=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer){let a=n.decode(new Uint8Array(e,0,4));if(a===w){try{s[o.KHR_BINARY_GLTF]=new S(e)}catch(e){i&&i(e);return}r=JSON.parse(s[o.KHR_BINARY_GLTF].content)}else r=JSON.parse(n.decode(e))}else r=e;if(void 0===r.asset||r.asset.version[0]<2){i&&i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new V(r,{path:a||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===b[a]&&console.warn('THREE.GLTFLoader: Unknown extension "'+a+'".')}}c.setExtensions(s),c.setPlugins(b),c.parse(t,i)}parseAsync(e,a){let t=this;return new Promise(function(i,r){t.parse(e,a,i,r)})}}function n(){let e={};return{get:function(a){return e[a]},add:function(a,t){e[a]=t},remove:function(a){delete e[a]},removeAll:function(){e={}}}}let o={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class c{constructor(e){this.parser=e,this.name=o.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,a=this.parser.json.nodes||[];for(let t=0,i=a.length;t=0))return null;throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return a.loadTextureImage(e,r.source,s)}}class v{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let a=this.name,t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[a])return null;let s=r.extensions[a],b=i.images[s.source],n=t.textureLoader;if(b.uri){let e=t.options.manager.getHandler(b.uri);null!==e&&(n=e)}return this.detectSupport().then(function(r){if(r)return t.loadTextureImage(e,s.source,n);if(i.extensionsRequired&&i.extensionsRequired.indexOf(a)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return t.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let a=new Image;a.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",a.onload=a.onerror=function(){e(1===a.height)}})),this.isSupported}}class T{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let a=this.name,t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[a])return null;let s=r.extensions[a],b=i.images[s.source],n=t.textureLoader;if(b.uri){let e=t.options.manager.getHandler(b.uri);null!==e&&(n=e)}return this.detectSupport().then(function(r){if(r)return t.loadTextureImage(e,s.source,n);if(i.extensionsRequired&&i.extensionsRequired.indexOf(a)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return t.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let a=new Image;a.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",a.onload=a.onerror=function(){e(1===a.height)}})),this.isSupported}}class R{constructor(e){this.name=o.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let a=this.parser.json,t=a.bufferViews[e];if(!t.extensions||!t.extensions[this.name])return null;{let e=t.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(!(a.extensionsRequired&&a.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return i.then(function(a){let t=e.byteOffset||0,i=e.byteLength||0,s=e.count,b=e.byteStride,n=new Uint8Array(a,t,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,b,n,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){let a=new ArrayBuffer(s*b);return r.decodeGltfBuffer(new Uint8Array(a),s,b,n,e.mode,e.filter),a})})}}}class j{constructor(e){this.name=o.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let a=this.parser.json,t=a.nodes[e];if(!t.extensions||!t.extensions[this.name]||void 0===t.mesh)return null;let r=a.meshes[t.mesh];for(let e of r.primitives)if(e.mode!==y.TRIANGLES&&e.mode!==y.TRIANGLE_STRIP&&e.mode!==y.TRIANGLE_FAN&&void 0!==e.mode)return null;let s=t.extensions[this.name],b=s.attributes,n=[],o={};for(let e in b)n.push(this.parser.getDependency("accessor",b[e]).then(a=>(o[e]=a,o[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let a=e.pop(),t=a.isGroup?a.children:[a],r=e[0].count,s=[];for(let e of t){let a=new i.Matrix4,t=new i.Vector3,b=new i.Quaternion,n=new i.Vector3(1,1,1),c=new i.InstancedMesh(e.geometry,e.material,r);for(let e=0;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&s<98?this.textureLoader=new i.TextureLoader(this.options.manager):this.textureLoader=new i.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,a){let t=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([t.getDependencies("scene"),t.getDependencies("animation"),t.getDependencies("camera")])}).then(function(a){let s={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:t,userData:{}};I(r,s,i),z(s,i),Promise.all(t._invokeAll(function(e){return e.afterRoot&&e.afterRoot(s)})).then(function(){e(s)})}).catch(a)}_markDefs(){let e=this.json.nodes||[],a=this.json.skins||[],t=this.json.meshes||[];for(let t=0,i=a.length;t{let t=this.associations.get(e);for(let[i,s]of(null!=t&&this.associations.set(a,t),e.children.entries()))r(s,a.children[i])};return r(t,i),i.name+="_instance_"+e.uses[a]++,i}_invokeOne(e){let a=Object.values(this.plugins);a.push(this);for(let t=0;t=2&&b.setY(a,p[e*o+1]),o>=3&&b.setZ(a,p[e*o+2]),o>=4&&b.setW(a,p[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return b})}loadTexture(e){let a=this.json,t=this.options,i=a.textures[e],r=i.source,s=a.images[r],b=this.textureLoader;if(s.uri){let e=t.manager.getHandler(s.uri);null!==e&&(b=e)}return this.loadTextureImage(e,r,b)}loadTextureImage(e,a,t){let r=this,s=this.json,b=s.textures[e],n=s.images[a],o=(n.uri||n.bufferView)+":"+b.sampler;if(this.textureCache[o])return this.textureCache[o];let c=this.loadImageSource(a,t).then(function(a){a.flipY=!1,a.name=b.name||n.name||"",""===a.name&&"string"==typeof n.uri&&!1===n.uri.startsWith("data:image/")&&(a.name=n.uri);let t=s.samplers||{},o=t[b.sampler]||{};return a.magFilter=H[o.magFilter]||i.LinearFilter,a.minFilter=H[o.minFilter]||i.LinearMipmapLinearFilter,a.wrapS=_[o.wrapS]||i.RepeatWrapping,a.wrapT=_[o.wrapT]||i.RepeatWrapping,r.associations.set(a,{textures:e}),a}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(e,a){let t=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let s=t.images[e],b=self.URL||self.webkitURL,n=s.uri||"",o=!1;if(void 0!==s.bufferView)n=this.getDependency("bufferView",s.bufferView).then(function(e){o=!0;let a=new Blob([e],{type:s.mimeType});return n=b.createObjectURL(a)});else if(void 0===s.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let c=Promise.resolve(n).then(function(e){return new Promise(function(t,s){let b=t;!0===a.isImageBitmapLoader&&(b=function(e){let a=new i.Texture(e);a.needsUpdate=!0,t(a)}),a.load((0,i.LoaderUtils).resolveURL(e,r.path),b,void 0,s)})}).then(function(e){var a;return!0===o&&b.revokeObjectURL(n),e.userData.mimeType=s.mimeType||((a=s.uri).search(/\.jpe?g($|\?)/i)>0||0===a.search(/^data\:image\/jpeg/)?"image/jpeg":a.search(/\.webp($|\?)/i)>0||0===a.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",n),e});return this.sourceCache[e]=c,c}assignTexture(e,a,t,i){let r=this;return this.getDependency("texture",t.index).then(function(s){if(!s)return null;if(void 0!==t.texCoord&&t.texCoord>0&&((s=s.clone()).channel=t.texCoord),r.extensions[o.KHR_TEXTURE_TRANSFORM]){let e=void 0!==t.extensions?t.extensions[o.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let a=r.associations.get(s);s=r.extensions[o.KHR_TEXTURE_TRANSFORM].extendTexture(s,e),r.associations.set(s,a)}}return void 0!==i&&(s.colorSpace=i),e[a]=s,s})}assignFinalMaterial(e){let a=e.geometry,t=e.material,r=void 0===a.attributes.tangent,s=void 0!==a.attributes.color,b=void 0===a.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+t.uuid,a=this.cache.get(e);a||(a=new i.PointsMaterial,(0,i.Material).prototype.copy.call(a,t),a.color.copy(t.color),a.map=t.map,a.sizeAttenuation=!1,this.cache.add(e,a)),t=a}else if(e.isLine){let e="LineBasicMaterial:"+t.uuid,a=this.cache.get(e);a||(a=new i.LineBasicMaterial,(0,i.Material).prototype.copy.call(a,t),a.color.copy(t.color),a.map=t.map,this.cache.add(e,a)),t=a}if(r||s||b){let e="ClonedMaterial:"+t.uuid+":";r&&(e+="derivative-tangents:"),s&&(e+="vertex-colors:"),b&&(e+="flat-shading:");let a=this.cache.get(e);a||(a=t.clone(),s&&(a.vertexColors=!0),b&&(a.flatShading=!0),r&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(e,a),this.associations.set(a,this.associations.get(t))),t=a}e.material=t}getMaterialType(){return i.MeshStandardMaterial}loadMaterial(e){let a;let t=this,r=this.json,s=this.extensions,b=r.materials[e],n={},c=[];if((b.extensions||{})[o.KHR_MATERIALS_UNLIT]){let e=s[o.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(n,b,t))}else{let r=b.pbrMetallicRoughness||{};if(n.color=new i.Color(1,1,1),n.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}void 0!==r.baseColorTexture&&c.push(t.assignTexture(n,"map",r.baseColorTexture,i.SRGBColorSpace)),n.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,n.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(c.push(t.assignTexture(n,"metalnessMap",r.metallicRoughnessTexture)),c.push(t.assignTexture(n,"roughnessMap",r.metallicRoughnessTexture))),a=this._invokeOne(function(a){return a.getMaterialType&&a.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(a){return a.extendMaterialParams&&a.extendMaterialParams(e,n)})))}!0===b.doubleSided&&(n.side=i.DoubleSide);let l=b.alphaMode||B.OPAQUE;if(l===B.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,l===B.MASK&&(n.alphaTest=void 0!==b.alphaCutoff?b.alphaCutoff:.5)),void 0!==b.normalTexture&&a!==i.MeshBasicMaterial&&(c.push(t.assignTexture(n,"normalMap",b.normalTexture)),n.normalScale=new i.Vector2(1,1),void 0!==b.normalTexture.scale)){let e=b.normalTexture.scale;n.normalScale.set(e,e)}return void 0!==b.occlusionTexture&&a!==i.MeshBasicMaterial&&(c.push(t.assignTexture(n,"aoMap",b.occlusionTexture)),void 0!==b.occlusionTexture.strength&&(n.aoMapIntensity=b.occlusionTexture.strength)),void 0!==b.emissiveFactor&&a!==i.MeshBasicMaterial&&(n.emissive=new(0,i.Color)().fromArray(b.emissiveFactor)),void 0!==b.emissiveTexture&&a!==i.MeshBasicMaterial&&c.push(t.assignTexture(n,"emissiveMap",b.emissiveTexture,i.SRGBColorSpace)),Promise.all(c).then(function(){let i=new a(n);return b.name&&(i.name=b.name),z(i,b),t.associations.set(i,{materials:e}),b.extensions&&I(s,i,b),i})}createUniqueName(e){let a=(0,i.PropertyBinding).sanitizeNodeName(e||"");return a in this.nodeNamesUsed?a+"_"+ ++this.nodeNamesUsed[a]:(this.nodeNamesUsed[a]=0,a)}loadGeometries(e){let a=this,t=this.extensions,r=this.primitiveCache,s=[];for(let b=0,n=e.length;b0&&function(e,a){if(e.updateMorphTargets(),void 0!==a.weights)for(let t=0,i=a.weights.length;t1?new i.Group:1===a.length?a[0]:new i.Object3D)!==a[0])for(let e=0,t=a.length;e{let a=new Map;for(let[e,t]of r.associations)(e instanceof i.Material||e instanceof i.Texture)&&a.set(e,t);return e.traverse(e=>{let t=r.associations.get(e);null!=t&&a.set(e,t)}),a})(s),s})}_createAnimationTracks(e,a,t,r,s){let b;let n=[],o=e.name?e.name:e.uuid,c=[];switch(q[s.path]===q.weights?e.traverse(function(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)}):c.push(o),q[s.path]){case q.weights:b=i.NumberKeyframeTrack;break;case q.rotation:b=i.QuaternionKeyframeTrack;break;case q.position:case q.scale:b=i.VectorKeyframeTrack;break;default:b=1===t.itemSize?i.NumberKeyframeTrack:i.VectorKeyframeTrack}let l=void 0!==r.interpolation?K[r.interpolation]:i.InterpolateLinear,d=this._getArrayFromAccessor(t);for(let e=0,t=c.length;ei);var i=function(){var e,a=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i=WebAssembly.validate(a)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaK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Qpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(s(i),{}).then(function(a){(e=a.instance).exports.__wasm_call_ctors()});function s(e){for(var a=new Uint8Array(e.length),i=0;i96?r-97:r>64?r-39:r+4}for(var s=0,i=0;i0?function(e,a,t,i,r){for(var s=c[0],b=1;b","node_modules/three/examples/jsm/loaders/GLTFLoader.js","node_modules/three/examples/jsm/libs/meshopt_decoder.module.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"7lx9d\", function(module, exports) {\n\n$parcel$export(module.exports, \"GLTFLoader\", () => $559434fcc6e6401d$export$aa93f11e7884f0f4);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $7ePFa = parcelRequire(\"7ePFa\");\nclass $559434fcc6e6401d$export$aa93f11e7884f0f4 extends (0, $ilwiq.Loader) {\n constructor(manager){\n super(manager);\n this.dracoLoader = null;\n this.ktx2Loader = null;\n this.meshoptDecoder = null;\n this.pluginCallbacks = [];\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsClearcoatExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFTextureBasisUExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFTextureWebPExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFTextureAVIFExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsSheenExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsTransmissionExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsVolumeExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsIorExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsEmissiveStrengthExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsSpecularExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsIridescenceExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMaterialsAnisotropyExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFLightsExtension(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMeshoptCompression(parser);\n });\n this.register(function(parser) {\n return new $559434fcc6e6401d$var$GLTFMeshGpuInstancing(parser);\n });\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n let resourcePath;\n if (this.resourcePath !== \"\") resourcePath = this.resourcePath;\n else if (this.path !== \"\") resourcePath = this.path;\n else resourcePath = (0, $ilwiq.LoaderUtils).extractUrlBase(url);\n // Tells the LoadingManager to track an extra item, which resolves after\n // the model is fully loaded. This means the count of items loaded will\n // be incorrect, but ensures manager.onLoad() does not fire early.\n this.manager.itemStart(url);\n const _onError = function(e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n };\n const loader = new (0, $ilwiq.FileLoader)(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(data) {\n try {\n scope.parse(data, resourcePath, function(gltf) {\n onLoad(gltf);\n scope.manager.itemEnd(url);\n }, _onError);\n } catch (e) {\n _onError(e);\n }\n }, onProgress, _onError);\n }\n setDRACOLoader(dracoLoader) {\n this.dracoLoader = dracoLoader;\n return this;\n }\n setDDSLoader() {\n throw new Error('THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".');\n }\n setKTX2Loader(ktx2Loader) {\n this.ktx2Loader = ktx2Loader;\n return this;\n }\n setMeshoptDecoder(meshoptDecoder) {\n this.meshoptDecoder = meshoptDecoder;\n return this;\n }\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) this.pluginCallbacks.push(callback);\n return this;\n }\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);\n return this;\n }\n parse(data, path, onLoad, onError) {\n let json;\n const extensions = {};\n const plugins = {};\n const textDecoder = new TextDecoder();\n if (typeof data === \"string\") json = JSON.parse(data);\n else if (data instanceof ArrayBuffer) {\n const magic = textDecoder.decode(new Uint8Array(data, 0, 4));\n if (magic === $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_BINARY_GLTF] = new $559434fcc6e6401d$var$GLTFBinaryExtension(data);\n } catch (error) {\n if (onError) onError(error);\n return;\n }\n json = JSON.parse(extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_BINARY_GLTF].content);\n } else json = JSON.parse(textDecoder.decode(data));\n } else json = data;\n if (json.asset === undefined || json.asset.version[0] < 2) {\n if (onError) onError(new Error(\"THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.\"));\n return;\n }\n const parser = new $559434fcc6e6401d$var$GLTFParser(json, {\n path: path || this.resourcePath || \"\",\n crossOrigin: this.crossOrigin,\n requestHeader: this.requestHeader,\n manager: this.manager,\n ktx2Loader: this.ktx2Loader,\n meshoptDecoder: this.meshoptDecoder\n });\n parser.fileLoader.setRequestHeader(this.requestHeader);\n for(let i = 0; i < this.pluginCallbacks.length; i++){\n const plugin = this.pluginCallbacks[i](parser);\n plugins[plugin.name] = plugin;\n // Workaround to avoid determining as unknown extension\n // in addUnknownExtensionsToUserData().\n // Remove this workaround if we move all the existing\n // extension handlers to plugin system\n extensions[plugin.name] = true;\n }\n if (json.extensionsUsed) for(let i = 0; i < json.extensionsUsed.length; ++i){\n const extensionName = json.extensionsUsed[i];\n const extensionsRequired = json.extensionsRequired || [];\n switch(extensionName){\n case $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new $559434fcc6e6401d$var$GLTFMaterialsUnlitExtension();\n break;\n case $559434fcc6e6401d$var$EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new $559434fcc6e6401d$var$GLTFDracoMeshCompressionExtension(json, this.dracoLoader);\n break;\n case $559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new $559434fcc6e6401d$var$GLTFTextureTransformExtension();\n break;\n case $559434fcc6e6401d$var$EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new $559434fcc6e6401d$var$GLTFMeshQuantizationExtension();\n break;\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".');\n }\n }\n parser.setExtensions(extensions);\n parser.setPlugins(plugins);\n parser.parse(onLoad, onError);\n }\n parseAsync(data, path) {\n const scope = this;\n return new Promise(function(resolve, reject) {\n scope.parse(data, path, resolve, reject);\n });\n }\n}\n/* GLTFREGISTRY */ function $559434fcc6e6401d$var$GLTFRegistry() {\n let objects = {};\n return {\n get: function(key) {\n return objects[key];\n },\n add: function(key, object) {\n objects[key] = object;\n },\n remove: function(key) {\n delete objects[key];\n },\n removeAll: function() {\n objects = {};\n }\n };\n}\n/*********************************/ /********** EXTENSIONS ***********/ /*********************************/ const $559434fcc6e6401d$var$EXTENSIONS = {\n KHR_BINARY_GLTF: \"KHR_binary_glTF\",\n KHR_DRACO_MESH_COMPRESSION: \"KHR_draco_mesh_compression\",\n KHR_LIGHTS_PUNCTUAL: \"KHR_lights_punctual\",\n KHR_MATERIALS_CLEARCOAT: \"KHR_materials_clearcoat\",\n KHR_MATERIALS_IOR: \"KHR_materials_ior\",\n KHR_MATERIALS_SHEEN: \"KHR_materials_sheen\",\n KHR_MATERIALS_SPECULAR: \"KHR_materials_specular\",\n KHR_MATERIALS_TRANSMISSION: \"KHR_materials_transmission\",\n KHR_MATERIALS_IRIDESCENCE: \"KHR_materials_iridescence\",\n KHR_MATERIALS_ANISOTROPY: \"KHR_materials_anisotropy\",\n KHR_MATERIALS_UNLIT: \"KHR_materials_unlit\",\n KHR_MATERIALS_VOLUME: \"KHR_materials_volume\",\n KHR_TEXTURE_BASISU: \"KHR_texture_basisu\",\n KHR_TEXTURE_TRANSFORM: \"KHR_texture_transform\",\n KHR_MESH_QUANTIZATION: \"KHR_mesh_quantization\",\n KHR_MATERIALS_EMISSIVE_STRENGTH: \"KHR_materials_emissive_strength\",\n EXT_TEXTURE_WEBP: \"EXT_texture_webp\",\n EXT_TEXTURE_AVIF: \"EXT_texture_avif\",\n EXT_MESHOPT_COMPRESSION: \"EXT_meshopt_compression\",\n EXT_MESH_GPU_INSTANCING: \"EXT_mesh_gpu_instancing\"\n};\n/**\n * Punctual Lights Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n */ class $559434fcc6e6401d$var$GLTFLightsExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n // Object3D instance caches\n this.cache = {\n refs: {},\n uses: {}\n };\n }\n _markDefs() {\n const parser = this.parser;\n const nodeDefs = this.parser.json.nodes || [];\n for(let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++){\n const nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light);\n }\n }\n _loadLight(lightIndex) {\n const parser = this.parser;\n const cacheKey = \"light:\" + lightIndex;\n let dependency = parser.cache.get(cacheKey);\n if (dependency) return dependency;\n const json = parser.json;\n const extensions = json.extensions && json.extensions[this.name] || {};\n const lightDefs = extensions.lights || [];\n const lightDef = lightDefs[lightIndex];\n let lightNode;\n const color = new (0, $ilwiq.Color)(0xffffff);\n if (lightDef.color !== undefined) color.fromArray(lightDef.color);\n const range = lightDef.range !== undefined ? lightDef.range : 0;\n switch(lightDef.type){\n case \"directional\":\n lightNode = new (0, $ilwiq.DirectionalLight)(color);\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n case \"point\":\n lightNode = new (0, $ilwiq.PointLight)(color);\n lightNode.distance = range;\n break;\n case \"spot\":\n lightNode = new (0, $ilwiq.SpotLight)(color);\n lightNode.distance = range;\n // Handle spotlight properties.\n lightDef.spot = lightDef.spot || {};\n lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;\n lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;\n lightNode.angle = lightDef.spot.outerConeAngle;\n lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n default:\n throw new Error(\"THREE.GLTFLoader: Unexpected light type: \" + lightDef.type);\n }\n // Some lights (e.g. spot) default to a position other than the origin. Reset the position\n // here, because node-level parsing will only override position if explicitly specified.\n lightNode.position.set(0, 0, 0);\n lightNode.decay = 2;\n $559434fcc6e6401d$var$assignExtrasToUserData(lightNode, lightDef);\n if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity;\n lightNode.name = parser.createUniqueName(lightDef.name || \"light_\" + lightIndex);\n dependency = Promise.resolve(lightNode);\n parser.cache.add(cacheKey, dependency);\n return dependency;\n }\n getDependency(type, index) {\n if (type !== \"light\") return;\n return this._loadLight(index);\n }\n createNodeAttachment(nodeIndex) {\n const self1 = this;\n const parser = this.parser;\n const json = parser.json;\n const nodeDef = json.nodes[nodeIndex];\n const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};\n const lightIndex = lightDef.light;\n if (lightIndex === undefined) return null;\n return this._loadLight(lightIndex).then(function(light) {\n return parser._getNodeRef(self1.cache, lightIndex, light);\n });\n }\n}\n/**\n * Unlit Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n */ class $559434fcc6e6401d$var$GLTFMaterialsUnlitExtension {\n constructor(){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_UNLIT;\n }\n getMaterialType() {\n return 0, $ilwiq.MeshBasicMaterial;\n }\n extendParams(materialParams, materialDef, parser) {\n const pending = [];\n materialParams.color = new (0, $ilwiq.Color)(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n const metallicRoughness = materialDef.pbrMetallicRoughness;\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"map\", metallicRoughness.baseColorTexture, (0, $ilwiq.SRGBColorSpace)));\n }\n return Promise.all(pending);\n }\n}\n/**\n * Materials Emissive Strength Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md\n */ class $559434fcc6e6401d$var$GLTFMaterialsEmissiveStrengthExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const emissiveStrength = materialDef.extensions[this.name].emissiveStrength;\n if (emissiveStrength !== undefined) materialParams.emissiveIntensity = emissiveStrength;\n return Promise.resolve();\n }\n}\n/**\n * Clearcoat Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat\n */ class $559434fcc6e6401d$var$GLTFMaterialsClearcoatExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.clearcoatFactor !== undefined) materialParams.clearcoat = extension.clearcoatFactor;\n if (extension.clearcoatTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"clearcoatMap\", extension.clearcoatTexture));\n if (extension.clearcoatRoughnessFactor !== undefined) materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n if (extension.clearcoatRoughnessTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"clearcoatRoughnessMap\", extension.clearcoatRoughnessTexture));\n if (extension.clearcoatNormalTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, \"clearcoatNormalMap\", extension.clearcoatNormalTexture));\n if (extension.clearcoatNormalTexture.scale !== undefined) {\n const scale = extension.clearcoatNormalTexture.scale;\n materialParams.clearcoatNormalScale = new (0, $ilwiq.Vector2)(scale, scale);\n }\n }\n return Promise.all(pending);\n }\n}\n/**\n * Iridescence Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence\n */ class $559434fcc6e6401d$var$GLTFMaterialsIridescenceExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.iridescenceFactor !== undefined) materialParams.iridescence = extension.iridescenceFactor;\n if (extension.iridescenceTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"iridescenceMap\", extension.iridescenceTexture));\n if (extension.iridescenceIor !== undefined) materialParams.iridescenceIOR = extension.iridescenceIor;\n if (materialParams.iridescenceThicknessRange === undefined) materialParams.iridescenceThicknessRange = [\n 100,\n 400\n ];\n if (extension.iridescenceThicknessMinimum !== undefined) materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum;\n if (extension.iridescenceThicknessMaximum !== undefined) materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum;\n if (extension.iridescenceThicknessTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"iridescenceThicknessMap\", extension.iridescenceThicknessTexture));\n return Promise.all(pending);\n }\n}\n/**\n * Sheen Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen\n */ class $559434fcc6e6401d$var$GLTFMaterialsSheenExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_SHEEN;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n materialParams.sheenColor = new (0, $ilwiq.Color)(0, 0, 0);\n materialParams.sheenRoughness = 0;\n materialParams.sheen = 1;\n const extension = materialDef.extensions[this.name];\n if (extension.sheenColorFactor !== undefined) materialParams.sheenColor.fromArray(extension.sheenColorFactor);\n if (extension.sheenRoughnessFactor !== undefined) materialParams.sheenRoughness = extension.sheenRoughnessFactor;\n if (extension.sheenColorTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"sheenColorMap\", extension.sheenColorTexture, (0, $ilwiq.SRGBColorSpace)));\n if (extension.sheenRoughnessTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"sheenRoughnessMap\", extension.sheenRoughnessTexture));\n return Promise.all(pending);\n }\n}\n/**\n * Transmission Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission\n * Draft: https://github.com/KhronosGroup/glTF/pull/1698\n */ class $559434fcc6e6401d$var$GLTFMaterialsTransmissionExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_TRANSMISSION;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.transmissionFactor !== undefined) materialParams.transmission = extension.transmissionFactor;\n if (extension.transmissionTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"transmissionMap\", extension.transmissionTexture));\n return Promise.all(pending);\n }\n}\n/**\n * Materials Volume Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume\n */ class $559434fcc6e6401d$var$GLTFMaterialsVolumeExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_VOLUME;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;\n if (extension.thicknessTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"thicknessMap\", extension.thicknessTexture));\n materialParams.attenuationDistance = extension.attenuationDistance || Infinity;\n const colorArray = extension.attenuationColor || [\n 1,\n 1,\n 1\n ];\n materialParams.attenuationColor = new (0, $ilwiq.Color)(colorArray[0], colorArray[1], colorArray[2]);\n return Promise.all(pending);\n }\n}\n/**\n * Materials ior Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior\n */ class $559434fcc6e6401d$var$GLTFMaterialsIorExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_IOR;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const extension = materialDef.extensions[this.name];\n materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;\n return Promise.resolve();\n }\n}\n/**\n * Materials specular Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular\n */ class $559434fcc6e6401d$var$GLTFMaterialsSpecularExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_SPECULAR;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;\n if (extension.specularTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"specularIntensityMap\", extension.specularTexture));\n const colorArray = extension.specularColorFactor || [\n 1,\n 1,\n 1\n ];\n materialParams.specularColor = new (0, $ilwiq.Color)(colorArray[0], colorArray[1], colorArray[2]);\n if (extension.specularColorTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"specularColorMap\", extension.specularColorTexture, (0, $ilwiq.SRGBColorSpace)));\n return Promise.all(pending);\n }\n}\n/**\n * Materials anisotropy Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy\n */ class $559434fcc6e6401d$var$GLTFMaterialsAnisotropyExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_ANISOTROPY;\n }\n getMaterialType(materialIndex) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return 0, $ilwiq.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser;\n const materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return Promise.resolve();\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.anisotropyStrength !== undefined) materialParams.anisotropy = extension.anisotropyStrength;\n if (extension.anisotropyRotation !== undefined) materialParams.anisotropyRotation = extension.anisotropyRotation;\n if (extension.anisotropyTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"anisotropyMap\", extension.anisotropyTexture));\n return Promise.all(pending);\n }\n}\n/**\n * BasisU Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n */ class $559434fcc6e6401d$var$GLTFTextureBasisUExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_BASISU;\n }\n loadTexture(textureIndex) {\n const parser = this.parser;\n const json = parser.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[this.name]) return null;\n const extension = textureDef.extensions[this.name];\n const loader = parser.options.ktx2Loader;\n if (!loader) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) throw new Error(\"THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures\");\n else // Assumes that the extension is optional and that a fallback texture is present\n return null;\n }\n return parser.loadTextureImage(textureIndex, extension.source, loader);\n }\n}\n/**\n * WebP Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n */ class $559434fcc6e6401d$var$GLTFTextureWebPExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.EXT_TEXTURE_WEBP;\n this.isSupported = null;\n }\n loadTexture(textureIndex) {\n const name = this.name;\n const parser = this.parser;\n const json = parser.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) return null;\n const extension = textureDef.extensions[name];\n const source = json.images[extension.source];\n let loader = parser.textureLoader;\n if (source.uri) {\n const handler = parser.options.manager.getHandler(source.uri);\n if (handler !== null) loader = handler;\n }\n return this.detectSupport().then(function(isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) throw new Error(\"THREE.GLTFLoader: WebP required by asset but unsupported.\");\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex);\n });\n }\n detectSupport() {\n if (!this.isSupported) this.isSupported = new Promise(function(resolve) {\n const image = new Image();\n // Lossy test image. Support for lossy images doesn't guarantee support for all\n // WebP images, unfortunately.\n image.src = \"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA\";\n image.onload = image.onerror = function() {\n resolve(image.height === 1);\n };\n });\n return this.isSupported;\n }\n}\n/**\n * AVIF Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif\n */ class $559434fcc6e6401d$var$GLTFTextureAVIFExtension {\n constructor(parser){\n this.parser = parser;\n this.name = $559434fcc6e6401d$var$EXTENSIONS.EXT_TEXTURE_AVIF;\n this.isSupported = null;\n }\n loadTexture(textureIndex) {\n const name = this.name;\n const parser = this.parser;\n const json = parser.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) return null;\n const extension = textureDef.extensions[name];\n const source = json.images[extension.source];\n let loader = parser.textureLoader;\n if (source.uri) {\n const handler = parser.options.manager.getHandler(source.uri);\n if (handler !== null) loader = handler;\n }\n return this.detectSupport().then(function(isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) throw new Error(\"THREE.GLTFLoader: AVIF required by asset but unsupported.\");\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex);\n });\n }\n detectSupport() {\n if (!this.isSupported) this.isSupported = new Promise(function(resolve) {\n const image = new Image();\n // Lossy test image.\n image.src = \"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=\";\n image.onload = image.onerror = function() {\n resolve(image.height === 1);\n };\n });\n return this.isSupported;\n }\n}\n/**\n * meshopt BufferView Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n */ class $559434fcc6e6401d$var$GLTFMeshoptCompression {\n constructor(parser){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.EXT_MESHOPT_COMPRESSION;\n this.parser = parser;\n }\n loadBufferView(index) {\n const json = this.parser.json;\n const bufferView = json.bufferViews[index];\n if (bufferView.extensions && bufferView.extensions[this.name]) {\n const extensionDef = bufferView.extensions[this.name];\n const buffer = this.parser.getDependency(\"buffer\", extensionDef.buffer);\n const decoder = this.parser.options.meshoptDecoder;\n if (!decoder || !decoder.supported) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) throw new Error(\"THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files\");\n else // Assumes that the extension is optional and that fallback buffer data is present\n return null;\n }\n return buffer.then(function(res) {\n const byteOffset = extensionDef.byteOffset || 0;\n const byteLength = extensionDef.byteLength || 0;\n const count = extensionDef.count;\n const stride = extensionDef.byteStride;\n const source = new Uint8Array(res, byteOffset, byteLength);\n if (decoder.decodeGltfBufferAsync) return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function(res) {\n return res.buffer;\n });\n else // Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync\n return decoder.ready.then(function() {\n const result = new ArrayBuffer(count * stride);\n decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter);\n return result;\n });\n });\n } else return null;\n }\n}\n/**\n * GPU Instancing Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing\n *\n */ class $559434fcc6e6401d$var$GLTFMeshGpuInstancing {\n constructor(parser){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.EXT_MESH_GPU_INSTANCING;\n this.parser = parser;\n }\n createNodeMesh(nodeIndex) {\n const json = this.parser.json;\n const nodeDef = json.nodes[nodeIndex];\n if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === undefined) return null;\n const meshDef = json.meshes[nodeDef.mesh];\n // No Points or Lines + Instancing support yet\n for (const primitive of meshDef.primitives){\n if (primitive.mode !== $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== undefined) return null;\n }\n const extensionDef = nodeDef.extensions[this.name];\n const attributesDef = extensionDef.attributes;\n // @TODO: Can we support InstancedMesh + SkinnedMesh?\n const pending = [];\n const attributes = {};\n for(const key in attributesDef)pending.push(this.parser.getDependency(\"accessor\", attributesDef[key]).then((accessor)=>{\n attributes[key] = accessor;\n return attributes[key];\n }));\n if (pending.length < 1) return null;\n pending.push(this.parser.createNodeMesh(nodeIndex));\n return Promise.all(pending).then((results)=>{\n const nodeObject = results.pop();\n const meshes = nodeObject.isGroup ? nodeObject.children : [\n nodeObject\n ];\n const count = results[0].count; // All attribute counts should be same\n const instancedMeshes = [];\n for (const mesh of meshes){\n // Temporal variables\n const m = new (0, $ilwiq.Matrix4)();\n const p = new (0, $ilwiq.Vector3)();\n const q = new (0, $ilwiq.Quaternion)();\n const s = new (0, $ilwiq.Vector3)(1, 1, 1);\n const instancedMesh = new (0, $ilwiq.InstancedMesh)(mesh.geometry, mesh.material, count);\n for(let i = 0; i < count; i++){\n if (attributes.TRANSLATION) p.fromBufferAttribute(attributes.TRANSLATION, i);\n if (attributes.ROTATION) q.fromBufferAttribute(attributes.ROTATION, i);\n if (attributes.SCALE) s.fromBufferAttribute(attributes.SCALE, i);\n instancedMesh.setMatrixAt(i, m.compose(p, q, s));\n }\n // Add instance attributes to the geometry, excluding TRS.\n for(const attributeName in attributes)if (attributeName !== \"TRANSLATION\" && attributeName !== \"ROTATION\" && attributeName !== \"SCALE\") mesh.geometry.setAttribute(attributeName, attributes[attributeName]);\n // Just in case\n (0, $ilwiq.Object3D).prototype.copy.call(instancedMesh, mesh);\n this.parser.assignFinalMaterial(instancedMesh);\n instancedMeshes.push(instancedMesh);\n }\n if (nodeObject.isGroup) {\n nodeObject.clear();\n nodeObject.add(...instancedMeshes);\n return nodeObject;\n }\n return instancedMeshes[0];\n });\n }\n}\n/* BINARY EXTENSION */ const $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_MAGIC = \"glTF\";\nconst $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH = 12;\nconst $559434fcc6e6401d$var$BINARY_EXTENSION_CHUNK_TYPES = {\n JSON: 0x4E4F534A,\n BIN: 0x004E4942\n};\nclass $559434fcc6e6401d$var$GLTFBinaryExtension {\n constructor(data){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_BINARY_GLTF;\n this.content = null;\n this.body = null;\n const headerView = new DataView(data, 0, $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH);\n const textDecoder = new TextDecoder();\n this.header = {\n magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true)\n };\n if (this.header.magic !== $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_MAGIC) throw new Error(\"THREE.GLTFLoader: Unsupported glTF-Binary header.\");\n else if (this.header.version < 2.0) throw new Error(\"THREE.GLTFLoader: Legacy binary file detected.\");\n const chunkContentsLength = this.header.length - $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH;\n const chunkView = new DataView(data, $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH);\n let chunkIndex = 0;\n while(chunkIndex < chunkContentsLength){\n const chunkLength = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n const chunkType = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n if (chunkType === $559434fcc6e6401d$var$BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n const contentArray = new Uint8Array(data, $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);\n this.content = textDecoder.decode(contentArray);\n } else if (chunkType === $559434fcc6e6401d$var$BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n const byteOffset = $559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n this.body = data.slice(byteOffset, byteOffset + chunkLength);\n }\n // Clients must ignore chunks with unknown types.\n chunkIndex += chunkLength;\n }\n if (this.content === null) throw new Error(\"THREE.GLTFLoader: JSON content not found.\");\n }\n}\n/**\n * DRACO Mesh Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */ class $559434fcc6e6401d$var$GLTFDracoMeshCompressionExtension {\n constructor(json, dracoLoader){\n if (!dracoLoader) throw new Error(\"THREE.GLTFLoader: No DRACOLoader instance provided.\");\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n this.json = json;\n this.dracoLoader = dracoLoader;\n this.dracoLoader.preload();\n }\n decodePrimitive(primitive, parser) {\n const json = this.json;\n const dracoLoader = this.dracoLoader;\n const bufferViewIndex = primitive.extensions[this.name].bufferView;\n const gltfAttributeMap = primitive.extensions[this.name].attributes;\n const threeAttributeMap = {};\n const attributeNormalizedMap = {};\n const attributeTypeMap = {};\n for(const attributeName in gltfAttributeMap){\n const threeAttributeName = $559434fcc6e6401d$var$ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];\n }\n for(const attributeName in primitive.attributes){\n const threeAttributeName = $559434fcc6e6401d$var$ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n if (gltfAttributeMap[attributeName] !== undefined) {\n const accessorDef = json.accessors[primitive.attributes[attributeName]];\n const componentType = $559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n attributeTypeMap[threeAttributeName] = componentType.name;\n attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;\n }\n }\n return parser.getDependency(\"bufferView\", bufferViewIndex).then(function(bufferView) {\n return new Promise(function(resolve) {\n dracoLoader.decodeDracoFile(bufferView, function(geometry) {\n for(const attributeName in geometry.attributes){\n const attribute = geometry.attributes[attributeName];\n const normalized = attributeNormalizedMap[attributeName];\n if (normalized !== undefined) attribute.normalized = normalized;\n }\n resolve(geometry);\n }, threeAttributeMap, attributeTypeMap);\n });\n });\n }\n}\n/**\n * Texture Transform Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform\n */ class $559434fcc6e6401d$var$GLTFTextureTransformExtension {\n constructor(){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n }\n extendTexture(texture, transform) {\n if ((transform.texCoord === undefined || transform.texCoord === texture.channel) && transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) // See https://github.com/mrdoob/three.js/issues/21819.\n return texture;\n texture = texture.clone();\n if (transform.texCoord !== undefined) texture.channel = transform.texCoord;\n if (transform.offset !== undefined) texture.offset.fromArray(transform.offset);\n if (transform.rotation !== undefined) texture.rotation = transform.rotation;\n if (transform.scale !== undefined) texture.repeat.fromArray(transform.scale);\n texture.needsUpdate = true;\n return texture;\n }\n}\n/**\n * Mesh Quantization Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization\n */ class $559434fcc6e6401d$var$GLTFMeshQuantizationExtension {\n constructor(){\n this.name = $559434fcc6e6401d$var$EXTENSIONS.KHR_MESH_QUANTIZATION;\n }\n}\n/*********************************/ /********** INTERPOLATION ********/ /*********************************/ // Spline Interpolation\n// Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation\nclass $559434fcc6e6401d$var$GLTFCubicSplineInterpolant extends (0, $ilwiq.Interpolant) {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n copySampleValue_(index) {\n // Copies a sample value to the result buffer. See description of glTF\n // CUBICSPLINE values layout in interpolate_() function below.\n const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;\n for(let i = 0; i !== valueSize; i++)result[i] = values[offset + i];\n return result;\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer;\n const values = this.sampleValues;\n const stride = this.valueSize;\n const stride2 = stride * 2;\n const stride3 = stride * 3;\n const td = t1 - t0;\n const p = (t - t0) / td;\n const pp = p * p;\n const ppp = pp * p;\n const offset1 = i1 * stride3;\n const offset0 = offset1 - stride3;\n const s2 = -2 * ppp + 3 * pp;\n const s3 = ppp - pp;\n const s0 = 1 - s2;\n const s1 = s3 - pp + p;\n // Layout of keyframe output values for CUBICSPLINE animations:\n // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]\n for(let i = 0; i !== stride; i++){\n const p0 = values[offset0 + i + stride]; // splineVertex_k\n const m0 = values[offset0 + i + stride2] * td; // outTangent_k * (t_k+1 - t_k)\n const p1 = values[offset1 + i + stride]; // splineVertex_k+1\n const m1 = values[offset1 + i] * td; // inTangent_k+1 * (t_k+1 - t_k)\n result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n }\n return result;\n }\n}\nconst $559434fcc6e6401d$var$_q = new (0, $ilwiq.Quaternion)();\nclass $559434fcc6e6401d$var$GLTFCubicSplineQuaternionInterpolant extends $559434fcc6e6401d$var$GLTFCubicSplineInterpolant {\n interpolate_(i1, t0, t, t1) {\n const result = super.interpolate_(i1, t0, t, t1);\n $559434fcc6e6401d$var$_q.fromArray(result).normalize().toArray(result);\n return result;\n }\n}\n/*********************************/ /********** INTERNALS ************/ /*********************************/ /* CONSTANTS */ const $559434fcc6e6401d$var$WEBGL_CONSTANTS = {\n FLOAT: 5126,\n //FLOAT_MAT2: 35674,\n FLOAT_MAT3: 35675,\n FLOAT_MAT4: 35676,\n FLOAT_VEC2: 35664,\n FLOAT_VEC3: 35665,\n FLOAT_VEC4: 35666,\n LINEAR: 9729,\n REPEAT: 10497,\n SAMPLER_2D: 35678,\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n UNSIGNED_BYTE: 5121,\n UNSIGNED_SHORT: 5123\n};\nconst $559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nconst $559434fcc6e6401d$var$WEBGL_FILTERS = {\n 9728: (0, $ilwiq.NearestFilter),\n 9729: (0, $ilwiq.LinearFilter),\n 9984: (0, $ilwiq.NearestMipmapNearestFilter),\n 9985: (0, $ilwiq.LinearMipmapNearestFilter),\n 9986: (0, $ilwiq.NearestMipmapLinearFilter),\n 9987: (0, $ilwiq.LinearMipmapLinearFilter)\n};\nconst $559434fcc6e6401d$var$WEBGL_WRAPPINGS = {\n 33071: (0, $ilwiq.ClampToEdgeWrapping),\n 33648: (0, $ilwiq.MirroredRepeatWrapping),\n 10497: (0, $ilwiq.RepeatWrapping)\n};\nconst $559434fcc6e6401d$var$WEBGL_TYPE_SIZES = {\n \"SCALAR\": 1,\n \"VEC2\": 2,\n \"VEC3\": 3,\n \"VEC4\": 4,\n \"MAT2\": 4,\n \"MAT3\": 9,\n \"MAT4\": 16\n};\nconst $559434fcc6e6401d$var$ATTRIBUTES = {\n POSITION: \"position\",\n NORMAL: \"normal\",\n TANGENT: \"tangent\",\n TEXCOORD_0: \"uv\",\n TEXCOORD_1: \"uv1\",\n TEXCOORD_2: \"uv2\",\n TEXCOORD_3: \"uv3\",\n COLOR_0: \"color\",\n WEIGHTS_0: \"skinWeight\",\n JOINTS_0: \"skinIndex\"\n};\nconst $559434fcc6e6401d$var$PATH_PROPERTIES = {\n scale: \"scale\",\n translation: \"position\",\n rotation: \"quaternion\",\n weights: \"morphTargetInfluences\"\n};\nconst $559434fcc6e6401d$var$INTERPOLATION = {\n CUBICSPLINE: undefined,\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: (0, $ilwiq.InterpolateLinear),\n STEP: (0, $ilwiq.InterpolateDiscrete)\n};\nconst $559434fcc6e6401d$var$ALPHA_MODES = {\n OPAQUE: \"OPAQUE\",\n MASK: \"MASK\",\n BLEND: \"BLEND\"\n};\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material\n */ function $559434fcc6e6401d$var$createDefaultMaterial(cache) {\n if (cache[\"DefaultMaterial\"] === undefined) cache[\"DefaultMaterial\"] = new (0, $ilwiq.MeshStandardMaterial)({\n color: 0xFFFFFF,\n emissive: 0x000000,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: (0, $ilwiq.FrontSide)\n });\n return cache[\"DefaultMaterial\"];\n}\nfunction $559434fcc6e6401d$var$addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n // Add unknown glTF extensions to an object's userData.\n for(const name in objectDef.extensions)if (knownExtensions[name] === undefined) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {};\n object.userData.gltfExtensions[name] = objectDef.extensions[name];\n }\n}\n/**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */ function $559434fcc6e6401d$var$assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== undefined) {\n if (typeof gltfDef.extras === \"object\") Object.assign(object.userData, gltfDef.extras);\n else console.warn(\"THREE.GLTFLoader: Ignoring primitive type .extras, \" + gltfDef.extras);\n }\n}\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets\n *\n * @param {BufferGeometry} geometry\n * @param {Array} targets\n * @param {GLTFParser} parser\n * @return {Promise}\n */ function $559434fcc6e6401d$var$addMorphTargets(geometry, targets, parser) {\n let hasMorphPosition = false;\n let hasMorphNormal = false;\n let hasMorphColor = false;\n for(let i = 0, il = targets.length; i < il; i++){\n const target = targets[i];\n if (target.POSITION !== undefined) hasMorphPosition = true;\n if (target.NORMAL !== undefined) hasMorphNormal = true;\n if (target.COLOR_0 !== undefined) hasMorphColor = true;\n if (hasMorphPosition && hasMorphNormal && hasMorphColor) break;\n }\n if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry);\n const pendingPositionAccessors = [];\n const pendingNormalAccessors = [];\n const pendingColorAccessors = [];\n for(let i = 0, il = targets.length; i < il; i++){\n const target = targets[i];\n if (hasMorphPosition) {\n const pendingAccessor = target.POSITION !== undefined ? parser.getDependency(\"accessor\", target.POSITION) : geometry.attributes.position;\n pendingPositionAccessors.push(pendingAccessor);\n }\n if (hasMorphNormal) {\n const pendingAccessor = target.NORMAL !== undefined ? parser.getDependency(\"accessor\", target.NORMAL) : geometry.attributes.normal;\n pendingNormalAccessors.push(pendingAccessor);\n }\n if (hasMorphColor) {\n const pendingAccessor = target.COLOR_0 !== undefined ? parser.getDependency(\"accessor\", target.COLOR_0) : geometry.attributes.color;\n pendingColorAccessors.push(pendingAccessor);\n }\n }\n return Promise.all([\n Promise.all(pendingPositionAccessors),\n Promise.all(pendingNormalAccessors),\n Promise.all(pendingColorAccessors)\n ]).then(function(accessors) {\n const morphPositions = accessors[0];\n const morphNormals = accessors[1];\n const morphColors = accessors[2];\n if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;\n if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;\n if (hasMorphColor) geometry.morphAttributes.color = morphColors;\n geometry.morphTargetsRelative = true;\n return geometry;\n });\n}\n/**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */ function $559434fcc6e6401d$var$updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets();\n if (meshDef.weights !== undefined) for(let i = 0, il = meshDef.weights.length; i < il; i++)mesh.morphTargetInfluences[i] = meshDef.weights[i];\n // .extras has user-defined data, so check that .extras.targetNames is an array.\n if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {\n const targetNames = meshDef.extras.targetNames;\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {};\n for(let i = 0, il = targetNames.length; i < il; i++)mesh.morphTargetDictionary[targetNames[i]] = i;\n } else console.warn(\"THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.\");\n }\n}\nfunction $559434fcc6e6401d$var$createPrimitiveKey(primitiveDef) {\n let geometryKey;\n const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];\n if (dracoExtension) geometryKey = \"draco:\" + dracoExtension.bufferView + \":\" + dracoExtension.indices + \":\" + $559434fcc6e6401d$var$createAttributesKey(dracoExtension.attributes);\n else geometryKey = primitiveDef.indices + \":\" + $559434fcc6e6401d$var$createAttributesKey(primitiveDef.attributes) + \":\" + primitiveDef.mode;\n if (primitiveDef.targets !== undefined) for(let i = 0, il = primitiveDef.targets.length; i < il; i++)geometryKey += \":\" + $559434fcc6e6401d$var$createAttributesKey(primitiveDef.targets[i]);\n return geometryKey;\n}\nfunction $559434fcc6e6401d$var$createAttributesKey(attributes) {\n let attributesKey = \"\";\n const keys = Object.keys(attributes).sort();\n for(let i = 0, il = keys.length; i < il; i++)attributesKey += keys[i] + \":\" + attributes[keys[i]] + \";\";\n return attributesKey;\n}\nfunction $559434fcc6e6401d$var$getNormalizedComponentScale(constructor) {\n // Reference:\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n switch(constructor){\n case Int8Array:\n return 1 / 127;\n case Uint8Array:\n return 1 / 255;\n case Int16Array:\n return 1 / 32767;\n case Uint16Array:\n return 1 / 65535;\n default:\n throw new Error(\"THREE.GLTFLoader: Unsupported normalized accessor component type.\");\n }\n}\nfunction $559434fcc6e6401d$var$getImageURIMimeType(uri) {\n if (uri.search(/\\.jpe?g($|\\?)/i) > 0 || uri.search(/^data\\:image\\/jpeg/) === 0) return \"image/jpeg\";\n if (uri.search(/\\.webp($|\\?)/i) > 0 || uri.search(/^data\\:image\\/webp/) === 0) return \"image/webp\";\n return \"image/png\";\n}\nconst $559434fcc6e6401d$var$_identityMatrix = new (0, $ilwiq.Matrix4)();\n/* GLTF PARSER */ class $559434fcc6e6401d$var$GLTFParser {\n constructor(json = {}, options = {}){\n this.json = json;\n this.extensions = {};\n this.plugins = {};\n this.options = options;\n // loader object cache\n this.cache = new $559434fcc6e6401d$var$GLTFRegistry();\n // associations between Three.js objects and glTF elements\n this.associations = new Map();\n // BufferGeometry caching\n this.primitiveCache = {};\n // Node cache\n this.nodeCache = {};\n // Object3D instance caches\n this.meshCache = {\n refs: {},\n uses: {}\n };\n this.cameraCache = {\n refs: {},\n uses: {}\n };\n this.lightCache = {\n refs: {},\n uses: {}\n };\n this.sourceCache = {};\n this.textureCache = {};\n // Track node names, to ensure no duplicates\n this.nodeNamesUsed = {};\n // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the\n // expensive work of uploading a texture to the GPU off the main thread.\n let isSafari = false;\n let isFirefox = false;\n let firefoxVersion = -1;\n if (typeof navigator !== \"undefined\") {\n isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;\n isFirefox = navigator.userAgent.indexOf(\"Firefox\") > -1;\n firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\\/([0-9]+)\\./)[1] : -1;\n }\n if (typeof createImageBitmap === \"undefined\" || isSafari || isFirefox && firefoxVersion < 98) this.textureLoader = new (0, $ilwiq.TextureLoader)(this.options.manager);\n else this.textureLoader = new (0, $ilwiq.ImageBitmapLoader)(this.options.manager);\n this.textureLoader.setCrossOrigin(this.options.crossOrigin);\n this.textureLoader.setRequestHeader(this.options.requestHeader);\n this.fileLoader = new (0, $ilwiq.FileLoader)(this.options.manager);\n this.fileLoader.setResponseType(\"arraybuffer\");\n if (this.options.crossOrigin === \"use-credentials\") this.fileLoader.setWithCredentials(true);\n }\n setExtensions(extensions) {\n this.extensions = extensions;\n }\n setPlugins(plugins) {\n this.plugins = plugins;\n }\n parse(onLoad, onError) {\n const parser = this;\n const json = this.json;\n const extensions = this.extensions;\n // Clear the loader cache\n this.cache.removeAll();\n this.nodeCache = {};\n // Mark the special nodes/meshes in json for efficient parse\n this._invokeAll(function(ext) {\n return ext._markDefs && ext._markDefs();\n });\n Promise.all(this._invokeAll(function(ext) {\n return ext.beforeRoot && ext.beforeRoot();\n })).then(function() {\n return Promise.all([\n parser.getDependencies(\"scene\"),\n parser.getDependencies(\"animation\"),\n parser.getDependencies(\"camera\")\n ]);\n }).then(function(dependencies) {\n const result = {\n scene: dependencies[0][json.scene || 0],\n scenes: dependencies[0],\n animations: dependencies[1],\n cameras: dependencies[2],\n asset: json.asset,\n parser: parser,\n userData: {}\n };\n $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, result, json);\n $559434fcc6e6401d$var$assignExtrasToUserData(result, json);\n Promise.all(parser._invokeAll(function(ext) {\n return ext.afterRoot && ext.afterRoot(result);\n })).then(function() {\n onLoad(result);\n });\n }).catch(onError);\n }\n /**\n\t * Marks the special nodes/meshes in json for efficient parse.\n\t */ _markDefs() {\n const nodeDefs = this.json.nodes || [];\n const skinDefs = this.json.skins || [];\n const meshDefs = this.json.meshes || [];\n // Nothing in the node definition indicates whether it is a Bone or an\n // Object3D. Use the skins' joint references to mark bones.\n for(let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++){\n const joints = skinDefs[skinIndex].joints;\n for(let i = 0, il = joints.length; i < il; i++)nodeDefs[joints[i]].isBone = true;\n }\n // Iterate over all nodes, marking references to shared resources,\n // as well as skeleton joints.\n for(let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++){\n const nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.mesh !== undefined) {\n this._addNodeRef(this.meshCache, nodeDef.mesh);\n // Nothing in the mesh definition indicates whether it is\n // a SkinnedMesh or Mesh. Use the node's mesh reference\n // to mark SkinnedMesh if node has skin.\n if (nodeDef.skin !== undefined) meshDefs[nodeDef.mesh].isSkinnedMesh = true;\n }\n if (nodeDef.camera !== undefined) this._addNodeRef(this.cameraCache, nodeDef.camera);\n }\n }\n /**\n\t * Counts references to shared node / Object3D resources. These resources\n\t * can be reused, or \"instantiated\", at multiple nodes in the scene\n\t * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n\t * be marked. Non-scenegraph resources (like Materials, Geometries, and\n\t * Textures) can be reused directly and are not marked here.\n\t *\n\t * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n\t */ _addNodeRef(cache, index) {\n if (index === undefined) return;\n if (cache.refs[index] === undefined) cache.refs[index] = cache.uses[index] = 0;\n cache.refs[index]++;\n }\n /** Returns a reference to a shared resource, cloning it if necessary. */ _getNodeRef(cache, index, object) {\n if (cache.refs[index] <= 1) return object;\n const ref = object.clone();\n // Propagates mappings to the cloned object, prevents mappings on the\n // original object from being lost.\n const updateMappings = (original, clone)=>{\n const mappings = this.associations.get(original);\n if (mappings != null) this.associations.set(clone, mappings);\n for (const [i, child] of original.children.entries())updateMappings(child, clone.children[i]);\n };\n updateMappings(object, ref);\n ref.name += \"_instance_\" + cache.uses[index]++;\n return ref;\n }\n _invokeOne(func) {\n const extensions = Object.values(this.plugins);\n extensions.push(this);\n for(let i = 0; i < extensions.length; i++){\n const result = func(extensions[i]);\n if (result) return result;\n }\n return null;\n }\n _invokeAll(func) {\n const extensions = Object.values(this.plugins);\n extensions.unshift(this);\n const pending = [];\n for(let i = 0; i < extensions.length; i++){\n const result = func(extensions[i]);\n if (result) pending.push(result);\n }\n return pending;\n }\n /**\n\t * Requests the specified dependency asynchronously, with caching.\n\t * @param {string} type\n\t * @param {number} index\n\t * @return {Promise}\n\t */ getDependency(type, index) {\n const cacheKey = type + \":\" + index;\n let dependency = this.cache.get(cacheKey);\n if (!dependency) {\n switch(type){\n case \"scene\":\n dependency = this.loadScene(index);\n break;\n case \"node\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadNode && ext.loadNode(index);\n });\n break;\n case \"mesh\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadMesh && ext.loadMesh(index);\n });\n break;\n case \"accessor\":\n dependency = this.loadAccessor(index);\n break;\n case \"bufferView\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadBufferView && ext.loadBufferView(index);\n });\n break;\n case \"buffer\":\n dependency = this.loadBuffer(index);\n break;\n case \"material\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadMaterial && ext.loadMaterial(index);\n });\n break;\n case \"texture\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadTexture && ext.loadTexture(index);\n });\n break;\n case \"skin\":\n dependency = this.loadSkin(index);\n break;\n case \"animation\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadAnimation && ext.loadAnimation(index);\n });\n break;\n case \"camera\":\n dependency = this.loadCamera(index);\n break;\n default:\n dependency = this._invokeOne(function(ext) {\n return ext != this && ext.getDependency && ext.getDependency(type, index);\n });\n if (!dependency) throw new Error(\"Unknown type: \" + type);\n break;\n }\n this.cache.add(cacheKey, dependency);\n }\n return dependency;\n }\n /**\n\t * Requests all dependencies of the specified type asynchronously, with caching.\n\t * @param {string} type\n\t * @return {Promise>}\n\t */ getDependencies(type) {\n let dependencies = this.cache.get(type);\n if (!dependencies) {\n const parser = this;\n const defs = this.json[type + (type === \"mesh\" ? \"es\" : \"s\")] || [];\n dependencies = Promise.all(defs.map(function(def, index) {\n return parser.getDependency(type, index);\n }));\n this.cache.add(type, dependencies);\n }\n return dependencies;\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t * @param {number} bufferIndex\n\t * @return {Promise}\n\t */ loadBuffer(bufferIndex) {\n const bufferDef = this.json.buffers[bufferIndex];\n const loader = this.fileLoader;\n if (bufferDef.type && bufferDef.type !== \"arraybuffer\") throw new Error(\"THREE.GLTFLoader: \" + bufferDef.type + \" buffer type is not supported.\");\n // If present, GLB container is required to be the first buffer.\n if (bufferDef.uri === undefined && bufferIndex === 0) return Promise.resolve(this.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_BINARY_GLTF].body);\n const options = this.options;\n return new Promise(function(resolve, reject) {\n loader.load((0, $ilwiq.LoaderUtils).resolveURL(bufferDef.uri, options.path), resolve, undefined, function() {\n reject(new Error('THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".'));\n });\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t * @param {number} bufferViewIndex\n\t * @return {Promise}\n\t */ loadBufferView(bufferViewIndex) {\n const bufferViewDef = this.json.bufferViews[bufferViewIndex];\n return this.getDependency(\"buffer\", bufferViewDef.buffer).then(function(buffer) {\n const byteLength = bufferViewDef.byteLength || 0;\n const byteOffset = bufferViewDef.byteOffset || 0;\n return buffer.slice(byteOffset, byteOffset + byteLength);\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n\t * @param {number} accessorIndex\n\t * @return {Promise}\n\t */ loadAccessor(accessorIndex) {\n const parser = this;\n const json = this.json;\n const accessorDef = this.json.accessors[accessorIndex];\n if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {\n const itemSize = $559434fcc6e6401d$var$WEBGL_TYPE_SIZES[accessorDef.type];\n const TypedArray = $559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n const normalized = accessorDef.normalized === true;\n const array = new TypedArray(accessorDef.count * itemSize);\n return Promise.resolve(new (0, $ilwiq.BufferAttribute)(array, itemSize, normalized));\n }\n const pendingBufferViews = [];\n if (accessorDef.bufferView !== undefined) pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.bufferView));\n else pendingBufferViews.push(null);\n if (accessorDef.sparse !== undefined) {\n pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.sparse.indices.bufferView));\n pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.sparse.values.bufferView));\n }\n return Promise.all(pendingBufferViews).then(function(bufferViews) {\n const bufferView = bufferViews[0];\n const itemSize = $559434fcc6e6401d$var$WEBGL_TYPE_SIZES[accessorDef.type];\n const TypedArray = $559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.\n const elementBytes = TypedArray.BYTES_PER_ELEMENT;\n const itemBytes = elementBytes * itemSize;\n const byteOffset = accessorDef.byteOffset || 0;\n const byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined;\n const normalized = accessorDef.normalized === true;\n let array, bufferAttribute;\n // The buffer is not interleaved if the stride is the item size in bytes.\n if (byteStride && byteStride !== itemBytes) {\n // Each \"slice\" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer\n // This makes sure that IBA.count reflects accessor.count properly\n const ibSlice = Math.floor(byteOffset / byteStride);\n const ibCacheKey = \"InterleavedBuffer:\" + accessorDef.bufferView + \":\" + accessorDef.componentType + \":\" + ibSlice + \":\" + accessorDef.count;\n let ib = parser.cache.get(ibCacheKey);\n if (!ib) {\n array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);\n // Integer parameters to IB/IBA are in array elements, not bytes.\n ib = new (0, $ilwiq.InterleavedBuffer)(array, byteStride / elementBytes);\n parser.cache.add(ibCacheKey, ib);\n }\n bufferAttribute = new (0, $ilwiq.InterleavedBufferAttribute)(ib, itemSize, byteOffset % byteStride / elementBytes, normalized);\n } else {\n if (bufferView === null) array = new TypedArray(accessorDef.count * itemSize);\n else array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);\n bufferAttribute = new (0, $ilwiq.BufferAttribute)(array, itemSize, normalized);\n }\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n if (accessorDef.sparse !== undefined) {\n const itemSizeIndices = $559434fcc6e6401d$var$WEBGL_TYPE_SIZES.SCALAR;\n const TypedArrayIndices = $559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];\n const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices);\n const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);\n if (bufferView !== null) // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n bufferAttribute = new (0, $ilwiq.BufferAttribute)(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized);\n for(let i = 0, il = sparseIndices.length; i < il; i++){\n const index = sparseIndices[i];\n bufferAttribute.setX(index, sparseValues[i * itemSize]);\n if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);\n if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);\n if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);\n if (itemSize >= 5) throw new Error(\"THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.\");\n }\n }\n return bufferAttribute;\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n\t * @param {number} textureIndex\n\t * @return {Promise}\n\t */ loadTexture(textureIndex) {\n const json = this.json;\n const options = this.options;\n const textureDef = json.textures[textureIndex];\n const sourceIndex = textureDef.source;\n const sourceDef = json.images[sourceIndex];\n let loader = this.textureLoader;\n if (sourceDef.uri) {\n const handler = options.manager.getHandler(sourceDef.uri);\n if (handler !== null) loader = handler;\n }\n return this.loadTextureImage(textureIndex, sourceIndex, loader);\n }\n loadTextureImage(textureIndex, sourceIndex, loader) {\n const parser = this;\n const json = this.json;\n const textureDef = json.textures[textureIndex];\n const sourceDef = json.images[sourceIndex];\n const cacheKey = (sourceDef.uri || sourceDef.bufferView) + \":\" + textureDef.sampler;\n if (this.textureCache[cacheKey]) // See https://github.com/mrdoob/three.js/issues/21559.\n return this.textureCache[cacheKey];\n const promise = this.loadImageSource(sourceIndex, loader).then(function(texture) {\n texture.flipY = false;\n texture.name = textureDef.name || sourceDef.name || \"\";\n if (texture.name === \"\" && typeof sourceDef.uri === \"string\" && sourceDef.uri.startsWith(\"data:image/\") === false) texture.name = sourceDef.uri;\n const samplers = json.samplers || {};\n const sampler = samplers[textureDef.sampler] || {};\n texture.magFilter = $559434fcc6e6401d$var$WEBGL_FILTERS[sampler.magFilter] || (0, $ilwiq.LinearFilter);\n texture.minFilter = $559434fcc6e6401d$var$WEBGL_FILTERS[sampler.minFilter] || (0, $ilwiq.LinearMipmapLinearFilter);\n texture.wrapS = $559434fcc6e6401d$var$WEBGL_WRAPPINGS[sampler.wrapS] || (0, $ilwiq.RepeatWrapping);\n texture.wrapT = $559434fcc6e6401d$var$WEBGL_WRAPPINGS[sampler.wrapT] || (0, $ilwiq.RepeatWrapping);\n parser.associations.set(texture, {\n textures: textureIndex\n });\n return texture;\n }).catch(function() {\n return null;\n });\n this.textureCache[cacheKey] = promise;\n return promise;\n }\n loadImageSource(sourceIndex, loader) {\n const parser = this;\n const json = this.json;\n const options = this.options;\n if (this.sourceCache[sourceIndex] !== undefined) return this.sourceCache[sourceIndex].then((texture)=>texture.clone());\n const sourceDef = json.images[sourceIndex];\n const URL = self.URL || self.webkitURL;\n let sourceURI = sourceDef.uri || \"\";\n let isObjectURL = false;\n if (sourceDef.bufferView !== undefined) // Load binary image data from bufferView, if provided.\n sourceURI = parser.getDependency(\"bufferView\", sourceDef.bufferView).then(function(bufferView) {\n isObjectURL = true;\n const blob = new Blob([\n bufferView\n ], {\n type: sourceDef.mimeType\n });\n sourceURI = URL.createObjectURL(blob);\n return sourceURI;\n });\n else if (sourceDef.uri === undefined) throw new Error(\"THREE.GLTFLoader: Image \" + sourceIndex + \" is missing URI and bufferView\");\n const promise = Promise.resolve(sourceURI).then(function(sourceURI) {\n return new Promise(function(resolve, reject) {\n let onLoad = resolve;\n if (loader.isImageBitmapLoader === true) onLoad = function(imageBitmap) {\n const texture = new (0, $ilwiq.Texture)(imageBitmap);\n texture.needsUpdate = true;\n resolve(texture);\n };\n loader.load((0, $ilwiq.LoaderUtils).resolveURL(sourceURI, options.path), onLoad, undefined, reject);\n });\n }).then(function(texture) {\n // Clean up resources and configure Texture.\n if (isObjectURL === true) URL.revokeObjectURL(sourceURI);\n texture.userData.mimeType = sourceDef.mimeType || $559434fcc6e6401d$var$getImageURIMimeType(sourceDef.uri);\n return texture;\n }).catch(function(error) {\n console.error(\"THREE.GLTFLoader: Couldn't load texture\", sourceURI);\n throw error;\n });\n this.sourceCache[sourceIndex] = promise;\n return promise;\n }\n /**\n\t * Asynchronously assigns a texture to the given material parameters.\n\t * @param {Object} materialParams\n\t * @param {string} mapName\n\t * @param {Object} mapDef\n\t * @return {Promise}\n\t */ assignTexture(materialParams, mapName, mapDef, colorSpace) {\n const parser = this;\n return this.getDependency(\"texture\", mapDef.index).then(function(texture) {\n if (!texture) return null;\n if (mapDef.texCoord !== undefined && mapDef.texCoord > 0) {\n texture = texture.clone();\n texture.channel = mapDef.texCoord;\n }\n if (parser.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n const transform = mapDef.extensions !== undefined ? mapDef.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined;\n if (transform) {\n const gltfReference = parser.associations.get(texture);\n texture = parser.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);\n parser.associations.set(texture, gltfReference);\n }\n }\n if (colorSpace !== undefined) texture.colorSpace = colorSpace;\n materialParams[mapName] = texture;\n return texture;\n });\n }\n /**\n\t * Assigns final material to a Mesh, Line, or Points instance. The instance\n\t * already has a material (generated from the glTF material options alone)\n\t * but reuse of the same glTF material may require multiple threejs materials\n\t * to accommodate different primitive types, defines, etc. New materials will\n\t * be created if necessary, and reused from a cache.\n\t * @param {Object3D} mesh Mesh, Line, or Points instance.\n\t */ assignFinalMaterial(mesh) {\n const geometry = mesh.geometry;\n let material = mesh.material;\n const useDerivativeTangents = geometry.attributes.tangent === undefined;\n const useVertexColors = geometry.attributes.color !== undefined;\n const useFlatShading = geometry.attributes.normal === undefined;\n if (mesh.isPoints) {\n const cacheKey = \"PointsMaterial:\" + material.uuid;\n let pointsMaterial = this.cache.get(cacheKey);\n if (!pointsMaterial) {\n pointsMaterial = new (0, $ilwiq.PointsMaterial)();\n (0, $ilwiq.Material).prototype.copy.call(pointsMaterial, material);\n pointsMaterial.color.copy(material.color);\n pointsMaterial.map = material.map;\n pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px\n this.cache.add(cacheKey, pointsMaterial);\n }\n material = pointsMaterial;\n } else if (mesh.isLine) {\n const cacheKey = \"LineBasicMaterial:\" + material.uuid;\n let lineMaterial = this.cache.get(cacheKey);\n if (!lineMaterial) {\n lineMaterial = new (0, $ilwiq.LineBasicMaterial)();\n (0, $ilwiq.Material).prototype.copy.call(lineMaterial, material);\n lineMaterial.color.copy(material.color);\n lineMaterial.map = material.map;\n this.cache.add(cacheKey, lineMaterial);\n }\n material = lineMaterial;\n }\n // Clone the material if it will be modified\n if (useDerivativeTangents || useVertexColors || useFlatShading) {\n let cacheKey = \"ClonedMaterial:\" + material.uuid + \":\";\n if (useDerivativeTangents) cacheKey += \"derivative-tangents:\";\n if (useVertexColors) cacheKey += \"vertex-colors:\";\n if (useFlatShading) cacheKey += \"flat-shading:\";\n let cachedMaterial = this.cache.get(cacheKey);\n if (!cachedMaterial) {\n cachedMaterial = material.clone();\n if (useVertexColors) cachedMaterial.vertexColors = true;\n if (useFlatShading) cachedMaterial.flatShading = true;\n if (useDerivativeTangents) {\n // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;\n if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;\n }\n this.cache.add(cacheKey, cachedMaterial);\n this.associations.set(cachedMaterial, this.associations.get(material));\n }\n material = cachedMaterial;\n }\n mesh.material = material;\n }\n getMaterialType() {\n return 0, $ilwiq.MeshStandardMaterial;\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n\t * @param {number} materialIndex\n\t * @return {Promise}\n\t */ loadMaterial(materialIndex) {\n const parser = this;\n const json = this.json;\n const extensions = this.extensions;\n const materialDef = json.materials[materialIndex];\n let materialType;\n const materialParams = {};\n const materialExtensions = materialDef.extensions || {};\n const pending = [];\n if (materialExtensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n const kmuExtension = extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_MATERIALS_UNLIT];\n materialType = kmuExtension.getMaterialType();\n pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));\n } else {\n // Specification:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material\n const metallicRoughness = materialDef.pbrMetallicRoughness || {};\n materialParams.color = new (0, $ilwiq.Color)(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== undefined) pending.push(parser.assignTexture(materialParams, \"map\", metallicRoughness.baseColorTexture, (0, $ilwiq.SRGBColorSpace)));\n materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;\n materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;\n if (metallicRoughness.metallicRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, \"metalnessMap\", metallicRoughness.metallicRoughnessTexture));\n pending.push(parser.assignTexture(materialParams, \"roughnessMap\", metallicRoughness.metallicRoughnessTexture));\n }\n materialType = this._invokeOne(function(ext) {\n return ext.getMaterialType && ext.getMaterialType(materialIndex);\n });\n pending.push(Promise.all(this._invokeAll(function(ext) {\n return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);\n })));\n }\n if (materialDef.doubleSided === true) materialParams.side = (0, $ilwiq.DoubleSide);\n const alphaMode = materialDef.alphaMode || $559434fcc6e6401d$var$ALPHA_MODES.OPAQUE;\n if (alphaMode === $559434fcc6e6401d$var$ALPHA_MODES.BLEND) {\n materialParams.transparent = true;\n // See: https://github.com/mrdoob/three.js/issues/17706\n materialParams.depthWrite = false;\n } else {\n materialParams.transparent = false;\n if (alphaMode === $559434fcc6e6401d$var$ALPHA_MODES.MASK) materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;\n }\n if (materialDef.normalTexture !== undefined && materialType !== (0, $ilwiq.MeshBasicMaterial)) {\n pending.push(parser.assignTexture(materialParams, \"normalMap\", materialDef.normalTexture));\n materialParams.normalScale = new (0, $ilwiq.Vector2)(1, 1);\n if (materialDef.normalTexture.scale !== undefined) {\n const scale = materialDef.normalTexture.scale;\n materialParams.normalScale.set(scale, scale);\n }\n }\n if (materialDef.occlusionTexture !== undefined && materialType !== (0, $ilwiq.MeshBasicMaterial)) {\n pending.push(parser.assignTexture(materialParams, \"aoMap\", materialDef.occlusionTexture));\n if (materialDef.occlusionTexture.strength !== undefined) materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n }\n if (materialDef.emissiveFactor !== undefined && materialType !== (0, $ilwiq.MeshBasicMaterial)) materialParams.emissive = new (0, $ilwiq.Color)().fromArray(materialDef.emissiveFactor);\n if (materialDef.emissiveTexture !== undefined && materialType !== (0, $ilwiq.MeshBasicMaterial)) pending.push(parser.assignTexture(materialParams, \"emissiveMap\", materialDef.emissiveTexture, (0, $ilwiq.SRGBColorSpace)));\n return Promise.all(pending).then(function() {\n const material = new materialType(materialParams);\n if (materialDef.name) material.name = materialDef.name;\n $559434fcc6e6401d$var$assignExtrasToUserData(material, materialDef);\n parser.associations.set(material, {\n materials: materialIndex\n });\n if (materialDef.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, material, materialDef);\n return material;\n });\n }\n /** When Object3D instances are targeted by animation, they need unique names. */ createUniqueName(originalName) {\n const sanitizedName = (0, $ilwiq.PropertyBinding).sanitizeNodeName(originalName || \"\");\n if (sanitizedName in this.nodeNamesUsed) return sanitizedName + \"_\" + ++this.nodeNamesUsed[sanitizedName];\n else {\n this.nodeNamesUsed[sanitizedName] = 0;\n return sanitizedName;\n }\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n\t *\n\t * Creates BufferGeometries from primitives.\n\t *\n\t * @param {Array} primitives\n\t * @return {Promise>}\n\t */ loadGeometries(primitives) {\n const parser = this;\n const extensions = this.extensions;\n const cache = this.primitiveCache;\n function createDracoPrimitive(primitive) {\n return extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) {\n return $559434fcc6e6401d$var$addPrimitiveAttributes(geometry, primitive, parser);\n });\n }\n const pending = [];\n for(let i = 0, il = primitives.length; i < il; i++){\n const primitive = primitives[i];\n const cacheKey = $559434fcc6e6401d$var$createPrimitiveKey(primitive);\n // See if we've already created this geometry\n const cached = cache[cacheKey];\n if (cached) // Use the cached geometry if it exists\n pending.push(cached.promise);\n else {\n let geometryPromise;\n if (primitive.extensions && primitive.extensions[$559434fcc6e6401d$var$EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) // Use DRACO geometry if available\n geometryPromise = createDracoPrimitive(primitive);\n else // Otherwise create a new geometry\n geometryPromise = $559434fcc6e6401d$var$addPrimitiveAttributes(new (0, $ilwiq.BufferGeometry)(), primitive, parser);\n // Cache this geometry\n cache[cacheKey] = {\n primitive: primitive,\n promise: geometryPromise\n };\n pending.push(geometryPromise);\n }\n }\n return Promise.all(pending);\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n\t * @param {number} meshIndex\n\t * @return {Promise}\n\t */ loadMesh(meshIndex) {\n const parser = this;\n const json = this.json;\n const extensions = this.extensions;\n const meshDef = json.meshes[meshIndex];\n const primitives = meshDef.primitives;\n const pending = [];\n for(let i = 0, il = primitives.length; i < il; i++){\n const material = primitives[i].material === undefined ? $559434fcc6e6401d$var$createDefaultMaterial(this.cache) : this.getDependency(\"material\", primitives[i].material);\n pending.push(material);\n }\n pending.push(parser.loadGeometries(primitives));\n return Promise.all(pending).then(function(results) {\n const materials = results.slice(0, results.length - 1);\n const geometries = results[results.length - 1];\n const meshes = [];\n for(let i = 0, il = geometries.length; i < il; i++){\n const geometry = geometries[i];\n const primitive = primitives[i];\n // 1. create Mesh\n let mesh;\n const material = materials[i];\n if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLES || primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === undefined) {\n // .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n mesh = meshDef.isSkinnedMesh === true ? new (0, $ilwiq.SkinnedMesh)(geometry, material) : new (0, $ilwiq.Mesh)(geometry, material);\n if (mesh.isSkinnedMesh === true) // normalize skin weights to fix malformed assets (see #15319)\n mesh.normalizeSkinWeights();\n if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_STRIP) mesh.geometry = (0, $7ePFa.toTrianglesDrawMode)(mesh.geometry, (0, $ilwiq.TriangleStripDrawMode));\n else if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.TRIANGLE_FAN) mesh.geometry = (0, $7ePFa.toTrianglesDrawMode)(mesh.geometry, (0, $ilwiq.TriangleFanDrawMode));\n } else if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.LINES) mesh = new (0, $ilwiq.LineSegments)(geometry, material);\n else if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.LINE_STRIP) mesh = new (0, $ilwiq.Line)(geometry, material);\n else if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.LINE_LOOP) mesh = new (0, $ilwiq.LineLoop)(geometry, material);\n else if (primitive.mode === $559434fcc6e6401d$var$WEBGL_CONSTANTS.POINTS) mesh = new (0, $ilwiq.Points)(geometry, material);\n else throw new Error(\"THREE.GLTFLoader: Primitive mode unsupported: \" + primitive.mode);\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) $559434fcc6e6401d$var$updateMorphTargets(mesh, meshDef);\n mesh.name = parser.createUniqueName(meshDef.name || \"mesh_\" + meshIndex);\n $559434fcc6e6401d$var$assignExtrasToUserData(mesh, meshDef);\n if (primitive.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, mesh, primitive);\n parser.assignFinalMaterial(mesh);\n meshes.push(mesh);\n }\n for(let i = 0, il = meshes.length; i < il; i++)parser.associations.set(meshes[i], {\n meshes: meshIndex,\n primitives: i\n });\n if (meshes.length === 1) {\n if (meshDef.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);\n return meshes[0];\n }\n const group = new (0, $ilwiq.Group)();\n if (meshDef.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, group, meshDef);\n parser.associations.set(group, {\n meshes: meshIndex\n });\n for(let i = 0, il = meshes.length; i < il; i++)group.add(meshes[i]);\n return group;\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n\t * @param {number} cameraIndex\n\t * @return {Promise}\n\t */ loadCamera(cameraIndex) {\n let camera;\n const cameraDef = this.json.cameras[cameraIndex];\n const params = cameraDef[cameraDef.type];\n if (!params) {\n console.warn(\"THREE.GLTFLoader: Missing camera parameters.\");\n return;\n }\n if (cameraDef.type === \"perspective\") camera = new (0, $ilwiq.PerspectiveCamera)((0, $ilwiq.MathUtils).radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6);\n else if (cameraDef.type === \"orthographic\") camera = new (0, $ilwiq.OrthographicCamera)(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);\n if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name);\n $559434fcc6e6401d$var$assignExtrasToUserData(camera, cameraDef);\n return Promise.resolve(camera);\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n\t * @param {number} skinIndex\n\t * @return {Promise}\n\t */ loadSkin(skinIndex) {\n const skinDef = this.json.skins[skinIndex];\n const pending = [];\n for(let i = 0, il = skinDef.joints.length; i < il; i++)pending.push(this._loadNodeShallow(skinDef.joints[i]));\n if (skinDef.inverseBindMatrices !== undefined) pending.push(this.getDependency(\"accessor\", skinDef.inverseBindMatrices));\n else pending.push(null);\n return Promise.all(pending).then(function(results) {\n const inverseBindMatrices = results.pop();\n const jointNodes = results;\n // Note that bones (joint nodes) may or may not be in the\n // scene graph at this time.\n const bones = [];\n const boneInverses = [];\n for(let i = 0, il = jointNodes.length; i < il; i++){\n const jointNode = jointNodes[i];\n if (jointNode) {\n bones.push(jointNode);\n const mat = new (0, $ilwiq.Matrix4)();\n if (inverseBindMatrices !== null) mat.fromArray(inverseBindMatrices.array, i * 16);\n boneInverses.push(mat);\n } else console.warn('THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[i]);\n }\n return new (0, $ilwiq.Skeleton)(bones, boneInverses);\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n\t * @param {number} animationIndex\n\t * @return {Promise}\n\t */ loadAnimation(animationIndex) {\n const json = this.json;\n const parser = this;\n const animationDef = json.animations[animationIndex];\n const animationName = animationDef.name ? animationDef.name : \"animation_\" + animationIndex;\n const pendingNodes = [];\n const pendingInputAccessors = [];\n const pendingOutputAccessors = [];\n const pendingSamplers = [];\n const pendingTargets = [];\n for(let i = 0, il = animationDef.channels.length; i < il; i++){\n const channel = animationDef.channels[i];\n const sampler = animationDef.samplers[channel.sampler];\n const target = channel.target;\n const name = target.node;\n const input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input;\n const output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output;\n if (target.node === undefined) continue;\n pendingNodes.push(this.getDependency(\"node\", name));\n pendingInputAccessors.push(this.getDependency(\"accessor\", input));\n pendingOutputAccessors.push(this.getDependency(\"accessor\", output));\n pendingSamplers.push(sampler);\n pendingTargets.push(target);\n }\n return Promise.all([\n Promise.all(pendingNodes),\n Promise.all(pendingInputAccessors),\n Promise.all(pendingOutputAccessors),\n Promise.all(pendingSamplers),\n Promise.all(pendingTargets)\n ]).then(function(dependencies) {\n const nodes = dependencies[0];\n const inputAccessors = dependencies[1];\n const outputAccessors = dependencies[2];\n const samplers = dependencies[3];\n const targets = dependencies[4];\n const tracks = [];\n for(let i = 0, il = nodes.length; i < il; i++){\n const node = nodes[i];\n const inputAccessor = inputAccessors[i];\n const outputAccessor = outputAccessors[i];\n const sampler = samplers[i];\n const target = targets[i];\n if (node === undefined) continue;\n if (node.updateMatrix) node.updateMatrix();\n const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target);\n if (createdTracks) for(let k = 0; k < createdTracks.length; k++)tracks.push(createdTracks[k]);\n }\n return new (0, $ilwiq.AnimationClip)(animationName, undefined, tracks);\n });\n }\n createNodeMesh(nodeIndex) {\n const json = this.json;\n const parser = this;\n const nodeDef = json.nodes[nodeIndex];\n if (nodeDef.mesh === undefined) return null;\n return parser.getDependency(\"mesh\", nodeDef.mesh).then(function(mesh) {\n const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);\n // if weights are provided on the node, override weights on the mesh.\n if (nodeDef.weights !== undefined) node.traverse(function(o) {\n if (!o.isMesh) return;\n for(let i = 0, il = nodeDef.weights.length; i < il; i++)o.morphTargetInfluences[i] = nodeDef.weights[i];\n });\n return node;\n });\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n\t * @param {number} nodeIndex\n\t * @return {Promise}\n\t */ loadNode(nodeIndex) {\n const json = this.json;\n const parser = this;\n const nodeDef = json.nodes[nodeIndex];\n const nodePending = parser._loadNodeShallow(nodeIndex);\n const childPending = [];\n const childrenDef = nodeDef.children || [];\n for(let i = 0, il = childrenDef.length; i < il; i++)childPending.push(parser.getDependency(\"node\", childrenDef[i]));\n const skeletonPending = nodeDef.skin === undefined ? Promise.resolve(null) : parser.getDependency(\"skin\", nodeDef.skin);\n return Promise.all([\n nodePending,\n Promise.all(childPending),\n skeletonPending\n ]).then(function(results) {\n const node = results[0];\n const children = results[1];\n const skeleton = results[2];\n if (skeleton !== null) // This full traverse should be fine because\n // child glTF nodes have not been added to this node yet.\n node.traverse(function(mesh) {\n if (!mesh.isSkinnedMesh) return;\n mesh.bind(skeleton, $559434fcc6e6401d$var$_identityMatrix);\n });\n for(let i = 0, il = children.length; i < il; i++)node.add(children[i]);\n return node;\n });\n }\n // ._loadNodeShallow() parses a single node.\n // skin and child nodes are created and added in .loadNode() (no '_' prefix).\n _loadNodeShallow(nodeIndex) {\n const json = this.json;\n const extensions = this.extensions;\n const parser = this;\n // This method is called from .loadNode() and .loadSkin().\n // Cache a node to avoid duplication.\n if (this.nodeCache[nodeIndex] !== undefined) return this.nodeCache[nodeIndex];\n const nodeDef = json.nodes[nodeIndex];\n // reserve node's name before its dependencies, so the root has the intended name.\n const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : \"\";\n const pending = [];\n const meshPromise = parser._invokeOne(function(ext) {\n return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);\n });\n if (meshPromise) pending.push(meshPromise);\n if (nodeDef.camera !== undefined) pending.push(parser.getDependency(\"camera\", nodeDef.camera).then(function(camera) {\n return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);\n }));\n parser._invokeAll(function(ext) {\n return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);\n }).forEach(function(promise) {\n pending.push(promise);\n });\n this.nodeCache[nodeIndex] = Promise.all(pending).then(function(objects) {\n let node;\n // .isBone isn't in glTF spec. See ._markDefs\n if (nodeDef.isBone === true) node = new (0, $ilwiq.Bone)();\n else if (objects.length > 1) node = new (0, $ilwiq.Group)();\n else if (objects.length === 1) node = objects[0];\n else node = new (0, $ilwiq.Object3D)();\n if (node !== objects[0]) for(let i = 0, il = objects.length; i < il; i++)node.add(objects[i]);\n if (nodeDef.name) {\n node.userData.name = nodeDef.name;\n node.name = nodeName;\n }\n $559434fcc6e6401d$var$assignExtrasToUserData(node, nodeDef);\n if (nodeDef.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, node, nodeDef);\n if (nodeDef.matrix !== undefined) {\n const matrix = new (0, $ilwiq.Matrix4)();\n matrix.fromArray(nodeDef.matrix);\n node.applyMatrix4(matrix);\n } else {\n if (nodeDef.translation !== undefined) node.position.fromArray(nodeDef.translation);\n if (nodeDef.rotation !== undefined) node.quaternion.fromArray(nodeDef.rotation);\n if (nodeDef.scale !== undefined) node.scale.fromArray(nodeDef.scale);\n }\n if (!parser.associations.has(node)) parser.associations.set(node, {});\n parser.associations.get(node).nodes = nodeIndex;\n return node;\n });\n return this.nodeCache[nodeIndex];\n }\n /**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n\t * @param {number} sceneIndex\n\t * @return {Promise}\n\t */ loadScene(sceneIndex) {\n const extensions = this.extensions;\n const sceneDef = this.json.scenes[sceneIndex];\n const parser = this;\n // Loader returns Group, not Scene.\n // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n const scene = new (0, $ilwiq.Group)();\n if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name);\n $559434fcc6e6401d$var$assignExtrasToUserData(scene, sceneDef);\n if (sceneDef.extensions) $559434fcc6e6401d$var$addUnknownExtensionsToUserData(extensions, scene, sceneDef);\n const nodeIds = sceneDef.nodes || [];\n const pending = [];\n for(let i = 0, il = nodeIds.length; i < il; i++)pending.push(parser.getDependency(\"node\", nodeIds[i]));\n return Promise.all(pending).then(function(nodes) {\n for(let i = 0, il = nodes.length; i < il; i++)scene.add(nodes[i]);\n // Removes dangling associations, associations that reference a node that\n // didn't make it into the scene.\n const reduceAssociations = (node)=>{\n const reducedAssociations = new Map();\n for (const [key, value] of parser.associations)if (key instanceof (0, $ilwiq.Material) || key instanceof (0, $ilwiq.Texture)) reducedAssociations.set(key, value);\n node.traverse((node)=>{\n const mappings = parser.associations.get(node);\n if (mappings != null) reducedAssociations.set(node, mappings);\n });\n return reducedAssociations;\n };\n parser.associations = reduceAssociations(scene);\n return scene;\n });\n }\n _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) {\n const tracks = [];\n const targetName = node.name ? node.name : node.uuid;\n const targetNames = [];\n if ($559434fcc6e6401d$var$PATH_PROPERTIES[target.path] === $559434fcc6e6401d$var$PATH_PROPERTIES.weights) node.traverse(function(object) {\n if (object.morphTargetInfluences) targetNames.push(object.name ? object.name : object.uuid);\n });\n else targetNames.push(targetName);\n let TypedKeyframeTrack;\n switch($559434fcc6e6401d$var$PATH_PROPERTIES[target.path]){\n case $559434fcc6e6401d$var$PATH_PROPERTIES.weights:\n TypedKeyframeTrack = (0, $ilwiq.NumberKeyframeTrack);\n break;\n case $559434fcc6e6401d$var$PATH_PROPERTIES.rotation:\n TypedKeyframeTrack = (0, $ilwiq.QuaternionKeyframeTrack);\n break;\n case $559434fcc6e6401d$var$PATH_PROPERTIES.position:\n case $559434fcc6e6401d$var$PATH_PROPERTIES.scale:\n TypedKeyframeTrack = (0, $ilwiq.VectorKeyframeTrack);\n break;\n default:\n switch(outputAccessor.itemSize){\n case 1:\n TypedKeyframeTrack = (0, $ilwiq.NumberKeyframeTrack);\n break;\n case 2:\n case 3:\n default:\n TypedKeyframeTrack = (0, $ilwiq.VectorKeyframeTrack);\n break;\n }\n break;\n }\n const interpolation = sampler.interpolation !== undefined ? $559434fcc6e6401d$var$INTERPOLATION[sampler.interpolation] : (0, $ilwiq.InterpolateLinear);\n const outputArray = this._getArrayFromAccessor(outputAccessor);\n for(let j = 0, jl = targetNames.length; j < jl; j++){\n const track = new TypedKeyframeTrack(targetNames[j] + \".\" + $559434fcc6e6401d$var$PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation);\n // Override interpolation with custom factory method.\n if (sampler.interpolation === \"CUBICSPLINE\") this._createCubicSplineTrackInterpolant(track);\n tracks.push(track);\n }\n return tracks;\n }\n _getArrayFromAccessor(accessor) {\n let outputArray = accessor.array;\n if (accessor.normalized) {\n const scale = $559434fcc6e6401d$var$getNormalizedComponentScale(outputArray.constructor);\n const scaled = new Float32Array(outputArray.length);\n for(let j = 0, jl = outputArray.length; j < jl; j++)scaled[j] = outputArray[j] * scale;\n outputArray = scaled;\n }\n return outputArray;\n }\n _createCubicSplineTrackInterpolant(track) {\n track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {\n // A CUBICSPLINE keyframe in glTF has three output values for each input value,\n // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()\n // must be divided by three to get the interpolant's sampleSize argument.\n const interpolantType = this instanceof (0, $ilwiq.QuaternionKeyframeTrack) ? $559434fcc6e6401d$var$GLTFCubicSplineQuaternionInterpolant : $559434fcc6e6401d$var$GLTFCubicSplineInterpolant;\n return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);\n };\n // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;\n }\n}\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */ function $559434fcc6e6401d$var$computeBounds(geometry, primitiveDef, parser) {\n const attributes = primitiveDef.attributes;\n const box = new (0, $ilwiq.Box3)();\n if (attributes.POSITION !== undefined) {\n const accessor = parser.json.accessors[attributes.POSITION];\n const min = accessor.min;\n const max = accessor.max;\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n if (min !== undefined && max !== undefined) {\n box.set(new (0, $ilwiq.Vector3)(min[0], min[1], min[2]), new (0, $ilwiq.Vector3)(max[0], max[1], max[2]));\n if (accessor.normalized) {\n const boxScale = $559434fcc6e6401d$var$getNormalizedComponentScale($559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessor.componentType]);\n box.min.multiplyScalar(boxScale);\n box.max.multiplyScalar(boxScale);\n }\n } else {\n console.warn(\"THREE.GLTFLoader: Missing min/max properties for accessor POSITION.\");\n return;\n }\n } else return;\n const targets = primitiveDef.targets;\n if (targets !== undefined) {\n const maxDisplacement = new (0, $ilwiq.Vector3)();\n const vector = new (0, $ilwiq.Vector3)();\n for(let i = 0, il = targets.length; i < il; i++){\n const target = targets[i];\n if (target.POSITION !== undefined) {\n const accessor = parser.json.accessors[target.POSITION];\n const min = accessor.min;\n const max = accessor.max;\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n if (min !== undefined && max !== undefined) {\n // we need to get max of absolute components because target weight is [-1,1]\n vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));\n vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));\n vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));\n if (accessor.normalized) {\n const boxScale = $559434fcc6e6401d$var$getNormalizedComponentScale($559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES[accessor.componentType]);\n vector.multiplyScalar(boxScale);\n }\n // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative\n // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets\n // are used to implement key-frame animations and as such only two are active at a time - this results in very large\n // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.\n maxDisplacement.max(vector);\n } else console.warn(\"THREE.GLTFLoader: Missing min/max properties for accessor POSITION.\");\n }\n }\n // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.\n box.expandByVector(maxDisplacement);\n }\n geometry.boundingBox = box;\n const sphere = new (0, $ilwiq.Sphere)();\n box.getCenter(sphere.center);\n sphere.radius = box.min.distanceTo(box.max) / 2;\n geometry.boundingSphere = sphere;\n}\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n * @return {Promise}\n */ function $559434fcc6e6401d$var$addPrimitiveAttributes(geometry, primitiveDef, parser) {\n const attributes = primitiveDef.attributes;\n const pending = [];\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser.getDependency(\"accessor\", accessorIndex).then(function(accessor) {\n geometry.setAttribute(attributeName, accessor);\n });\n }\n for(const gltfAttributeName in attributes){\n const threeAttributeName = $559434fcc6e6401d$var$ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();\n // Skip attributes already provided by e.g. Draco extension.\n if (threeAttributeName in geometry.attributes) continue;\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));\n }\n if (primitiveDef.indices !== undefined && !geometry.index) {\n const accessor = parser.getDependency(\"accessor\", primitiveDef.indices).then(function(accessor) {\n geometry.setIndex(accessor);\n });\n pending.push(accessor);\n }\n $559434fcc6e6401d$var$assignExtrasToUserData(geometry, primitiveDef);\n $559434fcc6e6401d$var$computeBounds(geometry, primitiveDef, parser);\n return Promise.all(pending).then(function() {\n return primitiveDef.targets !== undefined ? $559434fcc6e6401d$var$addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;\n });\n}\n\n});\n\nparcelRequire.register(\"kp7Te\", function(module, exports) {\n\n$parcel$export(module.exports, \"MeshoptDecoder\", () => $edac432dada49dd7$export$1111800106ba519a);\n// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\nvar $edac432dada49dd7$export$1111800106ba519a = function() {\n \"use strict\";\n // Built with clang version 14.0.4\n // Built from meshoptimizer 0.18\n var wasm_base = \"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb\";\n var wasm_simd = \"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb\";\n var detector = new Uint8Array([\n 0,\n 97,\n 115,\n 109,\n 1,\n 0,\n 0,\n 0,\n 1,\n 4,\n 1,\n 96,\n 0,\n 0,\n 3,\n 3,\n 2,\n 0,\n 0,\n 5,\n 3,\n 1,\n 0,\n 1,\n 12,\n 1,\n 0,\n 10,\n 22,\n 2,\n 12,\n 0,\n 65,\n 0,\n 65,\n 0,\n 65,\n 0,\n 252,\n 10,\n 0,\n 0,\n 11,\n 7,\n 0,\n 65,\n 0,\n 253,\n 15,\n 26,\n 11\n ]);\n var wasmpack = new Uint8Array([\n 32,\n 0,\n 65,\n 2,\n 1,\n 106,\n 34,\n 33,\n 3,\n 128,\n 11,\n 4,\n 13,\n 64,\n 6,\n 253,\n 10,\n 7,\n 15,\n 116,\n 127,\n 5,\n 8,\n 12,\n 40,\n 16,\n 19,\n 54,\n 20,\n 9,\n 27,\n 255,\n 113,\n 17,\n 42,\n 67,\n 24,\n 23,\n 146,\n 148,\n 18,\n 14,\n 22,\n 45,\n 70,\n 69,\n 56,\n 114,\n 101,\n 21,\n 25,\n 63,\n 75,\n 136,\n 108,\n 28,\n 118,\n 29,\n 73,\n 115\n ]);\n if (typeof WebAssembly !== \"object\") return {\n supported: false\n };\n var wasm = WebAssembly.validate(detector) ? wasm_simd : wasm_base;\n var instance;\n var ready = WebAssembly.instantiate(unpack(wasm), {}).then(function(result) {\n instance = result.instance;\n instance.exports.__wasm_call_ctors();\n });\n function unpack(data) {\n var result = new Uint8Array(data.length);\n for(var i = 0; i < data.length; ++i){\n var ch = data.charCodeAt(i);\n result[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4;\n }\n var write = 0;\n for(var i = 0; i < data.length; ++i)result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n return result.buffer.slice(0, write);\n }\n function decode(fun, target, count, size, source, filter) {\n var sbrk = instance.exports.sbrk;\n var count4 = count + 3 & -4;\n var tp = sbrk(count4 * size);\n var sp = sbrk(source.length);\n var heap = new Uint8Array(instance.exports.memory.buffer);\n heap.set(source, sp);\n var res = fun(tp, count, size, sp, source.length);\n if (res == 0 && filter) filter(tp, count4, size);\n target.set(heap.subarray(tp, tp + count * size));\n sbrk(tp - sbrk(0));\n if (res != 0) throw new Error(\"Malformed buffer data: \" + res);\n }\n var filters = {\n NONE: \"\",\n OCTAHEDRAL: \"meshopt_decodeFilterOct\",\n QUATERNION: \"meshopt_decodeFilterQuat\",\n EXPONENTIAL: \"meshopt_decodeFilterExp\"\n };\n var decoders = {\n ATTRIBUTES: \"meshopt_decodeVertexBuffer\",\n TRIANGLES: \"meshopt_decodeIndexBuffer\",\n INDICES: \"meshopt_decodeIndexSequence\"\n };\n var workers = [];\n var requestId = 0;\n function createWorker(url) {\n var worker = {\n object: new Worker(url),\n pending: 0,\n requests: {}\n };\n worker.object.onmessage = function(event) {\n var data = event.data;\n worker.pending -= data.count;\n worker.requests[data.id][data.action](data.value);\n delete worker.requests[data.id];\n };\n return worker;\n }\n function initWorkers(count) {\n var source = \"var instance; var ready = WebAssembly.instantiate(new Uint8Array([\" + new Uint8Array(unpack(wasm)) + \"]), {})\" + \".then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });\" + \"self.onmessage = workerProcess;\" + decode.toString() + workerProcess.toString();\n var blob = new Blob([\n source\n ], {\n type: \"text/javascript\"\n });\n var url = URL.createObjectURL(blob);\n for(var i = 0; i < count; ++i)workers[i] = createWorker(url);\n URL.revokeObjectURL(url);\n }\n function decodeWorker(count, size, source, mode, filter) {\n var worker = workers[0];\n for(var i = 1; i < workers.length; ++i)if (workers[i].pending < worker.pending) worker = workers[i];\n return new Promise(function(resolve, reject) {\n var data = new Uint8Array(source);\n var id = requestId++;\n worker.pending += count;\n worker.requests[id] = {\n resolve: resolve,\n reject: reject\n };\n worker.object.postMessage({\n id: id,\n count: count,\n size: size,\n source: data,\n mode: mode,\n filter: filter\n }, [\n data.buffer\n ]);\n });\n }\n function workerProcess(event) {\n ready.then(function() {\n var data = event.data;\n try {\n var target = new Uint8Array(data.count * data.size);\n decode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);\n self.postMessage({\n id: data.id,\n count: data.count,\n action: \"resolve\",\n value: target\n }, [\n target.buffer\n ]);\n } catch (error) {\n self.postMessage({\n id: data.id,\n count: data.count,\n action: \"reject\",\n value: error\n });\n }\n });\n }\n return {\n ready: ready,\n supported: true,\n useWorkers: function(count) {\n initWorkers(count);\n },\n decodeVertexBuffer: function(target, count, size, source, filter) {\n decode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);\n },\n decodeIndexBuffer: function(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);\n },\n decodeIndexSequence: function(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source);\n },\n decodeGltfBuffer: function(target, count, size, source, mode, filter) {\n decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n },\n decodeGltfBufferAsync: function(count, size, source, mode, filter) {\n if (workers.length > 0) return decodeWorker(count, size, source, decoders[mode], filters[filter]);\n return ready.then(function() {\n var target = new Uint8Array(count * size);\n decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n return target;\n });\n }\n };\n}();\n\n});\n\n\n//# sourceMappingURL=floorProjection.99e62bf6.js.map\n","import {\n\tAnimationClip,\n\tBone,\n\tBox3,\n\tBufferAttribute,\n\tBufferGeometry,\n\tClampToEdgeWrapping,\n\tColor,\n\tDirectionalLight,\n\tDoubleSide,\n\tFileLoader,\n\tFrontSide,\n\tGroup,\n\tImageBitmapLoader,\n\tInstancedMesh,\n\tInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tInterpolant,\n\tInterpolateDiscrete,\n\tInterpolateLinear,\n\tLine,\n\tLineBasicMaterial,\n\tLineLoop,\n\tLineSegments,\n\tLinearFilter,\n\tLinearMipmapLinearFilter,\n\tLinearMipmapNearestFilter,\n\tLoader,\n\tLoaderUtils,\n\tMaterial,\n\tMathUtils,\n\tMatrix4,\n\tMesh,\n\tMeshBasicMaterial,\n\tMeshPhysicalMaterial,\n\tMeshStandardMaterial,\n\tMirroredRepeatWrapping,\n\tNearestFilter,\n\tNearestMipmapLinearFilter,\n\tNearestMipmapNearestFilter,\n\tNumberKeyframeTrack,\n\tObject3D,\n\tOrthographicCamera,\n\tPerspectiveCamera,\n\tPointLight,\n\tPoints,\n\tPointsMaterial,\n\tPropertyBinding,\n\tQuaternion,\n\tQuaternionKeyframeTrack,\n\tRepeatWrapping,\n\tSkeleton,\n\tSkinnedMesh,\n\tSphere,\n\tSpotLight,\n\tTexture,\n\tTextureLoader,\n\tTriangleFanDrawMode,\n\tTriangleStripDrawMode,\n\tVector2,\n\tVector3,\n\tVectorKeyframeTrack,\n\tSRGBColorSpace\n} from 'three';\nimport { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';\n\nclass GLTFLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.dracoLoader = null;\n\t\tthis.ktx2Loader = null;\n\t\tthis.meshoptDecoder = null;\n\n\t\tthis.pluginCallbacks = [];\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsClearcoatExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureBasisUExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureWebPExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFTextureAVIFExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsSheenExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsTransmissionExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsVolumeExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsIorExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsEmissiveStrengthExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsSpecularExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsIridescenceExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMaterialsAnisotropyExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFLightsExtension( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMeshoptCompression( parser );\n\n\t\t} );\n\n\t\tthis.register( function ( parser ) {\n\n\t\t\treturn new GLTFMeshGpuInstancing( parser );\n\n\t\t} );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet resourcePath;\n\n\t\tif ( this.resourcePath !== '' ) {\n\n\t\t\tresourcePath = this.resourcePath;\n\n\t\t} else if ( this.path !== '' ) {\n\n\t\t\tresourcePath = this.path;\n\n\t\t} else {\n\n\t\t\tresourcePath = LoaderUtils.extractUrlBase( url );\n\n\t\t}\n\n\t\t// Tells the LoadingManager to track an extra item, which resolves after\n\t\t// the model is fully loaded. This means the count of items loaded will\n\t\t// be incorrect, but ensures manager.onLoad() does not fire early.\n\t\tthis.manager.itemStart( url );\n\n\t\tconst _onError = function ( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t};\n\n\t\tconst loader = new FileLoader( this.manager );\n\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tloader.load( url, function ( data ) {\n\n\t\t\ttry {\n\n\t\t\t\tscope.parse( data, resourcePath, function ( gltf ) {\n\n\t\t\t\t\tonLoad( gltf );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}, _onError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\t_onError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, _onError );\n\n\t}\n\n\tsetDRACOLoader( dracoLoader ) {\n\n\t\tthis.dracoLoader = dracoLoader;\n\t\treturn this;\n\n\t}\n\n\tsetDDSLoader() {\n\n\t\tthrow new Error(\n\n\t\t\t'THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".'\n\n\t\t);\n\n\t}\n\n\tsetKTX2Loader( ktx2Loader ) {\n\n\t\tthis.ktx2Loader = ktx2Loader;\n\t\treturn this;\n\n\t}\n\n\tsetMeshoptDecoder( meshoptDecoder ) {\n\n\t\tthis.meshoptDecoder = meshoptDecoder;\n\t\treturn this;\n\n\t}\n\n\tregister( callback ) {\n\n\t\tif ( this.pluginCallbacks.indexOf( callback ) === - 1 ) {\n\n\t\t\tthis.pluginCallbacks.push( callback );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunregister( callback ) {\n\n\t\tif ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) {\n\n\t\t\tthis.pluginCallbacks.splice( this.pluginCallbacks.indexOf( callback ), 1 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tparse( data, path, onLoad, onError ) {\n\n\t\tlet json;\n\t\tconst extensions = {};\n\t\tconst plugins = {};\n\t\tconst textDecoder = new TextDecoder();\n\n\t\tif ( typeof data === 'string' ) {\n\n\t\t\tjson = JSON.parse( data );\n\n\t\t} else if ( data instanceof ArrayBuffer ) {\n\n\t\t\tconst magic = textDecoder.decode( new Uint8Array( data, 0, 4 ) );\n\n\t\t\tif ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {\n\n\t\t\t\ttry {\n\n\t\t\t\t\textensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );\n\n\t\t\t\t} catch ( error ) {\n\n\t\t\t\t\tif ( onError ) onError( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tjson = JSON.parse( extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content );\n\n\t\t\t} else {\n\n\t\t\t\tjson = JSON.parse( textDecoder.decode( data ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tjson = data;\n\n\t\t}\n\n\t\tif ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {\n\n\t\t\tif ( onError ) onError( new Error( 'THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.' ) );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst parser = new GLTFParser( json, {\n\n\t\t\tpath: path || this.resourcePath || '',\n\t\t\tcrossOrigin: this.crossOrigin,\n\t\t\trequestHeader: this.requestHeader,\n\t\t\tmanager: this.manager,\n\t\t\tktx2Loader: this.ktx2Loader,\n\t\t\tmeshoptDecoder: this.meshoptDecoder\n\n\t\t} );\n\n\t\tparser.fileLoader.setRequestHeader( this.requestHeader );\n\n\t\tfor ( let i = 0; i < this.pluginCallbacks.length; i ++ ) {\n\n\t\t\tconst plugin = this.pluginCallbacks[ i ]( parser );\n\t\t\tplugins[ plugin.name ] = plugin;\n\n\t\t\t// Workaround to avoid determining as unknown extension\n\t\t\t// in addUnknownExtensionsToUserData().\n\t\t\t// Remove this workaround if we move all the existing\n\t\t\t// extension handlers to plugin system\n\t\t\textensions[ plugin.name ] = true;\n\n\t\t}\n\n\t\tif ( json.extensionsUsed ) {\n\n\t\t\tfor ( let i = 0; i < json.extensionsUsed.length; ++ i ) {\n\n\t\t\t\tconst extensionName = json.extensionsUsed[ i ];\n\t\t\t\tconst extensionsRequired = json.extensionsRequired || [];\n\n\t\t\t\tswitch ( extensionName ) {\n\n\t\t\t\t\tcase EXTENSIONS.KHR_MATERIALS_UNLIT:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFMaterialsUnlitExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFTextureTransformExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EXTENSIONS.KHR_MESH_QUANTIZATION:\n\t\t\t\t\t\textensions[ extensionName ] = new GLTFMeshQuantizationExtension();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( extensionsRequired.indexOf( extensionName ) >= 0 && plugins[ extensionName ] === undefined ) {\n\n\t\t\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tparser.setExtensions( extensions );\n\t\tparser.setPlugins( plugins );\n\t\tparser.parse( onLoad, onError );\n\n\t}\n\n\tparseAsync( data, path ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.parse( data, path, resolve, reject );\n\n\t\t} );\n\n\t}\n\n}\n\n/* GLTFREGISTRY */\n\nfunction GLTFRegistry() {\n\n\tlet objects = {};\n\n\treturn\t{\n\n\t\tget: function ( key ) {\n\n\t\t\treturn objects[ key ];\n\n\t\t},\n\n\t\tadd: function ( key, object ) {\n\n\t\t\tobjects[ key ] = object;\n\n\t\t},\n\n\t\tremove: function ( key ) {\n\n\t\t\tdelete objects[ key ];\n\n\t\t},\n\n\t\tremoveAll: function () {\n\n\t\t\tobjects = {};\n\n\t\t}\n\n\t};\n\n}\n\n/*********************************/\n/********** EXTENSIONS ***********/\n/*********************************/\n\nconst EXTENSIONS = {\n\tKHR_BINARY_GLTF: 'KHR_binary_glTF',\n\tKHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',\n\tKHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',\n\tKHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',\n\tKHR_MATERIALS_IOR: 'KHR_materials_ior',\n\tKHR_MATERIALS_SHEEN: 'KHR_materials_sheen',\n\tKHR_MATERIALS_SPECULAR: 'KHR_materials_specular',\n\tKHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',\n\tKHR_MATERIALS_IRIDESCENCE: 'KHR_materials_iridescence',\n\tKHR_MATERIALS_ANISOTROPY: 'KHR_materials_anisotropy',\n\tKHR_MATERIALS_UNLIT: 'KHR_materials_unlit',\n\tKHR_MATERIALS_VOLUME: 'KHR_materials_volume',\n\tKHR_TEXTURE_BASISU: 'KHR_texture_basisu',\n\tKHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',\n\tKHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',\n\tKHR_MATERIALS_EMISSIVE_STRENGTH: 'KHR_materials_emissive_strength',\n\tEXT_TEXTURE_WEBP: 'EXT_texture_webp',\n\tEXT_TEXTURE_AVIF: 'EXT_texture_avif',\n\tEXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',\n\tEXT_MESH_GPU_INSTANCING: 'EXT_mesh_gpu_instancing'\n};\n\n/**\n * Punctual Lights Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n */\nclass GLTFLightsExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n\n\t\t// Object3D instance caches\n\t\tthis.cache = { refs: {}, uses: {} };\n\n\t}\n\n\t_markDefs() {\n\n\t\tconst parser = this.parser;\n\t\tconst nodeDefs = this.parser.json.nodes || [];\n\n\t\tfor ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {\n\n\t\t\tconst nodeDef = nodeDefs[ nodeIndex ];\n\n\t\t\tif ( nodeDef.extensions\n\t\t\t\t\t&& nodeDef.extensions[ this.name ]\n\t\t\t\t\t&& nodeDef.extensions[ this.name ].light !== undefined ) {\n\n\t\t\t\tparser._addNodeRef( this.cache, nodeDef.extensions[ this.name ].light );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_loadLight( lightIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst cacheKey = 'light:' + lightIndex;\n\t\tlet dependency = parser.cache.get( cacheKey );\n\n\t\tif ( dependency ) return dependency;\n\n\t\tconst json = parser.json;\n\t\tconst extensions = ( json.extensions && json.extensions[ this.name ] ) || {};\n\t\tconst lightDefs = extensions.lights || [];\n\t\tconst lightDef = lightDefs[ lightIndex ];\n\t\tlet lightNode;\n\n\t\tconst color = new Color( 0xffffff );\n\n\t\tif ( lightDef.color !== undefined ) color.fromArray( lightDef.color );\n\n\t\tconst range = lightDef.range !== undefined ? lightDef.range : 0;\n\n\t\tswitch ( lightDef.type ) {\n\n\t\t\tcase 'directional':\n\t\t\t\tlightNode = new DirectionalLight( color );\n\t\t\t\tlightNode.target.position.set( 0, 0, - 1 );\n\t\t\t\tlightNode.add( lightNode.target );\n\t\t\t\tbreak;\n\n\t\t\tcase 'point':\n\t\t\t\tlightNode = new PointLight( color );\n\t\t\t\tlightNode.distance = range;\n\t\t\t\tbreak;\n\n\t\t\tcase 'spot':\n\t\t\t\tlightNode = new SpotLight( color );\n\t\t\t\tlightNode.distance = range;\n\t\t\t\t// Handle spotlight properties.\n\t\t\t\tlightDef.spot = lightDef.spot || {};\n\t\t\t\tlightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;\n\t\t\t\tlightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;\n\t\t\t\tlightNode.angle = lightDef.spot.outerConeAngle;\n\t\t\t\tlightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n\t\t\t\tlightNode.target.position.set( 0, 0, - 1 );\n\t\t\t\tlightNode.add( lightNode.target );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: Unexpected light type: ' + lightDef.type );\n\n\t\t}\n\n\t\t// Some lights (e.g. spot) default to a position other than the origin. Reset the position\n\t\t// here, because node-level parsing will only override position if explicitly specified.\n\t\tlightNode.position.set( 0, 0, 0 );\n\n\t\tlightNode.decay = 2;\n\n\t\tassignExtrasToUserData( lightNode, lightDef );\n\n\t\tif ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;\n\n\t\tlightNode.name = parser.createUniqueName( lightDef.name || ( 'light_' + lightIndex ) );\n\n\t\tdependency = Promise.resolve( lightNode );\n\n\t\tparser.cache.add( cacheKey, dependency );\n\n\t\treturn dependency;\n\n\t}\n\n\tgetDependency( type, index ) {\n\n\t\tif ( type !== 'light' ) return;\n\n\t\treturn this._loadLight( index );\n\n\t}\n\n\tcreateNodeAttachment( nodeIndex ) {\n\n\t\tconst self = this;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\t\tconst lightDef = ( nodeDef.extensions && nodeDef.extensions[ this.name ] ) || {};\n\t\tconst lightIndex = lightDef.light;\n\n\t\tif ( lightIndex === undefined ) return null;\n\n\t\treturn this._loadLight( lightIndex ).then( function ( light ) {\n\n\t\t\treturn parser._getNodeRef( self.cache, lightIndex, light );\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * Unlit Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n */\nclass GLTFMaterialsUnlitExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_UNLIT;\n\n\t}\n\n\tgetMaterialType() {\n\n\t\treturn MeshBasicMaterial;\n\n\t}\n\n\textendParams( materialParams, materialDef, parser ) {\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.color = new Color( 1.0, 1.0, 1.0 );\n\t\tmaterialParams.opacity = 1.0;\n\n\t\tconst metallicRoughness = materialDef.pbrMetallicRoughness;\n\n\t\tif ( metallicRoughness ) {\n\n\t\t\tif ( Array.isArray( metallicRoughness.baseColorFactor ) ) {\n\n\t\t\t\tconst array = metallicRoughness.baseColorFactor;\n\n\t\t\t\tmaterialParams.color.fromArray( array );\n\t\t\t\tmaterialParams.opacity = array[ 3 ];\n\n\t\t\t}\n\n\t\t\tif ( metallicRoughness.baseColorTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials Emissive Strength Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md\n */\nclass GLTFMaterialsEmissiveStrengthExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst emissiveStrength = materialDef.extensions[ this.name ].emissiveStrength;\n\n\t\tif ( emissiveStrength !== undefined ) {\n\n\t\t\tmaterialParams.emissiveIntensity = emissiveStrength;\n\n\t\t}\n\n\t\treturn Promise.resolve();\n\n\t}\n\n}\n\n/**\n * Clearcoat Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat\n */\nclass GLTFMaterialsClearcoatExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tif ( extension.clearcoatFactor !== undefined ) {\n\n\t\t\tmaterialParams.clearcoat = extension.clearcoatFactor;\n\n\t\t}\n\n\t\tif ( extension.clearcoatTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'clearcoatMap', extension.clearcoatTexture ) );\n\n\t\t}\n\n\t\tif ( extension.clearcoatRoughnessFactor !== undefined ) {\n\n\t\t\tmaterialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n\n\t\t}\n\n\t\tif ( extension.clearcoatRoughnessTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture ) );\n\n\t\t}\n\n\t\tif ( extension.clearcoatNormalTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture ) );\n\n\t\t\tif ( extension.clearcoatNormalTexture.scale !== undefined ) {\n\n\t\t\t\tconst scale = extension.clearcoatNormalTexture.scale;\n\n\t\t\t\tmaterialParams.clearcoatNormalScale = new Vector2( scale, scale );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Iridescence Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence\n */\nclass GLTFMaterialsIridescenceExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tif ( extension.iridescenceFactor !== undefined ) {\n\n\t\t\tmaterialParams.iridescence = extension.iridescenceFactor;\n\n\t\t}\n\n\t\tif ( extension.iridescenceTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'iridescenceMap', extension.iridescenceTexture ) );\n\n\t\t}\n\n\t\tif ( extension.iridescenceIor !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceIOR = extension.iridescenceIor;\n\n\t\t}\n\n\t\tif ( materialParams.iridescenceThicknessRange === undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange = [ 100, 400 ];\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessMinimum !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange[ 0 ] = extension.iridescenceThicknessMinimum;\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessMaximum !== undefined ) {\n\n\t\t\tmaterialParams.iridescenceThicknessRange[ 1 ] = extension.iridescenceThicknessMaximum;\n\n\t\t}\n\n\t\tif ( extension.iridescenceThicknessTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Sheen Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen\n */\nclass GLTFMaterialsSheenExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_SHEEN;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tmaterialParams.sheenColor = new Color( 0, 0, 0 );\n\t\tmaterialParams.sheenRoughness = 0;\n\t\tmaterialParams.sheen = 1;\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tif ( extension.sheenColorFactor !== undefined ) {\n\n\t\t\tmaterialParams.sheenColor.fromArray( extension.sheenColorFactor );\n\n\t\t}\n\n\t\tif ( extension.sheenRoughnessFactor !== undefined ) {\n\n\t\t\tmaterialParams.sheenRoughness = extension.sheenRoughnessFactor;\n\n\t\t}\n\n\t\tif ( extension.sheenColorTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\tif ( extension.sheenRoughnessTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Transmission Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission\n * Draft: https://github.com/KhronosGroup/glTF/pull/1698\n */\nclass GLTFMaterialsTransmissionExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tif ( extension.transmissionFactor !== undefined ) {\n\n\t\t\tmaterialParams.transmission = extension.transmissionFactor;\n\n\t\t}\n\n\t\tif ( extension.transmissionTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'transmissionMap', extension.transmissionTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials Volume Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume\n */\nclass GLTFMaterialsVolumeExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_VOLUME;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tmaterialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;\n\n\t\tif ( extension.thicknessTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'thicknessMap', extension.thicknessTexture ) );\n\n\t\t}\n\n\t\tmaterialParams.attenuationDistance = extension.attenuationDistance || Infinity;\n\n\t\tconst colorArray = extension.attenuationColor || [ 1, 1, 1 ];\n\t\tmaterialParams.attenuationColor = new Color( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ] );\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials ior Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior\n */\nclass GLTFMaterialsIorExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_IOR;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tmaterialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;\n\n\t\treturn Promise.resolve();\n\n\t}\n\n}\n\n/**\n * Materials specular Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular\n */\nclass GLTFMaterialsSpecularExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tmaterialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;\n\n\t\tif ( extension.specularTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'specularIntensityMap', extension.specularTexture ) );\n\n\t\t}\n\n\t\tconst colorArray = extension.specularColorFactor || [ 1, 1, 1 ];\n\t\tmaterialParams.specularColor = new Color( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ] );\n\n\t\tif ( extension.specularColorTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * Materials anisotropy Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy\n */\nclass GLTFMaterialsAnisotropyExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;\n\n\t}\n\n\tgetMaterialType( materialIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;\n\n\t\treturn MeshPhysicalMaterial;\n\n\t}\n\n\textendMaterialParams( materialIndex, materialParams ) {\n\n\t\tconst parser = this.parser;\n\t\tconst materialDef = parser.json.materials[ materialIndex ];\n\n\t\tif ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {\n\n\t\t\treturn Promise.resolve();\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tconst extension = materialDef.extensions[ this.name ];\n\n\t\tif ( extension.anisotropyStrength !== undefined ) {\n\n\t\t\tmaterialParams.anisotropy = extension.anisotropyStrength;\n\n\t\t}\n\n\t\tif ( extension.anisotropyRotation !== undefined ) {\n\n\t\t\tmaterialParams.anisotropyRotation = extension.anisotropyRotation;\n\n\t\t}\n\n\t\tif ( extension.anisotropyTexture !== undefined ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'anisotropyMap', extension.anisotropyTexture ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n}\n\n/**\n * BasisU Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n */\nclass GLTFTextureBasisUExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.KHR_TEXTURE_BASISU;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ this.name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ this.name ];\n\t\tconst loader = parser.options.ktx2Loader;\n\n\t\tif ( ! loader ) {\n\n\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {\n\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );\n\n\t\t\t} else {\n\n\t\t\t\t// Assumes that the extension is optional and that a fallback texture is present\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t}\n\n}\n\n/**\n * WebP Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n */\nclass GLTFTextureWebPExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.EXT_TEXTURE_WEBP;\n\t\tthis.isSupported = null;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst name = this.name;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ name ];\n\t\tconst source = json.images[ extension.source ];\n\n\t\tlet loader = parser.textureLoader;\n\t\tif ( source.uri ) {\n\n\t\t\tconst handler = parser.options.manager.getHandler( source.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn this.detectSupport().then( function ( isSupported ) {\n\n\t\t\tif ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {\n\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: WebP required by asset but unsupported.' );\n\n\t\t\t}\n\n\t\t\t// Fall back to PNG or JPEG.\n\t\t\treturn parser.loadTexture( textureIndex );\n\n\t\t} );\n\n\t}\n\n\tdetectSupport() {\n\n\t\tif ( ! this.isSupported ) {\n\n\t\t\tthis.isSupported = new Promise( function ( resolve ) {\n\n\t\t\t\tconst image = new Image();\n\n\t\t\t\t// Lossy test image. Support for lossy images doesn't guarantee support for all\n\t\t\t\t// WebP images, unfortunately.\n\t\t\t\timage.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';\n\n\t\t\t\timage.onload = image.onerror = function () {\n\n\t\t\t\t\tresolve( image.height === 1 );\n\n\t\t\t\t};\n\n\t\t\t} );\n\n\t\t}\n\n\t\treturn this.isSupported;\n\n\t}\n\n}\n\n/**\n * AVIF Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif\n */\nclass GLTFTextureAVIFExtension {\n\n\tconstructor( parser ) {\n\n\t\tthis.parser = parser;\n\t\tthis.name = EXTENSIONS.EXT_TEXTURE_AVIF;\n\t\tthis.isSupported = null;\n\n\t}\n\n\tloadTexture( textureIndex ) {\n\n\t\tconst name = this.name;\n\t\tconst parser = this.parser;\n\t\tconst json = parser.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\n\t\tif ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst extension = textureDef.extensions[ name ];\n\t\tconst source = json.images[ extension.source ];\n\n\t\tlet loader = parser.textureLoader;\n\t\tif ( source.uri ) {\n\n\t\t\tconst handler = parser.options.manager.getHandler( source.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn this.detectSupport().then( function ( isSupported ) {\n\n\t\t\tif ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );\n\n\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {\n\n\t\t\t\tthrow new Error( 'THREE.GLTFLoader: AVIF required by asset but unsupported.' );\n\n\t\t\t}\n\n\t\t\t// Fall back to PNG or JPEG.\n\t\t\treturn parser.loadTexture( textureIndex );\n\n\t\t} );\n\n\t}\n\n\tdetectSupport() {\n\n\t\tif ( ! this.isSupported ) {\n\n\t\t\tthis.isSupported = new Promise( function ( resolve ) {\n\n\t\t\t\tconst image = new Image();\n\n\t\t\t\t// Lossy test image.\n\t\t\t\timage.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=';\n\t\t\t\timage.onload = image.onerror = function () {\n\n\t\t\t\t\tresolve( image.height === 1 );\n\n\t\t\t\t};\n\n\t\t\t} );\n\n\t\t}\n\n\t\treturn this.isSupported;\n\n\t}\n\n}\n\n/**\n * meshopt BufferView Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n */\nclass GLTFMeshoptCompression {\n\n\tconstructor( parser ) {\n\n\t\tthis.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;\n\t\tthis.parser = parser;\n\n\t}\n\n\tloadBufferView( index ) {\n\n\t\tconst json = this.parser.json;\n\t\tconst bufferView = json.bufferViews[ index ];\n\n\t\tif ( bufferView.extensions && bufferView.extensions[ this.name ] ) {\n\n\t\t\tconst extensionDef = bufferView.extensions[ this.name ];\n\n\t\t\tconst buffer = this.parser.getDependency( 'buffer', extensionDef.buffer );\n\t\t\tconst decoder = this.parser.options.meshoptDecoder;\n\n\t\t\tif ( ! decoder || ! decoder.supported ) {\n\n\t\t\t\tif ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {\n\n\t\t\t\t\tthrow new Error( 'THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files' );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Assumes that the extension is optional and that fallback buffer data is present\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn buffer.then( function ( res ) {\n\n\t\t\t\tconst byteOffset = extensionDef.byteOffset || 0;\n\t\t\t\tconst byteLength = extensionDef.byteLength || 0;\n\n\t\t\t\tconst count = extensionDef.count;\n\t\t\t\tconst stride = extensionDef.byteStride;\n\n\t\t\t\tconst source = new Uint8Array( res, byteOffset, byteLength );\n\n\t\t\t\tif ( decoder.decodeGltfBufferAsync ) {\n\n\t\t\t\t\treturn decoder.decodeGltfBufferAsync( count, stride, source, extensionDef.mode, extensionDef.filter ).then( function ( res ) {\n\n\t\t\t\t\t\treturn res.buffer;\n\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync\n\t\t\t\t\treturn decoder.ready.then( function () {\n\n\t\t\t\t\t\tconst result = new ArrayBuffer( count * stride );\n\t\t\t\t\t\tdecoder.decodeGltfBuffer( new Uint8Array( result ), count, stride, source, extensionDef.mode, extensionDef.filter );\n\t\t\t\t\t\treturn result;\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * GPU Instancing Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing\n *\n */\nclass GLTFMeshGpuInstancing {\n\n\tconstructor( parser ) {\n\n\t\tthis.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;\n\t\tthis.parser = parser;\n\n\t}\n\n\tcreateNodeMesh( nodeIndex ) {\n\n\t\tconst json = this.parser.json;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tif ( ! nodeDef.extensions || ! nodeDef.extensions[ this.name ] ||\n\t\t\tnodeDef.mesh === undefined ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst meshDef = json.meshes[ nodeDef.mesh ];\n\n\t\t// No Points or Lines + Instancing support yet\n\n\t\tfor ( const primitive of meshDef.primitives ) {\n\n\t\t\tif ( primitive.mode !== WEBGL_CONSTANTS.TRIANGLES &&\n\t\t\t\t primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP &&\n\t\t\t\t primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN &&\n\t\t\t\t primitive.mode !== undefined ) {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst extensionDef = nodeDef.extensions[ this.name ];\n\t\tconst attributesDef = extensionDef.attributes;\n\n\t\t// @TODO: Can we support InstancedMesh + SkinnedMesh?\n\n\t\tconst pending = [];\n\t\tconst attributes = {};\n\n\t\tfor ( const key in attributesDef ) {\n\n\t\t\tpending.push( this.parser.getDependency( 'accessor', attributesDef[ key ] ).then( accessor => {\n\n\t\t\t\tattributes[ key ] = accessor;\n\t\t\t\treturn attributes[ key ];\n\n\t\t\t} ) );\n\n\t\t}\n\n\t\tif ( pending.length < 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tpending.push( this.parser.createNodeMesh( nodeIndex ) );\n\n\t\treturn Promise.all( pending ).then( results => {\n\n\t\t\tconst nodeObject = results.pop();\n\t\t\tconst meshes = nodeObject.isGroup ? nodeObject.children : [ nodeObject ];\n\t\t\tconst count = results[ 0 ].count; // All attribute counts should be same\n\t\t\tconst instancedMeshes = [];\n\n\t\t\tfor ( const mesh of meshes ) {\n\n\t\t\t\t// Temporal variables\n\t\t\t\tconst m = new Matrix4();\n\t\t\t\tconst p = new Vector3();\n\t\t\t\tconst q = new Quaternion();\n\t\t\t\tconst s = new Vector3( 1, 1, 1 );\n\n\t\t\t\tconst instancedMesh = new InstancedMesh( mesh.geometry, mesh.material, count );\n\n\t\t\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\t\t\tif ( attributes.TRANSLATION ) {\n\n\t\t\t\t\t\tp.fromBufferAttribute( attributes.TRANSLATION, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attributes.ROTATION ) {\n\n\t\t\t\t\t\tq.fromBufferAttribute( attributes.ROTATION, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attributes.SCALE ) {\n\n\t\t\t\t\t\ts.fromBufferAttribute( attributes.SCALE, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tinstancedMesh.setMatrixAt( i, m.compose( p, q, s ) );\n\n\t\t\t\t}\n\n\t\t\t\t// Add instance attributes to the geometry, excluding TRS.\n\t\t\t\tfor ( const attributeName in attributes ) {\n\n\t\t\t\t\tif ( attributeName !== 'TRANSLATION' &&\n\t\t\t\t\t\t attributeName !== 'ROTATION' &&\n\t\t\t\t\t\t attributeName !== 'SCALE' ) {\n\n\t\t\t\t\t\tmesh.geometry.setAttribute( attributeName, attributes[ attributeName ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// Just in case\n\t\t\t\tObject3D.prototype.copy.call( instancedMesh, mesh );\n\n\t\t\t\tthis.parser.assignFinalMaterial( instancedMesh );\n\n\t\t\t\tinstancedMeshes.push( instancedMesh );\n\n\t\t\t}\n\n\t\t\tif ( nodeObject.isGroup ) {\n\n\t\t\t\tnodeObject.clear();\n\n\t\t\t\tnodeObject.add( ... instancedMeshes );\n\n\t\t\t\treturn nodeObject;\n\n\t\t\t}\n\n\t\t\treturn instancedMeshes[ 0 ];\n\n\t\t} );\n\n\t}\n\n}\n\n/* BINARY EXTENSION */\nconst BINARY_EXTENSION_HEADER_MAGIC = 'glTF';\nconst BINARY_EXTENSION_HEADER_LENGTH = 12;\nconst BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 };\n\nclass GLTFBinaryExtension {\n\n\tconstructor( data ) {\n\n\t\tthis.name = EXTENSIONS.KHR_BINARY_GLTF;\n\t\tthis.content = null;\n\t\tthis.body = null;\n\n\t\tconst headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );\n\t\tconst textDecoder = new TextDecoder();\n\n\t\tthis.header = {\n\t\t\tmagic: textDecoder.decode( new Uint8Array( data.slice( 0, 4 ) ) ),\n\t\t\tversion: headerView.getUint32( 4, true ),\n\t\t\tlength: headerView.getUint32( 8, true )\n\t\t};\n\n\t\tif ( this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Unsupported glTF-Binary header.' );\n\n\t\t} else if ( this.header.version < 2.0 ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Legacy binary file detected.' );\n\n\t\t}\n\n\t\tconst chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;\n\t\tconst chunkView = new DataView( data, BINARY_EXTENSION_HEADER_LENGTH );\n\t\tlet chunkIndex = 0;\n\n\t\twhile ( chunkIndex < chunkContentsLength ) {\n\n\t\t\tconst chunkLength = chunkView.getUint32( chunkIndex, true );\n\t\t\tchunkIndex += 4;\n\n\t\t\tconst chunkType = chunkView.getUint32( chunkIndex, true );\n\t\t\tchunkIndex += 4;\n\n\t\t\tif ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON ) {\n\n\t\t\t\tconst contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength );\n\t\t\t\tthis.content = textDecoder.decode( contentArray );\n\n\t\t\t} else if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN ) {\n\n\t\t\t\tconst byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n\t\t\t\tthis.body = data.slice( byteOffset, byteOffset + chunkLength );\n\n\t\t\t}\n\n\t\t\t// Clients must ignore chunks with unknown types.\n\n\t\t\tchunkIndex += chunkLength;\n\n\t\t}\n\n\t\tif ( this.content === null ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: JSON content not found.' );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * DRACO Mesh Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */\nclass GLTFDracoMeshCompressionExtension {\n\n\tconstructor( json, dracoLoader ) {\n\n\t\tif ( ! dracoLoader ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );\n\n\t\t}\n\n\t\tthis.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n\t\tthis.json = json;\n\t\tthis.dracoLoader = dracoLoader;\n\t\tthis.dracoLoader.preload();\n\n\t}\n\n\tdecodePrimitive( primitive, parser ) {\n\n\t\tconst json = this.json;\n\t\tconst dracoLoader = this.dracoLoader;\n\t\tconst bufferViewIndex = primitive.extensions[ this.name ].bufferView;\n\t\tconst gltfAttributeMap = primitive.extensions[ this.name ].attributes;\n\t\tconst threeAttributeMap = {};\n\t\tconst attributeNormalizedMap = {};\n\t\tconst attributeTypeMap = {};\n\n\t\tfor ( const attributeName in gltfAttributeMap ) {\n\n\t\t\tconst threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();\n\n\t\t\tthreeAttributeMap[ threeAttributeName ] = gltfAttributeMap[ attributeName ];\n\n\t\t}\n\n\t\tfor ( const attributeName in primitive.attributes ) {\n\n\t\t\tconst threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();\n\n\t\t\tif ( gltfAttributeMap[ attributeName ] !== undefined ) {\n\n\t\t\t\tconst accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];\n\t\t\t\tconst componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\n\t\t\t\tattributeTypeMap[ threeAttributeName ] = componentType.name;\n\t\t\t\tattributeNormalizedMap[ threeAttributeName ] = accessorDef.normalized === true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn parser.getDependency( 'bufferView', bufferViewIndex ).then( function ( bufferView ) {\n\n\t\t\treturn new Promise( function ( resolve ) {\n\n\t\t\t\tdracoLoader.decodeDracoFile( bufferView, function ( geometry ) {\n\n\t\t\t\t\tfor ( const attributeName in geometry.attributes ) {\n\n\t\t\t\t\t\tconst attribute = geometry.attributes[ attributeName ];\n\t\t\t\t\t\tconst normalized = attributeNormalizedMap[ attributeName ];\n\n\t\t\t\t\t\tif ( normalized !== undefined ) attribute.normalized = normalized;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( geometry );\n\n\t\t\t\t}, threeAttributeMap, attributeTypeMap );\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * Texture Transform Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform\n */\nclass GLTFTextureTransformExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n\n\t}\n\n\textendTexture( texture, transform ) {\n\n\t\tif ( ( transform.texCoord === undefined || transform.texCoord === texture.channel )\n\t\t\t&& transform.offset === undefined\n\t\t\t&& transform.rotation === undefined\n\t\t\t&& transform.scale === undefined ) {\n\n\t\t\t// See https://github.com/mrdoob/three.js/issues/21819.\n\t\t\treturn texture;\n\n\t\t}\n\n\t\ttexture = texture.clone();\n\n\t\tif ( transform.texCoord !== undefined ) {\n\n\t\t\ttexture.channel = transform.texCoord;\n\n\t\t}\n\n\t\tif ( transform.offset !== undefined ) {\n\n\t\t\ttexture.offset.fromArray( transform.offset );\n\n\t\t}\n\n\t\tif ( transform.rotation !== undefined ) {\n\n\t\t\ttexture.rotation = transform.rotation;\n\n\t\t}\n\n\t\tif ( transform.scale !== undefined ) {\n\n\t\t\ttexture.repeat.fromArray( transform.scale );\n\n\t\t}\n\n\t\ttexture.needsUpdate = true;\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Mesh Quantization Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization\n */\nclass GLTFMeshQuantizationExtension {\n\n\tconstructor() {\n\n\t\tthis.name = EXTENSIONS.KHR_MESH_QUANTIZATION;\n\n\t}\n\n}\n\n/*********************************/\n/********** INTERPOLATION ********/\n/*********************************/\n\n// Spline Interpolation\n// Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation\nclass GLTFCubicSplineInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// Copies a sample value to the result buffer. See description of glTF\n\t\t// CUBICSPLINE values layout in interpolate_() function below.\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tvalueSize = this.valueSize,\n\t\t\toffset = index * valueSize * 3 + valueSize;\n\n\t\tfor ( let i = 0; i !== valueSize; i ++ ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer;\n\t\tconst values = this.sampleValues;\n\t\tconst stride = this.valueSize;\n\n\t\tconst stride2 = stride * 2;\n\t\tconst stride3 = stride * 3;\n\n\t\tconst td = t1 - t0;\n\n\t\tconst p = ( t - t0 ) / td;\n\t\tconst pp = p * p;\n\t\tconst ppp = pp * p;\n\n\t\tconst offset1 = i1 * stride3;\n\t\tconst offset0 = offset1 - stride3;\n\n\t\tconst s2 = - 2 * ppp + 3 * pp;\n\t\tconst s3 = ppp - pp;\n\t\tconst s0 = 1 - s2;\n\t\tconst s1 = s3 - pp + p;\n\n\t\t// Layout of keyframe output values for CUBICSPLINE animations:\n\t\t// [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]\n\t\tfor ( let i = 0; i !== stride; i ++ ) {\n\n\t\t\tconst p0 = values[ offset0 + i + stride ]; // splineVertex_k\n\t\t\tconst m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)\n\t\t\tconst p1 = values[ offset1 + i + stride ]; // splineVertex_k+1\n\t\t\tconst m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)\n\n\t\t\tresult[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nconst _q = new Quaternion();\n\nclass GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = super.interpolate_( i1, t0, t, t1 );\n\n\t\t_q.fromArray( result ).normalize().toArray( result );\n\n\t\treturn result;\n\n\t}\n\n}\n\n\n/*********************************/\n/********** INTERNALS ************/\n/*********************************/\n\n/* CONSTANTS */\n\nconst WEBGL_CONSTANTS = {\n\tFLOAT: 5126,\n\t//FLOAT_MAT2: 35674,\n\tFLOAT_MAT3: 35675,\n\tFLOAT_MAT4: 35676,\n\tFLOAT_VEC2: 35664,\n\tFLOAT_VEC3: 35665,\n\tFLOAT_VEC4: 35666,\n\tLINEAR: 9729,\n\tREPEAT: 10497,\n\tSAMPLER_2D: 35678,\n\tPOINTS: 0,\n\tLINES: 1,\n\tLINE_LOOP: 2,\n\tLINE_STRIP: 3,\n\tTRIANGLES: 4,\n\tTRIANGLE_STRIP: 5,\n\tTRIANGLE_FAN: 6,\n\tUNSIGNED_BYTE: 5121,\n\tUNSIGNED_SHORT: 5123\n};\n\nconst WEBGL_COMPONENT_TYPES = {\n\t5120: Int8Array,\n\t5121: Uint8Array,\n\t5122: Int16Array,\n\t5123: Uint16Array,\n\t5125: Uint32Array,\n\t5126: Float32Array\n};\n\nconst WEBGL_FILTERS = {\n\t9728: NearestFilter,\n\t9729: LinearFilter,\n\t9984: NearestMipmapNearestFilter,\n\t9985: LinearMipmapNearestFilter,\n\t9986: NearestMipmapLinearFilter,\n\t9987: LinearMipmapLinearFilter\n};\n\nconst WEBGL_WRAPPINGS = {\n\t33071: ClampToEdgeWrapping,\n\t33648: MirroredRepeatWrapping,\n\t10497: RepeatWrapping\n};\n\nconst WEBGL_TYPE_SIZES = {\n\t'SCALAR': 1,\n\t'VEC2': 2,\n\t'VEC3': 3,\n\t'VEC4': 4,\n\t'MAT2': 4,\n\t'MAT3': 9,\n\t'MAT4': 16\n};\n\nconst ATTRIBUTES = {\n\tPOSITION: 'position',\n\tNORMAL: 'normal',\n\tTANGENT: 'tangent',\n\tTEXCOORD_0: 'uv',\n\tTEXCOORD_1: 'uv1',\n\tTEXCOORD_2: 'uv2',\n\tTEXCOORD_3: 'uv3',\n\tCOLOR_0: 'color',\n\tWEIGHTS_0: 'skinWeight',\n\tJOINTS_0: 'skinIndex',\n};\n\nconst PATH_PROPERTIES = {\n\tscale: 'scale',\n\ttranslation: 'position',\n\trotation: 'quaternion',\n\tweights: 'morphTargetInfluences'\n};\n\nconst INTERPOLATION = {\n\tCUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n\t\t // keyframe track will be initialized with a default interpolation type, then modified.\n\tLINEAR: InterpolateLinear,\n\tSTEP: InterpolateDiscrete\n};\n\nconst ALPHA_MODES = {\n\tOPAQUE: 'OPAQUE',\n\tMASK: 'MASK',\n\tBLEND: 'BLEND'\n};\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material\n */\nfunction createDefaultMaterial( cache ) {\n\n\tif ( cache[ 'DefaultMaterial' ] === undefined ) {\n\n\t\tcache[ 'DefaultMaterial' ] = new MeshStandardMaterial( {\n\t\t\tcolor: 0xFFFFFF,\n\t\t\temissive: 0x000000,\n\t\t\tmetalness: 1,\n\t\t\troughness: 1,\n\t\t\ttransparent: false,\n\t\t\tdepthTest: true,\n\t\t\tside: FrontSide\n\t\t} );\n\n\t}\n\n\treturn cache[ 'DefaultMaterial' ];\n\n}\n\nfunction addUnknownExtensionsToUserData( knownExtensions, object, objectDef ) {\n\n\t// Add unknown glTF extensions to an object's userData.\n\n\tfor ( const name in objectDef.extensions ) {\n\n\t\tif ( knownExtensions[ name ] === undefined ) {\n\n\t\t\tobject.userData.gltfExtensions = object.userData.gltfExtensions || {};\n\t\t\tobject.userData.gltfExtensions[ name ] = objectDef.extensions[ name ];\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */\nfunction assignExtrasToUserData( object, gltfDef ) {\n\n\tif ( gltfDef.extras !== undefined ) {\n\n\t\tif ( typeof gltfDef.extras === 'object' ) {\n\n\t\t\tObject.assign( object.userData, gltfDef.extras );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets\n *\n * @param {BufferGeometry} geometry\n * @param {Array} targets\n * @param {GLTFParser} parser\n * @return {Promise}\n */\nfunction addMorphTargets( geometry, targets, parser ) {\n\n\tlet hasMorphPosition = false;\n\tlet hasMorphNormal = false;\n\tlet hasMorphColor = false;\n\n\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\tconst target = targets[ i ];\n\n\t\tif ( target.POSITION !== undefined ) hasMorphPosition = true;\n\t\tif ( target.NORMAL !== undefined ) hasMorphNormal = true;\n\t\tif ( target.COLOR_0 !== undefined ) hasMorphColor = true;\n\n\t\tif ( hasMorphPosition && hasMorphNormal && hasMorphColor ) break;\n\n\t}\n\n\tif ( ! hasMorphPosition && ! hasMorphNormal && ! hasMorphColor ) return Promise.resolve( geometry );\n\n\tconst pendingPositionAccessors = [];\n\tconst pendingNormalAccessors = [];\n\tconst pendingColorAccessors = [];\n\n\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\tconst target = targets[ i ];\n\n\t\tif ( hasMorphPosition ) {\n\n\t\t\tconst pendingAccessor = target.POSITION !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.POSITION )\n\t\t\t\t: geometry.attributes.position;\n\n\t\t\tpendingPositionAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t\tif ( hasMorphNormal ) {\n\n\t\t\tconst pendingAccessor = target.NORMAL !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.NORMAL )\n\t\t\t\t: geometry.attributes.normal;\n\n\t\t\tpendingNormalAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t\tif ( hasMorphColor ) {\n\n\t\t\tconst pendingAccessor = target.COLOR_0 !== undefined\n\t\t\t\t? parser.getDependency( 'accessor', target.COLOR_0 )\n\t\t\t\t: geometry.attributes.color;\n\n\t\t\tpendingColorAccessors.push( pendingAccessor );\n\n\t\t}\n\n\t}\n\n\treturn Promise.all( [\n\t\tPromise.all( pendingPositionAccessors ),\n\t\tPromise.all( pendingNormalAccessors ),\n\t\tPromise.all( pendingColorAccessors )\n\t] ).then( function ( accessors ) {\n\n\t\tconst morphPositions = accessors[ 0 ];\n\t\tconst morphNormals = accessors[ 1 ];\n\t\tconst morphColors = accessors[ 2 ];\n\n\t\tif ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;\n\t\tif ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;\n\t\tif ( hasMorphColor ) geometry.morphAttributes.color = morphColors;\n\t\tgeometry.morphTargetsRelative = true;\n\n\t\treturn geometry;\n\n\t} );\n\n}\n\n/**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\nfunction updateMorphTargets( mesh, meshDef ) {\n\n\tmesh.updateMorphTargets();\n\n\tif ( meshDef.weights !== undefined ) {\n\n\t\tfor ( let i = 0, il = meshDef.weights.length; i < il; i ++ ) {\n\n\t\t\tmesh.morphTargetInfluences[ i ] = meshDef.weights[ i ];\n\n\t\t}\n\n\t}\n\n\t// .extras has user-defined data, so check that .extras.targetNames is an array.\n\tif ( meshDef.extras && Array.isArray( meshDef.extras.targetNames ) ) {\n\n\t\tconst targetNames = meshDef.extras.targetNames;\n\n\t\tif ( mesh.morphTargetInfluences.length === targetNames.length ) {\n\n\t\t\tmesh.morphTargetDictionary = {};\n\n\t\t\tfor ( let i = 0, il = targetNames.length; i < il; i ++ ) {\n\n\t\t\t\tmesh.morphTargetDictionary[ targetNames[ i ] ] = i;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.' );\n\n\t\t}\n\n\t}\n\n}\n\nfunction createPrimitiveKey( primitiveDef ) {\n\n\tlet geometryKey;\n\n\tconst dracoExtension = primitiveDef.extensions && primitiveDef.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ];\n\n\tif ( dracoExtension ) {\n\n\t\tgeometryKey = 'draco:' + dracoExtension.bufferView\n\t\t\t\t+ ':' + dracoExtension.indices\n\t\t\t\t+ ':' + createAttributesKey( dracoExtension.attributes );\n\n\t} else {\n\n\t\tgeometryKey = primitiveDef.indices + ':' + createAttributesKey( primitiveDef.attributes ) + ':' + primitiveDef.mode;\n\n\t}\n\n\tif ( primitiveDef.targets !== undefined ) {\n\n\t\tfor ( let i = 0, il = primitiveDef.targets.length; i < il; i ++ ) {\n\n\t\t\tgeometryKey += ':' + createAttributesKey( primitiveDef.targets[ i ] );\n\n\t\t}\n\n\t}\n\n\treturn geometryKey;\n\n}\n\nfunction createAttributesKey( attributes ) {\n\n\tlet attributesKey = '';\n\n\tconst keys = Object.keys( attributes ).sort();\n\n\tfor ( let i = 0, il = keys.length; i < il; i ++ ) {\n\n\t\tattributesKey += keys[ i ] + ':' + attributes[ keys[ i ] ] + ';';\n\n\t}\n\n\treturn attributesKey;\n\n}\n\nfunction getNormalizedComponentScale( constructor ) {\n\n\t// Reference:\n\t// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n\n\tswitch ( constructor ) {\n\n\t\tcase Int8Array:\n\t\t\treturn 1 / 127;\n\n\t\tcase Uint8Array:\n\t\t\treturn 1 / 255;\n\n\t\tcase Int16Array:\n\t\t\treturn 1 / 32767;\n\n\t\tcase Uint16Array:\n\t\t\treturn 1 / 65535;\n\n\t\tdefault:\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Unsupported normalized accessor component type.' );\n\n\t}\n\n}\n\nfunction getImageURIMimeType( uri ) {\n\n\tif ( uri.search( /\\.jpe?g($|\\?)/i ) > 0 || uri.search( /^data\\:image\\/jpeg/ ) === 0 ) return 'image/jpeg';\n\tif ( uri.search( /\\.webp($|\\?)/i ) > 0 || uri.search( /^data\\:image\\/webp/ ) === 0 ) return 'image/webp';\n\n\treturn 'image/png';\n\n}\n\nconst _identityMatrix = new Matrix4();\n\n/* GLTF PARSER */\n\nclass GLTFParser {\n\n\tconstructor( json = {}, options = {} ) {\n\n\t\tthis.json = json;\n\t\tthis.extensions = {};\n\t\tthis.plugins = {};\n\t\tthis.options = options;\n\n\t\t// loader object cache\n\t\tthis.cache = new GLTFRegistry();\n\n\t\t// associations between Three.js objects and glTF elements\n\t\tthis.associations = new Map();\n\n\t\t// BufferGeometry caching\n\t\tthis.primitiveCache = {};\n\n\t\t// Node cache\n\t\tthis.nodeCache = {};\n\n\t\t// Object3D instance caches\n\t\tthis.meshCache = { refs: {}, uses: {} };\n\t\tthis.cameraCache = { refs: {}, uses: {} };\n\t\tthis.lightCache = { refs: {}, uses: {} };\n\n\t\tthis.sourceCache = {};\n\t\tthis.textureCache = {};\n\n\t\t// Track node names, to ensure no duplicates\n\t\tthis.nodeNamesUsed = {};\n\n\t\t// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the\n\t\t// expensive work of uploading a texture to the GPU off the main thread.\n\n\t\tlet isSafari = false;\n\t\tlet isFirefox = false;\n\t\tlet firefoxVersion = - 1;\n\n\t\tif ( typeof navigator !== 'undefined' ) {\n\n\t\t\tisSafari = /^((?!chrome|android).)*safari/i.test( navigator.userAgent ) === true;\n\t\t\tisFirefox = navigator.userAgent.indexOf( 'Firefox' ) > - 1;\n\t\t\tfirefoxVersion = isFirefox ? navigator.userAgent.match( /Firefox\\/([0-9]+)\\./ )[ 1 ] : - 1;\n\n\t\t}\n\n\t\tif ( typeof createImageBitmap === 'undefined' || isSafari || ( isFirefox && firefoxVersion < 98 ) ) {\n\n\t\t\tthis.textureLoader = new TextureLoader( this.options.manager );\n\n\t\t} else {\n\n\t\t\tthis.textureLoader = new ImageBitmapLoader( this.options.manager );\n\n\t\t}\n\n\t\tthis.textureLoader.setCrossOrigin( this.options.crossOrigin );\n\t\tthis.textureLoader.setRequestHeader( this.options.requestHeader );\n\n\t\tthis.fileLoader = new FileLoader( this.options.manager );\n\t\tthis.fileLoader.setResponseType( 'arraybuffer' );\n\n\t\tif ( this.options.crossOrigin === 'use-credentials' ) {\n\n\t\t\tthis.fileLoader.setWithCredentials( true );\n\n\t\t}\n\n\t}\n\n\tsetExtensions( extensions ) {\n\n\t\tthis.extensions = extensions;\n\n\t}\n\n\tsetPlugins( plugins ) {\n\n\t\tthis.plugins = plugins;\n\n\t}\n\n\tparse( onLoad, onError ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\n\t\t// Clear the loader cache\n\t\tthis.cache.removeAll();\n\t\tthis.nodeCache = {};\n\n\t\t// Mark the special nodes/meshes in json for efficient parse\n\t\tthis._invokeAll( function ( ext ) {\n\n\t\t\treturn ext._markDefs && ext._markDefs();\n\n\t\t} );\n\n\t\tPromise.all( this._invokeAll( function ( ext ) {\n\n\t\t\treturn ext.beforeRoot && ext.beforeRoot();\n\n\t\t} ) ).then( function () {\n\n\t\t\treturn Promise.all( [\n\n\t\t\t\tparser.getDependencies( 'scene' ),\n\t\t\t\tparser.getDependencies( 'animation' ),\n\t\t\t\tparser.getDependencies( 'camera' ),\n\n\t\t\t] );\n\n\t\t} ).then( function ( dependencies ) {\n\n\t\t\tconst result = {\n\t\t\t\tscene: dependencies[ 0 ][ json.scene || 0 ],\n\t\t\t\tscenes: dependencies[ 0 ],\n\t\t\t\tanimations: dependencies[ 1 ],\n\t\t\t\tcameras: dependencies[ 2 ],\n\t\t\t\tasset: json.asset,\n\t\t\t\tparser: parser,\n\t\t\t\tuserData: {}\n\t\t\t};\n\n\t\t\taddUnknownExtensionsToUserData( extensions, result, json );\n\n\t\t\tassignExtrasToUserData( result, json );\n\n\t\t\tPromise.all( parser._invokeAll( function ( ext ) {\n\n\t\t\t\treturn ext.afterRoot && ext.afterRoot( result );\n\n\t\t\t} ) ).then( function () {\n\n\t\t\t\tonLoad( result );\n\n\t\t\t} );\n\n\t\t} ).catch( onError );\n\n\t}\n\n\t/**\n\t * Marks the special nodes/meshes in json for efficient parse.\n\t */\n\t_markDefs() {\n\n\t\tconst nodeDefs = this.json.nodes || [];\n\t\tconst skinDefs = this.json.skins || [];\n\t\tconst meshDefs = this.json.meshes || [];\n\n\t\t// Nothing in the node definition indicates whether it is a Bone or an\n\t\t// Object3D. Use the skins' joint references to mark bones.\n\t\tfor ( let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex ++ ) {\n\n\t\t\tconst joints = skinDefs[ skinIndex ].joints;\n\n\t\t\tfor ( let i = 0, il = joints.length; i < il; i ++ ) {\n\n\t\t\t\tnodeDefs[ joints[ i ] ].isBone = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Iterate over all nodes, marking references to shared resources,\n\t\t// as well as skeleton joints.\n\t\tfor ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {\n\n\t\t\tconst nodeDef = nodeDefs[ nodeIndex ];\n\n\t\t\tif ( nodeDef.mesh !== undefined ) {\n\n\t\t\t\tthis._addNodeRef( this.meshCache, nodeDef.mesh );\n\n\t\t\t\t// Nothing in the mesh definition indicates whether it is\n\t\t\t\t// a SkinnedMesh or Mesh. Use the node's mesh reference\n\t\t\t\t// to mark SkinnedMesh if node has skin.\n\t\t\t\tif ( nodeDef.skin !== undefined ) {\n\n\t\t\t\t\tmeshDefs[ nodeDef.mesh ].isSkinnedMesh = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( nodeDef.camera !== undefined ) {\n\n\t\t\t\tthis._addNodeRef( this.cameraCache, nodeDef.camera );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Counts references to shared node / Object3D resources. These resources\n\t * can be reused, or \"instantiated\", at multiple nodes in the scene\n\t * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n\t * be marked. Non-scenegraph resources (like Materials, Geometries, and\n\t * Textures) can be reused directly and are not marked here.\n\t *\n\t * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n\t */\n\t_addNodeRef( cache, index ) {\n\n\t\tif ( index === undefined ) return;\n\n\t\tif ( cache.refs[ index ] === undefined ) {\n\n\t\t\tcache.refs[ index ] = cache.uses[ index ] = 0;\n\n\t\t}\n\n\t\tcache.refs[ index ] ++;\n\n\t}\n\n\t/** Returns a reference to a shared resource, cloning it if necessary. */\n\t_getNodeRef( cache, index, object ) {\n\n\t\tif ( cache.refs[ index ] <= 1 ) return object;\n\n\t\tconst ref = object.clone();\n\n\t\t// Propagates mappings to the cloned object, prevents mappings on the\n\t\t// original object from being lost.\n\t\tconst updateMappings = ( original, clone ) => {\n\n\t\t\tconst mappings = this.associations.get( original );\n\t\t\tif ( mappings != null ) {\n\n\t\t\t\tthis.associations.set( clone, mappings );\n\n\t\t\t}\n\n\t\t\tfor ( const [ i, child ] of original.children.entries() ) {\n\n\t\t\t\tupdateMappings( child, clone.children[ i ] );\n\n\t\t\t}\n\n\t\t};\n\n\t\tupdateMappings( object, ref );\n\n\t\tref.name += '_instance_' + ( cache.uses[ index ] ++ );\n\n\t\treturn ref;\n\n\t}\n\n\t_invokeOne( func ) {\n\n\t\tconst extensions = Object.values( this.plugins );\n\t\textensions.push( this );\n\n\t\tfor ( let i = 0; i < extensions.length; i ++ ) {\n\n\t\t\tconst result = func( extensions[ i ] );\n\n\t\t\tif ( result ) return result;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t_invokeAll( func ) {\n\n\t\tconst extensions = Object.values( this.plugins );\n\t\textensions.unshift( this );\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0; i < extensions.length; i ++ ) {\n\n\t\t\tconst result = func( extensions[ i ] );\n\n\t\t\tif ( result ) pending.push( result );\n\n\t\t}\n\n\t\treturn pending;\n\n\t}\n\n\t/**\n\t * Requests the specified dependency asynchronously, with caching.\n\t * @param {string} type\n\t * @param {number} index\n\t * @return {Promise}\n\t */\n\tgetDependency( type, index ) {\n\n\t\tconst cacheKey = type + ':' + index;\n\t\tlet dependency = this.cache.get( cacheKey );\n\n\t\tif ( ! dependency ) {\n\n\t\t\tswitch ( type ) {\n\n\t\t\t\tcase 'scene':\n\t\t\t\t\tdependency = this.loadScene( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'node':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadNode && ext.loadNode( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'mesh':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadMesh && ext.loadMesh( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'accessor':\n\t\t\t\t\tdependency = this.loadAccessor( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bufferView':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadBufferView && ext.loadBufferView( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'buffer':\n\t\t\t\t\tdependency = this.loadBuffer( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'material':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadMaterial && ext.loadMaterial( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'texture':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadTexture && ext.loadTexture( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'skin':\n\t\t\t\t\tdependency = this.loadSkin( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'animation':\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext.loadAnimation && ext.loadAnimation( index );\n\n\t\t\t\t\t} );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'camera':\n\t\t\t\t\tdependency = this.loadCamera( index );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tdependency = this._invokeOne( function ( ext ) {\n\n\t\t\t\t\t\treturn ext != this && ext.getDependency && ext.getDependency( type, index );\n\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( ! dependency ) {\n\n\t\t\t\t\t\tthrow new Error( 'Unknown type: ' + type );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tthis.cache.add( cacheKey, dependency );\n\n\t\t}\n\n\t\treturn dependency;\n\n\t}\n\n\t/**\n\t * Requests all dependencies of the specified type asynchronously, with caching.\n\t * @param {string} type\n\t * @return {Promise>}\n\t */\n\tgetDependencies( type ) {\n\n\t\tlet dependencies = this.cache.get( type );\n\n\t\tif ( ! dependencies ) {\n\n\t\t\tconst parser = this;\n\t\t\tconst defs = this.json[ type + ( type === 'mesh' ? 'es' : 's' ) ] || [];\n\n\t\t\tdependencies = Promise.all( defs.map( function ( def, index ) {\n\n\t\t\t\treturn parser.getDependency( type, index );\n\n\t\t\t} ) );\n\n\t\t\tthis.cache.add( type, dependencies );\n\n\t\t}\n\n\t\treturn dependencies;\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t * @param {number} bufferIndex\n\t * @return {Promise}\n\t */\n\tloadBuffer( bufferIndex ) {\n\n\t\tconst bufferDef = this.json.buffers[ bufferIndex ];\n\t\tconst loader = this.fileLoader;\n\n\t\tif ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );\n\n\t\t}\n\n\t\t// If present, GLB container is required to be the first buffer.\n\t\tif ( bufferDef.uri === undefined && bufferIndex === 0 ) {\n\n\t\t\treturn Promise.resolve( this.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body );\n\n\t\t}\n\n\t\tconst options = this.options;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tloader.load( LoaderUtils.resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {\n\n\t\t\t\treject( new Error( 'THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".' ) );\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n\t * @param {number} bufferViewIndex\n\t * @return {Promise}\n\t */\n\tloadBufferView( bufferViewIndex ) {\n\n\t\tconst bufferViewDef = this.json.bufferViews[ bufferViewIndex ];\n\n\t\treturn this.getDependency( 'buffer', bufferViewDef.buffer ).then( function ( buffer ) {\n\n\t\t\tconst byteLength = bufferViewDef.byteLength || 0;\n\t\t\tconst byteOffset = bufferViewDef.byteOffset || 0;\n\t\t\treturn buffer.slice( byteOffset, byteOffset + byteLength );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n\t * @param {number} accessorIndex\n\t * @return {Promise}\n\t */\n\tloadAccessor( accessorIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\n\t\tconst accessorDef = this.json.accessors[ accessorIndex ];\n\n\t\tif ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {\n\n\t\t\tconst itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];\n\t\t\tconst TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\t\t\tconst normalized = accessorDef.normalized === true;\n\n\t\t\tconst array = new TypedArray( accessorDef.count * itemSize );\n\t\t\treturn Promise.resolve( new BufferAttribute( array, itemSize, normalized ) );\n\n\t\t}\n\n\t\tconst pendingBufferViews = [];\n\n\t\tif ( accessorDef.bufferView !== undefined ) {\n\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.bufferView ) );\n\n\t\t} else {\n\n\t\t\tpendingBufferViews.push( null );\n\n\t\t}\n\n\t\tif ( accessorDef.sparse !== undefined ) {\n\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.indices.bufferView ) );\n\t\t\tpendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.values.bufferView ) );\n\n\t\t}\n\n\t\treturn Promise.all( pendingBufferViews ).then( function ( bufferViews ) {\n\n\t\t\tconst bufferView = bufferViews[ 0 ];\n\n\t\t\tconst itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];\n\t\t\tconst TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];\n\n\t\t\t// For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.\n\t\t\tconst elementBytes = TypedArray.BYTES_PER_ELEMENT;\n\t\t\tconst itemBytes = elementBytes * itemSize;\n\t\t\tconst byteOffset = accessorDef.byteOffset || 0;\n\t\t\tconst byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[ accessorDef.bufferView ].byteStride : undefined;\n\t\t\tconst normalized = accessorDef.normalized === true;\n\t\t\tlet array, bufferAttribute;\n\n\t\t\t// The buffer is not interleaved if the stride is the item size in bytes.\n\t\t\tif ( byteStride && byteStride !== itemBytes ) {\n\n\t\t\t\t// Each \"slice\" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer\n\t\t\t\t// This makes sure that IBA.count reflects accessor.count properly\n\t\t\t\tconst ibSlice = Math.floor( byteOffset / byteStride );\n\t\t\t\tconst ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;\n\t\t\t\tlet ib = parser.cache.get( ibCacheKey );\n\n\t\t\t\tif ( ! ib ) {\n\n\t\t\t\t\tarray = new TypedArray( bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes );\n\n\t\t\t\t\t// Integer parameters to IB/IBA are in array elements, not bytes.\n\t\t\t\t\tib = new InterleavedBuffer( array, byteStride / elementBytes );\n\n\t\t\t\t\tparser.cache.add( ibCacheKey, ib );\n\n\t\t\t\t}\n\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized );\n\n\t\t\t} else {\n\n\t\t\t\tif ( bufferView === null ) {\n\n\t\t\t\t\tarray = new TypedArray( accessorDef.count * itemSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tarray = new TypedArray( bufferView, byteOffset, accessorDef.count * itemSize );\n\n\t\t\t\t}\n\n\t\t\t\tbufferAttribute = new BufferAttribute( array, itemSize, normalized );\n\n\t\t\t}\n\n\t\t\t// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n\t\t\tif ( accessorDef.sparse !== undefined ) {\n\n\t\t\t\tconst itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;\n\t\t\t\tconst TypedArrayIndices = WEBGL_COMPONENT_TYPES[ accessorDef.sparse.indices.componentType ];\n\n\t\t\t\tconst byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n\t\t\t\tconst byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n\n\t\t\t\tconst sparseIndices = new TypedArrayIndices( bufferViews[ 1 ], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices );\n\t\t\t\tconst sparseValues = new TypedArray( bufferViews[ 2 ], byteOffsetValues, accessorDef.sparse.count * itemSize );\n\n\t\t\t\tif ( bufferView !== null ) {\n\n\t\t\t\t\t// Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n\t\t\t\t\tbufferAttribute = new BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, il = sparseIndices.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst index = sparseIndices[ i ];\n\n\t\t\t\t\tbufferAttribute.setX( index, sparseValues[ i * itemSize ] );\n\t\t\t\t\tif ( itemSize >= 2 ) bufferAttribute.setY( index, sparseValues[ i * itemSize + 1 ] );\n\t\t\t\t\tif ( itemSize >= 3 ) bufferAttribute.setZ( index, sparseValues[ i * itemSize + 2 ] );\n\t\t\t\t\tif ( itemSize >= 4 ) bufferAttribute.setW( index, sparseValues[ i * itemSize + 3 ] );\n\t\t\t\t\tif ( itemSize >= 5 ) throw new Error( 'THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn bufferAttribute;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n\t * @param {number} textureIndex\n\t * @return {Promise}\n\t */\n\tloadTexture( textureIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst options = this.options;\n\t\tconst textureDef = json.textures[ textureIndex ];\n\t\tconst sourceIndex = textureDef.source;\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tlet loader = this.textureLoader;\n\n\t\tif ( sourceDef.uri ) {\n\n\t\t\tconst handler = options.manager.getHandler( sourceDef.uri );\n\t\t\tif ( handler !== null ) loader = handler;\n\n\t\t}\n\n\t\treturn this.loadTextureImage( textureIndex, sourceIndex, loader );\n\n\t}\n\n\tloadTextureImage( textureIndex, sourceIndex, loader ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\n\t\tconst textureDef = json.textures[ textureIndex ];\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tconst cacheKey = ( sourceDef.uri || sourceDef.bufferView ) + ':' + textureDef.sampler;\n\n\t\tif ( this.textureCache[ cacheKey ] ) {\n\n\t\t\t// See https://github.com/mrdoob/three.js/issues/21559.\n\t\t\treturn this.textureCache[ cacheKey ];\n\n\t\t}\n\n\t\tconst promise = this.loadImageSource( sourceIndex, loader ).then( function ( texture ) {\n\n\t\t\ttexture.flipY = false;\n\n\t\t\ttexture.name = textureDef.name || sourceDef.name || '';\n\n\t\t\tif ( texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith( 'data:image/' ) === false ) {\n\n\t\t\t\ttexture.name = sourceDef.uri;\n\n\t\t\t}\n\n\t\t\tconst samplers = json.samplers || {};\n\t\t\tconst sampler = samplers[ textureDef.sampler ] || {};\n\n\t\t\ttexture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || LinearFilter;\n\t\t\ttexture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || LinearMipmapLinearFilter;\n\t\t\ttexture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || RepeatWrapping;\n\t\t\ttexture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || RepeatWrapping;\n\n\t\t\tparser.associations.set( texture, { textures: textureIndex } );\n\n\t\t\treturn texture;\n\n\t\t} ).catch( function () {\n\n\t\t\treturn null;\n\n\t\t} );\n\n\t\tthis.textureCache[ cacheKey ] = promise;\n\n\t\treturn promise;\n\n\t}\n\n\tloadImageSource( sourceIndex, loader ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst options = this.options;\n\n\t\tif ( this.sourceCache[ sourceIndex ] !== undefined ) {\n\n\t\t\treturn this.sourceCache[ sourceIndex ].then( ( texture ) => texture.clone() );\n\n\t\t}\n\n\t\tconst sourceDef = json.images[ sourceIndex ];\n\n\t\tconst URL = self.URL || self.webkitURL;\n\n\t\tlet sourceURI = sourceDef.uri || '';\n\t\tlet isObjectURL = false;\n\n\t\tif ( sourceDef.bufferView !== undefined ) {\n\n\t\t\t// Load binary image data from bufferView, if provided.\n\n\t\t\tsourceURI = parser.getDependency( 'bufferView', sourceDef.bufferView ).then( function ( bufferView ) {\n\n\t\t\t\tisObjectURL = true;\n\t\t\t\tconst blob = new Blob( [ bufferView ], { type: sourceDef.mimeType } );\n\t\t\t\tsourceURI = URL.createObjectURL( blob );\n\t\t\t\treturn sourceURI;\n\n\t\t\t} );\n\n\t\t} else if ( sourceDef.uri === undefined ) {\n\n\t\t\tthrow new Error( 'THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView' );\n\n\t\t}\n\n\t\tconst promise = Promise.resolve( sourceURI ).then( function ( sourceURI ) {\n\n\t\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\t\tlet onLoad = resolve;\n\n\t\t\t\tif ( loader.isImageBitmapLoader === true ) {\n\n\t\t\t\t\tonLoad = function ( imageBitmap ) {\n\n\t\t\t\t\t\tconst texture = new Texture( imageBitmap );\n\t\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\t\tresolve( texture );\n\n\t\t\t\t\t};\n\n\t\t\t\t}\n\n\t\t\t\tloader.load( LoaderUtils.resolveURL( sourceURI, options.path ), onLoad, undefined, reject );\n\n\t\t\t} );\n\n\t\t} ).then( function ( texture ) {\n\n\t\t\t// Clean up resources and configure Texture.\n\n\t\t\tif ( isObjectURL === true ) {\n\n\t\t\t\tURL.revokeObjectURL( sourceURI );\n\n\t\t\t}\n\n\t\t\ttexture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType( sourceDef.uri );\n\n\t\t\treturn texture;\n\n\t\t} ).catch( function ( error ) {\n\n\t\t\tconsole.error( 'THREE.GLTFLoader: Couldn\\'t load texture', sourceURI );\n\t\t\tthrow error;\n\n\t\t} );\n\n\t\tthis.sourceCache[ sourceIndex ] = promise;\n\t\treturn promise;\n\n\t}\n\n\t/**\n\t * Asynchronously assigns a texture to the given material parameters.\n\t * @param {Object} materialParams\n\t * @param {string} mapName\n\t * @param {Object} mapDef\n\t * @return {Promise}\n\t */\n\tassignTexture( materialParams, mapName, mapDef, colorSpace ) {\n\n\t\tconst parser = this;\n\n\t\treturn this.getDependency( 'texture', mapDef.index ).then( function ( texture ) {\n\n\t\t\tif ( ! texture ) return null;\n\n\t\t\tif ( mapDef.texCoord !== undefined && mapDef.texCoord > 0 ) {\n\n\t\t\t\ttexture = texture.clone();\n\t\t\t\ttexture.channel = mapDef.texCoord;\n\n\t\t\t}\n\n\t\t\tif ( parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] ) {\n\n\t\t\t\tconst transform = mapDef.extensions !== undefined ? mapDef.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] : undefined;\n\n\t\t\t\tif ( transform ) {\n\n\t\t\t\t\tconst gltfReference = parser.associations.get( texture );\n\t\t\t\t\ttexture = parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ].extendTexture( texture, transform );\n\t\t\t\t\tparser.associations.set( texture, gltfReference );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = colorSpace;\n\n\t\t\t}\n\n\t\t\tmaterialParams[ mapName ] = texture;\n\n\t\t\treturn texture;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Assigns final material to a Mesh, Line, or Points instance. The instance\n\t * already has a material (generated from the glTF material options alone)\n\t * but reuse of the same glTF material may require multiple threejs materials\n\t * to accommodate different primitive types, defines, etc. New materials will\n\t * be created if necessary, and reused from a cache.\n\t * @param {Object3D} mesh Mesh, Line, or Points instance.\n\t */\n\tassignFinalMaterial( mesh ) {\n\n\t\tconst geometry = mesh.geometry;\n\t\tlet material = mesh.material;\n\n\t\tconst useDerivativeTangents = geometry.attributes.tangent === undefined;\n\t\tconst useVertexColors = geometry.attributes.color !== undefined;\n\t\tconst useFlatShading = geometry.attributes.normal === undefined;\n\n\t\tif ( mesh.isPoints ) {\n\n\t\t\tconst cacheKey = 'PointsMaterial:' + material.uuid;\n\n\t\t\tlet pointsMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! pointsMaterial ) {\n\n\t\t\t\tpointsMaterial = new PointsMaterial();\n\t\t\t\tMaterial.prototype.copy.call( pointsMaterial, material );\n\t\t\t\tpointsMaterial.color.copy( material.color );\n\t\t\t\tpointsMaterial.map = material.map;\n\t\t\t\tpointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px\n\n\t\t\t\tthis.cache.add( cacheKey, pointsMaterial );\n\n\t\t\t}\n\n\t\t\tmaterial = pointsMaterial;\n\n\t\t} else if ( mesh.isLine ) {\n\n\t\t\tconst cacheKey = 'LineBasicMaterial:' + material.uuid;\n\n\t\t\tlet lineMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! lineMaterial ) {\n\n\t\t\t\tlineMaterial = new LineBasicMaterial();\n\t\t\t\tMaterial.prototype.copy.call( lineMaterial, material );\n\t\t\t\tlineMaterial.color.copy( material.color );\n\t\t\t\tlineMaterial.map = material.map;\n\n\t\t\t\tthis.cache.add( cacheKey, lineMaterial );\n\n\t\t\t}\n\n\t\t\tmaterial = lineMaterial;\n\n\t\t}\n\n\t\t// Clone the material if it will be modified\n\t\tif ( useDerivativeTangents || useVertexColors || useFlatShading ) {\n\n\t\t\tlet cacheKey = 'ClonedMaterial:' + material.uuid + ':';\n\n\t\t\tif ( useDerivativeTangents ) cacheKey += 'derivative-tangents:';\n\t\t\tif ( useVertexColors ) cacheKey += 'vertex-colors:';\n\t\t\tif ( useFlatShading ) cacheKey += 'flat-shading:';\n\n\t\t\tlet cachedMaterial = this.cache.get( cacheKey );\n\n\t\t\tif ( ! cachedMaterial ) {\n\n\t\t\t\tcachedMaterial = material.clone();\n\n\t\t\t\tif ( useVertexColors ) cachedMaterial.vertexColors = true;\n\t\t\t\tif ( useFlatShading ) cachedMaterial.flatShading = true;\n\n\t\t\t\tif ( useDerivativeTangents ) {\n\n\t\t\t\t\t// https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n\t\t\t\t\tif ( cachedMaterial.normalScale ) cachedMaterial.normalScale.y *= - 1;\n\t\t\t\t\tif ( cachedMaterial.clearcoatNormalScale ) cachedMaterial.clearcoatNormalScale.y *= - 1;\n\n\t\t\t\t}\n\n\t\t\t\tthis.cache.add( cacheKey, cachedMaterial );\n\n\t\t\t\tthis.associations.set( cachedMaterial, this.associations.get( material ) );\n\n\t\t\t}\n\n\t\t\tmaterial = cachedMaterial;\n\n\t\t}\n\n\t\tmesh.material = material;\n\n\t}\n\n\tgetMaterialType( /* materialIndex */ ) {\n\n\t\treturn MeshStandardMaterial;\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n\t * @param {number} materialIndex\n\t * @return {Promise}\n\t */\n\tloadMaterial( materialIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\t\tconst materialDef = json.materials[ materialIndex ];\n\n\t\tlet materialType;\n\t\tconst materialParams = {};\n\t\tconst materialExtensions = materialDef.extensions || {};\n\n\t\tconst pending = [];\n\n\t\tif ( materialExtensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ] ) {\n\n\t\t\tconst kmuExtension = extensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ];\n\t\t\tmaterialType = kmuExtension.getMaterialType();\n\t\t\tpending.push( kmuExtension.extendParams( materialParams, materialDef, parser ) );\n\n\t\t} else {\n\n\t\t\t// Specification:\n\t\t\t// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material\n\n\t\t\tconst metallicRoughness = materialDef.pbrMetallicRoughness || {};\n\n\t\t\tmaterialParams.color = new Color( 1.0, 1.0, 1.0 );\n\t\t\tmaterialParams.opacity = 1.0;\n\n\t\t\tif ( Array.isArray( metallicRoughness.baseColorFactor ) ) {\n\n\t\t\t\tconst array = metallicRoughness.baseColorFactor;\n\n\t\t\t\tmaterialParams.color.fromArray( array );\n\t\t\t\tmaterialParams.opacity = array[ 3 ];\n\n\t\t\t}\n\n\t\t\tif ( metallicRoughness.baseColorTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );\n\n\t\t\t}\n\n\t\t\tmaterialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;\n\t\t\tmaterialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;\n\n\t\t\tif ( metallicRoughness.metallicRoughnessTexture !== undefined ) {\n\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture ) );\n\t\t\t\tpending.push( parser.assignTexture( materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture ) );\n\n\t\t\t}\n\n\t\t\tmaterialType = this._invokeOne( function ( ext ) {\n\n\t\t\t\treturn ext.getMaterialType && ext.getMaterialType( materialIndex );\n\n\t\t\t} );\n\n\t\t\tpending.push( Promise.all( this._invokeAll( function ( ext ) {\n\n\t\t\t\treturn ext.extendMaterialParams && ext.extendMaterialParams( materialIndex, materialParams );\n\n\t\t\t} ) ) );\n\n\t\t}\n\n\t\tif ( materialDef.doubleSided === true ) {\n\n\t\t\tmaterialParams.side = DoubleSide;\n\n\t\t}\n\n\t\tconst alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;\n\n\t\tif ( alphaMode === ALPHA_MODES.BLEND ) {\n\n\t\t\tmaterialParams.transparent = true;\n\n\t\t\t// See: https://github.com/mrdoob/three.js/issues/17706\n\t\t\tmaterialParams.depthWrite = false;\n\n\t\t} else {\n\n\t\t\tmaterialParams.transparent = false;\n\n\t\t\tif ( alphaMode === ALPHA_MODES.MASK ) {\n\n\t\t\t\tmaterialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture ) );\n\n\t\t\tmaterialParams.normalScale = new Vector2( 1, 1 );\n\n\t\t\tif ( materialDef.normalTexture.scale !== undefined ) {\n\n\t\t\t\tconst scale = materialDef.normalTexture.scale;\n\n\t\t\t\tmaterialParams.normalScale.set( scale, scale );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture ) );\n\n\t\t\tif ( materialDef.occlusionTexture.strength !== undefined ) {\n\n\t\t\t\tmaterialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tmaterialParams.emissive = new Color().fromArray( materialDef.emissiveFactor );\n\n\t\t}\n\n\t\tif ( materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial ) {\n\n\t\t\tpending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function () {\n\n\t\t\tconst material = new materialType( materialParams );\n\n\t\t\tif ( materialDef.name ) material.name = materialDef.name;\n\n\t\t\tassignExtrasToUserData( material, materialDef );\n\n\t\t\tparser.associations.set( material, { materials: materialIndex } );\n\n\t\t\tif ( materialDef.extensions ) addUnknownExtensionsToUserData( extensions, material, materialDef );\n\n\t\t\treturn material;\n\n\t\t} );\n\n\t}\n\n\t/** When Object3D instances are targeted by animation, they need unique names. */\n\tcreateUniqueName( originalName ) {\n\n\t\tconst sanitizedName = PropertyBinding.sanitizeNodeName( originalName || '' );\n\n\t\tif ( sanitizedName in this.nodeNamesUsed ) {\n\n\t\t\treturn sanitizedName + '_' + ( ++ this.nodeNamesUsed[ sanitizedName ] );\n\n\t\t} else {\n\n\t\t\tthis.nodeNamesUsed[ sanitizedName ] = 0;\n\n\t\t\treturn sanitizedName;\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n\t *\n\t * Creates BufferGeometries from primitives.\n\t *\n\t * @param {Array} primitives\n\t * @return {Promise>}\n\t */\n\tloadGeometries( primitives ) {\n\n\t\tconst parser = this;\n\t\tconst extensions = this.extensions;\n\t\tconst cache = this.primitiveCache;\n\n\t\tfunction createDracoPrimitive( primitive ) {\n\n\t\t\treturn extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ]\n\t\t\t\t.decodePrimitive( primitive, parser )\n\t\t\t\t.then( function ( geometry ) {\n\n\t\t\t\t\treturn addPrimitiveAttributes( geometry, primitive, parser );\n\n\t\t\t\t} );\n\n\t\t}\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = primitives.length; i < il; i ++ ) {\n\n\t\t\tconst primitive = primitives[ i ];\n\t\t\tconst cacheKey = createPrimitiveKey( primitive );\n\n\t\t\t// See if we've already created this geometry\n\t\t\tconst cached = cache[ cacheKey ];\n\n\t\t\tif ( cached ) {\n\n\t\t\t\t// Use the cached geometry if it exists\n\t\t\t\tpending.push( cached.promise );\n\n\t\t\t} else {\n\n\t\t\t\tlet geometryPromise;\n\n\t\t\t\tif ( primitive.extensions && primitive.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ] ) {\n\n\t\t\t\t\t// Use DRACO geometry if available\n\t\t\t\t\tgeometryPromise = createDracoPrimitive( primitive );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise create a new geometry\n\t\t\t\t\tgeometryPromise = addPrimitiveAttributes( new BufferGeometry(), primitive, parser );\n\n\t\t\t\t}\n\n\t\t\t\t// Cache this geometry\n\t\t\t\tcache[ cacheKey ] = { primitive: primitive, promise: geometryPromise };\n\n\t\t\t\tpending.push( geometryPromise );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Promise.all( pending );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n\t * @param {number} meshIndex\n\t * @return {Promise}\n\t */\n\tloadMesh( meshIndex ) {\n\n\t\tconst parser = this;\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\n\t\tconst meshDef = json.meshes[ meshIndex ];\n\t\tconst primitives = meshDef.primitives;\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = primitives.length; i < il; i ++ ) {\n\n\t\t\tconst material = primitives[ i ].material === undefined\n\t\t\t\t? createDefaultMaterial( this.cache )\n\t\t\t\t: this.getDependency( 'material', primitives[ i ].material );\n\n\t\t\tpending.push( material );\n\n\t\t}\n\n\t\tpending.push( parser.loadGeometries( primitives ) );\n\n\t\treturn Promise.all( pending ).then( function ( results ) {\n\n\t\t\tconst materials = results.slice( 0, results.length - 1 );\n\t\t\tconst geometries = results[ results.length - 1 ];\n\n\t\t\tconst meshes = [];\n\n\t\t\tfor ( let i = 0, il = geometries.length; i < il; i ++ ) {\n\n\t\t\t\tconst geometry = geometries[ i ];\n\t\t\t\tconst primitive = primitives[ i ];\n\n\t\t\t\t// 1. create Mesh\n\n\t\t\t\tlet mesh;\n\n\t\t\t\tconst material = materials[ i ];\n\n\t\t\t\tif ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||\n\t\t\t\t\t\tprimitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||\n\t\t\t\t\t\tprimitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||\n\t\t\t\t\t\tprimitive.mode === undefined ) {\n\n\t\t\t\t\t// .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n\t\t\t\t\tmesh = meshDef.isSkinnedMesh === true\n\t\t\t\t\t\t? new SkinnedMesh( geometry, material )\n\t\t\t\t\t\t: new Mesh( geometry, material );\n\n\t\t\t\t\tif ( mesh.isSkinnedMesh === true ) {\n\n\t\t\t\t\t\t// normalize skin weights to fix malformed assets (see #15319)\n\t\t\t\t\t\tmesh.normalizeSkinWeights();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ) {\n\n\t\t\t\t\t\tmesh.geometry = toTrianglesDrawMode( mesh.geometry, TriangleStripDrawMode );\n\n\t\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ) {\n\n\t\t\t\t\t\tmesh.geometry = toTrianglesDrawMode( mesh.geometry, TriangleFanDrawMode );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {\n\n\t\t\t\t\tmesh = new LineSegments( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {\n\n\t\t\t\t\tmesh = new Line( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {\n\n\t\t\t\t\tmesh = new LineLoop( geometry, material );\n\n\t\t\t\t} else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) {\n\n\t\t\t\t\tmesh = new Points( geometry, material );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode );\n\n\t\t\t\t}\n\n\t\t\t\tif ( Object.keys( mesh.geometry.morphAttributes ).length > 0 ) {\n\n\t\t\t\t\tupdateMorphTargets( mesh, meshDef );\n\n\t\t\t\t}\n\n\t\t\t\tmesh.name = parser.createUniqueName( meshDef.name || ( 'mesh_' + meshIndex ) );\n\n\t\t\t\tassignExtrasToUserData( mesh, meshDef );\n\n\t\t\t\tif ( primitive.extensions ) addUnknownExtensionsToUserData( extensions, mesh, primitive );\n\n\t\t\t\tparser.assignFinalMaterial( mesh );\n\n\t\t\t\tmeshes.push( mesh );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, il = meshes.length; i < il; i ++ ) {\n\n\t\t\t\tparser.associations.set( meshes[ i ], {\n\t\t\t\t\tmeshes: meshIndex,\n\t\t\t\t\tprimitives: i\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tif ( meshes.length === 1 ) {\n\n\t\t\t\tif ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, meshes[ 0 ], meshDef );\n\n\t\t\t\treturn meshes[ 0 ];\n\n\t\t\t}\n\n\t\t\tconst group = new Group();\n\n\t\t\tif ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, group, meshDef );\n\n\t\t\tparser.associations.set( group, { meshes: meshIndex } );\n\n\t\t\tfor ( let i = 0, il = meshes.length; i < il; i ++ ) {\n\n\t\t\t\tgroup.add( meshes[ i ] );\n\n\t\t\t}\n\n\t\t\treturn group;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n\t * @param {number} cameraIndex\n\t * @return {Promise}\n\t */\n\tloadCamera( cameraIndex ) {\n\n\t\tlet camera;\n\t\tconst cameraDef = this.json.cameras[ cameraIndex ];\n\t\tconst params = cameraDef[ cameraDef.type ];\n\n\t\tif ( ! params ) {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing camera parameters.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( cameraDef.type === 'perspective' ) {\n\n\t\t\tcamera = new PerspectiveCamera( MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );\n\n\t\t} else if ( cameraDef.type === 'orthographic' ) {\n\n\t\t\tcamera = new OrthographicCamera( - params.xmag, params.xmag, params.ymag, - params.ymag, params.znear, params.zfar );\n\n\t\t}\n\n\t\tif ( cameraDef.name ) camera.name = this.createUniqueName( cameraDef.name );\n\n\t\tassignExtrasToUserData( camera, cameraDef );\n\n\t\treturn Promise.resolve( camera );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n\t * @param {number} skinIndex\n\t * @return {Promise}\n\t */\n\tloadSkin( skinIndex ) {\n\n\t\tconst skinDef = this.json.skins[ skinIndex ];\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = skinDef.joints.length; i < il; i ++ ) {\n\n\t\t\tpending.push( this._loadNodeShallow( skinDef.joints[ i ] ) );\n\n\t\t}\n\n\t\tif ( skinDef.inverseBindMatrices !== undefined ) {\n\n\t\t\tpending.push( this.getDependency( 'accessor', skinDef.inverseBindMatrices ) );\n\n\t\t} else {\n\n\t\t\tpending.push( null );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function ( results ) {\n\n\t\t\tconst inverseBindMatrices = results.pop();\n\t\t\tconst jointNodes = results;\n\n\t\t\t// Note that bones (joint nodes) may or may not be in the\n\t\t\t// scene graph at this time.\n\n\t\t\tconst bones = [];\n\t\t\tconst boneInverses = [];\n\n\t\t\tfor ( let i = 0, il = jointNodes.length; i < il; i ++ ) {\n\n\t\t\t\tconst jointNode = jointNodes[ i ];\n\n\t\t\t\tif ( jointNode ) {\n\n\t\t\t\t\tbones.push( jointNode );\n\n\t\t\t\t\tconst mat = new Matrix4();\n\n\t\t\t\t\tif ( inverseBindMatrices !== null ) {\n\n\t\t\t\t\t\tmat.fromArray( inverseBindMatrices.array, i * 16 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tboneInverses.push( mat );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new Skeleton( bones, boneInverses );\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n\t * @param {number} animationIndex\n\t * @return {Promise}\n\t */\n\tloadAnimation( animationIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\n\t\tconst animationDef = json.animations[ animationIndex ];\n\t\tconst animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex;\n\n\t\tconst pendingNodes = [];\n\t\tconst pendingInputAccessors = [];\n\t\tconst pendingOutputAccessors = [];\n\t\tconst pendingSamplers = [];\n\t\tconst pendingTargets = [];\n\n\t\tfor ( let i = 0, il = animationDef.channels.length; i < il; i ++ ) {\n\n\t\t\tconst channel = animationDef.channels[ i ];\n\t\t\tconst sampler = animationDef.samplers[ channel.sampler ];\n\t\t\tconst target = channel.target;\n\t\t\tconst name = target.node;\n\t\t\tconst input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input;\n\t\t\tconst output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output;\n\n\t\t\tif ( target.node === undefined ) continue;\n\n\t\t\tpendingNodes.push( this.getDependency( 'node', name ) );\n\t\t\tpendingInputAccessors.push( this.getDependency( 'accessor', input ) );\n\t\t\tpendingOutputAccessors.push( this.getDependency( 'accessor', output ) );\n\t\t\tpendingSamplers.push( sampler );\n\t\t\tpendingTargets.push( target );\n\n\t\t}\n\n\t\treturn Promise.all( [\n\n\t\t\tPromise.all( pendingNodes ),\n\t\t\tPromise.all( pendingInputAccessors ),\n\t\t\tPromise.all( pendingOutputAccessors ),\n\t\t\tPromise.all( pendingSamplers ),\n\t\t\tPromise.all( pendingTargets )\n\n\t\t] ).then( function ( dependencies ) {\n\n\t\t\tconst nodes = dependencies[ 0 ];\n\t\t\tconst inputAccessors = dependencies[ 1 ];\n\t\t\tconst outputAccessors = dependencies[ 2 ];\n\t\t\tconst samplers = dependencies[ 3 ];\n\t\t\tconst targets = dependencies[ 4 ];\n\n\t\t\tconst tracks = [];\n\n\t\t\tfor ( let i = 0, il = nodes.length; i < il; i ++ ) {\n\n\t\t\t\tconst node = nodes[ i ];\n\t\t\t\tconst inputAccessor = inputAccessors[ i ];\n\t\t\t\tconst outputAccessor = outputAccessors[ i ];\n\t\t\t\tconst sampler = samplers[ i ];\n\t\t\t\tconst target = targets[ i ];\n\n\t\t\t\tif ( node === undefined ) continue;\n\n\t\t\t\tif ( node.updateMatrix ) {\n\n\t\t\t\t\tnode.updateMatrix();\n\n\t\t\t\t}\n\n\t\t\t\tconst createdTracks = parser._createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target );\n\n\t\t\t\tif ( createdTracks ) {\n\n\t\t\t\t\tfor ( let k = 0; k < createdTracks.length; k ++ ) {\n\n\t\t\t\t\t\ttracks.push( createdTracks[ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new AnimationClip( animationName, undefined, tracks );\n\n\t\t} );\n\n\t}\n\n\tcreateNodeMesh( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tif ( nodeDef.mesh === undefined ) return null;\n\n\t\treturn parser.getDependency( 'mesh', nodeDef.mesh ).then( function ( mesh ) {\n\n\t\t\tconst node = parser._getNodeRef( parser.meshCache, nodeDef.mesh, mesh );\n\n\t\t\t// if weights are provided on the node, override weights on the mesh.\n\t\t\tif ( nodeDef.weights !== undefined ) {\n\n\t\t\t\tnode.traverse( function ( o ) {\n\n\t\t\t\t\tif ( ! o.isMesh ) return;\n\n\t\t\t\t\tfor ( let i = 0, il = nodeDef.weights.length; i < il; i ++ ) {\n\n\t\t\t\t\t\to.morphTargetInfluences[ i ] = nodeDef.weights[ i ];\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n\t * @param {number} nodeIndex\n\t * @return {Promise}\n\t */\n\tloadNode( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst parser = this;\n\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\tconst nodePending = parser._loadNodeShallow( nodeIndex );\n\n\t\tconst childPending = [];\n\t\tconst childrenDef = nodeDef.children || [];\n\n\t\tfor ( let i = 0, il = childrenDef.length; i < il; i ++ ) {\n\n\t\t\tchildPending.push( parser.getDependency( 'node', childrenDef[ i ] ) );\n\n\t\t}\n\n\t\tconst skeletonPending = nodeDef.skin === undefined\n\t\t\t? Promise.resolve( null )\n\t\t\t: parser.getDependency( 'skin', nodeDef.skin );\n\n\t\treturn Promise.all( [\n\t\t\tnodePending,\n\t\t\tPromise.all( childPending ),\n\t\t\tskeletonPending\n\t\t] ).then( function ( results ) {\n\n\t\t\tconst node = results[ 0 ];\n\t\t\tconst children = results[ 1 ];\n\t\t\tconst skeleton = results[ 2 ];\n\n\t\t\tif ( skeleton !== null ) {\n\n\t\t\t\t// This full traverse should be fine because\n\t\t\t\t// child glTF nodes have not been added to this node yet.\n\t\t\t\tnode.traverse( function ( mesh ) {\n\n\t\t\t\t\tif ( ! mesh.isSkinnedMesh ) return;\n\n\t\t\t\t\tmesh.bind( skeleton, _identityMatrix );\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, il = children.length; i < il; i ++ ) {\n\n\t\t\t\tnode.add( children[ i ] );\n\n\t\t\t}\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t}\n\n\t// ._loadNodeShallow() parses a single node.\n\t// skin and child nodes are created and added in .loadNode() (no '_' prefix).\n\t_loadNodeShallow( nodeIndex ) {\n\n\t\tconst json = this.json;\n\t\tconst extensions = this.extensions;\n\t\tconst parser = this;\n\n\t\t// This method is called from .loadNode() and .loadSkin().\n\t\t// Cache a node to avoid duplication.\n\n\t\tif ( this.nodeCache[ nodeIndex ] !== undefined ) {\n\n\t\t\treturn this.nodeCache[ nodeIndex ];\n\n\t\t}\n\n\t\tconst nodeDef = json.nodes[ nodeIndex ];\n\n\t\t// reserve node's name before its dependencies, so the root has the intended name.\n\t\tconst nodeName = nodeDef.name ? parser.createUniqueName( nodeDef.name ) : '';\n\n\t\tconst pending = [];\n\n\t\tconst meshPromise = parser._invokeOne( function ( ext ) {\n\n\t\t\treturn ext.createNodeMesh && ext.createNodeMesh( nodeIndex );\n\n\t\t} );\n\n\t\tif ( meshPromise ) {\n\n\t\t\tpending.push( meshPromise );\n\n\t\t}\n\n\t\tif ( nodeDef.camera !== undefined ) {\n\n\t\t\tpending.push( parser.getDependency( 'camera', nodeDef.camera ).then( function ( camera ) {\n\n\t\t\t\treturn parser._getNodeRef( parser.cameraCache, nodeDef.camera, camera );\n\n\t\t\t} ) );\n\n\t\t}\n\n\t\tparser._invokeAll( function ( ext ) {\n\n\t\t\treturn ext.createNodeAttachment && ext.createNodeAttachment( nodeIndex );\n\n\t\t} ).forEach( function ( promise ) {\n\n\t\t\tpending.push( promise );\n\n\t\t} );\n\n\t\tthis.nodeCache[ nodeIndex ] = Promise.all( pending ).then( function ( objects ) {\n\n\t\t\tlet node;\n\n\t\t\t// .isBone isn't in glTF spec. See ._markDefs\n\t\t\tif ( nodeDef.isBone === true ) {\n\n\t\t\t\tnode = new Bone();\n\n\t\t\t} else if ( objects.length > 1 ) {\n\n\t\t\t\tnode = new Group();\n\n\t\t\t} else if ( objects.length === 1 ) {\n\n\t\t\t\tnode = objects[ 0 ];\n\n\t\t\t} else {\n\n\t\t\t\tnode = new Object3D();\n\n\t\t\t}\n\n\t\t\tif ( node !== objects[ 0 ] ) {\n\n\t\t\t\tfor ( let i = 0, il = objects.length; i < il; i ++ ) {\n\n\t\t\t\t\tnode.add( objects[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( nodeDef.name ) {\n\n\t\t\t\tnode.userData.name = nodeDef.name;\n\t\t\t\tnode.name = nodeName;\n\n\t\t\t}\n\n\t\t\tassignExtrasToUserData( node, nodeDef );\n\n\t\t\tif ( nodeDef.extensions ) addUnknownExtensionsToUserData( extensions, node, nodeDef );\n\n\t\t\tif ( nodeDef.matrix !== undefined ) {\n\n\t\t\t\tconst matrix = new Matrix4();\n\t\t\t\tmatrix.fromArray( nodeDef.matrix );\n\t\t\t\tnode.applyMatrix4( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tif ( nodeDef.translation !== undefined ) {\n\n\t\t\t\t\tnode.position.fromArray( nodeDef.translation );\n\n\t\t\t\t}\n\n\t\t\t\tif ( nodeDef.rotation !== undefined ) {\n\n\t\t\t\t\tnode.quaternion.fromArray( nodeDef.rotation );\n\n\t\t\t\t}\n\n\t\t\t\tif ( nodeDef.scale !== undefined ) {\n\n\t\t\t\t\tnode.scale.fromArray( nodeDef.scale );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ! parser.associations.has( node ) ) {\n\n\t\t\t\tparser.associations.set( node, {} );\n\n\t\t\t}\n\n\t\t\tparser.associations.get( node ).nodes = nodeIndex;\n\n\t\t\treturn node;\n\n\t\t} );\n\n\t\treturn this.nodeCache[ nodeIndex ];\n\n\t}\n\n\t/**\n\t * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n\t * @param {number} sceneIndex\n\t * @return {Promise}\n\t */\n\tloadScene( sceneIndex ) {\n\n\t\tconst extensions = this.extensions;\n\t\tconst sceneDef = this.json.scenes[ sceneIndex ];\n\t\tconst parser = this;\n\n\t\t// Loader returns Group, not Scene.\n\t\t// See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n\t\tconst scene = new Group();\n\t\tif ( sceneDef.name ) scene.name = parser.createUniqueName( sceneDef.name );\n\n\t\tassignExtrasToUserData( scene, sceneDef );\n\n\t\tif ( sceneDef.extensions ) addUnknownExtensionsToUserData( extensions, scene, sceneDef );\n\n\t\tconst nodeIds = sceneDef.nodes || [];\n\n\t\tconst pending = [];\n\n\t\tfor ( let i = 0, il = nodeIds.length; i < il; i ++ ) {\n\n\t\t\tpending.push( parser.getDependency( 'node', nodeIds[ i ] ) );\n\n\t\t}\n\n\t\treturn Promise.all( pending ).then( function ( nodes ) {\n\n\t\t\tfor ( let i = 0, il = nodes.length; i < il; i ++ ) {\n\n\t\t\t\tscene.add( nodes[ i ] );\n\n\t\t\t}\n\n\t\t\t// Removes dangling associations, associations that reference a node that\n\t\t\t// didn't make it into the scene.\n\t\t\tconst reduceAssociations = ( node ) => {\n\n\t\t\t\tconst reducedAssociations = new Map();\n\n\t\t\t\tfor ( const [ key, value ] of parser.associations ) {\n\n\t\t\t\t\tif ( key instanceof Material || key instanceof Texture ) {\n\n\t\t\t\t\t\treducedAssociations.set( key, value );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tnode.traverse( ( node ) => {\n\n\t\t\t\t\tconst mappings = parser.associations.get( node );\n\n\t\t\t\t\tif ( mappings != null ) {\n\n\t\t\t\t\t\treducedAssociations.set( node, mappings );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\treturn reducedAssociations;\n\n\t\t\t};\n\n\t\t\tparser.associations = reduceAssociations( scene );\n\n\t\t\treturn scene;\n\n\t\t} );\n\n\t}\n\n\t_createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target ) {\n\n\t\tconst tracks = [];\n\n\t\tconst targetName = node.name ? node.name : node.uuid;\n\t\tconst targetNames = [];\n\n\t\tif ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {\n\n\t\t\tnode.traverse( function ( object ) {\n\n\t\t\t\tif ( object.morphTargetInfluences ) {\n\n\t\t\t\t\ttargetNames.push( object.name ? object.name : object.uuid );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\ttargetNames.push( targetName );\n\n\t\t}\n\n\t\tlet TypedKeyframeTrack;\n\n\t\tswitch ( PATH_PROPERTIES[ target.path ] ) {\n\n\t\t\tcase PATH_PROPERTIES.weights:\n\n\t\t\t\tTypedKeyframeTrack = NumberKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tcase PATH_PROPERTIES.rotation:\n\n\t\t\t\tTypedKeyframeTrack = QuaternionKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tcase PATH_PROPERTIES.position:\n\t\t\tcase PATH_PROPERTIES.scale:\n\n\t\t\t\tTypedKeyframeTrack = VectorKeyframeTrack;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tswitch ( outputAccessor.itemSize ) {\n\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tTypedKeyframeTrack = NumberKeyframeTrack;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\tcase 3:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tTypedKeyframeTrack = VectorKeyframeTrack;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tconst interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;\n\n\n\t\tconst outputArray = this._getArrayFromAccessor( outputAccessor );\n\n\t\tfor ( let j = 0, jl = targetNames.length; j < jl; j ++ ) {\n\n\t\t\tconst track = new TypedKeyframeTrack(\n\t\t\t\ttargetNames[ j ] + '.' + PATH_PROPERTIES[ target.path ],\n\t\t\t\tinputAccessor.array,\n\t\t\t\toutputArray,\n\t\t\t\tinterpolation\n\t\t\t);\n\n\t\t\t// Override interpolation with custom factory method.\n\t\t\tif ( sampler.interpolation === 'CUBICSPLINE' ) {\n\n\t\t\t\tthis._createCubicSplineTrackInterpolant( track );\n\n\t\t\t}\n\n\t\t\ttracks.push( track );\n\n\t\t}\n\n\t\treturn tracks;\n\n\t}\n\n\t_getArrayFromAccessor( accessor ) {\n\n\t\tlet outputArray = accessor.array;\n\n\t\tif ( accessor.normalized ) {\n\n\t\t\tconst scale = getNormalizedComponentScale( outputArray.constructor );\n\t\t\tconst scaled = new Float32Array( outputArray.length );\n\n\t\t\tfor ( let j = 0, jl = outputArray.length; j < jl; j ++ ) {\n\n\t\t\t\tscaled[ j ] = outputArray[ j ] * scale;\n\n\t\t\t}\n\n\t\t\toutputArray = scaled;\n\n\t\t}\n\n\t\treturn outputArray;\n\n\t}\n\n\t_createCubicSplineTrackInterpolant( track ) {\n\n\t\ttrack.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline( result ) {\n\n\t\t\t// A CUBICSPLINE keyframe in glTF has three output values for each input value,\n\t\t\t// representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()\n\t\t\t// must be divided by three to get the interpolant's sampleSize argument.\n\n\t\t\tconst interpolantType = ( this instanceof QuaternionKeyframeTrack ) ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;\n\n\t\t\treturn new interpolantType( this.times, this.values, this.getValueSize() / 3, result );\n\n\t\t};\n\n\t\t// Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n\t\ttrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;\n\n\t}\n\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\nfunction computeBounds( geometry, primitiveDef, parser ) {\n\n\tconst attributes = primitiveDef.attributes;\n\n\tconst box = new Box3();\n\n\tif ( attributes.POSITION !== undefined ) {\n\n\t\tconst accessor = parser.json.accessors[ attributes.POSITION ];\n\n\t\tconst min = accessor.min;\n\t\tconst max = accessor.max;\n\n\t\t// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n\t\tif ( min !== undefined && max !== undefined ) {\n\n\t\t\tbox.set(\n\t\t\t\tnew Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),\n\t\t\t\tnew Vector3( max[ 0 ], max[ 1 ], max[ 2 ] )\n\t\t\t);\n\n\t\t\tif ( accessor.normalized ) {\n\n\t\t\t\tconst boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );\n\t\t\t\tbox.min.multiplyScalar( boxScale );\n\t\t\t\tbox.max.multiplyScalar( boxScale );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );\n\n\t\t\treturn;\n\n\t\t}\n\n\t} else {\n\n\t\treturn;\n\n\t}\n\n\tconst targets = primitiveDef.targets;\n\n\tif ( targets !== undefined ) {\n\n\t\tconst maxDisplacement = new Vector3();\n\t\tconst vector = new Vector3();\n\n\t\tfor ( let i = 0, il = targets.length; i < il; i ++ ) {\n\n\t\t\tconst target = targets[ i ];\n\n\t\t\tif ( target.POSITION !== undefined ) {\n\n\t\t\t\tconst accessor = parser.json.accessors[ target.POSITION ];\n\t\t\t\tconst min = accessor.min;\n\t\t\t\tconst max = accessor.max;\n\n\t\t\t\t// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n\t\t\t\tif ( min !== undefined && max !== undefined ) {\n\n\t\t\t\t\t// we need to get max of absolute components because target weight is [-1,1]\n\t\t\t\t\tvector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );\n\t\t\t\t\tvector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );\n\t\t\t\t\tvector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );\n\n\n\t\t\t\t\tif ( accessor.normalized ) {\n\n\t\t\t\t\t\tconst boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );\n\t\t\t\t\t\tvector.multiplyScalar( boxScale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative\n\t\t\t\t\t// to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets\n\t\t\t\t\t// are used to implement key-frame animations and as such only two are active at a time - this results in very large\n\t\t\t\t\t// boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.\n\t\t\t\t\tmaxDisplacement.max( vector );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.\n\t\tbox.expandByVector( maxDisplacement );\n\n\t}\n\n\tgeometry.boundingBox = box;\n\n\tconst sphere = new Sphere();\n\n\tbox.getCenter( sphere.center );\n\tsphere.radius = box.min.distanceTo( box.max ) / 2;\n\n\tgeometry.boundingSphere = sphere;\n\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n * @return {Promise}\n */\nfunction addPrimitiveAttributes( geometry, primitiveDef, parser ) {\n\n\tconst attributes = primitiveDef.attributes;\n\n\tconst pending = [];\n\n\tfunction assignAttributeAccessor( accessorIndex, attributeName ) {\n\n\t\treturn parser.getDependency( 'accessor', accessorIndex )\n\t\t\t.then( function ( accessor ) {\n\n\t\t\t\tgeometry.setAttribute( attributeName, accessor );\n\n\t\t\t} );\n\n\t}\n\n\tfor ( const gltfAttributeName in attributes ) {\n\n\t\tconst threeAttributeName = ATTRIBUTES[ gltfAttributeName ] || gltfAttributeName.toLowerCase();\n\n\t\t// Skip attributes already provided by e.g. Draco extension.\n\t\tif ( threeAttributeName in geometry.attributes ) continue;\n\n\t\tpending.push( assignAttributeAccessor( attributes[ gltfAttributeName ], threeAttributeName ) );\n\n\t}\n\n\tif ( primitiveDef.indices !== undefined && ! geometry.index ) {\n\n\t\tconst accessor = parser.getDependency( 'accessor', primitiveDef.indices ).then( function ( accessor ) {\n\n\t\t\tgeometry.setIndex( accessor );\n\n\t\t} );\n\n\t\tpending.push( accessor );\n\n\t}\n\n\tassignExtrasToUserData( geometry, primitiveDef );\n\n\tcomputeBounds( geometry, primitiveDef, parser );\n\n\treturn Promise.all( pending ).then( function () {\n\n\t\treturn primitiveDef.targets !== undefined\n\t\t\t? addMorphTargets( geometry, primitiveDef.targets, parser )\n\t\t\t: geometry;\n\n\t} );\n\n}\n\nexport { GLTFLoader };\n","// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\nvar MeshoptDecoder = (function() {\n\t\"use strict\";\n\n\t// Built with clang version 14.0.4\n\t// Built from meshoptimizer 0.18\n\tvar wasm_base = \"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb\";\n\tvar wasm_simd = \"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb\";\n\n\tvar detector = new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);\n\tvar wasmpack = new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);\n\n\tif (typeof WebAssembly !== 'object') {\n\t\treturn {\n\t\t\tsupported: false,\n\t\t};\n\t}\n\n\tvar wasm = WebAssembly.validate(detector) ? wasm_simd : wasm_base;\n\n\tvar instance;\n\n\tvar ready =\n\t\tWebAssembly.instantiate(unpack(wasm), {})\n\t\t.then(function(result) {\n\t\t\tinstance = result.instance;\n\t\t\tinstance.exports.__wasm_call_ctors();\n\t\t});\n\n\tfunction unpack(data) {\n\t\tvar result = new Uint8Array(data.length);\n\t\tfor (var i = 0; i < data.length; ++i) {\n\t\t\tvar ch = data.charCodeAt(i);\n\t\t\tresult[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4;\n\t\t}\n\t\tvar write = 0;\n\t\tfor (var i = 0; i < data.length; ++i) {\n\t\t\tresult[write++] = (result[i] < 60) ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n\t\t}\n\t\treturn result.buffer.slice(0, write);\n\t}\n\n\tfunction decode(fun, target, count, size, source, filter) {\n\t\tvar sbrk = instance.exports.sbrk;\n\t\tvar count4 = (count + 3) & ~3;\n\t\tvar tp = sbrk(count4 * size);\n\t\tvar sp = sbrk(source.length);\n\t\tvar heap = new Uint8Array(instance.exports.memory.buffer);\n\t\theap.set(source, sp);\n\t\tvar res = fun(tp, count, size, sp, source.length);\n\t\tif (res == 0 && filter) {\n\t\t\tfilter(tp, count4, size);\n\t\t}\n\t\ttarget.set(heap.subarray(tp, tp + count * size));\n\t\tsbrk(tp - sbrk(0));\n\t\tif (res != 0) {\n\t\t\tthrow new Error(\"Malformed buffer data: \" + res);\n\t\t}\n\t}\n\n\tvar filters = {\n\t\tNONE: \"\",\n\t\tOCTAHEDRAL: \"meshopt_decodeFilterOct\",\n\t\tQUATERNION: \"meshopt_decodeFilterQuat\",\n\t\tEXPONENTIAL: \"meshopt_decodeFilterExp\",\n\t};\n\n\tvar decoders = {\n\t\tATTRIBUTES: \"meshopt_decodeVertexBuffer\",\n\t\tTRIANGLES: \"meshopt_decodeIndexBuffer\",\n\t\tINDICES: \"meshopt_decodeIndexSequence\",\n\t};\n\n\tvar workers = [];\n\tvar requestId = 0;\n\n\tfunction createWorker(url) {\n\t\tvar worker = {\n\t\t\tobject: new Worker(url),\n\t\t\tpending: 0,\n\t\t\trequests: {}\n\t\t};\n\n\t\tworker.object.onmessage = function(event) {\n\t\t\tvar data = event.data;\n\n\t\t\tworker.pending -= data.count;\n\t\t\tworker.requests[data.id][data.action](data.value);\n\n\t\t\tdelete worker.requests[data.id];\n\t\t};\n\n\t\treturn worker;\n\t}\n\n\tfunction initWorkers(count) {\n\t\tvar source =\n\t\t\t\"var instance; var ready = WebAssembly.instantiate(new Uint8Array([\" + new Uint8Array(unpack(wasm)) + \"]), {})\" +\n\t\t\t\".then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });\" +\n\t\t\t\"self.onmessage = workerProcess;\" +\n\t\t\tdecode.toString() + workerProcess.toString();\n\n\t\tvar blob = new Blob([source], {type: 'text/javascript'});\n\t\tvar url = URL.createObjectURL(blob);\n\n\t\tfor (var i = 0; i < count; ++i) {\n\t\t\tworkers[i] = createWorker(url);\n\t\t}\n\n\t\tURL.revokeObjectURL(url);\n\t}\n\n\tfunction decodeWorker(count, size, source, mode, filter) {\n\t\tvar worker = workers[0];\n\n\t\tfor (var i = 1; i < workers.length; ++i) {\n\t\t\tif (workers[i].pending < worker.pending) {\n\t\t\t\tworker = workers[i];\n\t\t\t}\n\t\t}\n\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar data = new Uint8Array(source);\n\t\t\tvar id = requestId++;\n\n\t\t\tworker.pending += count;\n\t\t\tworker.requests[id] = { resolve: resolve, reject: reject };\n\t\t\tworker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [ data.buffer ]);\n\t\t});\n\t}\n\n\tfunction workerProcess(event) {\n\t\tready.then(function() {\n\t\t\tvar data = event.data;\n\t\t\ttry {\n\t\t\t\tvar target = new Uint8Array(data.count * data.size);\n\t\t\t\tdecode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);\n\t\t\t\tself.postMessage({ id: data.id, count: data.count, action: \"resolve\", value: target }, [ target.buffer ]);\n\t\t\t} catch (error) {\n\t\t\t\tself.postMessage({ id: data.id, count: data.count, action: \"reject\", value: error });\n\t\t\t}\n\t\t});\n\t}\n\n\treturn {\n\t\tready: ready,\n\t\tsupported: true,\n\t\tuseWorkers: function(count) {\n\t\t\tinitWorkers(count);\n\t\t},\n\t\tdecodeVertexBuffer: function(target, count, size, source, filter) {\n\t\t\tdecode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);\n\t\t},\n\t\tdecodeIndexBuffer: function(target, count, size, source) {\n\t\t\tdecode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);\n\t\t},\n\t\tdecodeIndexSequence: function(target, count, size, source) {\n\t\t\tdecode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source);\n\t\t},\n\t\tdecodeGltfBuffer: function(target, count, size, source, mode, filter) {\n\t\t\tdecode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n\t\t},\n\t\tdecodeGltfBufferAsync: function(count, size, source, mode, filter) {\n\t\t\tif (workers.length > 0) {\n\t\t\t\treturn decodeWorker(count, size, source, decoders[mode], filters[filter]);\n\t\t\t}\n\n\t\t\treturn ready.then(function() {\n\t\t\t\tvar target = new Uint8Array(count * size);\n\t\t\t\tdecode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);\n\t\t\t\treturn target;\n\t\t\t});\n\t\t}\n\t};\n})();\n\nexport { MeshoptDecoder };\n"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$559434fcc6e6401d$export$aa93f11e7884f0f4","$ilwiq","$7ePFa","Loader","constructor","manager","dracoLoader","ktx2Loader","meshoptDecoder","pluginCallbacks","parser","$559434fcc6e6401d$var$GLTFMaterialsClearcoatExtension","$559434fcc6e6401d$var$GLTFTextureBasisUExtension","$559434fcc6e6401d$var$GLTFTextureWebPExtension","$559434fcc6e6401d$var$GLTFTextureAVIFExtension","$559434fcc6e6401d$var$GLTFMaterialsSheenExtension","$559434fcc6e6401d$var$GLTFMaterialsTransmissionExtension","$559434fcc6e6401d$var$GLTFMaterialsVolumeExtension","$559434fcc6e6401d$var$GLTFMaterialsIorExtension","$559434fcc6e6401d$var$GLTFMaterialsEmissiveStrengthExtension","$559434fcc6e6401d$var$GLTFMaterialsSpecularExtension","$559434fcc6e6401d$var$GLTFMaterialsIridescenceExtension","$559434fcc6e6401d$var$GLTFMaterialsAnisotropyExtension","$559434fcc6e6401d$var$GLTFLightsExtension","$559434fcc6e6401d$var$GLTFMeshoptCompression","$559434fcc6e6401d$var$GLTFMeshGpuInstancing","load","url","onLoad","onProgress","onError","resourcePath","scope","path","LoaderUtils","extractUrlBase","itemStart","_onError","console","error","itemError","itemEnd","loader","FileLoader","setPath","setResponseType","setRequestHeader","requestHeader","setWithCredentials","withCredentials","data","parse","gltf","setDRACOLoader","setDDSLoader","setKTX2Loader","setMeshoptDecoder","callback","indexOf","push","unregister","splice","json","extensions","plugins","textDecoder","TextDecoder","JSON","ArrayBuffer","magic","decode","Uint8Array","$559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_MAGIC","$559434fcc6e6401d$var$EXTENSIONS","KHR_BINARY_GLTF","$559434fcc6e6401d$var$GLTFBinaryExtension","content","undefined","asset","version","$559434fcc6e6401d$var$GLTFParser","crossOrigin","fileLoader","i","length","plugin","name","extensionsUsed","extensionName","extensionsRequired","KHR_MATERIALS_UNLIT","$559434fcc6e6401d$var$GLTFMaterialsUnlitExtension","KHR_DRACO_MESH_COMPRESSION","$559434fcc6e6401d$var$GLTFDracoMeshCompressionExtension","KHR_TEXTURE_TRANSFORM","$559434fcc6e6401d$var$GLTFTextureTransformExtension","KHR_MESH_QUANTIZATION","$559434fcc6e6401d$var$GLTFMeshQuantizationExtension","warn","setExtensions","setPlugins","parseAsync","Promise","resolve","reject","$559434fcc6e6401d$var$GLTFRegistry","objects","key","add","object","remove","removeAll","KHR_LIGHTS_PUNCTUAL","KHR_MATERIALS_CLEARCOAT","KHR_MATERIALS_IOR","KHR_MATERIALS_SHEEN","KHR_MATERIALS_SPECULAR","KHR_MATERIALS_TRANSMISSION","KHR_MATERIALS_IRIDESCENCE","KHR_MATERIALS_ANISOTROPY","KHR_MATERIALS_VOLUME","KHR_TEXTURE_BASISU","KHR_MATERIALS_EMISSIVE_STRENGTH","EXT_TEXTURE_WEBP","EXT_TEXTURE_AVIF","EXT_MESHOPT_COMPRESSION","EXT_MESH_GPU_INSTANCING","cache","refs","uses","_markDefs","nodeDefs","nodes","nodeIndex","nodeLength","nodeDef","light","_addNodeRef","_loadLight","lightIndex","lightNode","cacheKey","dependency","lightDefs","lights","lightDef","color","Color","fromArray","range","type","DirectionalLight","target","position","PointLight","distance","SpotLight","spot","innerConeAngle","outerConeAngle","Math","PI","angle","penumbra","decay","$559434fcc6e6401d$var$assignExtrasToUserData","intensity","createUniqueName","getDependency","index","createNodeAttachment","self1","then","_getNodeRef","getMaterialType","MeshBasicMaterial","extendParams","materialParams","materialDef","pending","opacity","metallicRoughness","pbrMetallicRoughness","Array","isArray","baseColorFactor","array","baseColorTexture","assignTexture","SRGBColorSpace","all","extendMaterialParams","materialIndex","materials","emissiveStrength","emissiveIntensity","MeshPhysicalMaterial","extension","clearcoatFactor","clearcoat","clearcoatTexture","clearcoatRoughnessFactor","clearcoatRoughness","clearcoatRoughnessTexture","clearcoatNormalTexture","scale","clearcoatNormalScale","Vector2","iridescenceFactor","iridescence","iridescenceTexture","iridescenceIor","iridescenceIOR","iridescenceThicknessRange","iridescenceThicknessMinimum","iridescenceThicknessMaximum","iridescenceThicknessTexture","sheenColor","sheenRoughness","sheen","sheenColorFactor","sheenRoughnessFactor","sheenColorTexture","sheenRoughnessTexture","transmissionFactor","transmission","transmissionTexture","thickness","thicknessFactor","thicknessTexture","attenuationDistance","Infinity","colorArray","attenuationColor","ior","specularIntensity","specularFactor","specularTexture","specularColorFactor","specularColor","specularColorTexture","anisotropyStrength","anisotropy","anisotropyRotation","anisotropyTexture","loadTexture","textureIndex","textureDef","textures","options","loadTextureImage","source","isSupported","images","textureLoader","uri","handler","getHandler","detectSupport","image","Image","src","onload","onerror","height","loadBufferView","bufferView","bufferViews","extensionDef","buffer","decoder","supported","res","byteOffset","byteLength","count","stride","byteStride","decodeGltfBufferAsync","mode","filter","ready","result","decodeGltfBuffer","createNodeMesh","mesh","meshDef","meshes","primitive","primitives","$559434fcc6e6401d$var$WEBGL_CONSTANTS","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN","attributesDef","attributes","accessor","results","nodeObject","pop","isGroup","children","instancedMeshes","m","Matrix4","p","Vector3","q","Quaternion","instancedMesh","InstancedMesh","geometry","material","TRANSLATION","fromBufferAttribute","ROTATION","SCALE","setMatrixAt","compose","attributeName","setAttribute","Object3D","prototype","copy","assignFinalMaterial","clear","$559434fcc6e6401d$var$BINARY_EXTENSION_CHUNK_TYPES","BIN","body","headerView","DataView","header","slice","getUint32","chunkContentsLength","chunkView","chunkIndex","chunkLength","chunkType","contentArray","$559434fcc6e6401d$var$BINARY_EXTENSION_HEADER_LENGTH","preload","decodePrimitive","bufferViewIndex","gltfAttributeMap","threeAttributeMap","attributeNormalizedMap","attributeTypeMap","threeAttributeName","$559434fcc6e6401d$var$ATTRIBUTES","toLowerCase","accessorDef","accessors","componentType","$559434fcc6e6401d$var$WEBGL_COMPONENT_TYPES","normalized","decodeDracoFile","attribute","extendTexture","texture","transform","texCoord","channel","offset","rotation","clone","repeat","needsUpdate","$559434fcc6e6401d$var$GLTFCubicSplineInterpolant","Interpolant","parameterPositions","sampleValues","sampleSize","resultBuffer","copySampleValue_","values","valueSize","interpolate_","i1","t0","t","t1","stride2","stride3","td","pp","ppp","offset1","offset0","s2","s3","s0","s1","p0","m0","p1","m1","$559434fcc6e6401d$var$_q","$559434fcc6e6401d$var$GLTFCubicSplineQuaternionInterpolant","normalize","toArray","POINTS","LINES","LINE_LOOP","LINE_STRIP","Int8Array","Int16Array","Uint16Array","Uint32Array","Float32Array","$559434fcc6e6401d$var$WEBGL_FILTERS","NearestFilter","LinearFilter","NearestMipmapNearestFilter","LinearMipmapNearestFilter","NearestMipmapLinearFilter","LinearMipmapLinearFilter","$559434fcc6e6401d$var$WEBGL_WRAPPINGS","ClampToEdgeWrapping","MirroredRepeatWrapping","RepeatWrapping","$559434fcc6e6401d$var$WEBGL_TYPE_SIZES","POSITION","NORMAL","TANGENT","TEXCOORD_0","TEXCOORD_1","TEXCOORD_2","TEXCOORD_3","COLOR_0","WEIGHTS_0","JOINTS_0","$559434fcc6e6401d$var$PATH_PROPERTIES","translation","weights","$559434fcc6e6401d$var$INTERPOLATION","CUBICSPLINE","LINEAR","InterpolateLinear","STEP","InterpolateDiscrete","$559434fcc6e6401d$var$ALPHA_MODES","OPAQUE","MASK","BLEND","$559434fcc6e6401d$var$addUnknownExtensionsToUserData","knownExtensions","objectDef","userData","gltfExtensions","gltfDef","extras","assign","$559434fcc6e6401d$var$createAttributesKey","attributesKey","keys","sort","il","$559434fcc6e6401d$var$getNormalizedComponentScale","$559434fcc6e6401d$var$_identityMatrix","associations","Map","primitiveCache","nodeCache","meshCache","cameraCache","lightCache","sourceCache","textureCache","nodeNamesUsed","isSafari","isFirefox","firefoxVersion","navigator","test","userAgent","match","createImageBitmap","TextureLoader","ImageBitmapLoader","setCrossOrigin","_invokeAll","ext","beforeRoot","getDependencies","dependencies","scene","scenes","animations","cameras","afterRoot","catch","skinDefs","skins","meshDefs","skinIndex","skinLength","joints","isBone","skin","isSkinnedMesh","camera","ref","updateMappings","original","mappings","child","entries","_invokeOne","func","unshift","loadScene","loadNode","loadMesh","loadAccessor","loadBuffer","loadMaterial","loadSkin","loadAnimation","loadCamera","defs","map","def","bufferIndex","bufferDef","buffers","resolveURL","bufferViewDef","accessorIndex","sparse","itemSize","TypedArray","BufferAttribute","pendingBufferViews","indices","bufferAttribute","elementBytes","BYTES_PER_ELEMENT","itemBytes","ibSlice","floor","ibCacheKey","ib","InterleavedBuffer","InterleavedBufferAttribute","itemSizeIndices","SCALAR","TypedArrayIndices","byteOffsetIndices","byteOffsetValues","sparseIndices","sparseValues","setX","setY","setZ","setW","sourceIndex","sourceDef","sampler","promise","loadImageSource","flipY","startsWith","samplers","magFilter","minFilter","wrapS","wrapT","URL","webkitURL","sourceURI","isObjectURL","blob","Blob","mimeType","createObjectURL","isImageBitmapLoader","imageBitmap","Texture","revokeObjectURL","search","mapName","mapDef","colorSpace","gltfReference","useDerivativeTangents","tangent","useVertexColors","useFlatShading","normal","isPoints","uuid","pointsMaterial","PointsMaterial","Material","sizeAttenuation","isLine","lineMaterial","LineBasicMaterial","cachedMaterial","vertexColors","flatShading","normalScale","y","MeshStandardMaterial","materialType","materialExtensions","kmuExtension","metalness","metallicFactor","roughness","roughnessFactor","metallicRoughnessTexture","doubleSided","side","DoubleSide","alphaMode","transparent","depthWrite","alphaTest","alphaCutoff","normalTexture","occlusionTexture","strength","aoMapIntensity","emissiveFactor","emissive","emissiveTexture","originalName","sanitizedName","PropertyBinding","sanitizeNodeName","loadGeometries","$559434fcc6e6401d$var$createPrimitiveKey","primitiveDef","geometryKey","dracoExtension","targets","cached","geometryPromise","createDracoPrimitive","$559434fcc6e6401d$var$addPrimitiveAttributes","BufferGeometry","meshIndex","depthTest","FrontSide","geometries","SkinnedMesh","Mesh","normalizeSkinWeights","toTrianglesDrawMode","TriangleStripDrawMode","TriangleFanDrawMode","LineSegments","Line","LineLoop","Points","morphAttributes","$559434fcc6e6401d$var$updateMorphTargets","updateMorphTargets","morphTargetInfluences","targetNames","morphTargetDictionary","group","Group","cameraIndex","cameraDef","params","PerspectiveCamera","MathUtils","radToDeg","yfov","aspectRatio","znear","zfar","OrthographicCamera","xmag","ymag","skinDef","_loadNodeShallow","inverseBindMatrices","bones","boneInverses","jointNodes","jointNode","mat","Skeleton","animationIndex","animationDef","animationName","pendingNodes","pendingInputAccessors","pendingOutputAccessors","pendingSamplers","pendingTargets","channels","node","input","parameters","output","inputAccessors","outputAccessors","tracks","inputAccessor","outputAccessor","updateMatrix","createdTracks","_createAnimationTracks","k","AnimationClip","traverse","o","isMesh","nodePending","childPending","childrenDef","skeletonPending","skeleton","bind","nodeName","meshPromise","forEach","Bone","matrix","applyMatrix4","quaternion","has","sceneIndex","sceneDef","nodeIds","reduceAssociations","reducedAssociations","value","TypedKeyframeTrack","targetName","NumberKeyframeTrack","QuaternionKeyframeTrack","VectorKeyframeTrack","interpolation","outputArray","_getArrayFromAccessor","j","jl","track","_createCubicSplineTrackInterpolant","scaled","createInterpolant","interpolantType","times","getValueSize","isInterpolantFactoryMethodGLTFCubicSpline","gltfAttributeName","assignAttributeAccessor","setIndex","$559434fcc6e6401d$var$computeBounds","box","Box3","min","max","boxScale","multiplyScalar","maxDisplacement","vector","abs","expandByVector","boundingBox","sphere","Sphere","getCenter","center","radius","distanceTo","boundingSphere","$559434fcc6e6401d$var$addMorphTargets","hasMorphPosition","hasMorphNormal","hasMorphColor","pendingPositionAccessors","pendingNormalAccessors","pendingColorAccessors","pendingAccessor","morphPositions","morphNormals","morphColors","morphTargetsRelative","$edac432dada49dd7$export$1111800106ba519a","instance","detector","wasmpack","WebAssembly","wasm","validate","instantiate","unpack","__wasm_call_ctors","ch","charCodeAt","write","fun","size","sbrk","count4","tp","sp","heap","memory","subarray","filters","NONE","OCTAHEDRAL","QUATERNION","EXPONENTIAL","decoders","ATTRIBUTES","INDICES","workers","requestId","workerProcess","event","postMessage","action","useWorkers","initWorkers","toString","createWorker","worker","Worker","requests","onmessage","decodeVertexBuffer","meshopt_decodeVertexBuffer","decodeIndexBuffer","meshopt_decodeIndexBuffer","decodeIndexSequence","meshopt_decodeIndexSequence","decodeWorker"],"version":3,"file":"floorProjection.99e62bf6.js.map"} \ No newline at end of file diff --git a/example/bundle/floorProjection.html b/example/bundle/floorProjection.html new file mode 100644 index 0000000..1fdd42e --- /dev/null +++ b/example/bundle/floorProjection.html @@ -0,0 +1 @@ +three-edge-projection - Projected Edge Generation
Floor plan silhouette and edge projection from Sketchfab model.
loading...
\ No newline at end of file diff --git a/example/bundle/projectionAsync.worker.15f44cdc.js b/example/bundle/projectionAsync.worker.15f44cdc.js new file mode 100644 index 0000000..0f7a123 --- /dev/null +++ b/example/bundle/projectionAsync.worker.15f44cdc.js @@ -0,0 +1,187 @@ +(()=>{function e(e,t,n,i){Object.defineProperty(e,t,{get:n,set:i,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n={},i={},r=t.parcelRequire6c98;null==r&&((r=function(e){if(e in n)return n[e].exports;if(e in i){var t=i[e];delete i[e];var r={id:e,exports:{}};return n[e]=r,t.call(r.exports,r,r.exports),r.exports}var a=Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(e,t){i[e]=t},t.parcelRequire6c98=r),r.register("e06gU",function(t,n){let i;e(t.exports,"FrontSide",()=>r),e(t.exports,"BackSide",()=>a),e(t.exports,"DoubleSide",()=>s),e(t.exports,"MathUtils",()=>T),e(t.exports,"Vector2",()=>b),e(t.exports,"Vector3",()=>Z),e(t.exports,"Box3",()=>$),e(t.exports,"Sphere",()=>e_),e(t.exports,"Ray",()=>eb),e(t.exports,"Matrix4",()=>eA),e(t.exports,"Triangle",()=>e9),e(t.exports,"BufferAttribute",()=>tc),e(t.exports,"BufferGeometry",()=>tS),e(t.exports,"Plane",()=>t2),e(t.exports,"Shape",()=>rU),e(t.exports,"ShapeUtils",()=>rJ),e(t.exports,"ShapeGeometry",()=>r3),e(t.exports,"Line3",()=>aT);let r=0,a=1,s=2,o="srgb",l="srgb-linear",h="display-p3",u="300 es";class c{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let n=this._listeners,i=n[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,i=t.length;n>8&255]+d[e>>16&255]+d[e>>24&255]+"-"+d[255&t]+d[t>>8&255]+"-"+d[t>>16&15|64]+d[t>>24&255]+"-"+d[63&n|128]+d[n>>8&255]+"-"+d[n>>16&255]+d[n>>24&255]+d[255&i]+d[i>>8&255]+d[i>>16&255]+d[i>>24&255];return r.toLowerCase()}function _(e,t,n){return Math.max(t,Math.min(n,e))}function v(e,t){return(e%t+t)%t}function x(e,t,n){return(1-n)*e+n*t}function M(e){return(e&e-1)==0&&0!==e}function y(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function S(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function E(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let T={DEG2RAD:f,RAD2DEG:m,generateUUID:g,clamp:_,euclideanModulo:v,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:x,damp:function(e,t,n,i){return x(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(v(e,2*t)-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())},seededRandom:function(e){void 0!==e&&(p=e);let t=p+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*f},radToDeg:function(e){return e*m},isPowerOfTwo:M,ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:y,setQuaternionFromProperEuler:function(e,t,n,i,r){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),h=a((t+i)/2),u=s((t+i)/2),c=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:E,denormalize:S};class b{constructor(e=0,t=0){b.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let 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(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(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(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(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(_(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class A{constructor(e,t,n,i,r,a,s,o,l){A.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=s,h[3]=t,h[4]=r,h[5]=o,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],h=n[4],u=n[7],c=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],_=i[1],v=i[4],x=i[7],M=i[2],y=i[5],S=i[8];return r[0]=a*f+s*_+o*M,r[3]=a*m+s*v+o*y,r[6]=a*g+s*x+o*S,r[1]=l*f+h*_+u*M,r[4]=l*m+h*v+u*y,r[7]=l*g+h*x+u*S,r[2]=c*f+d*_+p*M,r[5]=c*m+d*v+p*y,r[8]=c*g+d*x+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-n*r*h+n*s*o+i*r*l-i*a*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=h*a-s*l,c=s*o-h*r,d=l*r-a*o,p=t*u+n*c+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=u*f,e[1]=(i*l-h*n)*f,e[2]=(s*n-i*a)*f,e[3]=c*f,e[4]=(h*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e;let 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(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let 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(e,t,n,i,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(w.makeScale(e,t)),this}rotate(e){return this.premultiply(w.makeRotation(-e)),this}translate(e,t){return this.premultiply(w.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}clone(){return new this.constructor().fromArray(this.elements)}}let w=new A;function R(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function C(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let L={};function P(e){e in L||(L[e]=!0,console.warn(e))}function U(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function N(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let D=new A().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-.0000001,1e-7,.9105199]),I=new A().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),O={[l]:e=>e,[o]:e=>e.convertSRGBToLinear(),[h]:function(e){return e.convertSRGBToLinear().applyMatrix3(I)}},F={[l]:e=>e,[o]:e=>e.convertLinearToSRGB(),[h]:function(e){return e.applyMatrix3(D).convertLinearToSRGB()}},z={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(legacyMode){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!legacyMode},get workingColorSpace(){return l},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;let i=O[t],r=F[n];if(void 0===i||void 0===r)throw Error(`Unsupported color space conversion, "${t}" to "${n}".`);return r(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}};class B{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===i&&(i=C("canvas")),i.width=e.width,i.height=e.height;let n=i.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=i}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=C("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002: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 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002: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}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return P("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===o?3001:3e3}set encoding(e){P("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===e?o:""}}W.DEFAULT_IMAGE=null,W.DEFAULT_MAPPING=300,W.DEFAULT_ANISOTROPY=1;class X{constructor(e=0,t=0,n=0,i=1){X.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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 Error("index is out of range: "+e)}return this}getComponent(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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(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(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(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(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(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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(e){let t,n,i;let r=e.elements,a=r[0],s=r[4],o=r[8],l=r[1],h=r[5],u=r[9],c=r[2],d=r[6],p=r[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-c)&&.01>Math.abs(u-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+c)&&.1>Math.abs(u+d)&&.1>Math.abs(a+h+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,r=(h+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+c)/4,_=(u+d)/4;return e>r&&e>f?e<.01?(t=0,n=.707106781,i=.707106781):(n=m/(t=Math.sqrt(e)),i=g/t):r>f?r<.01?(t=.707106781,n=0,i=.707106781):(t=m/(n=Math.sqrt(r)),i=_/n):f<.01?(t=.707106781,n=.707106781,i=0):(t=g/(i=Math.sqrt(f)),n=_/i),this.set(t,n,i,Math.PI),this}let f=Math.sqrt((d-u)*(d-u)+(o-c)*(o-c)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-u)/f,this.y=(o-c)/f,this.z=(l-s)/f,this.w=Math.acos((a+h+p-1)/2),this}min(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(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(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(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(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(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(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class j extends c{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new X(0,0,e,t),this.scissorTest=!1,this.viewport=new X(0,0,e,t),void 0!==n.encoding&&(P("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=3001===n.encoding?o:""),this.texture=new W({width:e,height:t,depth:1},n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new G(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class q extends j{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Y extends W{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class J{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],c=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(1===s){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||o!==c||l!==d||h!==p){let e=1-s,t=o*c+l*d+h*p+u*f,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){let r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}let r=s*n;if(o=o*e+c*r,l=l*e+d*r,h=h*e+p*r,u=u*e+f*r,e===1-s){let e=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=e,l*=e,h*=e,u*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){let s=n[i],o=n[i+1],l=n[i+2],h=n[i+3],u=r[a],c=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-s*d,e[t+2]=l*p+h*d+s*c-o*u,e[t+3]=h*p-s*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),h=s(i/2),u=s(r/2),c=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=n+s+u;if(c>0){let e=.5/Math.sqrt(c+1);this._w=.25/e,this._x=(h-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>u){let e=2*Math.sqrt(1+n-s-u);this._w=(h-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>u){let e=2*Math.sqrt(1+s-n-u);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+u-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(e){return 2*Math.acos(Math.abs(_(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);return 0===n||this.slerp(e,Math.min(1,t/n)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=n*h+a*s+i*l-r*o,this._y=i*h+a*o+r*s-n*l,this._z=r*h+a*l+n*o-i*s,this._w=a*h-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,i=this._y,r=this._z,a=this._w,s=a*e._w+n*e._x+i*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),h=Math.atan2(l,s),u=Math.sin((1-t)*h)/l,c=Math.sin(t*h)/l;return this._w=a*u+this._w*c,this._x=n*u+this._x*c,this._y=i*u+this._y*c,this._z=r*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(e=0,t=0,n=0){Z.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Q.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Q.setFromAxisAngle(e,t))}applyMatrix3(e){let 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(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=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])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*i-s*n,h=o*n+s*t-r*i,u=o*i+r*n-a*t,c=-r*t-a*n-s*i;return this.x=l*o+-(c*r)+-(h*s)- -(u*a),this.y=h*o+-(c*a)+-(u*r)- -(l*s),this.z=u*o+-(c*s)+-(l*a)- -(h*r),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let 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(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(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(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(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(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(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(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(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return K.copy(this).projectOnVector(e),this.sub(K)}reflect(e){return this.sub(K.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(_(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let 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(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let 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(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let K=new Z,Q=new J;class ${constructor(e=new Z(1/0,1/0,1/0),t=new Z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x)&&!(e.ythis.max.y)&&!(e.zthis.max.z)}containsBox(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(e,t){return 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(e){return!(e.max.xthis.max.x)&&!(e.max.ythis.max.y)&&!(e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,et),et.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let 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(e){if(this.isEmpty())return!1;this.getCenter(eh),eu.subVectors(this.max,eh),ei.subVectors(e.a,eh),er.subVectors(e.b,eh),ea.subVectors(e.c,eh),es.subVectors(er,ei),eo.subVectors(ea,er),el.subVectors(ei,ea);let t=[0,-es.z,es.y,0,-eo.z,eo.y,0,-el.z,el.y,es.z,0,-es.x,eo.z,0,-eo.x,el.z,0,-el.x,-es.y,es.x,0,-eo.y,eo.x,0,-el.y,el.x,0];return!!(ep(t,ei,er,ea,eu)&&ep(t=[1,0,0,0,1,0,0,0,1],ei,er,ea,eu))&&(ec.crossVectors(es,eo),ep(t=[ec.x,ec.y,ec.z],ei,er,ea,eu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,et).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(et).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(ee[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ee[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ee[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ee[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ee[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ee[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ee[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ee[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ee)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let ee=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],et=new Z,en=new $,ei=new Z,er=new Z,ea=new Z,es=new Z,eo=new Z,el=new Z,eh=new Z,eu=new Z,ec=new Z,ed=new Z;function ep(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){ed.fromArray(e,a);let s=r.x*Math.abs(ed.x)+r.y*Math.abs(ed.y)+r.z*Math.abs(ed.z),o=t.dot(ed),l=n.dot(ed),h=i.dot(ed);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let ef=new $,em=new Z,eg=new Z;class e_{constructor(e=new Z,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):ef.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;em.subVectors(e,this.center);let t=em.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(em,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(eg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(em.copy(e.center).add(eg)),this.expandByPoint(em.copy(e.center).sub(eg)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let ev=new Z,ex=new Z,eM=new Z,ey=new Z,eS=new Z,eE=new Z,eT=new Z;class eb{constructor(e=new Z,t=new Z(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ev)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ev.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ev.copy(this.origin).addScaledVector(this.direction,t),ev.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){let r,a,s,o;ex.copy(e).add(t).multiplyScalar(.5),eM.copy(t).sub(e).normalize(),ey.copy(this.origin).sub(ex);let l=.5*e.distanceTo(t),h=-this.direction.dot(eM),u=ey.dot(this.direction),c=-ey.dot(eM),d=ey.lengthSq(),p=Math.abs(1-h*h);if(p>0){if(r=h*c-u,a=h*u-c,o=l*p,r>=0){if(a>=-o){if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+h*a+2*u)+a*(h*r+a+2*c)+d}else s=-(r=Math.max(0,-(h*(a=l)+u)))*r+a*(a+2*c)+d}else s=-(r=Math.max(0,-(h*(a=-l)+u)))*r+a*(a+2*c)+d}else a<=-o?(a=(r=Math.max(0,-(-h*l+u)))>0?-l:Math.min(Math.max(-l,-c),l),s=-r*r+a*(a+2*c)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-c),l))*(a+2*c)+d):(a=(r=Math.max(0,-(h*l+u)))>0?l:Math.min(Math.max(-l,-c),l),s=-r*r+a*(a+2*c)+d)}else a=h>0?-l:l,s=-(r=Math.max(0,-(h*a+u)))*r+a*(a+2*c)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(ex).addScaledVector(eM,a),s}intersectSphere(e,t){ev.subVectors(e.center,this.origin);let n=ev.dot(this.direction),i=ev.dot(ev)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let n=e.normal.dot(this.direction);return n*t<0}intersectBox(e,t){let n,i,r,a,s,o;let l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(l>=0?(n=(e.min.x-c.x)*l,i=(e.max.x-c.x)*l):(n=(e.max.x-c.x)*l,i=(e.min.x-c.x)*l),h>=0?(r=(e.min.y-c.y)*h,a=(e.max.y-c.y)*h):(r=(e.max.y-c.y)*h,a=(e.min.y-c.y)*h),n>a||r>i)?null:((r>n||isNaN(n))&&(n=r),(a=0?(s=(e.min.z-c.z)*u,o=(e.max.z-c.z)*u):(s=(e.max.z-c.z)*u,o=(e.min.z-c.z)*u),n>o||s>i)?null:((s>n||n!=n)&&(n=s),(o=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,ev)}intersectTriangle(e,t,n,i,r){let a;eS.subVectors(t,e),eE.subVectors(n,e),eT.crossVectors(eS,eE);let s=this.direction.dot(eT);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ey.subVectors(this.origin,e);let o=a*this.direction.dot(eE.crossVectors(ey,eE));if(o<0)return null;let l=a*this.direction.dot(eS.cross(ey));if(l<0||o+l>s)return null;let h=-a*ey.dot(eT);return h<0?null:this.at(h/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eA{constructor(e,t,n,i,r,a,s,o,l,h,u,c,d,p,f,m){eA.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,h,u,c,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,h,u,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eA().fromArray(this.elements)}copy(e){let 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(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(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(e){let t=this.elements,n=e.elements,i=1/ew.setFromMatrixColumn(e,0).length(),r=1/ew.setFromMatrixColumn(e,1).length(),a=1/ew.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]*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(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){let e=a*h,n=a*u,i=s*h,r=s*u;t[0]=o*h,t[4]=-o*u,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,n=o*u,i=l*h,r=l*u;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,n=o*u,i=l*h,r=l*u;t[0]=e-r*s,t[4]=-a*u,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*h,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,n=a*u,i=s*h,r=s*u;t[0]=o*h,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*u,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*h,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=n*u+i,t[10]=e-r*u}else if("XZY"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*h,t[4]=-u,t[8]=l*h,t[1]=e*u+r,t[5]=a*h,t[9]=n*u-i,t[2]=i*u-n,t[6]=s*h,t[10]=r*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eC,e,eL)}lookAt(e,t,n){let i=this.elements;return eN.subVectors(e,t),0===eN.lengthSq()&&(eN.z=1),eN.normalize(),eP.crossVectors(n,eN),0===eP.lengthSq()&&(1===Math.abs(n.z)?eN.x+=1e-4:eN.z+=1e-4,eN.normalize(),eP.crossVectors(n,eN)),eP.normalize(),eU.crossVectors(eN,eP),i[0]=eP.x,i[4]=eU.x,i[8]=eN.x,i[1]=eP.y,i[5]=eU.y,i[9]=eN.y,i[2]=eP.z,i[6]=eU.z,i[10]=eN.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],h=n[1],u=n[5],c=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],_=n[3],v=n[7],x=n[11],M=n[15],y=i[0],S=i[4],E=i[8],T=i[12],b=i[1],A=i[5],w=i[9],R=i[13],C=i[2],L=i[6],P=i[10],U=i[14],N=i[3],D=i[7],I=i[11],O=i[15];return r[0]=a*y+s*b+o*C+l*N,r[4]=a*S+s*A+o*L+l*D,r[8]=a*E+s*w+o*P+l*I,r[12]=a*T+s*R+o*U+l*O,r[1]=h*y+u*b+c*C+d*N,r[5]=h*S+u*A+c*L+d*D,r[9]=h*E+u*w+c*P+d*I,r[13]=h*T+u*R+c*U+d*O,r[2]=p*y+f*b+m*C+g*N,r[6]=p*S+f*A+m*L+g*D,r[10]=p*E+f*w+m*P+g*I,r[14]=p*T+f*R+m*U+g*O,r[3]=_*y+v*b+x*C+M*N,r[7]=_*S+v*A+x*L+M*D,r[11]=_*E+v*w+x*P+M*I,r[15]=_*T+v*R+x*U+M*O,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],u=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+r*o*u-i*l*u-r*s*c+n*l*c+i*s*d-n*o*d)+f*(+t*o*d-t*l*c+r*a*c-i*a*d+i*l*h-r*o*h)+m*(+t*l*u-t*s*d-r*a*u+n*a*d+r*s*h-n*l*h)+g*(-i*s*h-t*o*u+t*s*c+i*a*u-n*a*c+n*o*h)}transpose(){let e;let 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(e,t,n){let 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}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],_=u*m*l-f*c*l+f*o*d-s*m*d-u*o*g+s*c*g,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i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let 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(e){let 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(e){let 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(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,h=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,h*s+n,h*o-i*a,0,l*o-i*s,h*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,h=a+a,u=s+s,c=r*l,d=r*h,p=r*u,f=a*h,m=a*u,g=s*u,_=o*l,v=o*h,x=o*u,M=n.x,y=n.y,S=n.z;return i[0]=(1-(f+g))*M,i[1]=(d+x)*M,i[2]=(p-v)*M,i[3]=0,i[4]=(d-x)*y,i[5]=(1-(c+g))*y,i[6]=(m+_)*y,i[7]=0,i[8]=(p+v)*S,i[9]=(m-_)*S,i[10]=(1-(c+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,r=ew.set(i[0],i[1],i[2]).length(),a=ew.set(i[4],i[5],i[6]).length(),s=ew.set(i[8],i[9],i[10]).length(),o=this.determinant();o<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],eR.copy(this);let l=1/r,h=1/a,u=1/s;return eR.elements[0]*=l,eR.elements[1]*=l,eR.elements[2]*=l,eR.elements[4]*=h,eR.elements[5]*=h,eR.elements[6]*=h,eR.elements[8]*=u,eR.elements[9]*=u,eR.elements[10]*=u,t.setFromRotationMatrix(eR),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3){let o,l;let h=this.elements;if(2e3===s)o=-(a+r)/(a-r),l=-2*a*r/(a-r);else if(2001===s)o=-a/(a-r),l=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return h[0]=2*r/(t-e),h[4]=0,h[8]=(t+e)/(t-e),h[12]=0,h[1]=0,h[5]=2*r/(n-i),h[9]=(n+i)/(n-i),h[13]=0,h[2]=0,h[6]=0,h[10]=o,h[14]=l,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3){let o,l;let h=this.elements,u=1/(t-e),c=1/(n-i),d=1/(a-r);if(2e3===s)o=(a+r)*d,l=-2*d;else if(2001===s)o=r*d,l=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return h[0]=2*u,h[4]=0,h[8]=0,h[12]=-((t+e)*u),h[1]=0,h[5]=2*c,h[9]=0,h[13]=-((n+i)*c),h[2]=0,h[6]=0,h[10]=l,h[14]=-o,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}}let ew=new Z,eR=new eA,eC=new Z(0,0,0),eL=new Z(1,1,1),eP=new Z,eU=new Z,eN=new Z,eD=new eA,eI=new J;class eO{constructor(e=0,t=0,n=0,i=eO.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],h=i[9],u=i[2],c=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(_(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-_(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(_(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-_(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(_(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-_(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,r)):(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,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return eD.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eD,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eI.setFromEuler(this),this.setFromQuaternion(eI,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(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(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}eO.DEFAULT_ORDER="XYZ";class eF{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(n=n.concat(r))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ek,e,eW),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ek,eX,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),h.length>0&&(n.animations=h),u.length>0&&(n.nodes=u)}return n.object=i,n;function a(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){eQ.subVectors(i,t),e$.subVectors(n,t),e0.subVectors(e,t);let a=eQ.dot(eQ),s=eQ.dot(e$),o=eQ.dot(e0),l=e$.dot(e$),h=e$.dot(e0),u=a*l-s*s;if(0===u)return r.set(-2,-1,-1);let c=1/u,d=(l*o-s*h)*c,p=(a*h-s*o)*c;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,e1),e1.x>=0&&e1.y>=0&&e1.x+e1.y<=1}static getUV(e,t,n,i,r,a,s,o){return!1===e8&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),e8=!0),this.getInterpolation(e,t,n,i,r,a,s,o)}static getInterpolation(e,t,n,i,r,a,s,o){return this.getBarycoord(e,t,n,i,e1),o.setScalar(0),o.addScaledVector(r,e1.x),o.addScaledVector(a,e1.y),o.addScaledVector(s,e1.z),o}static isFrontFacing(e,t,n,i){return eQ.subVectors(n,t),e$.subVectors(e,t),0>eQ.cross(e$).dot(i)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return eQ.subVectors(this.c,this.b),e$.subVectors(this.a,this.b),.5*eQ.cross(e$).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return e9.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return e9.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return!1===e8&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),e8=!0),e9.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}getInterpolation(e,t,n,i,r){return e9.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return e9.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return e9.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,i;let r=this.a,a=this.b,s=this.c;e2.subVectors(a,r),e3.subVectors(s,r),e5.subVectors(e,r);let o=e2.dot(e5),l=e3.dot(e5);if(o<=0&&l<=0)return t.copy(r);e6.subVectors(e,a);let h=e2.dot(e6),u=e3.dot(e6);if(h>=0&&u<=h)return t.copy(a);let c=o*u-h*l;if(c<=0&&o>=0&&h<=0)return n=o/(o-h),t.copy(r).addScaledVector(e2,n);e7.subVectors(e,s);let d=e2.dot(e7),p=e3.dot(e7);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(e3,i);let m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return e4.subVectors(s,a),i=(u-h)/(u-h+(d-p)),t.copy(a).addScaledVector(e4,i);let g=1/(m+f+c);return n=f*g,i=c*g,t.copy(r).addScaledVector(e2,n).addScaledVector(e3,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let te=0;class tt extends c{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:te++}),this.uuid=g(),this.name="",this.type="Material",this.blending=1,this.side=r,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let n in e){let 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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.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()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),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,n.lightMapIntensity=this.lightMapIntensity),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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==r&&(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.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==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),void 0!==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.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,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;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let i=0;i!==e;++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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}let tn={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},ti={h:0,s:0,l:0},tr={h:0,s:0,l:0};function ta(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class ts{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=o){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,z.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=z.workingColorSpace){return this.r=e,this.g=t,this.b=n,z.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=z.workingColorSpace){if(e=v(e,1),t=_(t,0,1),n=_(n,0,1),0===t)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=ta(r,i,e+1/3),this.g=ta(r,i,e),this.b=ta(r,i,e-1/3)}return z.toWorkingColorSpace(this,i),this}setStyle(e,t=o){let n;function i(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;let a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=o){let n=tn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=U(e.r),this.g=U(e.g),this.b=U(e.b),this}copyLinearToSRGB(e){return this.r=N(e.r),this.g=N(e.g),this.b=N(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=o){return z.fromWorkingColorSpace(to.copy(this),e),65536*Math.round(_(255*to.r,0,255))+256*Math.round(_(255*to.g,0,255))+Math.round(_(255*to.b,0,255))}getHexString(e=o){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=z.workingColorSpace){let n,i;z.fromWorkingColorSpace(to.copy(this),t);let r=to.r,a=to.g,s=to.b,o=Math.max(r,a,s),l=Math.min(r,a,s),h=(l+o)/2;if(l===o)n=0,i=0;else{let e=o-l;switch(i=h<=.5?e/(o+l):e/(2-o-l),o){case r:n=(a-s)/e+(a0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let i=n[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},r=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone(t));let i=e.attributes;for(let e in i){let n=i[e];this.setAttribute(e,n.clone(t))}let r=e.morphAttributes;for(let e in r){let n=[],i=r[e];for(let e=0,r=i.length;e0){let e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t(e.far-e.near)**2)||(tE.copy(r).invert(),tT.copy(e.ray).applyMatrix4(tE),null!==n.boundingBox&&!1===tT.intersectsBox(n.boundingBox)))return;this._computeIntersections(e,t,tT)}}_computeIntersections(e,t,n){let i;let r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,c=r.groups,d=r.drawRange;if(null!==s){if(Array.isArray(a))for(let r=0,o=c.length;rn.far?null:{distance:u,point:tB.clone(),object:e}}(e,t,n,i,tw,tR,tC,tz);if(d){s&&(tU.fromBufferAttribute(s,h),tN.fromBufferAttribute(s,u),tD.fromBufferAttribute(s,c),d.uv=e9.getInterpolation(tz,tw,tR,tC,tU,tN,tD,new b)),o&&(tU.fromBufferAttribute(o,h),tN.fromBufferAttribute(o,u),tD.fromBufferAttribute(o,c),d.uv1=e9.getInterpolation(tz,tw,tR,tC,tU,tN,tD,new b),d.uv2=d.uv1),l&&(tI.fromBufferAttribute(l,h),tO.fromBufferAttribute(l,u),tF.fromBufferAttribute(l,c),d.normal=e9.getInterpolation(tz,tw,tR,tC,tI,tO,tF,new Z),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));let e={a:h,b:u,c:c,normal:new Z,materialIndex:0};e9.getNormal(tw,tR,tC,e.normal),d.face=e}return d}class tV extends tS{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};let s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let o=[],l=[],h=[],u=[],c=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,_){let v=a/m,x=p/g,M=a/2,y=p/2,S=f/2,E=m+1,T=g+1,b=0,A=0,w=new Z;for(let a=0;a0?1:-1,h.push(w.x,w.y,w.z),u.push(o/m),u.push(1-a/g),b+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class tY extends eK{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eA,this.projectionMatrix=new eA,this.projectionMatrixInverse=new eA,this.coordinateSystem=2e3}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class tJ extends tY{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e){let t=.5*this.getFilmHeight()/e;this.fov=2*m*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*f*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*m*Math.atan(Math.tan(.5*f*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,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=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*f*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}}class tZ extends eK{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;let i=new tJ(-90,1,e,t);i.layers=this.layers,this.add(i);let r=new tJ(-90,1,e,t);r.layers=this.layers,this.add(r);let a=new tJ(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new tJ(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new tJ(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new tJ(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,r,a,s,o,l]=this.children,h=e.getRenderTarget(),u=e.xr.enabled;e.xr.enabled=!1;let c=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,a),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=c,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class tK extends W{constructor(e,t,n,i,r,a,s,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:301,n,i,r,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tQ extends q{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];void 0!==t.encoding&&(P("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=3001===t.encoding?o:""),this.texture=new tK(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new tV(5,5,5),r=new tq({name:"CubemapFromEquirect",uniforms:tk(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:a,blending:0});r.uniforms.tEquirect.value=t;let s=new tH(i,r),o=t.minFilter;1008===t.minFilter&&(t.minFilter=1006);let l=new tZ(1,10,this);return l.update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}let t$=new Z,t0=new Z,t1=new A;class t2{constructor(e=new Z(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=t$.subVectors(n,t).cross(t0.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let n=e.delta(t$),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||t1.getNormalMatrix(e),i=this.coplanarPoint(t$).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let t3=new e_,t4=new Z;class t5{constructor(e=new t2,t=new t2,n=new t2,i=new t2,r=new t2,a=new t2){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){let n=this.planes,i=e.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],_=i[13],v=i[14],x=i[15];if(n[0].setComponents(o-r,c-l,m-d,x-g).normalize(),n[1].setComponents(o+r,c+l,m+d,x+g).normalize(),n[2].setComponents(o+a,c+h,m+p,x+_).normalize(),n[3].setComponents(o-a,c-h,m-p,x-_).normalize(),n[4].setComponents(o-s,c-u,m-f,x-v).normalize(),2e3===t)n[5].setComponents(o+s,c+u,m+f,x+v).normalize();else if(2001===t)n[5].setComponents(s,u,f,v).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),t3.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),t3.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(t3)}intersectsSprite(e){return t3.center.set(0,0,0),t3.radius=.7071067811865476,t3.applyMatrix4(e.matrixWorld),this.intersectsSphere(t3)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++){let r=t[e].distanceToPoint(n);if(r0?e.max.x:e.min.x,t4.y=i.normal.y>0?e.max.y:e.min.y,t4.z=i.normal.z>0?e.max.z:e.min.z,0>i.distanceToPoint(t4))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function t6(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function t7(e,t){let 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);let n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){let e=i.get(t);(!e||e.version 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float 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 }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 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 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\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 mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return 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}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometry.position;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometry.position;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometry, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometry.normal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_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 uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif",map_fragment:"#ifdef USE_MAP\n diffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},ne={common:{diffuse:{value:new ts(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new A},alphaMap:{value:null},alphaMapTransform:{value:new A},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new A}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new A}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new A}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new A},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new A},normalScale:{value:new b(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new A},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new A}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new A}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new A}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ts(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ts(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new A},alphaTest:{value:0},uvTransform:{value:new A}},sprite:{diffuse:{value:new ts(16777215)},opacity:{value:1},center:{value:new b(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new A},alphaMap:{value:null},alphaMapTransform:{value:new A},alphaTest:{value:0}}},nt={basic:{uniforms:tW([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:t9.meshbasic_vert,fragmentShader:t9.meshbasic_frag},lambert:{uniforms:tW([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new ts(0)}}]),vertexShader:t9.meshlambert_vert,fragmentShader:t9.meshlambert_frag},phong:{uniforms:tW([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new ts(0)},specular:{value:new ts(1118481)},shininess:{value:30}}]),vertexShader:t9.meshphong_vert,fragmentShader:t9.meshphong_frag},standard:{uniforms:tW([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new ts(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:t9.meshphysical_vert,fragmentShader:t9.meshphysical_frag},toon:{uniforms:tW([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new ts(0)}}]),vertexShader:t9.meshtoon_vert,fragmentShader:t9.meshtoon_frag},matcap:{uniforms:tW([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:t9.meshmatcap_vert,fragmentShader:t9.meshmatcap_frag},points:{uniforms:tW([ne.points,ne.fog]),vertexShader:t9.points_vert,fragmentShader:t9.points_frag},dashed:{uniforms:tW([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:t9.linedashed_vert,fragmentShader:t9.linedashed_frag},depth:{uniforms:tW([ne.common,ne.displacementmap]),vertexShader:t9.depth_vert,fragmentShader:t9.depth_frag},normal:{uniforms:tW([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:t9.meshnormal_vert,fragmentShader:t9.meshnormal_frag},sprite:{uniforms:tW([ne.sprite,ne.fog]),vertexShader:t9.sprite_vert,fragmentShader:t9.sprite_frag},background:{uniforms:{uvTransform:{value:new A},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:t9.background_vert,fragmentShader:t9.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:t9.backgroundCube_vert,fragmentShader:t9.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:t9.cube_vert,fragmentShader:t9.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:t9.equirect_vert,fragmentShader:t9.equirect_frag},distanceRGBA:{uniforms:tW([ne.common,ne.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:t9.distanceRGBA_vert,fragmentShader:t9.distanceRGBA_frag},shadow:{uniforms:tW([ne.lights,ne.fog,{color:{value:new ts(0)},opacity:{value:1}}]),vertexShader:t9.shadow_vert,fragmentShader:t9.shadow_frag}};nt.physical={uniforms:tW([nt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new A},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new A},clearcoatNormalScale:{value:new b(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new A},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new A},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new A},sheen:{value:0},sheenColor:{value:new ts(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new A},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new A},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new A},transmissionSamplerSize:{value:new b},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new A},attenuationDistance:{value:0},attenuationColor:{value:new ts(0)},specularColor:{value:new ts(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new A},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new A},anisotropyVector:{value:new b},anisotropyMap:{value:null},anisotropyMapTransform:{value:new A}}]),vertexShader:t9.meshphysical_vert,fragmentShader:t9.meshphysical_frag};let nn={r:0,b:0,g:0};function ni(e,t,n,i,s,l,h){let u,c;let d=new ts(0),p=!0===l?0:1,f=null,m=0,g=null;function _(t,n){t.getRGB(nn,tX(e)),i.buffers.color.setClear(nn.r,nn.g,nn.b,n,h)}return{getClearColor:function(){return d},setClearColor:function(e,t=1){d.set(e),_(d,p=t)},getClearAlpha:function(){return p},setClearAlpha:function(e){_(d,p=e)},render:function(l,v){let x=!1,M=!0===v.isScene?v.background:null;if(M&&M.isTexture){let e=v.backgroundBlurriness>0;M=(e?n:t).get(M)}null===M?_(d,p):M&&M.isColor&&(_(M,1),x=!0);let y=e.xr,S=y.getEnvironmentBlendMode();switch(S){case"opaque":x=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,h),x=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,h),x=!0}(e.autoClear||x)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),M&&(M.isCubeTexture||306===M.mapping)?(void 0===c&&((c=new tH(new tV(1,1,1),new tq({name:"BackgroundCubeMaterial",uniforms:tk(nt.backgroundCube.uniforms),vertexShader:nt.backgroundCube.vertexShader,fragmentShader:nt.backgroundCube.fragmentShader,side:a,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.flipEnvMap.value=M.isCubeTexture&&!1===M.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=M.colorSpace!==o,(f!==M||m!==M.version||g!==e.toneMapping)&&(c.material.needsUpdate=!0,f=M,m=M.version,g=e.toneMapping),c.layers.enableAll(),l.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(void 0===u&&((u=new tH(new t8(2,2),new tq({name:"BackgroundMaterial",uniforms:tk(nt.background.uniforms),vertexShader:nt.background.vertexShader,fragmentShader:nt.background.fragmentShader,side:r,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(u)),u.material.uniforms.t2D.value=M,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=M.colorSpace!==o,!0===M.matrixAutoUpdate&&M.updateMatrix(),u.material.uniforms.uvTransform.value.copy(M.matrix),(f!==M||m!==M.version||g!==e.toneMapping)&&(u.material.needsUpdate=!0,f=M,m=M.version,g=e.toneMapping),u.layers.enableAll(),l.unshift(u,u.geometry,u.material,0,0,null))}}}function nr(e,t,n,i){let r=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),s=i.isWebGL2||null!==a,o={},l=p(null),h=l,u=!1;function c(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(e){let t=[],n=[],i=[];for(let e=0;e=0){let n=r[t],i=a[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n||n.attribute!==i||i&&n.data!==i.data)return!0;s++}}return h.attributesNum!==s||h.index!==i}(r,x,d,M))&&function(e,t,n,i){let r={},a=t.attributes,s=0,o=n.getAttributes();for(let t in o){let n=o[t];if(n.location>=0){let n=a[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}}h.attributes=r,h.attributesNum=s,h.index=i}(r,x,d,M)}else{let e=!0===l.wireframe;(h.geometry!==x.id||h.program!==d.id||h.wireframe!==e)&&(h.geometry=x.id,h.program=d.id,h.wireframe=e,y=!0)}null!==M&&n.update(M,e.ELEMENT_ARRAY_BUFFER),(y||u)&&(u=!1,function(r,a,s,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();let l=o.attributes,h=s.getAttributes(),u=a.defaultAttributeValues;for(let t in h){let a=h[t];if(a.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){let t=s.normalized,l=s.itemSize,h=n.get(s);if(void 0===h)continue;let u=h.buffer,c=h.type,d=h.bytesPerElement,p=!0===i.isWebGL2&&(c===e.INT||c===e.UNSIGNED_INT||1013===s.gpuType);if(s.isInterleavedBufferAttribute){let n=s.data,i=n.stride,h=s.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,s=void 0!==n.precision?n.precision:"highp",o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=a||t.has("WEBGL_draw_buffers"),h=!0===n.logarithmicDepthBuffer,u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),_=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,x=a||t.has("OES_texture_float"),M=a?e.getParameter(e.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:v&&x,maxSamples:M}}function no(e){let t=this,n=null,i=0,r=!1,a=!1,s=new t2,o=new A,l={value:null,needsUpdate:!1};function h(e,n,i,r){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){let t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length0),t.numPlanes=i,t.numIntersection=0)}}function nl(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let a=r.mapping;if(303===a||304===a){if(t.has(r)){let e=t.get(r).texture;return n(e,r.mapping)}{let a=r.image;if(!a||!(a.height>0))return null;{let s=new tQ(a.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}}}}return r},dispose:function(){t=new WeakMap}}}let nh=[.125,.215,.35,.446,.526,.582],nu=new class extends tY{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let 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,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}},nc=new ts,nd=null,np=(1+Math.sqrt(5))/2,nf=1/np,nm=[new Z(1,1,1),new Z(-1,1,1),new Z(1,1,-1),new Z(-1,1,-1),new Z(0,np,nf),new Z(0,np,-nf),new Z(nf,0,np),new Z(-nf,0,np),new Z(np,nf,0),new Z(-np,nf,0)];class ng{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){nd=this._renderer.getRenderTarget(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=nM(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=nx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=nh[s-e+4-1]:0===s&&(o=0),i.push(o);let l=1/(a-2),h=-l,u=1+l,c=[h,h,u,h,u,u,h,h,u,u,h,u],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];d.set(i,18*e),p.set(c,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new tS;m.setAttribute("position",new tc(d,3)),m.setAttribute("uv",new tc(p,2)),m.setAttribute("faceIndex",new tc(f,1)),t.push(m),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){let i=new Float32Array(20),r=new Z(0,1,0),a=new tq({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ny(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:0,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return i}_compileMaterial(e){let t=new tH(this._lodPlanes[0],e);this._renderer.compile(t,nu)}_sceneToCubeUV(e,t,n,i){let r=new tJ(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,h=l.autoClear,u=l.toneMapping;l.getClearColor(nc),l.toneMapping=0,l.autoClear=!1;let c=new tl({name:"PMREM.Background",side:a,depthWrite:!1,depthTest:!1}),d=new tH(new tV,c),p=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,p=!0):(c.color.copy(nc),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));let a=this._cubeSize;nv(i,n*a,t>2?a:0,a,a),l.setRenderTarget(i),p&&l.render(d,r),l.render(e,r)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=u,l.autoClear=h,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=nM()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=nx());let r=i?this._cubemapMaterial:this._equirectMaterial,a=new tH(this._lodPlanes[0],r),s=r.uniforms;s.envMap.value=e;let o=this._cubeSize;nv(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,nu)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e_-4?i-_+4:0),M=4*(this._cubeSize-v);nv(t,x,M,3*v,2*v),o.setRenderTarget(t),o.render(h,nu)}}function n_(e,t,n){let i=new q(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function nv(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function nx(){return new tq({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ny(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function nM(){return new tq({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ny(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function ny(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function nS(e){let t=new WeakMap,n=null;function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new ng(e)),i=s?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{let a=r.image;if(!(s&&a&&a.height>0||o&&a&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(a)))return null;{null===n&&(n=new ng(e));let a=s?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,a),r.addEventListener("dispose",i),a.texture}}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function nE(e){let t={};function n(n){let i;if(void 0!==t[n])return t[n];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 t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){let t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function nT(e,t,n,i){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);for(let e in o.morphAttributes){let n=o.morphAttributes[e];for(let e=0,i=n.length;et.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*r),g=new Y(m,p,f,r);g.type=1015,g.needsUpdate=!0;let _=4*d;for(let t=0;t0)return e;let r=t*n,a=nI[r];if(void 0===a&&(a=new Float32Array(r),nI[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function nG(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}}function iC(e){return""!==e}function iL(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).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_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function iP(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let iU=/^[ \t]*#include +<([\w\d./]+)>/gm;function iN(e){return e.replace(iU,iI)}let iD=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function iI(e,t){let n=t9[t];if(void 0===n){let e=iD.get(t);if(void 0!==e)n=t9[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return iN(n)}let iO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function iF(e){return e.replace(iO,iz)}function iz(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(r+="\n"),(a=[S,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E].filter(iC).join("\n")).length>0&&(a+="\n")):(r=[iB(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",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 "+x:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+_:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",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","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(iC).join("\n"),a=[S,iB(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E,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 "+v:"",n.envMap?"#define "+x:"",n.envMap?"#define "+M:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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 "+_:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?t9.tonemapping_pars_fragment:"",0!==n.toneMapping?function(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",t9.colorspace_pars_fragment,function(e,t){let n=function(e){switch(e){case l:return["Linear","( value )"];case o:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(iC).join("\n")),m=iP(m=iL(m=iN(m),n),n),g=iP(g=iL(g=iN(g),n),n),m=iF(m),g=iF(g),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",r="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+r,a=["#define varying in",n.glslVersion===u?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===u?"":"#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"+a);let A=b+r+m,w=b+a+g,R=iA(p,p.VERTEX_SHADER,A),C=iA(p,p.FRAGMENT_SHADER,w);if(p.attachShader(T,R),p.attachShader(T,C),void 0!==n.index0AttributeName?p.bindAttribLocation(T,0,n.index0AttributeName):!0===n.morphTargets&&p.bindAttribLocation(T,0,"position"),p.linkProgram(T),e.debug.checkShaderErrors){let t=p.getProgramInfoLog(T).trim(),n=p.getShaderInfoLog(R).trim(),i=p.getShaderInfoLog(C).trim(),s=!0,o=!0;if(!1===p.getProgramParameter(T,p.LINK_STATUS)){if(s=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(p,T,R,C);else{let e=iR(p,R,"vertex"),n=iR(p,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+p.getError()+" - VALIDATE_STATUS "+p.getProgramParameter(T,p.VALIDATE_STATUS)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):(""===n||""===i)&&(o=!1);o&&(this.diagnostics={runnable:s,programLog:t,vertexShader:{log:n,prefix:r},fragmentShader:{log:i,prefix:a}})}return p.deleteShader(R),p.deleteShader(C),this.getUniforms=function(){return void 0===s&&(s=new ib(p,T)),s},this.getAttributes=function(){return void 0===h&&(h=function(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,Y=o.clearcoat>0,J=o.iridescence>0,Z=o.sheen>0,K=o.transmission>0,Q=q&&!!o.anisotropyMap,$=Y&&!!o.clearcoatMap,ee=Y&&!!o.clearcoatNormalMap,et=Y&&!!o.clearcoatRoughnessMap,en=J&&!!o.iridescenceMap,ei=J&&!!o.iridescenceThicknessMap,er=Z&&!!o.sheenColorMap,ea=Z&&!!o.sheenRoughnessMap,es=!!o.specularMap,eo=!!o.specularColorMap,el=!!o.specularIntensityMap,eh=K&&!!o.transmissionMap,eu=K&&!!o.thicknessMap,ec=!!o.gradientMap,ed=!!o.alphaMap,ep=o.alphaTest>0,ef=!!o.alphaHash,em=!!o.extensions,eg=!!A.attributes.uv1,e_=!!A.attributes.uv2,ev=!!A.attributes.uv3,ex=0;o.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(ex=e.toneMapping);let eM={isWebGL2:p,shaderID:L,shaderType:o.type,shaderName:o.name,vertexShader:y,fragmentShader:S,defines:o.defines,customVertexShaderID:E,customFragmentShaderID:T,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:g,instancing:I,instancingColor:I&&null!==M.instanceColor,supportsVertexTextures:m,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:l,map:O,matcap:F,envMap:z,envMapMode:z&&R.mapping,envMapCubeUVHeight:C,aoMap:B,lightMap:H,bumpMap:G,normalMap:V,displacementMap:m&&k,emissiveMap:W,normalMapObjectSpace:V&&1===o.normalMapType,normalMapTangentSpace:V&&0===o.normalMapType,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:Q,clearcoat:Y,clearcoatMap:$,clearcoatNormalMap:ee,clearcoatRoughnessMap:et,iridescence:J,iridescenceMap:en,iridescenceThicknessMap:ei,sheen:Z,sheenColorMap:er,sheenRoughnessMap:ea,specularMap:es,specularColorMap:eo,specularIntensityMap:el,transmission:K,transmissionMap:eh,thicknessMap:eu,gradientMap:ec,opaque:!1===o.transparent&&1===o.blending,alphaMap:ed,alphaTest:ep,alphaHash:ef,combine:o.combine,mapUv:O&&v(o.map.channel),aoMapUv:B&&v(o.aoMap.channel),lightMapUv:H&&v(o.lightMap.channel),bumpMapUv:G&&v(o.bumpMap.channel),normalMapUv:V&&v(o.normalMap.channel),displacementMapUv:k&&v(o.displacementMap.channel),emissiveMapUv:W&&v(o.emissiveMap.channel),metalnessMapUv:X&&v(o.metalnessMap.channel),roughnessMapUv:j&&v(o.roughnessMap.channel),anisotropyMapUv:Q&&v(o.anisotropyMap.channel),clearcoatMapUv:$&&v(o.clearcoatMap.channel),clearcoatNormalMapUv:ee&&v(o.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&v(o.clearcoatRoughnessMap.channel),iridescenceMapUv:en&&v(o.iridescenceMap.channel),iridescenceThicknessMapUv:ei&&v(o.iridescenceThicknessMap.channel),sheenColorMapUv:er&&v(o.sheenColorMap.channel),sheenRoughnessMapUv:ea&&v(o.sheenRoughnessMap.channel),specularMapUv:es&&v(o.specularMap.channel),specularColorMapUv:eo&&v(o.specularColorMap.channel),specularIntensityMapUv:el&&v(o.specularIntensityMap.channel),transmissionMapUv:eh&&v(o.transmissionMap.channel),thicknessMapUv:eu&&v(o.thicknessMap.channel),alphaMapUv:ed&&v(o.alphaMap.channel),vertexTangents:!!A.attributes.tangent&&(V||q),vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!A.attributes.color&&4===A.attributes.color.itemSize,vertexUv1s:eg,vertexUv2s:e_,vertexUv3s:ev,pointsUvs:!0===M.isPoints&&!!A.attributes.uv&&(O||ed),fog:!!b,useFog:!0===o.fog,fogExp2:b&&b.isFogExp2,flatShading:!0===o.flatShading,sizeAttenuation:!0===o.sizeAttenuation,logarithmicDepthBuffer:f,skinning:!0===M.isSkinnedMesh,morphTargets:void 0!==A.morphAttributes.position,morphNormals:void 0!==A.morphAttributes.normal,morphColors:void 0!==A.morphAttributes.color,morphTargetsCount:U,morphTextureStride:N,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numSpotLightMaps:u.spotLightMap.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numSpotLightShadowsWithMaps:u.numSpotLightShadowsWithMaps,numClippingPlanes:h.numPlanes,numClipIntersection:h.numIntersection,dithering:o.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,useLegacyLights:e._useLegacyLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:o.side===s,flipSided:o.side===a,useDepthPacking:o.depthPacking>=0,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionDerivatives:em&&!0===o.extensions.derivatives,extensionFragDepth:em&&!0===o.extensions.fragDepth,extensionDrawBuffers:em&&!0===o.extensions.drawBuffers,extensionShaderTextureLOD:em&&!0===o.extensions.shaderTextureLOD,rendererExtensionFragDepth:p||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:p||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:p||i.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()};return eM},getProgramCacheKey:function(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n.push(t.precision),n.push(t.outputColorSpace),n.push(t.envMapMode),n.push(t.envMapCubeUVHeight),n.push(t.mapUv),n.push(t.alphaMapUv),n.push(t.lightMapUv),n.push(t.aoMapUv),n.push(t.bumpMapUv),n.push(t.normalMapUv),n.push(t.displacementMapUv),n.push(t.emissiveMapUv),n.push(t.metalnessMapUv),n.push(t.roughnessMapUv),n.push(t.anisotropyMapUv),n.push(t.clearcoatMapUv),n.push(t.clearcoatNormalMapUv),n.push(t.clearcoatRoughnessMapUv),n.push(t.iridescenceMapUv),n.push(t.iridescenceThicknessMapUv),n.push(t.sheenColorMapUv),n.push(t.sheenRoughnessMapUv),n.push(t.specularMapUv),n.push(t.specularColorMapUv),n.push(t.specularIntensityMapUv),n.push(t.transmissionMapUv),n.push(t.thicknessMapUv),n.push(t.combine),n.push(t.fogExp2),n.push(t.sizeAttenuation),n.push(t.morphTargetsCount),n.push(t.morphAttributeCount),n.push(t.numDirLights),n.push(t.numPointLights),n.push(t.numSpotLights),n.push(t.numSpotLightMaps),n.push(t.numHemiLights),n.push(t.numRectAreaLights),n.push(t.numDirLightShadows),n.push(t.numPointLightShadows),n.push(t.numSpotLightShadows),n.push(t.numSpotLightShadowsWithMaps),n.push(t.shadowMapType),n.push(t.toneMapping),n.push(t.numClippingPlanes),n.push(t.numClipIntersection),n.push(t.depthPacking),u.disableAll(),t.isWebGL2&&u.enable(0),t.supportsVertexTextures&&u.enable(1),t.instancing&&u.enable(2),t.instancingColor&&u.enable(3),t.matcap&&u.enable(4),t.envMap&&u.enable(5),t.normalMapObjectSpace&&u.enable(6),t.normalMapTangentSpace&&u.enable(7),t.clearcoat&&u.enable(8),t.iridescence&&u.enable(9),t.alphaTest&&u.enable(10),t.vertexColors&&u.enable(11),t.vertexAlphas&&u.enable(12),t.vertexUv1s&&u.enable(13),t.vertexUv2s&&u.enable(14),t.vertexUv3s&&u.enable(15),t.vertexTangents&&u.enable(16),t.anisotropy&&u.enable(17),n.push(u.mask),u.disableAll(),t.fog&&u.enable(0),t.useFog&&u.enable(1),t.flatShading&&u.enable(2),t.logarithmicDepthBuffer&&u.enable(3),t.skinning&&u.enable(4),t.morphTargets&&u.enable(5),t.morphNormals&&u.enable(6),t.morphColors&&u.enable(7),t.premultipliedAlpha&&u.enable(8),t.shadowMapEnabled&&u.enable(9),t.useLegacyLights&&u.enable(10),t.doubleSided&&u.enable(11),t.flipSided&&u.enable(12),t.useDepthPacking&&u.enable(13),t.dithering&&u.enable(14),t.transmission&&u.enable(15),t.sheen&&u.enable(16),t.opaque&&u.enable(17),t.pointsUvs&&u.enable(18),n.push(u.mask),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){let t;let n=_[e.type];if(n){let e=nt[n];t=tj.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let i;for(let e=0,t=d.length;e0?i.push(u):!0===s.transparent?r.push(u):n.push(u)},unshift:function(e,t,s,o,l,h){let u=a(e,t,s,o,l,h);s.transmission>0?i.unshift(u):!0===s.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||ij),i.length>1&&i.sort(t||iq),r.length>1&&r.sort(t||iq)}}}function iJ(){let e=new WeakMap;return{get:function(t,n){let i;let r=e.get(t);return void 0===r?(i=new iY,e.set(t,[i])):n>=r.length?(i=new iY,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function iZ(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new Z,color:new ts};break;case"SpotLight":n={position:new Z,direction:new Z,color:new ts,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Z,color:new ts,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Z,skyColor:new ts,groundColor:new ts};break;case"RectAreaLight":n={color:new ts,position:new Z,halfWidth:new Z,halfHeight:new Z}}return e[t.id]=n,n}}}let iK=0;function iQ(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function i$(e,t){let n=new iZ,i=function(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new b};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new b,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,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)r.probe.push(new Z);let a=new Z,s=new eA,o=new eA;return{setup:function(a,s){let o=0,l=0,h=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let u=0,c=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,x=0;a.sort(iQ);let M=!0===s?Math.PI:1;for(let e=0,t=a.length;e0&&(t.isWebGL2?(r.rectAreaLTC1=ne.LTC_FLOAT_1,r.rectAreaLTC2=ne.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=ne.LTC_FLOAT_1,r.rectAreaLTC2=ne.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=ne.LTC_HALF_1,r.rectAreaLTC2=ne.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;let y=r.hash;(y.directionalLength!==u||y.pointLength!==c||y.spotLength!==d||y.rectAreaLength!==p||y.hemiLength!==f||y.numDirectionalShadows!==m||y.numPointShadows!==g||y.numSpotShadows!==_||y.numSpotMaps!==v)&&(r.directional.length=u,r.spot.length=d,r.rectArea.length=p,r.point.length=c,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=_+v-x,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=x,y.directionalLength=u,y.pointLength=c,y.spotLength=d,y.rectAreaLength=p,y.hemiLength=f,y.numDirectionalShadows=m,y.numPointShadows=g,y.numSpotShadows=_,y.numSpotMaps=v,r.version=iK++)},setupView:function(e,t){let n=0,i=0,l=0,h=0,u=0,c=t.matrixWorldInverse;for(let t=0,d=e.length;t=s.length?(a=new i0(e,t),s.push(a)):a=s[r],a},dispose:function(){n=new WeakMap}}}class i2 extends tt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}class i3 extends tt{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function i4(e,t,n){let i=new t5,o=new b,l=new b,h=new X,u=new i2({depthPacking:3201}),c=new i3,d={},p=n.maxTextureSize,f={[r]:a,[a]:r,[s]:s},m=new tq({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new b},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 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, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),g=m.clone();g.defines.HORIZONTAL_PASS=1;let _=new tS;_.setAttribute("position",new tc(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new tH(_,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let M=this.type;function y(t,n,i,r){let a=null,s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?c:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){let e=a.uuid,t=n.uuid,i=d[e];void 0===i&&(i={},d[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,3===r?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){let t=e.properties.get(a);t.light=i}return a}this.render=function(n,r,a){if(!1===x.enabled||!1===x.autoUpdate&&!1===x.needsUpdate||0===n.length)return;let s=e.getRenderTarget(),u=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);let f=3!==M&&3===this.type,_=3===M&&3!==this.type;for(let s=0,u=n.length;sp||o.y>p)&&(o.x>p&&(l.x=Math.floor(p/x.x),o.x=l.x*x.x,c.mapSize.x=l.x),o.y>p&&(l.y=Math.floor(p/x.y),o.y=l.y*x.y,c.mapSize.y=l.y)),null===c.map||!0===f||!0===_){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};null!==c.map&&c.map.dispose(),c.map=new q(o.x,o.y,e),c.map.texture.name=u.name+".shadowMap",c.camera.updateProjectionMatrix()}e.setRenderTarget(c.map),e.clear();let M=c.getViewportCount();for(let n=0;n=1:-1!==U.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(U)[1])>=2);let N=null,D={},I=e.getParameter(e.SCISSOR_BOX),O=e.getParameter(e.VIEWPORT),F=new X().fromArray(I),z=new X().fromArray(O);function B(t,n,r,a){let s=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;oi||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){let i=t?y:Math.floor,a=i(r*e.width),s=i(r*e.height);void 0===h&&(h=S(a,s));let o=n?S(a,s):h;o.width=a,o.height=s;let l=o.getContext("2d");return l.drawImage(e,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+s+")."),o}"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function T(e){return M(e.width)&&M(e.height)}function b(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function A(t){e.generateMipmap(t)}function w(n,i,r,a,s=!1){if(!1===u)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+"'")}let l=i;return i===e.RED&&(r===e.FLOAT&&(l=e.R32F),r===e.HALF_FLOAT&&(l=e.R16F),r===e.UNSIGNED_BYTE&&(l=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(l=e.R8UI),r===e.UNSIGNED_SHORT&&(l=e.R16UI),r===e.UNSIGNED_INT&&(l=e.R32UI),r===e.BYTE&&(l=e.R8I),r===e.SHORT&&(l=e.R16I),r===e.INT&&(l=e.R32I)),i===e.RG&&(r===e.FLOAT&&(l=e.RG32F),r===e.HALF_FLOAT&&(l=e.RG16F),r===e.UNSIGNED_BYTE&&(l=e.RG8)),i===e.RGBA&&(r===e.FLOAT&&(l=e.RGBA32F),r===e.HALF_FLOAT&&(l=e.RGBA16F),r===e.UNSIGNED_BYTE&&(l=a===o&&!1===s?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)),(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get("EXT_color_buffer_float"),l}function R(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function L(t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function P(e){let t=e.target;t.removeEventListener("dispose",P),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let n=e.source,r=v.get(n);if(r){let i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&N(e),0===Object.keys(r).length&&v.delete(n)}i.remove(e)}(t),t.isVideoTexture&&_.delete(t)}function U(t){let n=t.target;n.removeEventListener("dispose",U),function(t){let n=t.texture,r=i.get(t),a=i.get(n);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(r.__webglFramebuffer[t]))for(let n=0;n0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{V(a,t,r);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}let O={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},F={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},z={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function H(n,a,s){if(s?(e.texParameteri(n,e.TEXTURE_WRAP_S,O[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,O[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,O[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,F[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,F[a.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),(1001!==a.wrapS||1001!==a.wrapT)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,L(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,L(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,z[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){let s=t.get("EXT_texture_filter_anisotropic");1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==u||1016!==a.type||!1!==t.has("OES_texture_half_float_linear"))&&(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function G(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",P));let r=n.source,a=v.get(r);void 0===a&&(a={},v.set(r,a));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;let r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&N(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function V(t,r,s){let o=e.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(o=e.TEXTURE_2D_ARRAY),r.isData3DTexture&&(o=e.TEXTURE_3D);let l=G(t,r),h=r.source;n.bindTexture(o,t.__webglTexture,e.TEXTURE0+s);let c=i.get(h);if(h.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);let i=!u&&(1001!==r.wrapS||1001!==r.wrapT||1003!==r.minFilter&&1006!==r.minFilter)&&!1===T(r.image),d=E(r.image,i,!1,p);d=Y(r,d);let f=T(d)||u,m=a.convert(r.format,r.colorSpace),g=a.convert(r.type),_=w(r.internalFormat,m,g,r.colorSpace);H(o,r,f);let v=r.mipmaps,x=u&&!0!==r.isVideoTexture,M=void 0===c.__version||!0===l,y=R(r,d,f);if(r.isDepthTexture)_=e.DEPTH_COMPONENT,u?_=1015===r.type?e.DEPTH_COMPONENT32F:1014===r.type?e.DEPTH_COMPONENT24:1020===r.type?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&_===e.DEPTH_COMPONENT&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1014,g=a.convert(r.type)),1027===r.format&&_===e.DEPTH_COMPONENT&&(_=e.DEPTH_STENCIL,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,g=a.convert(r.type))),M&&(x?n.texStorage2D(e.TEXTURE_2D,1,_,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,_,d.width,d.height,0,m,g,null));else if(r.isDataTexture){if(v.length>0&&f){x&&M&&n.texStorage2D(e.TEXTURE_2D,y,_,v[0].width,v[0].height);for(let i=0,r=v.length;i>=1,i>>=1}}}else if(v.length>0&&f){x&&M&&n.texStorage2D(e.TEXTURE_2D,y,_,v[0].width,v[0].height);for(let i=0,r=v.length;i>h),i=Math.max(1,r.height>>h);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,h,d,t,i,r.depth,0,u,c,null):n.texImage2D(l,h,d,t,i,0,u,c,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),q(r)?m.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,l,i.get(s).__webglTexture,0,j(r)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,l,i.get(s).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function W(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){let r=e.DEPTH_COMPONENT16;if(i||q(n)){let t=n.depthTexture;t&&t.isDepthTexture&&(1015===t.type?r=e.DEPTH_COMPONENT32F:1014===t.type&&(r=e.DEPTH_COMPONENT24));let i=j(n);q(n)?m.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,i,r,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,i,r,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){let r=j(n);i&&!1===q(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,n.width,n.height):q(n)?m.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{let t=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function Y(e,n){let i=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||1035===e.format||i!==l&&""!==i&&(i===o?!1===u?!0===t.has("EXT_sRGB")&&1023===r?(e.format=1035,e.minFilter=1006,e.generateMipmaps=!1):n=B.sRGBToLinear(n):(1023!==r||1009!==a)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){let e=D;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),D+=1,e},this.resetTextureUnits=function(){D=0},this.setTexture2D=I,this.setTexture2DArray=function(t,r){let a=i.get(t);if(t.version>0&&a.__version!==t.version){V(a,t,r);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){let a=i.get(t);if(t.version>0&&a.__version!==t.version){V(a,t,r);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,r){let s=i.get(t);if(t.version>0&&s.__version!==t.version){(function(t,r,s){if(6!==r.image.length)return;let o=G(t,r),l=r.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);let h=i.get(l);if(l.version!==h.__version||!0===o){let t;n.activeTexture(e.TEXTURE0+s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);let i=r.isCompressedTexture||r.image[0].isCompressedTexture,c=r.image[0]&&r.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)i||c?p[e]=c?r.image[e].image:r.image[e]:p[e]=E(r.image[e],!1,!0,d),p[e]=Y(r,p[e]);let f=p[0],m=T(f)||u,g=a.convert(r.format,r.colorSpace),_=a.convert(r.type),v=w(r.internalFormat,g,_,r.colorSpace),x=u&&!0!==r.isVideoTexture,M=void 0===h.__version||!0===o,y=R(r,f,m);if(H(e.TEXTURE_CUBE_MAP,r,m),i){x&&M&&n.texStorage2D(e.TEXTURE_CUBE_MAP,y,v,f.width,f.height);for(let i=0;i<6;i++){t=p[i].mipmaps;for(let a=0;a0&&y++,n.texStorage2D(e.TEXTURE_CUBE_MAP,y,v,p[0].width,p[0].height));for(let i=0;i<6;i++)if(c){x?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,p[i].width,p[i].height,g,_,p[i].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,v,p[i].width,p[i].height,0,g,_,p[i].data);for(let r=0;r0){l.__webglFramebuffer[t]=[];for(let n=0;n0){l.__webglFramebuffer=[];for(let t=0;t0&&!1===q(t)){let i=d?o:[o];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0&&!1===q(t)){let r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=[],h=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=i.get(t),c=!0===t.isWebGLMultipleRenderTargets;if(c)for(let t=0;t.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(re)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new i9;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class rn extends W{constructor(e,t,n,i,r,a,s,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===h&&(n=1014),void 0===n&&1027===h&&(n=1020),super(null,i,r,a,s,o,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class ri extends c{constructor(e,t){super();let n=this,i=null,r=1,a=null,s="local-floor",o=1,l=null,h=null,u=null,c=null,d=null,p=null,f=t.getContextAttributes(),g=null,_=null,v=[],x=[],M=new tJ;M.layers.enable(1),M.viewport=new X;let y=new tJ;y.layers.enable(2),y.viewport=new X;let S=[M,y],E=new i8;E.layers.enable(1),E.layers.enable(2);let T=null,b=null;function A(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let n=v[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function w(){i.removeEventListener("select",A),i.removeEventListener("selectstart",A),i.removeEventListener("selectend",A),i.removeEventListener("squeeze",A),i.removeEventListener("squeezestart",A),i.removeEventListener("squeezeend",A),i.removeEventListener("end",w),i.removeEventListener("inputsourceschange",R);for(let e=0;e=0&&(x[i]=null,v[i].disconnect(n))}for(let t=0;t=x.length){x.push(n),i=e;break}if(null===x[e]){x[e]=n,i=e;break}}if(-1===i)break}let r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new rt,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new rt,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new rt,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==c?c:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(h){if(null!==(i=h)){if(g=e.getRenderTarget(),i.addEventListener("select",A),i.addEventListener("selectstart",A),i.addEventListener("selectend",A),i.addEventListener("squeeze",A),i.addEventListener("squeezestart",A),i.addEventListener("squeezeend",A),i.addEventListener("end",w),i.addEventListener("inputsourceschange",R),!0!==f.xrCompatible&&await t.makeXRCompatible(),void 0===i.renderState.layers||!1===e.capabilities.isWebGL2){let n={antialias:void 0!==i.renderState.layers||f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),_=new q(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let n=null,a=null,s=null;f.depth&&(s=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?1027:1026,a=f.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};c=(u=new XRWebGLBinding(i,t)).createProjectionLayer(o),i.updateRenderState({layers:[c]}),_=new q(c.textureWidth,c.textureHeight,{format:1023,type:1009,depthTexture:new rn(c.textureWidth,c.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0});let l=e.properties.get(_);l.__ignoreDepthValues=c.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),N.setContext(i),N.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode};let C=new Z,L=new Z;function P(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;E.near=y.near=M.near=e.near,E.far=y.far=M.far=e.far,(T!==E.near||b!==E.far)&&(i.updateRenderState({depthNear:E.near,depthFar:E.far}),T=E.near,b=E.far);let t=e.parent,n=E.cameras;P(E,t);for(let e=0;e0&&(i.alphaTest.value=r.alphaTest);let s=t.get(r).envMap;if(s&&(i.envMap.value=s,i.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;let t=!0===e._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*t,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,tX(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,o,l){r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),r.gradientMap&&(e.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?(i(e,r),e.specular.value.copy(r.specular),e.shininess.value=Math.max(r.shininess,1e-4)):r.isMeshStandardMaterial?(i(e,r),function(e,i){e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,e.metalnessMapTransform)),e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,e.roughnessMapTransform));let r=t.get(i).envMap;r&&(e.envMapIntensity.value=i.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&(e.ior.value=r.ior,r.sheen>0&&(e.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen),e.sheenRoughness.value=r.sheenRoughness,r.sheenColorMap&&(e.sheenColorMap.value=r.sheenColorMap,n(r.sheenColorMap,e.sheenColorMapTransform)),r.sheenRoughnessMap&&(e.sheenRoughnessMap.value=r.sheenRoughnessMap,n(r.sheenRoughnessMap,e.sheenRoughnessMapTransform))),r.clearcoat>0&&(e.clearcoat.value=r.clearcoat,e.clearcoatRoughness.value=r.clearcoatRoughness,r.clearcoatMap&&(e.clearcoatMap.value=r.clearcoatMap,n(r.clearcoatMap,e.clearcoatMapTransform)),r.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=r.clearcoatRoughnessMap,n(r.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),r.clearcoatNormalMap&&(e.clearcoatNormalMap.value=r.clearcoatNormalMap,n(r.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(r.clearcoatNormalScale),r.side===a&&e.clearcoatNormalScale.value.negate())),r.iridescence>0&&(e.iridescence.value=r.iridescence,e.iridescenceIOR.value=r.iridescenceIOR,e.iridescenceThicknessMinimum.value=r.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=r.iridescenceThicknessRange[1],r.iridescenceMap&&(e.iridescenceMap.value=r.iridescenceMap,n(r.iridescenceMap,e.iridescenceMapTransform)),r.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=r.iridescenceThicknessMap,n(r.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),r.transmission>0&&(e.transmission.value=r.transmission,e.transmissionSamplerMap.value=l.texture,e.transmissionSamplerSize.value.set(l.width,l.height),r.transmissionMap&&(e.transmissionMap.value=r.transmissionMap,n(r.transmissionMap,e.transmissionMapTransform)),e.thickness.value=r.thickness,r.thicknessMap&&(e.thicknessMap.value=r.thicknessMap,n(r.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=r.attenuationDistance,e.attenuationColor.value.copy(r.attenuationColor)),r.anisotropy>0&&(e.anisotropyVector.value.set(r.anisotropy*Math.cos(r.anisotropyRotation),r.anisotropy*Math.sin(r.anisotropyRotation)),r.anisotropyMap&&(e.anisotropyMap.value=r.anisotropyMap,n(r.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=r.specularIntensity,e.specularColor.value.copy(r.specularColor),r.specularColorMap&&(e.specularColorMap.value=r.specularColorMap,n(r.specularColorMap,e.specularColorMapTransform)),r.specularIntensityMap&&(e.specularIntensityMap.value=r.specularIntensityMap,n(r.specularIntensityMap,e.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(i(e,r),r.matcap&&(e.matcap.value=r.matcap)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){let i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.isLineDashedMaterial&&(e.dashSize.value=r.dashSize,e.totalSize.value=r.dashSize+r.gapSize,e.scale.value=r.scale)):r.isPointsMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.size.value=r.size*s,e.scale.value=.5*o,r.map&&(e.map.value=r.map,n(r.map,e.uvTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isSpriteMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.rotation.value=r.rotation,r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ra(e,t,n,i){let r={},a={},s=[],o=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let n=t.target;n.removeEventListener("dispose",h);let i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;i.uniformBlockBinding(e,n)},update:function(n,u){let c=r[n.id];void 0===c&&(function(e){let t=e.uniforms,n=0,i=0;for(let e=0,r=t.length;e0){i=n%16;let e=16-i;0!==i&&e-a.boundary<0&&(n+=16-i,r.__offset=n)}n+=a.storage}(i=n%16)>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),c=function(t){let n=function(){for(let e=0;ea.matrixWorld.determinant(),_=function(e,t,n,r,a){var s;!0!==t.isScene&&(t=ew),d.resetTextureUnits();let o=t.fog,u=r.isMeshStandardMaterial?t.environment:null,m=null===ei?$.outputColorSpace:!0===ei.isXRRenderTarget?ei.texture.colorSpace:l,g=(r.isMeshStandardMaterial?f:p).get(r.envMap||u),_=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,v=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),M=!!n.morphAttributes.position,y=!!n.morphAttributes.normal,S=!!n.morphAttributes.color,T=0;r.toneMapped&&(null===ei||!0===ei.isXRRenderTarget)&&(T=$.toneMapping);let b=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,A=void 0!==b?b.length:0,R=c.get(r),C=J.state.lights;if(!0===eM&&(!0===ey||e!==ea)){let t=e===ea&&r.id===er;E.setState(r,e,t)}let L=!1;r.version===R.__version?R.needsLights&&R.lightsStateVersion!==C.state.version?L=!0:R.outputColorSpace!==m?L=!0:a.isInstancedMesh&&!1===R.instancing?L=!0:a.isInstancedMesh||!0!==R.instancing?a.isSkinnedMesh&&!1===R.skinning?L=!0:a.isSkinnedMesh||!0!==R.skinning?a.isInstancedMesh&&!0===R.instancingColor&&null===a.instanceColor?L=!0:a.isInstancedMesh&&!1===R.instancingColor&&null!==a.instanceColor?L=!0:R.envMap!==g?L=!0:!0===r.fog&&R.fog!==o?L=!0:void 0!==R.numClippingPlanes&&(R.numClippingPlanes!==E.numPlanes||R.numIntersection!==E.numIntersection)?L=!0:R.vertexAlphas!==_?L=!0:R.vertexTangents!==v?L=!0:R.morphTargets!==M?L=!0:R.morphNormals!==y?L=!0:R.morphColors!==S?L=!0:R.toneMapping!==T?L=!0:!0===i.isWebGL2&&R.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:(L=!0,R.__version=r.version);let P=R.currentProgram;!0===L&&(P=eW(r,t,a));let U=!1,D=!1,I=!1,O=P.getUniforms(),F=R.uniforms;if(h.useProgram(P.program)&&(U=!0,D=!0,I=!0),r.id!==er&&(er=r.id,D=!0),U||ea!==e){if(O.setValue(eC,"projectionMatrix",e.projectionMatrix),i.logarithmicDepthBuffer&&O.setValue(eC,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),ea!==e&&(ea=e,D=!0,I=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){let t=O.map.cameraPosition;void 0!==t&&t.setValue(eC,eb.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(eC,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||a.isSkinnedMesh)&&O.setValue(eC,"viewMatrix",e.matrixWorldInverse)}if(a.isSkinnedMesh){O.setOptional(eC,a,"bindMatrix"),O.setOptional(eC,a,"bindMatrixInverse");let e=a.skeleton;e&&(i.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eC,"boneTexture",e.boneTexture,d),O.setValue(eC,"boneTextureSize",e.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let z=n.morphAttributes;if((void 0!==z.position||void 0!==z.normal||void 0!==z.color&&!0===i.isWebGL2)&&w.update(a,n,P),(D||R.receiveShadow!==a.receiveShadow)&&(R.receiveShadow=a.receiveShadow,O.setValue(eC,"receiveShadow",a.receiveShadow)),r.isMeshGouraudMaterial&&null!==r.envMap&&(F.envMap.value=g,F.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1),D&&(O.setValue(eC,"toneMappingExposure",$.toneMappingExposure),R.needsLights&&(s=I,F.ambientLightColor.needsUpdate=s,F.lightProbe.needsUpdate=s,F.directionalLights.needsUpdate=s,F.directionalLightShadows.needsUpdate=s,F.pointLights.needsUpdate=s,F.pointLightShadows.needsUpdate=s,F.spotLights.needsUpdate=s,F.spotLightShadows.needsUpdate=s,F.rectAreaLights.needsUpdate=s,F.hemisphereLights.needsUpdate=s),o&&!0===r.fog&&x.refreshFogUniforms(F,o),x.refreshMaterialUniforms(F,r,ep,ed,eS),ib.upload(eC,R.uniformsList,F,d)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(ib.upload(eC,R.uniformsList,F,d),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(eC,"center",a.center),O.setValue(eC,"modelViewMatrix",a.modelViewMatrix),O.setValue(eC,"normalMatrix",a.normalMatrix),O.setValue(eC,"modelMatrix",a.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&function(e,t,r,o){let l=i.isWebGL2;null===eS&&(eS=new q(1,1,{generateMipmaps:!0,type:n.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:l?4:0})),$.getDrawingBufferSize(eT),l?eS.setSize(eT.x,eT.y):eS.setSize(y(eT.x),y(eT.y));let h=$.getRenderTarget();$.setRenderTarget(eS),$.getClearColor(eh),(eu=$.getClearAlpha())<1&&$.setClearColor(16777215,.5),$.clear();let u=$.toneMapping;$.toneMapping=0,eV(e,r,o),d.updateMultisampleRenderTarget(eS),d.updateRenderTargetMipmap(eS);let c=!1;for(let e=0,n=t.length;e0&&eV(l,t,r),u.length>0&&eV(u,t,r),c.length>0&&eV(c,t,r),h.buffers.depth.setTest(!0),h.buffers.depth.setMask(!0),h.buffers.color.setMask(!0),h.setPolygonOffset(!1)}function eV(e,t,n){let i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r0?Q[Q.length-1]:null,K.pop(),Y=K.length>0?K[K.length-1]:null},this.getActiveCubeFace=function(){return et},this.getActiveMipmapLevel=function(){return en},this.getRenderTarget=function(){return ei},this.setRenderTargetTextures=function(e,t,i){c.get(e.texture).__webglTexture=t,c.get(e.depthTexture).__webglTexture=i;let r=c.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===i,r.__autoAllocateDepthBuffer||!0!==n.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let n=c.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){ei=e,et=t,en=n;let r=!0,a=null,s=!1,o=!1;if(e){let l=c.get(e);void 0!==l.__useDefaultFramebuffer?(h.bindFramebuffer(eC.FRAMEBUFFER,null),r=!1):void 0===l.__webglFramebuffer?d.setupRenderTarget(e):l.__hasExternalTextures&&d.rebindTextures(e,c.get(e.texture).__webglTexture,c.get(e.depthTexture).__webglTexture);let u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(o=!0);let p=c.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(p[t])?p[t][n]:p[t],s=!0):a=i.isWebGL2&&e.samples>0&&!1===d.useMultisampledRTT(e)?c.get(e).__webglMultisampledFramebuffer:Array.isArray(p)?p[n]:p,es.copy(e.viewport),eo.copy(e.scissor),el=e.scissorTest}else es.copy(eg).multiplyScalar(ep).floor(),eo.copy(e_).multiplyScalar(ep).floor(),el=ev;let l=h.bindFramebuffer(eC.FRAMEBUFFER,a);if(l&&i.drawBuffers&&r&&h.drawBuffers(e,a),h.viewport(es),h.scissor(eo),h.setScissorTest(el),s){let i=c.get(e.texture);eC.framebufferTexture2D(eC.FRAMEBUFFER,eC.COLOR_ATTACHMENT0,eC.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){let i=c.get(e.texture),r=t||0;eC.framebufferTextureLayer(eC.FRAMEBUFFER,eC.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}er=-1},this.readRenderTargetPixels=function(e,t,r,a,s,o,l){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let u=c.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==l&&(u=u[l]),u){h.bindFramebuffer(eC.FRAMEBUFFER,u);try{let l=e.texture,h=l.format,u=l.type;if(1023!==h&&P.convert(h)!==eC.getParameter(eC.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let c=1016===u&&(n.has("EXT_color_buffer_half_float")||i.isWebGL2&&n.has("EXT_color_buffer_float"));if(1009!==u&&P.convert(u)!==eC.getParameter(eC.IMPLEMENTATION_COLOR_READ_TYPE)&&!(1015===u&&(i.isWebGL2||n.has("OES_texture_float")||n.has("WEBGL_color_buffer_float")))&&!c){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-a&&r>=0&&r<=e.height-s&&eC.readPixels(t,r,a,s,P.convert(h),P.convert(u),o)}finally{let e=null!==ei?c.get(ei).__webglFramebuffer:null;h.bindFramebuffer(eC.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){let i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i);d.setTexture2D(t,0),eC.copyTexSubImage2D(eC.TEXTURE_2D,n,0,0,e.x,e.y,r,a),h.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){let r=t.image.width,a=t.image.height,s=P.convert(n.format),o=P.convert(n.type);d.setTexture2D(n,0),eC.pixelStorei(eC.UNPACK_FLIP_Y_WEBGL,n.flipY),eC.pixelStorei(eC.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eC.pixelStorei(eC.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?eC.texSubImage2D(eC.TEXTURE_2D,i,e.x,e.y,r,a,s,o,t.image.data):t.isCompressedTexture?eC.compressedTexSubImage2D(eC.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):eC.texSubImage2D(eC.TEXTURE_2D,i,e.x,e.y,s,o,t.image),0===i&&n.generateMipmaps&&eC.generateMipmap(eC.TEXTURE_2D),h.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){let a;if($.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=P.convert(i.format),c=P.convert(i.type);if(i.isData3DTexture)d.setTexture3D(i,0),a=eC.TEXTURE_3D;else if(i.isDataArrayTexture)d.setTexture2DArray(i,0),a=eC.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}eC.pixelStorei(eC.UNPACK_FLIP_Y_WEBGL,i.flipY),eC.pixelStorei(eC.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),eC.pixelStorei(eC.UNPACK_ALIGNMENT,i.unpackAlignment);let p=eC.getParameter(eC.UNPACK_ROW_LENGTH),f=eC.getParameter(eC.UNPACK_IMAGE_HEIGHT),m=eC.getParameter(eC.UNPACK_SKIP_PIXELS),g=eC.getParameter(eC.UNPACK_SKIP_ROWS),_=eC.getParameter(eC.UNPACK_SKIP_IMAGES),v=n.isCompressedTexture?n.mipmaps[0]:n.image;eC.pixelStorei(eC.UNPACK_ROW_LENGTH,v.width),eC.pixelStorei(eC.UNPACK_IMAGE_HEIGHT,v.height),eC.pixelStorei(eC.UNPACK_SKIP_PIXELS,e.min.x),eC.pixelStorei(eC.UNPACK_SKIP_ROWS,e.min.y),eC.pixelStorei(eC.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?eC.texSubImage3D(a,r,t.x,t.y,t.z,s,o,l,u,c,v.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),eC.compressedTexSubImage3D(a,r,t.x,t.y,t.z,s,o,l,u,v.data)):eC.texSubImage3D(a,r,t.x,t.y,t.z,s,o,l,u,c,v),eC.pixelStorei(eC.UNPACK_ROW_LENGTH,p),eC.pixelStorei(eC.UNPACK_IMAGE_HEIGHT,f),eC.pixelStorei(eC.UNPACK_SKIP_PIXELS,m),eC.pixelStorei(eC.UNPACK_SKIP_ROWS,g),eC.pixelStorei(eC.UNPACK_SKIP_IMAGES,_),0===r&&i.generateMipmaps&&eC.generateMipmap(a),h.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?d.setTextureCube(e,0):e.isData3DTexture?d.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?d.setTexture2DArray(e,0):d.setTexture2D(e,0),h.unbindTexture()},this.resetState=function(){et=0,en=0,ei=null,h.reset(),U.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===o?3001:3e3}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=3001===e?o:l}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}(class extends rs{}).prototype.isWebGL1Renderer=!0;class ro{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(n=this.getPoint(a/e)).distanceTo(i)),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n;let i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=i[r=Math.floor(s+(o-s)/2)]-n)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(i[r=o]===n)return r/(a-1);let h=i[r],u=i[r+1],c=(r+(n-h)/(u-h))/(a-1);return c}getTangent(e,t){let n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);let r=this.getPoint(n),a=this.getPoint(i),s=t||(r.isVector2?new b:new Z);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new Z,i=[],r=[],a=[],s=new Z,o=new eA;for(let t=0;t<=e;t++){let n=t/e;i[t]=this.getTangentAt(n,new Z)}r[0]=new Z,a[0]=new Z;let l=Number.MAX_VALUE,h=Math.abs(i[0].x),u=Math.abs(i[0].y),c=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),c<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(_(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(_(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class rl extends ro{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t){let n=t||new b,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;rn.length-2?n.length-1:r+1],h=n[r>n.length-3?n.length-1:r+2];return t.set(rf(a,s.x,o.x,l.x,h.x),rf(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?n=r[(o-1)%a]:(ru.subVectors(r[0],r[1]).add(r[0]),n=ru);let h=r[o%a],u=r[(o+1)%a];if(this.closed||o+2=n){let e=i[r]-n,a=this.curves[r],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class rb extends tS{constructor(e=[new b(0,-.5),new b(.5,0),new b(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=_(i,0,2*Math.PI);let r=[],a=[],s=[],o=[],l=[],h=1/t,u=new Z,c=new b,d=new Z,p=new Z,f=new Z,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){let d=n+r*h*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*f,a.push(u.x,u.y,u.z),c.x=r/t,c.y=n/(e.length-1),s.push(c.x,c.y);let i=o[3*n+0]*p,h=o[3*n+1],d=o[3*n+0]*f;l.push(i,h,d)}}for(let n=0;n0&&_(!0),t>0&&_(!1)),this.setIndex(h),this.setAttribute("position",new tf(u,3)),this.setAttribute("normal",new tf(c,3)),this.setAttribute("uv",new tf(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rR(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rC extends rR{constructor(e=1,t=1,n=32,i=1,r=!1,a=0,s=2*Math.PI){super(0,e,t,n,i,r,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(e){return new rC(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rL extends tS{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};let r=[],a=[];function s(e){r.push(e.x,e.y,e.z)}function o(t,n){let i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function l(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new Z,i=new Z,r=new Z;for(let a=0;a.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new tf(r,3)),this.setAttribute("normal",new tf(r.slice(),3)),this.setAttribute("uv",new tf(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rL(e.vertices,e.indices,e.radius,e.details)}}class rP extends rL{constructor(e=1,t=0){let 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];super(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="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rP(e.radius,e.detail)}}class rU extends rT{constructor(e){super(e),this.uuid=g(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n=n.next.y&&n.next.y!==n.y){let e=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=a&&e>i&&(i=e,r=n.x=n.x&&n.x>=l&&a!==n.x&&rz(sr.x||n.x===r.x&&(d=r,p=n,0>rB(d.prev,d,p.prev)&&0>rB(p.next,d,d.next))))&&(r=n,u=c)),n=n.next}while(n!==o)return r}(e,t);if(!n)return t;let i=rX(n,e);return rI(i,i.next),rI(n,n.next)}(h[r],n);return n}(e,t,d,n)),e.length>80*n){i=a=e[0],r=s=e[1];for(let t=n;ta&&(a=o),l>s&&(s=l);h=0!==(h=Math.max(a-i,s-r))?32767/h:0}return function e(t,n,i,r,a,s,o){if(!t)return;!o&&s&&function(e,t,n,i){let r=e;do 0===r.z&&(r.z=rF(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){let t,n,i,r,a,s,o,l,h=1;do{for(n=e,e=null,a=null,s=0;n;){for(s++,i=n,o=0,t=0;t0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,h*=2}while(s>1)}(r)}(t,r,a,s);let l=t,h,u;for(;t.prev!==t.next;){if(h=t.prev,u=t.next,s?function(e,t,n,i){let r=e.prev,a=e.next;if(rB(r,e,a)>=0)return!1;let s=r.x,o=e.x,l=a.x,h=r.y,u=e.y,c=a.y,d=so?s>l?s:l:o>l?o:l,m=h>u?h>c?h:c:u>c?u:c,g=rF(d,p,t,n,i),_=rF(f,m,t,n,i),v=e.prevZ,x=e.nextZ;for(;v&&v.z>=g&&x&&x.z<=_;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==a&&rz(s,h,o,u,l,c,v.x,v.y)&&rB(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==r&&x!==a&&rz(s,h,o,u,l,c,x.x,x.y)&&rB(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==a&&rz(s,h,o,u,l,c,v.x,v.y)&&rB(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==r&&x!==a&&rz(s,h,o,u,l,c,x.x,x.y)&&rB(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}(t,r,a,s):function(e){let t=e.prev,n=e.next;if(rB(t,e,n)>=0)return!1;let i=t.x,r=e.x,a=n.x,s=t.y,o=e.y,l=n.y,h=ir?i>a?i:a:r>a?r:a,d=s>o?s>l?s:l:o>l?o:l,p=n.next;for(;p!==t;){if(p.x>=h&&p.x<=c&&p.y>=u&&p.y<=d&&rz(i,s,r,o,a,l,p.x,p.y)&&rB(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(h.i/i|0),n.push(t.i/i|0),n.push(u.i/i|0),rq(t),t=u.next,l=u.next;continue}if((t=u)===l){o?1===o?e(t=function(e,t,n){let i=e;do{let r=i.prev,a=i.next.next;!rH(r,a)&&rG(r,i,i.next,a)&&rW(r,a)&&rW(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),rq(i),rq(i.next),i=e=a),i=i.next}while(i!==e)return rI(i)}(rI(t),n,i),n,i,r,a,s,2):2===o&&function(t,n,i,r,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,h;if(o.i!==t.i&&(l=o,h=t,l.next.i!==h.i&&l.prev.i!==h.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&rG(n,n.next,e,t))return!0;n=n.next}while(n!==e)return!1}(l,h)&&(rW(l,h)&&rW(h,l)&&function(e,t){let n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e)return i}(l,h)&&(rB(l.prev,l,h.prev)||rB(l,h.prev,h))||rH(l,h)&&rB(l.prev,l,l.next)>0&&rB(h.prev,h,h.next)>0))){let l=rX(o,t);o=rI(o,o.next),l=rI(l,l.next),e(o,n,i,r,a,s,0),e(l,n,i,r,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,i,r,a,s):e(rI(t),n,i,r,a,s,1);break}}}(d,p,n,i,r,h,0),p}};function rD(e,t,n,i,r){let a,s;if(r===function(e,t,n,i){let r=0;for(let a=t,s=n-i;a0)for(a=t;a=t;a-=i)s=rj(a,e[a],e[a+1],s);return s&&rH(s,s.next)&&(rq(s),s=s.next),s}function rI(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(rH(n,n.next)||0===rB(n.prev,n,n.next))){if(rq(n),(n=t=n.prev)===n.next)break;i=!0}else n=n.next;while(i||n!==t)return t}function rO(e,t){return e.x-t.x}function rF(e,t,n,i,r){return(e=((e=((e=((e=((e=(e-n)*r|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function rz(e,t,n,i,r,a,s,o){return(r-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(r-s)*(i-o)}function rB(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function rH(e,t){return e.x===t.x&&e.y===t.y}function rG(e,t,n,i){let r=rk(rB(e,t,n)),a=rk(rB(e,t,i)),s=rk(rB(n,i,e)),o=rk(rB(n,i,t));return!!(r!==a&&s!==o||0===r&&rV(e,n,t)||0===a&&rV(e,i,t)||0===s&&rV(n,e,i)||0===o&&rV(n,t,i))}function rV(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 rk(e){return e>0?1:e<0?-1:0}function rW(e,t){return 0>rB(e.prev,e,e.next)?rB(e,t,e.next)>=0&&rB(e,e.prev,t)>=0:0>rB(e,t,e.prev)||0>rB(e,e.next,t)}function rX(e,t){let n=new rY(e.i,e.x,e.y),i=new rY(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function rj(e,t,n,i){let r=new rY(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 rq(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 rY(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class rJ{static area(e){let t=e.length,n=0;for(let i=t-1,r=0;rrJ.area(e)}static triangulateShape(e,t){let n=[],i=[],r=[];rZ(e),rK(n,e);let a=e.length;t.forEach(rZ);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function rK(e,t){for(let n=0;nNumber.EPSILON){let c=Math.sqrt(u),d=Math.sqrt(l*l+h*h),p=t.x-o/c,f=t.y+s/c,m=n.x-h/d,g=n.y+l/d,_=((m-p)*h-(g-f)*l)/(s*h-o*l);i=p+s*_-e.x,r=f+o*_-e.y;let v=i*i+r*r;if(v<=2)return new b(i,r);a=Math.sqrt(v/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(h)&&(e=!0),e?(i=-o,r=s,a=Math.sqrt(u)):(i=s,r=o,a=Math.sqrt(u/2))}return new b(i/a,r/a)}let N=[];for(let e=0,t=R.length,n=t-1,i=e+1;e=0;e--){let t=e/_,n=f*Math.cos(t*Math.PI/2),i=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=R.length;e=0;){let a=r,s=r-1;s<0&&(s=e.length-1);for(let e=0,r=c+2*_;e0)&&d.push(t,r,l),(e!==n-1||o=r)){let s=t[1];e=(r=t[--n-1]))break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=r9(n,r,a),this.values=r9(this.values,r*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){let i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&at(i))for(let t=0,n=i.length;t!==n;++t){let n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=r9(this.times),t=r9(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=r9(e,0,a),this.values=r9(t,0,a*n)):(this.times=e,this.values=t),this}clone(){let e=r9(this.times,0),t=r9(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}as.prototype.TimeBufferType=Float32Array,as.prototype.ValueBufferType=Float32Array,as.prototype.DefaultInterpolation=2301;class ao extends as{}ao.prototype.ValueTypeName="bool",ao.prototype.ValueBufferType=Array,ao.prototype.DefaultInterpolation=2300,ao.prototype.InterpolantFactoryMethodLinear=void 0,ao.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends as{}).prototype.ValueTypeName="color",(class extends as{}).prototype.ValueTypeName="number";class al extends an{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t),l=e*s;for(let e=l+s;l!==e;l+=4)J.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ah extends as{InterpolantFactoryMethodLinear(e){return new al(this.times,this.values,this.getValueSize(),e)}}ah.prototype.ValueTypeName="quaternion",ah.prototype.DefaultInterpolation=2301,ah.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends as{}au.prototype.ValueTypeName="string",au.prototype.ValueBufferType=Array,au.prototype.DefaultInterpolation=2300,au.prototype.InterpolantFactoryMethodLinear=void 0,au.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends as{}).prototype.ValueTypeName="vector";let ac="\\[\\]\\.:\\/",ad=RegExp("["+ac+"]","g"),ap="[^"+ac+"]",af="[^"+ac.replace("\\.","")+"]",am=/((?:WC+[\/:])*)/.source.replace("WC",ap),ag=/(WCOD+)?/.source.replace("WCOD",af),a_=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ap),av=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ap),ax=RegExp("^"+am+ag+a_+av+"$"),aM=["material","materials","bones","map"];class ay{constructor(e,t,n){this.path=t,this.parsedPath=n||ay.parseTrackName(t),this.node=ay.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ay.Composite(e,t,n):new ay(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ad,"")}static parseTrackName(e){let t=ax.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let 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){let e=n.nodeName.substring(i+1);-1!==aM.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let i=0;i","node_modules/three/build/three.module.js"],"sourcesContent":["(() => {\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"e06gU\", function(module, exports) {\n\n$parcel$export(module.exports, \"FrontSide\", () => $a315ee31802fb757$export$2ede184fc2998901);\n$parcel$export(module.exports, \"BackSide\", () => $a315ee31802fb757$export$d9f0486e75b5ace);\n$parcel$export(module.exports, \"DoubleSide\", () => $a315ee31802fb757$export$3b296b6f144d5b03);\n$parcel$export(module.exports, \"MathUtils\", () => $a315ee31802fb757$export$6a7ef315a0d1ef07);\n$parcel$export(module.exports, \"Vector2\", () => $a315ee31802fb757$export$c977b3e384af9ae1);\n$parcel$export(module.exports, \"Vector3\", () => $a315ee31802fb757$export$64b5c384219d3699);\n$parcel$export(module.exports, \"Box3\", () => $a315ee31802fb757$export$6f7d5a9418ab2aa3);\n$parcel$export(module.exports, \"Sphere\", () => $a315ee31802fb757$export$805e8b72413ccaba);\n$parcel$export(module.exports, \"Ray\", () => $a315ee31802fb757$export$a186db52eed6d40e);\n$parcel$export(module.exports, \"Matrix4\", () => $a315ee31802fb757$export$2ae72fc923e5eb5);\n$parcel$export(module.exports, \"Triangle\", () => $a315ee31802fb757$export$5a465592bfe74b48);\n$parcel$export(module.exports, \"BufferAttribute\", () => $a315ee31802fb757$export$8dea267bd6bde117);\n$parcel$export(module.exports, \"BufferGeometry\", () => $a315ee31802fb757$export$b7be63a67df8959);\n$parcel$export(module.exports, \"Plane\", () => $a315ee31802fb757$export$7ff5ac152ef991b0);\n$parcel$export(module.exports, \"Shape\", () => $a315ee31802fb757$export$6428a7f2611ef1fa);\n$parcel$export(module.exports, \"ShapeUtils\", () => $a315ee31802fb757$export$96bdf6d9c66d7ba8);\n$parcel$export(module.exports, \"ShapeGeometry\", () => $a315ee31802fb757$export$57a29a1c803e9065);\n$parcel$export(module.exports, \"Line3\", () => $a315ee31802fb757$export$e0ba6359f1954fd3);\n/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */ const $a315ee31802fb757$export$3545e07a80636437 = \"155\";\nconst $a315ee31802fb757$export$7177b3e430c2d7ca = {\n LEFT: 0,\n MIDDLE: 1,\n RIGHT: 2,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2\n};\nconst $a315ee31802fb757$export$d46bd3ead7cc759b = {\n ROTATE: 0,\n PAN: 1,\n DOLLY_PAN: 2,\n DOLLY_ROTATE: 3\n};\nconst $a315ee31802fb757$export$3237e1f2c1ea1f44 = 0;\nconst $a315ee31802fb757$export$b9a7b4fc5cb15f9b = 1;\nconst $a315ee31802fb757$export$b8058bcc7037d3f3 = 2;\nconst $a315ee31802fb757$export$f24be24dcddeac0d = 3;\nconst $a315ee31802fb757$export$346307dbae2b7447 = 0;\nconst $a315ee31802fb757$export$5813f879eee7cd88 = 1;\nconst $a315ee31802fb757$export$a47c4b43a1be34f0 = 2;\nconst $a315ee31802fb757$export$896ae1ade6c829c4 = 3;\nconst $a315ee31802fb757$export$2ede184fc2998901 = 0;\nconst $a315ee31802fb757$export$d9f0486e75b5ace = 1;\nconst $a315ee31802fb757$export$3b296b6f144d5b03 = 2;\nconst $a315ee31802fb757$export$211211c00f97204d = 2; // r149\nconst $a315ee31802fb757$export$63b8d6b580fc65ba = 0;\nconst $a315ee31802fb757$export$5b29a26d96ee6af0 = 1;\nconst $a315ee31802fb757$export$777d8f9551c2216b = 2;\nconst $a315ee31802fb757$export$cdfa06f868e2e467 = 3;\nconst $a315ee31802fb757$export$4138e1c684b46a20 = 4;\nconst $a315ee31802fb757$export$eda4864c68df1fa2 = 5;\nconst $a315ee31802fb757$export$20183a0484ce21a0 = 100;\nconst $a315ee31802fb757$export$73e0df5177988548 = 101;\nconst $a315ee31802fb757$export$28e582859cbec660 = 102;\nconst $a315ee31802fb757$export$c8c1508da8d0600c = 103;\nconst $a315ee31802fb757$export$99948c02fb51055f = 104;\nconst $a315ee31802fb757$export$2110f05edf778d3d = 200;\nconst $a315ee31802fb757$export$8805bad65e24940e = 201;\nconst $a315ee31802fb757$export$7fbe15b28d28cf52 = 202;\nconst $a315ee31802fb757$export$947829af9f2c17f6 = 203;\nconst $a315ee31802fb757$export$d5773124e86cf28c = 204;\nconst $a315ee31802fb757$export$11d468cc7f19e971 = 205;\nconst $a315ee31802fb757$export$a78aed1ca2a87192 = 206;\nconst $a315ee31802fb757$export$5d0fe17fd8773bac = 207;\nconst $a315ee31802fb757$export$ef5f2dd8ffac5574 = 208;\nconst $a315ee31802fb757$export$56b85b2686ab16 = 209;\nconst $a315ee31802fb757$export$c05e2a1fc8609506 = 210;\nconst $a315ee31802fb757$export$69025ce147cee220 = 0;\nconst $a315ee31802fb757$export$7182eb52ea3b3f04 = 1;\nconst $a315ee31802fb757$export$eedccec66ab7ebe = 2;\nconst $a315ee31802fb757$export$296f78a0b892f81a = 3;\nconst $a315ee31802fb757$export$a60d398fc7b7590e = 4;\nconst $a315ee31802fb757$export$7d7234c1240a1fc4 = 5;\nconst $a315ee31802fb757$export$c5e2c52991f30937 = 6;\nconst $a315ee31802fb757$export$2f843afa843d8916 = 7;\nconst $a315ee31802fb757$export$e50ac29801f1774d = 0;\nconst $a315ee31802fb757$export$9f9d94f963c85479 = 1;\nconst $a315ee31802fb757$export$e641dc52bc3494aa = 2;\nconst $a315ee31802fb757$export$9fcb6b4294603b2 = 0;\nconst $a315ee31802fb757$export$98f52c2a46c598ca = 1;\nconst $a315ee31802fb757$export$74b25e54b3bcd548 = 2;\nconst $a315ee31802fb757$export$932b3dd283d4a366 = 3;\nconst $a315ee31802fb757$export$a0d98fe6d7e4af64 = 4;\nconst $a315ee31802fb757$export$2c7b09c1e9abfb5e = 5;\nconst $a315ee31802fb757$export$1beec6768cbb3d2d = 300;\nconst $a315ee31802fb757$export$8759762a6477f2c4 = 301;\nconst $a315ee31802fb757$export$dc59f8aed047f61d = 302;\nconst $a315ee31802fb757$export$d64030b316d3b087 = 303;\nconst $a315ee31802fb757$export$ee99d97d46898098 = 304;\nconst $a315ee31802fb757$export$dbf3e70ff37af79 = 306;\nconst $a315ee31802fb757$export$533346c8e8dac0f5 = 1000;\nconst $a315ee31802fb757$export$9d9334239a5a5e06 = 1001;\nconst $a315ee31802fb757$export$c7e7c00b14f51a4f = 1002;\nconst $a315ee31802fb757$export$727aa5ec3fe39bf0 = 1003;\nconst $a315ee31802fb757$export$d129e38cf6feaa8c = 1004;\nconst $a315ee31802fb757$export$14a4936464a36496 = 1004;\nconst $a315ee31802fb757$export$d2327c1afe5bfdf2 = 1005;\nconst $a315ee31802fb757$export$cbc5b7f5647595d8 = 1005;\nconst $a315ee31802fb757$export$8a72f490b25c56c8 = 1006;\nconst $a315ee31802fb757$export$19a719f377145a13 = 1007;\nconst $a315ee31802fb757$export$dbe96bee3fe9dbf0 = 1007;\nconst $a315ee31802fb757$export$5d8599b6a933fb1b = 1008;\nconst $a315ee31802fb757$export$90d80f1e3506775f = 1008;\nconst $a315ee31802fb757$export$2e8ce08d3f6f5e10 = 1009;\nconst $a315ee31802fb757$export$545fce0311a9796a = 1010;\nconst $a315ee31802fb757$export$88572337f312435f = 1011;\nconst $a315ee31802fb757$export$c63dc51868b06a9d = 1012;\nconst $a315ee31802fb757$export$5c612977753abe2 = 1013;\nconst $a315ee31802fb757$export$c3c7fc4518ebba96 = 1014;\nconst $a315ee31802fb757$export$f6d331659b644596 = 1015;\nconst $a315ee31802fb757$export$2697304443f382bc = 1016;\nconst $a315ee31802fb757$export$b3969b01faf587f2 = 1017;\nconst $a315ee31802fb757$export$18886f8ae33e90de = 1018;\nconst $a315ee31802fb757$export$6c8ea339bfab1301 = 1020;\nconst $a315ee31802fb757$export$988473390501ed4b = 1021;\nconst $a315ee31802fb757$export$3f8bb04b555a363c = 1023;\nconst $a315ee31802fb757$export$cc09ccbf6d1ed449 = 1024;\nconst $a315ee31802fb757$export$9053a81c4a69c289 = 1025;\nconst $a315ee31802fb757$export$c1b6b5136be58045 = 1026;\nconst $a315ee31802fb757$export$1e113ac2d0905829 = 1027;\nconst $a315ee31802fb757$export$4e041a7967d15c4b = 1028;\nconst $a315ee31802fb757$export$aa92e870a709d190 = 1029;\nconst $a315ee31802fb757$export$6cdf0b461c7ce8a0 = 1030;\nconst $a315ee31802fb757$export$1ba1c45f9f77d4d7 = 1031;\nconst $a315ee31802fb757$export$c200e7d26f592f21 = 1033;\nconst $a315ee31802fb757$export$21d1799c6d552fc0 = 33776;\nconst $a315ee31802fb757$export$afa304c3e981b668 = 33777;\nconst $a315ee31802fb757$export$d2a1a68024a3e56c = 33778;\nconst $a315ee31802fb757$export$9a79c424327dacf9 = 33779;\nconst $a315ee31802fb757$export$19ada9bbb1af3573 = 35840;\nconst $a315ee31802fb757$export$d0f0355bb3d948e4 = 35841;\nconst $a315ee31802fb757$export$b82296714358084c = 35842;\nconst $a315ee31802fb757$export$b71692456c47b6c3 = 35843;\nconst $a315ee31802fb757$export$6ab91af2d757aee7 = 36196;\nconst $a315ee31802fb757$export$7800993ef8106a6a = 37492;\nconst $a315ee31802fb757$export$23ed8300a860e7d8 = 37496;\nconst $a315ee31802fb757$export$dc5570b4a2b92d48 = 37808;\nconst $a315ee31802fb757$export$68880cd325f8b2fb = 37809;\nconst $a315ee31802fb757$export$7d2c0be323373d95 = 37810;\nconst $a315ee31802fb757$export$22b52da301fc3a3e = 37811;\nconst $a315ee31802fb757$export$c009e2cb4a66485e = 37812;\nconst $a315ee31802fb757$export$118fff5afa255b63 = 37813;\nconst $a315ee31802fb757$export$120713c829ae0667 = 37814;\nconst $a315ee31802fb757$export$c79eeabbf53313e9 = 37815;\nconst $a315ee31802fb757$export$443cf6567cdd6424 = 37816;\nconst $a315ee31802fb757$export$6573984fc9840780 = 37817;\nconst $a315ee31802fb757$export$e7aee563f30091de = 37818;\nconst $a315ee31802fb757$export$2eb8634622ddeab7 = 37819;\nconst $a315ee31802fb757$export$202b1ce7b5d25742 = 37820;\nconst $a315ee31802fb757$export$18ab77abd087e467 = 37821;\nconst $a315ee31802fb757$export$ce40b115e188bc81 = 36492;\nconst $a315ee31802fb757$export$b1688df4c4c21670 = 36283;\nconst $a315ee31802fb757$export$fc15e5d8261eed58 = 36284;\nconst $a315ee31802fb757$export$d220f6ade8463a0f = 36285;\nconst $a315ee31802fb757$export$768646d09dc1b6ef = 36286;\nconst $a315ee31802fb757$export$d62fdc9d1b1cccad = 2200;\nconst $a315ee31802fb757$export$dfaf4422ce096e29 = 2201;\nconst $a315ee31802fb757$export$f8f6f2041b78e210 = 2202;\nconst $a315ee31802fb757$export$995b32462a65e855 = 2300;\nconst $a315ee31802fb757$export$30fac1aace31cf4d = 2301;\nconst $a315ee31802fb757$export$198b11ff4c72bb30 = 2302;\nconst $a315ee31802fb757$export$7f795934b84ab523 = 2400;\nconst $a315ee31802fb757$export$24a4ccb5099273b5 = 2401;\nconst $a315ee31802fb757$export$8e8c3ecdcd8e1fee = 2402;\nconst $a315ee31802fb757$export$bcfbbdcf8de7f8cd = 2500;\nconst $a315ee31802fb757$export$d875e029ef558d3 = 2501;\nconst $a315ee31802fb757$export$4c28c87c2dc84758 = 0;\nconst $a315ee31802fb757$export$b23a071aa286eb29 = 1;\nconst $a315ee31802fb757$export$f0d8293634f88842 = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */ const $a315ee31802fb757$export$7207336e4151a112 = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */ const $a315ee31802fb757$export$f32388edbb32674 = 3001;\nconst $a315ee31802fb757$export$deeb383078690b50 = 3200;\nconst $a315ee31802fb757$export$8f910f4c4f73df11 = 3201;\nconst $a315ee31802fb757$export$2852a58ebdac27b8 = 0;\nconst $a315ee31802fb757$export$9990ad26f9db5b2c = 1;\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst $a315ee31802fb757$export$bfcb490c2dd3db51 = \"\";\nconst $a315ee31802fb757$export$561f394b24edfcaa = \"srgb\";\nconst $a315ee31802fb757$export$42429b3acfb233a4 = \"srgb-linear\";\nconst $a315ee31802fb757$export$626af19ae879bdf6 = \"display-p3\";\nconst $a315ee31802fb757$export$69433f11f42d5527 = 0;\nconst $a315ee31802fb757$export$9f542ae4b5baca34 = 7680;\nconst $a315ee31802fb757$export$8a4f28336ef203d3 = 7681;\nconst $a315ee31802fb757$export$2928c0231297c036 = 7682;\nconst $a315ee31802fb757$export$c0e9611c8a15f9a8 = 7683;\nconst $a315ee31802fb757$export$9c2c08927385dcc4 = 34055;\nconst $a315ee31802fb757$export$7c74ea00fa1315e6 = 34056;\nconst $a315ee31802fb757$export$22e2e5726612443 = 5386;\nconst $a315ee31802fb757$export$1343870698229224 = 512;\nconst $a315ee31802fb757$export$8e1d8ed281997fa6 = 513;\nconst $a315ee31802fb757$export$55648a1cde8329a7 = 514;\nconst $a315ee31802fb757$export$2dff107857e6aca2 = 515;\nconst $a315ee31802fb757$export$6f93765ab2f451a2 = 516;\nconst $a315ee31802fb757$export$6f3fb2d2440f2b76 = 517;\nconst $a315ee31802fb757$export$4119cf7b4c98fd5a = 518;\nconst $a315ee31802fb757$export$14cf96713ddd97a8 = 519;\nconst $a315ee31802fb757$export$d9e2d19a747baaab = 512;\nconst $a315ee31802fb757$export$36bcf49c713b3eb7 = 513;\nconst $a315ee31802fb757$export$66f28d946fc6a0d5 = 514;\nconst $a315ee31802fb757$export$64eea11eb407ddf1 = 515;\nconst $a315ee31802fb757$export$155af022118f3a38 = 516;\nconst $a315ee31802fb757$export$67ab95dde6bed156 = 517;\nconst $a315ee31802fb757$export$1cdcb70d53d65f61 = 518;\nconst $a315ee31802fb757$export$187b73a3e352c145 = 519;\nconst $a315ee31802fb757$export$763e8360f4d7f77d = 35044;\nconst $a315ee31802fb757$export$8505d14ac8546ca = 35048;\nconst $a315ee31802fb757$export$721e63549e51d81e = 35040;\nconst $a315ee31802fb757$export$415731dc4f48e299 = 35045;\nconst $a315ee31802fb757$export$9e809946455f13bc = 35049;\nconst $a315ee31802fb757$export$2ed9499a35b5f832 = 35041;\nconst $a315ee31802fb757$export$32ab2503ea19469a = 35046;\nconst $a315ee31802fb757$export$ab4022c2c3f86315 = 35050;\nconst $a315ee31802fb757$export$ba7f1db36a76a970 = 35042;\nconst $a315ee31802fb757$export$43600cc67fabd9f = \"100\";\nconst $a315ee31802fb757$export$f63012db5506e7dd = \"300 es\";\nconst $a315ee31802fb757$export$ca1dce8b5e1de74d = 1035; // fallback for WebGL 1\nconst $a315ee31802fb757$export$5a0e9190d10875d3 = 2000;\nconst $a315ee31802fb757$export$cc83beedcb9be9ac = 2001;\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */ class $a315ee31802fb757$export$ec8b666c5fe2c75a {\n addEventListener(type, listener) {\n if (this._listeners === undefined) this._listeners = {};\n const listeners = this._listeners;\n if (listeners[type] === undefined) listeners[type] = [];\n if (listeners[type].indexOf(listener) === -1) listeners[type].push(listener);\n }\n hasEventListener(type, listener) {\n if (this._listeners === undefined) return false;\n const listeners = this._listeners;\n return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;\n }\n removeEventListener(type, listener) {\n if (this._listeners === undefined) return;\n const listeners = this._listeners;\n const listenerArray = listeners[type];\n if (listenerArray !== undefined) {\n const index = listenerArray.indexOf(listener);\n if (index !== -1) listenerArray.splice(index, 1);\n }\n }\n dispatchEvent(event) {\n if (this._listeners === undefined) return;\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n if (listenerArray !== undefined) {\n event.target = this;\n // Make a copy, in case listeners are removed while iterating.\n const array = listenerArray.slice(0);\n for(let i = 0, l = array.length; i < l; i++)array[i].call(this, event);\n event.target = null;\n }\n }\n}\nconst $a315ee31802fb757$var$_lut = [\n \"00\",\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n \"0a\",\n \"0b\",\n \"0c\",\n \"0d\",\n \"0e\",\n \"0f\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\",\n \"1a\",\n \"1b\",\n \"1c\",\n \"1d\",\n \"1e\",\n \"1f\",\n \"20\",\n \"21\",\n \"22\",\n \"23\",\n \"24\",\n \"25\",\n \"26\",\n \"27\",\n \"28\",\n \"29\",\n \"2a\",\n \"2b\",\n \"2c\",\n \"2d\",\n \"2e\",\n \"2f\",\n \"30\",\n \"31\",\n \"32\",\n \"33\",\n \"34\",\n \"35\",\n \"36\",\n \"37\",\n \"38\",\n \"39\",\n \"3a\",\n \"3b\",\n \"3c\",\n \"3d\",\n \"3e\",\n \"3f\",\n \"40\",\n \"41\",\n \"42\",\n \"43\",\n \"44\",\n \"45\",\n \"46\",\n \"47\",\n \"48\",\n \"49\",\n \"4a\",\n \"4b\",\n \"4c\",\n \"4d\",\n \"4e\",\n \"4f\",\n \"50\",\n \"51\",\n \"52\",\n \"53\",\n \"54\",\n \"55\",\n \"56\",\n \"57\",\n \"58\",\n \"59\",\n \"5a\",\n \"5b\",\n \"5c\",\n \"5d\",\n \"5e\",\n \"5f\",\n \"60\",\n \"61\",\n \"62\",\n \"63\",\n \"64\",\n \"65\",\n \"66\",\n \"67\",\n \"68\",\n \"69\",\n \"6a\",\n \"6b\",\n \"6c\",\n \"6d\",\n \"6e\",\n \"6f\",\n \"70\",\n \"71\",\n \"72\",\n \"73\",\n \"74\",\n \"75\",\n \"76\",\n \"77\",\n \"78\",\n \"79\",\n \"7a\",\n \"7b\",\n \"7c\",\n \"7d\",\n \"7e\",\n \"7f\",\n \"80\",\n \"81\",\n \"82\",\n \"83\",\n \"84\",\n \"85\",\n \"86\",\n \"87\",\n \"88\",\n \"89\",\n \"8a\",\n \"8b\",\n \"8c\",\n \"8d\",\n \"8e\",\n \"8f\",\n \"90\",\n \"91\",\n \"92\",\n \"93\",\n \"94\",\n \"95\",\n \"96\",\n \"97\",\n \"98\",\n \"99\",\n \"9a\",\n \"9b\",\n \"9c\",\n \"9d\",\n \"9e\",\n \"9f\",\n \"a0\",\n \"a1\",\n \"a2\",\n \"a3\",\n \"a4\",\n \"a5\",\n \"a6\",\n \"a7\",\n \"a8\",\n \"a9\",\n \"aa\",\n \"ab\",\n \"ac\",\n \"ad\",\n \"ae\",\n \"af\",\n \"b0\",\n \"b1\",\n \"b2\",\n \"b3\",\n \"b4\",\n \"b5\",\n \"b6\",\n \"b7\",\n \"b8\",\n \"b9\",\n \"ba\",\n \"bb\",\n \"bc\",\n \"bd\",\n \"be\",\n \"bf\",\n \"c0\",\n \"c1\",\n \"c2\",\n \"c3\",\n \"c4\",\n \"c5\",\n \"c6\",\n \"c7\",\n \"c8\",\n \"c9\",\n \"ca\",\n \"cb\",\n \"cc\",\n \"cd\",\n \"ce\",\n \"cf\",\n \"d0\",\n \"d1\",\n \"d2\",\n \"d3\",\n \"d4\",\n \"d5\",\n \"d6\",\n \"d7\",\n \"d8\",\n \"d9\",\n \"da\",\n \"db\",\n \"dc\",\n \"dd\",\n \"de\",\n \"df\",\n \"e0\",\n \"e1\",\n \"e2\",\n \"e3\",\n \"e4\",\n \"e5\",\n \"e6\",\n \"e7\",\n \"e8\",\n \"e9\",\n \"ea\",\n \"eb\",\n \"ec\",\n \"ed\",\n \"ee\",\n \"ef\",\n \"f0\",\n \"f1\",\n \"f2\",\n \"f3\",\n \"f4\",\n \"f5\",\n \"f6\",\n \"f7\",\n \"f8\",\n \"f9\",\n \"fa\",\n \"fb\",\n \"fc\",\n \"fd\",\n \"fe\",\n \"ff\"\n];\nlet $a315ee31802fb757$var$_seed = 1234567;\nconst $a315ee31802fb757$var$DEG2RAD = Math.PI / 180;\nconst $a315ee31802fb757$var$RAD2DEG = 180 / Math.PI;\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction $a315ee31802fb757$var$generateUUID() {\n const d0 = Math.random() * 0xffffffff | 0;\n const d1 = Math.random() * 0xffffffff | 0;\n const d2 = Math.random() * 0xffffffff | 0;\n const d3 = Math.random() * 0xffffffff | 0;\n const uuid = $a315ee31802fb757$var$_lut[d0 & 0xff] + $a315ee31802fb757$var$_lut[d0 >> 8 & 0xff] + $a315ee31802fb757$var$_lut[d0 >> 16 & 0xff] + $a315ee31802fb757$var$_lut[d0 >> 24 & 0xff] + \"-\" + $a315ee31802fb757$var$_lut[d1 & 0xff] + $a315ee31802fb757$var$_lut[d1 >> 8 & 0xff] + \"-\" + $a315ee31802fb757$var$_lut[d1 >> 16 & 0x0f | 0x40] + $a315ee31802fb757$var$_lut[d1 >> 24 & 0xff] + \"-\" + $a315ee31802fb757$var$_lut[d2 & 0x3f | 0x80] + $a315ee31802fb757$var$_lut[d2 >> 8 & 0xff] + \"-\" + $a315ee31802fb757$var$_lut[d2 >> 16 & 0xff] + $a315ee31802fb757$var$_lut[d2 >> 24 & 0xff] + $a315ee31802fb757$var$_lut[d3 & 0xff] + $a315ee31802fb757$var$_lut[d3 >> 8 & 0xff] + $a315ee31802fb757$var$_lut[d3 >> 16 & 0xff] + $a315ee31802fb757$var$_lut[d3 >> 24 & 0xff];\n // .toLowerCase() here flattens concatenated strings to save heap memory space.\n return uuid.toLowerCase();\n}\nfunction $a315ee31802fb757$var$clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction $a315ee31802fb757$var$euclideanModulo(n, m) {\n return (n % m + m) % m;\n}\n// Linear mapping from range to range \nfunction $a315ee31802fb757$var$mapLinear(x, a1, a2, b1, b2) {\n return b1 + (x - a1) * (b2 - b1) / (a2 - a1);\n}\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction $a315ee31802fb757$var$inverseLerp(x, y, value) {\n if (x !== y) return (value - x) / (y - x);\n else return 0;\n}\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction $a315ee31802fb757$var$lerp(x, y, t) {\n return (1 - t) * x + t * y;\n}\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction $a315ee31802fb757$var$damp(x, y, lambda, dt) {\n return $a315ee31802fb757$var$lerp(x, y, 1 - Math.exp(-lambda * dt));\n}\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction $a315ee31802fb757$var$pingpong(x, length = 1) {\n return length - Math.abs($a315ee31802fb757$var$euclideanModulo(x, length * 2) - length);\n}\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction $a315ee31802fb757$var$smoothstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * (3 - 2 * x);\n}\nfunction $a315ee31802fb757$var$smootherstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * x * (x * (x * 6 - 15) + 10);\n}\n// Random integer from interval\nfunction $a315ee31802fb757$var$randInt(low, high) {\n return low + Math.floor(Math.random() * (high - low + 1));\n}\n// Random float from interval\nfunction $a315ee31802fb757$var$randFloat(low, high) {\n return low + Math.random() * (high - low);\n}\n// Random float from <-range/2, range/2> interval\nfunction $a315ee31802fb757$var$randFloatSpread(range) {\n return range * (0.5 - Math.random());\n}\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction $a315ee31802fb757$var$seededRandom(s) {\n if (s !== undefined) $a315ee31802fb757$var$_seed = s;\n // Mulberry32 generator\n let t = $a315ee31802fb757$var$_seed += 0x6D2B79F5;\n t = Math.imul(t ^ t >>> 15, t | 1);\n t ^= t + Math.imul(t ^ t >>> 7, t | 61);\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n}\nfunction $a315ee31802fb757$var$degToRad(degrees) {\n return degrees * $a315ee31802fb757$var$DEG2RAD;\n}\nfunction $a315ee31802fb757$var$radToDeg(radians) {\n return radians * $a315ee31802fb757$var$RAD2DEG;\n}\nfunction $a315ee31802fb757$var$isPowerOfTwo(value) {\n return (value & value - 1) === 0 && value !== 0;\n}\nfunction $a315ee31802fb757$var$ceilPowerOfTwo(value) {\n return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));\n}\nfunction $a315ee31802fb757$var$floorPowerOfTwo(value) {\n return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));\n}\nfunction $a315ee31802fb757$var$setQuaternionFromProperEuler(q, a, b, c, order) {\n // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n // rotations are applied to the axes in the order specified by 'order'\n // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n // angles are in radians\n const cos = Math.cos;\n const sin = Math.sin;\n const c2 = cos(b / 2);\n const s2 = sin(b / 2);\n const c13 = cos((a + c) / 2);\n const s13 = sin((a + c) / 2);\n const c1_3 = cos((a - c) / 2);\n const s1_3 = sin((a - c) / 2);\n const c3_1 = cos((c - a) / 2);\n const s3_1 = sin((c - a) / 2);\n switch(order){\n case \"XYX\":\n q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);\n break;\n case \"YZY\":\n q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);\n break;\n case \"ZXZ\":\n q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);\n break;\n case \"XZX\":\n q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);\n break;\n case \"YXY\":\n q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);\n break;\n case \"ZYZ\":\n q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);\n break;\n default:\n console.warn(\"THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \" + order);\n }\n}\nfunction $a315ee31802fb757$var$denormalize(value, array) {\n switch(array.constructor){\n case Float32Array:\n return value;\n case Uint32Array:\n return value / 4294967295.0;\n case Uint16Array:\n return value / 65535.0;\n case Uint8Array:\n return value / 255.0;\n case Int32Array:\n return Math.max(value / 2147483647.0, -1);\n case Int16Array:\n return Math.max(value / 32767.0, -1);\n case Int8Array:\n return Math.max(value / 127.0, -1);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nfunction $a315ee31802fb757$var$normalize(value, array) {\n switch(array.constructor){\n case Float32Array:\n return value;\n case Uint32Array:\n return Math.round(value * 4294967295.0);\n case Uint16Array:\n return Math.round(value * 65535.0);\n case Uint8Array:\n return Math.round(value * 255.0);\n case Int32Array:\n return Math.round(value * 2147483647.0);\n case Int16Array:\n return Math.round(value * 32767.0);\n case Int8Array:\n return Math.round(value * 127.0);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nconst $a315ee31802fb757$export$6a7ef315a0d1ef07 = {\n DEG2RAD: $a315ee31802fb757$var$DEG2RAD,\n RAD2DEG: $a315ee31802fb757$var$RAD2DEG,\n generateUUID: $a315ee31802fb757$var$generateUUID,\n clamp: $a315ee31802fb757$var$clamp,\n euclideanModulo: $a315ee31802fb757$var$euclideanModulo,\n mapLinear: $a315ee31802fb757$var$mapLinear,\n inverseLerp: $a315ee31802fb757$var$inverseLerp,\n lerp: $a315ee31802fb757$var$lerp,\n damp: $a315ee31802fb757$var$damp,\n pingpong: $a315ee31802fb757$var$pingpong,\n smoothstep: $a315ee31802fb757$var$smoothstep,\n smootherstep: $a315ee31802fb757$var$smootherstep,\n randInt: $a315ee31802fb757$var$randInt,\n randFloat: $a315ee31802fb757$var$randFloat,\n randFloatSpread: $a315ee31802fb757$var$randFloatSpread,\n seededRandom: $a315ee31802fb757$var$seededRandom,\n degToRad: $a315ee31802fb757$var$degToRad,\n radToDeg: $a315ee31802fb757$var$radToDeg,\n isPowerOfTwo: $a315ee31802fb757$var$isPowerOfTwo,\n ceilPowerOfTwo: $a315ee31802fb757$var$ceilPowerOfTwo,\n floorPowerOfTwo: $a315ee31802fb757$var$floorPowerOfTwo,\n setQuaternionFromProperEuler: $a315ee31802fb757$var$setQuaternionFromProperEuler,\n normalize: $a315ee31802fb757$var$normalize,\n denormalize: $a315ee31802fb757$var$denormalize\n};\nclass $a315ee31802fb757$export$c977b3e384af9ae1 {\n constructor(x = 0, y = 0){\n $a315ee31802fb757$export$c977b3e384af9ae1.prototype.isVector2 = true;\n this.x = x;\n this.y = y;\n }\n get width() {\n return this.x;\n }\n set width(value) {\n this.x = value;\n }\n get height() {\n return this.y;\n }\n set height(value) {\n this.y = value;\n }\n set(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n return this;\n }\n divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n applyMatrix3(m) {\n const x = this.x, y = this.y;\n const e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6];\n this.y = e[1] * x + e[4] * y + e[7];\n return this;\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y;\n }\n cross(v) {\n return this.x * v.y - this.y * v.x;\n }\n lengthSq() {\n return this.x * this.x + this.y * this.y;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n angle() {\n // computes the angle in radians with respect to the positive x-axis\n const angle = Math.atan2(-this.y, -this.x) + Math.PI;\n return angle;\n }\n angleTo(v) {\n const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n const theta = this.dot(v) / denominator;\n // clamp, to handle numerical problems\n return Math.acos($a315ee31802fb757$var$clamp(theta, -1, 1));\n }\n distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n distanceToSquared(v) {\n const dx = this.x - v.x, dy = this.y - v.y;\n return dx * dx + dy * dy;\n }\n manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n return this;\n }\n rotateAround(center, angle) {\n const c = Math.cos(angle), s = Math.sin(angle);\n const x = this.x - center.x;\n const y = this.y - center.y;\n this.x = x * c - y * s + center.x;\n this.y = x * s + y * c + center.y;\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n }\n}\nclass $a315ee31802fb757$export$8ff26dafa08918 {\n constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33){\n $a315ee31802fb757$export$8ff26dafa08918.prototype.isMatrix3 = true;\n this.elements = [\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ];\n if (n11 !== undefined) this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33);\n }\n set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {\n const te = this.elements;\n te[0] = n11;\n te[1] = n21;\n te[2] = n31;\n te[3] = n12;\n te[4] = n22;\n te[5] = n32;\n te[6] = n13;\n te[7] = n23;\n te[8] = n33;\n return this;\n }\n identity() {\n this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);\n return this;\n }\n copy(m) {\n const te = this.elements;\n const me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n return this;\n }\n extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrix3Column(this, 0);\n yAxis.setFromMatrix3Column(this, 1);\n zAxis.setFromMatrix3Column(this, 2);\n return this;\n }\n setFromMatrix4(m) {\n const me = m.elements;\n this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);\n return this;\n }\n multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n multiplyMatrices(a, b) {\n const ae = a.elements;\n const be = b.elements;\n const te = this.elements;\n const a11 = ae[0], a12 = ae[3], a13 = ae[6];\n const a21 = ae[1], a22 = ae[4], a23 = ae[7];\n const a31 = ae[2], a32 = ae[5], a33 = ae[8];\n const b11 = be[0], b12 = be[3], b13 = be[6];\n const b21 = be[1], b22 = be[4], b23 = be[7];\n const b31 = be[2], b32 = be[5], b33 = be[8];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31;\n te[3] = a11 * b12 + a12 * b22 + a13 * b32;\n te[6] = a11 * b13 + a12 * b23 + a13 * b33;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31;\n te[4] = a21 * b12 + a22 * b22 + a23 * b32;\n te[7] = a21 * b13 + a22 * b23 + a23 * b33;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31;\n te[5] = a31 * b12 + a32 * b22 + a33 * b32;\n te[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return this;\n }\n multiplyScalar(s) {\n const te = this.elements;\n te[0] *= s;\n te[3] *= s;\n te[6] *= s;\n te[1] *= s;\n te[4] *= s;\n te[7] *= s;\n te[2] *= s;\n te[5] *= s;\n te[8] *= s;\n return this;\n }\n determinant() {\n const te = this.elements;\n const a = te[0], b = te[1], c = te[2], d = te[3], e = te[4], f = te[5], g = te[6], h = te[7], i = te[8];\n return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n }\n invert() {\n const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n12 = te[3], n22 = te[4], n32 = te[5], n13 = te[6], n23 = te[7], n33 = te[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);\n const detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n31 * n23 - n33 * n21) * detInv;\n te[2] = (n32 * n21 - n31 * n22) * detInv;\n te[3] = t12 * detInv;\n te[4] = (n33 * n11 - n31 * n13) * detInv;\n te[5] = (n31 * n12 - n32 * n11) * detInv;\n te[6] = t13 * detInv;\n te[7] = (n21 * n13 - n23 * n11) * detInv;\n te[8] = (n22 * n11 - n21 * n12) * detInv;\n return this;\n }\n transpose() {\n let tmp;\n const m = this.elements;\n tmp = m[1];\n m[1] = m[3];\n m[3] = tmp;\n tmp = m[2];\n m[2] = m[6];\n m[6] = tmp;\n tmp = m[5];\n m[5] = m[7];\n m[7] = tmp;\n return this;\n }\n getNormalMatrix(matrix4) {\n return this.setFromMatrix4(matrix4).invert().transpose();\n }\n transposeIntoArray(r) {\n const m = this.elements;\n r[0] = m[0];\n r[1] = m[3];\n r[2] = m[6];\n r[3] = m[1];\n r[4] = m[4];\n r[5] = m[7];\n r[6] = m[2];\n r[7] = m[5];\n r[8] = m[8];\n return this;\n }\n setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {\n const c = Math.cos(rotation);\n const s = Math.sin(rotation);\n this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);\n return this;\n }\n //\n scale(sx, sy) {\n this.premultiply($a315ee31802fb757$var$_m3.makeScale(sx, sy));\n return this;\n }\n rotate(theta) {\n this.premultiply($a315ee31802fb757$var$_m3.makeRotation(-theta));\n return this;\n }\n translate(tx, ty) {\n this.premultiply($a315ee31802fb757$var$_m3.makeTranslation(tx, ty));\n return this;\n }\n // for 2D Transforms\n makeTranslation(x, y) {\n if (x.isVector2) this.set(1, 0, x.x, 0, 1, x.y, 0, 0, 1);\n else this.set(1, 0, x, 0, 1, y, 0, 0, 1);\n return this;\n }\n makeRotation(theta) {\n // counterclockwise\n const c = Math.cos(theta);\n const s = Math.sin(theta);\n this.set(c, -s, 0, s, c, 0, 0, 0, 1);\n return this;\n }\n makeScale(x, y) {\n this.set(x, 0, 0, 0, y, 0, 0, 0, 1);\n return this;\n }\n //\n equals(matrix) {\n const te = this.elements;\n const me = matrix.elements;\n for(let i = 0; i < 9; i++){\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n fromArray(array, offset = 0) {\n for(let i = 0; i < 9; i++)this.elements[i] = array[i + offset];\n return this;\n }\n toArray(array = [], offset = 0) {\n const te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n return array;\n }\n clone() {\n return new this.constructor().fromArray(this.elements);\n }\n}\nconst $a315ee31802fb757$var$_m3 = /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918();\nfunction $a315ee31802fb757$var$arrayNeedsUint32(array) {\n // assumes larger values usually on last\n for(let i = array.length - 1; i >= 0; --i){\n if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n }\n return false;\n}\nconst $a315ee31802fb757$var$TYPED_ARRAYS = {\n Int8Array: Int8Array,\n Uint8Array: Uint8Array,\n Uint8ClampedArray: Uint8ClampedArray,\n Int16Array: Int16Array,\n Uint16Array: Uint16Array,\n Int32Array: Int32Array,\n Uint32Array: Uint32Array,\n Float32Array: Float32Array,\n Float64Array: Float64Array\n};\nfunction $a315ee31802fb757$var$getTypedArray(type, buffer) {\n return new $a315ee31802fb757$var$TYPED_ARRAYS[type](buffer);\n}\nfunction $a315ee31802fb757$var$createElementNS(name) {\n return document.createElementNS(\"http://www.w3.org/1999/xhtml\", name);\n}\nconst $a315ee31802fb757$var$_cache = {};\nfunction $a315ee31802fb757$var$warnOnce(message) {\n if (message in $a315ee31802fb757$var$_cache) return;\n $a315ee31802fb757$var$_cache[message] = true;\n console.warn(message);\n}\nfunction $a315ee31802fb757$var$SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);\n}\nfunction $a315ee31802fb757$var$LinearToSRGB(c) {\n return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;\n}\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */ const $a315ee31802fb757$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918().fromArray([\n 0.8224621,\n 0.0331941,\n 0.0170827,\n 0.1775380,\n 0.9668058,\n 0.0723974,\n -0.0000001,\n 0.0000001,\n 0.9105199\n]);\nconst $a315ee31802fb757$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918().fromArray([\n 1.2249401,\n -0.0420569,\n -0.0196376,\n -0.2249404,\n 1.0420571,\n -0.0786361,\n 0.0000001,\n 0.0000000,\n 1.0982735\n]);\nfunction $a315ee31802fb757$var$DisplayP3ToLinearSRGB(color) {\n // Display P3 uses the sRGB transfer functions\n return color.convertSRGBToLinear().applyMatrix3($a315ee31802fb757$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB);\n}\nfunction $a315ee31802fb757$var$LinearSRGBToDisplayP3(color) {\n // Display P3 uses the sRGB transfer functions\n return color.applyMatrix3($a315ee31802fb757$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB();\n}\n// Conversions from to Linear-sRGB reference space.\nconst $a315ee31802fb757$var$TO_LINEAR = {\n [$a315ee31802fb757$export$42429b3acfb233a4]: (color)=>color,\n [$a315ee31802fb757$export$561f394b24edfcaa]: (color)=>color.convertSRGBToLinear(),\n [$a315ee31802fb757$export$626af19ae879bdf6]: $a315ee31802fb757$var$DisplayP3ToLinearSRGB\n};\n// Conversions to from Linear-sRGB reference space.\nconst $a315ee31802fb757$var$FROM_LINEAR = {\n [$a315ee31802fb757$export$42429b3acfb233a4]: (color)=>color,\n [$a315ee31802fb757$export$561f394b24edfcaa]: (color)=>color.convertLinearToSRGB(),\n [$a315ee31802fb757$export$626af19ae879bdf6]: $a315ee31802fb757$var$LinearSRGBToDisplayP3\n};\nconst $a315ee31802fb757$export$5e6fd513f44698c = {\n enabled: true,\n get legacyMode () {\n console.warn(\"THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.\");\n return !this.enabled;\n },\n set legacyMode (legacyMode){\n console.warn(\"THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.\");\n this.enabled = !legacyMode;\n },\n get workingColorSpace () {\n return $a315ee31802fb757$export$42429b3acfb233a4;\n },\n set workingColorSpace (colorSpace){\n console.warn(\"THREE.ColorManagement: .workingColorSpace is readonly.\");\n },\n convert: function(color, sourceColorSpace, targetColorSpace) {\n if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) return color;\n const sourceToLinear = $a315ee31802fb757$var$TO_LINEAR[sourceColorSpace];\n const targetFromLinear = $a315ee31802fb757$var$FROM_LINEAR[targetColorSpace];\n if (sourceToLinear === undefined || targetFromLinear === undefined) throw new Error(`Unsupported color space conversion, \"${sourceColorSpace}\" to \"${targetColorSpace}\".`);\n return targetFromLinear(sourceToLinear(color));\n },\n fromWorkingColorSpace: function(color, targetColorSpace) {\n return this.convert(color, this.workingColorSpace, targetColorSpace);\n },\n toWorkingColorSpace: function(color, sourceColorSpace) {\n return this.convert(color, sourceColorSpace, this.workingColorSpace);\n }\n};\nlet $a315ee31802fb757$var$_canvas;\nclass $a315ee31802fb757$export$698882cf06df44aa {\n static getDataURL(image) {\n if (/^data:/i.test(image.src)) return image.src;\n if (typeof HTMLCanvasElement === \"undefined\") return image.src;\n let canvas;\n if (image instanceof HTMLCanvasElement) canvas = image;\n else {\n if ($a315ee31802fb757$var$_canvas === undefined) $a315ee31802fb757$var$_canvas = $a315ee31802fb757$var$createElementNS(\"canvas\");\n $a315ee31802fb757$var$_canvas.width = image.width;\n $a315ee31802fb757$var$_canvas.height = image.height;\n const context = $a315ee31802fb757$var$_canvas.getContext(\"2d\");\n if (image instanceof ImageData) context.putImageData(image, 0, 0);\n else context.drawImage(image, 0, 0, image.width, image.height);\n canvas = $a315ee31802fb757$var$_canvas;\n }\n if (canvas.width > 2048 || canvas.height > 2048) {\n console.warn(\"THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons\", image);\n return canvas.toDataURL(\"image/jpeg\", 0.6);\n } else return canvas.toDataURL(\"image/png\");\n }\n static sRGBToLinear(image) {\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) {\n const canvas = $a315ee31802fb757$var$createElementNS(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\");\n context.drawImage(image, 0, 0, image.width, image.height);\n const imageData = context.getImageData(0, 0, image.width, image.height);\n const data = imageData.data;\n for(let i = 0; i < data.length; i++)data[i] = $a315ee31802fb757$var$SRGBToLinear(data[i] / 255) * 255;\n context.putImageData(imageData, 0, 0);\n return canvas;\n } else if (image.data) {\n const data = image.data.slice(0);\n for(let i = 0; i < data.length; i++)if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) data[i] = Math.floor($a315ee31802fb757$var$SRGBToLinear(data[i] / 255) * 255);\n else // assuming float\n data[i] = $a315ee31802fb757$var$SRGBToLinear(data[i]);\n return {\n data: data,\n width: image.width,\n height: image.height\n };\n } else {\n console.warn(\"THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.\");\n return image;\n }\n }\n}\nlet $a315ee31802fb757$var$sourceId = 0;\nclass $a315ee31802fb757$export$1d2df86270c81ecb {\n constructor(data = null){\n this.isSource = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$sourceId++\n });\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.data = data;\n this.version = 0;\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (!isRootObject && meta.images[this.uuid] !== undefined) return meta.images[this.uuid];\n const output = {\n uuid: this.uuid,\n url: \"\"\n };\n const data = this.data;\n if (data !== null) {\n let url;\n if (Array.isArray(data)) {\n // cube texture\n url = [];\n for(let i = 0, l = data.length; i < l; i++)if (data[i].isDataTexture) url.push($a315ee31802fb757$var$serializeImage(data[i].image));\n else url.push($a315ee31802fb757$var$serializeImage(data[i]));\n } else // texture\n url = $a315ee31802fb757$var$serializeImage(data);\n output.url = url;\n }\n if (!isRootObject) meta.images[this.uuid] = output;\n return output;\n }\n}\nfunction $a315ee31802fb757$var$serializeImage(image) {\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) // default images\n return $a315ee31802fb757$export$698882cf06df44aa.getDataURL(image);\n else {\n if (image.data) // images of DataTexture\n return {\n data: Array.from(image.data),\n width: image.width,\n height: image.height,\n type: image.data.constructor.name\n };\n else {\n console.warn(\"THREE.Texture: Unable to serialize Texture.\");\n return {};\n }\n }\n}\nlet $a315ee31802fb757$var$textureId = 0;\nclass $a315ee31802fb757$export$5431306cf43de24a extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(image = $a315ee31802fb757$export$5431306cf43de24a.DEFAULT_IMAGE, mapping = $a315ee31802fb757$export$5431306cf43de24a.DEFAULT_MAPPING, wrapS = $a315ee31802fb757$export$9d9334239a5a5e06, wrapT = $a315ee31802fb757$export$9d9334239a5a5e06, magFilter = $a315ee31802fb757$export$8a72f490b25c56c8, minFilter = $a315ee31802fb757$export$5d8599b6a933fb1b, format = $a315ee31802fb757$export$3f8bb04b555a363c, type = $a315ee31802fb757$export$2e8ce08d3f6f5e10, anisotropy = $a315ee31802fb757$export$5431306cf43de24a.DEFAULT_ANISOTROPY, colorSpace1 = $a315ee31802fb757$export$bfcb490c2dd3db51){\n super();\n this.isTexture = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$textureId++\n });\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.name = \"\";\n this.source = new $a315ee31802fb757$export$1d2df86270c81ecb(image);\n this.mipmaps = [];\n this.mapping = mapping;\n this.channel = 0;\n this.wrapS = wrapS;\n this.wrapT = wrapT;\n this.magFilter = magFilter;\n this.minFilter = minFilter;\n this.anisotropy = anisotropy;\n this.format = format;\n this.internalFormat = null;\n this.type = type;\n this.offset = new $a315ee31802fb757$export$c977b3e384af9ae1(0, 0);\n this.repeat = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.center = new $a315ee31802fb757$export$c977b3e384af9ae1(0, 0);\n this.rotation = 0;\n this.matrixAutoUpdate = true;\n this.matrix = new $a315ee31802fb757$export$8ff26dafa08918();\n this.generateMipmaps = true;\n this.premultiplyAlpha = false;\n this.flipY = true;\n this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n if (typeof colorSpace1 === \"string\") this.colorSpace = colorSpace1;\n else {\n $a315ee31802fb757$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n this.colorSpace = colorSpace1 === $a315ee31802fb757$export$f32388edbb32674 ? $a315ee31802fb757$export$561f394b24edfcaa : $a315ee31802fb757$export$bfcb490c2dd3db51;\n }\n this.userData = {};\n this.version = 0;\n this.onUpdate = null;\n this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n }\n get image() {\n return this.source.data;\n }\n set image(value = null) {\n this.source.data = value;\n }\n updateMatrix() {\n this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.name = source.name;\n this.source = source.source;\n this.mipmaps = source.mipmaps.slice(0);\n this.mapping = source.mapping;\n this.channel = source.channel;\n this.wrapS = source.wrapS;\n this.wrapT = source.wrapT;\n this.magFilter = source.magFilter;\n this.minFilter = source.minFilter;\n this.anisotropy = source.anisotropy;\n this.format = source.format;\n this.internalFormat = source.internalFormat;\n this.type = source.type;\n this.offset.copy(source.offset);\n this.repeat.copy(source.repeat);\n this.center.copy(source.center);\n this.rotation = source.rotation;\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrix.copy(source.matrix);\n this.generateMipmaps = source.generateMipmaps;\n this.premultiplyAlpha = source.premultiplyAlpha;\n this.flipY = source.flipY;\n this.unpackAlignment = source.unpackAlignment;\n this.colorSpace = source.colorSpace;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n this.needsUpdate = true;\n return this;\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (!isRootObject && meta.textures[this.uuid] !== undefined) return meta.textures[this.uuid];\n const output = {\n metadata: {\n version: 4.6,\n type: \"Texture\",\n generator: \"Texture.toJSON\"\n },\n uuid: this.uuid,\n name: this.name,\n image: this.source.toJSON(meta).uuid,\n mapping: this.mapping,\n channel: this.channel,\n repeat: [\n this.repeat.x,\n this.repeat.y\n ],\n offset: [\n this.offset.x,\n this.offset.y\n ],\n center: [\n this.center.x,\n this.center.y\n ],\n rotation: this.rotation,\n wrap: [\n this.wrapS,\n this.wrapT\n ],\n format: this.format,\n internalFormat: this.internalFormat,\n type: this.type,\n colorSpace: this.colorSpace,\n minFilter: this.minFilter,\n magFilter: this.magFilter,\n anisotropy: this.anisotropy,\n flipY: this.flipY,\n generateMipmaps: this.generateMipmaps,\n premultiplyAlpha: this.premultiplyAlpha,\n unpackAlignment: this.unpackAlignment\n };\n if (Object.keys(this.userData).length > 0) output.userData = this.userData;\n if (!isRootObject) meta.textures[this.uuid] = output;\n return output;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n transformUv(uv) {\n if (this.mapping !== $a315ee31802fb757$export$1beec6768cbb3d2d) return uv;\n uv.applyMatrix3(this.matrix);\n if (uv.x < 0 || uv.x > 1) switch(this.wrapS){\n case $a315ee31802fb757$export$533346c8e8dac0f5:\n uv.x = uv.x - Math.floor(uv.x);\n break;\n case $a315ee31802fb757$export$9d9334239a5a5e06:\n uv.x = uv.x < 0 ? 0 : 1;\n break;\n case $a315ee31802fb757$export$c7e7c00b14f51a4f:\n if (Math.abs(Math.floor(uv.x) % 2) === 1) uv.x = Math.ceil(uv.x) - uv.x;\n else uv.x = uv.x - Math.floor(uv.x);\n break;\n }\n if (uv.y < 0 || uv.y > 1) switch(this.wrapT){\n case $a315ee31802fb757$export$533346c8e8dac0f5:\n uv.y = uv.y - Math.floor(uv.y);\n break;\n case $a315ee31802fb757$export$9d9334239a5a5e06:\n uv.y = uv.y < 0 ? 0 : 1;\n break;\n case $a315ee31802fb757$export$c7e7c00b14f51a4f:\n if (Math.abs(Math.floor(uv.y) % 2) === 1) uv.y = Math.ceil(uv.y) - uv.y;\n else uv.y = uv.y - Math.floor(uv.y);\n break;\n }\n if (this.flipY) uv.y = 1 - uv.y;\n return uv;\n }\n set needsUpdate(value) {\n if (value === true) {\n this.version++;\n this.source.needsUpdate = true;\n }\n }\n get encoding() {\n $a315ee31802fb757$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n return this.colorSpace === $a315ee31802fb757$export$561f394b24edfcaa ? $a315ee31802fb757$export$f32388edbb32674 : $a315ee31802fb757$export$7207336e4151a112;\n }\n set encoding(encoding) {\n $a315ee31802fb757$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n this.colorSpace = encoding === $a315ee31802fb757$export$f32388edbb32674 ? $a315ee31802fb757$export$561f394b24edfcaa : $a315ee31802fb757$export$bfcb490c2dd3db51;\n }\n}\n$a315ee31802fb757$export$5431306cf43de24a.DEFAULT_IMAGE = null;\n$a315ee31802fb757$export$5431306cf43de24a.DEFAULT_MAPPING = $a315ee31802fb757$export$1beec6768cbb3d2d;\n$a315ee31802fb757$export$5431306cf43de24a.DEFAULT_ANISOTROPY = 1;\nclass $a315ee31802fb757$export$fa7daccca11cdbe3 {\n constructor(x = 0, y = 0, z = 0, w = 1){\n $a315ee31802fb757$export$fa7daccca11cdbe3.prototype.isVector4 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n get width() {\n return this.z;\n }\n set width(value) {\n this.z = value;\n }\n get height() {\n return this.w;\n }\n set height(value) {\n this.w = value;\n }\n set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n this.w = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setZ(z) {\n this.z = z;\n return this;\n }\n setW(w) {\n this.w = w;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n case 3:\n this.w = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n case 3:\n return this.w;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y, this.z, this.w);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n this.w = v.w !== undefined ? v.w : 1;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n this.w += v.w;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n this.w += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n this.w = a.w + b.w;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n this.w += v.w * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n this.w -= v.w;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n this.w -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n this.w = a.w - b.w;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n this.w *= v.w;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n this.w *= scalar;\n return this;\n }\n applyMatrix4(m) {\n const x = this.x, y = this.y, z = this.z, w = this.w;\n const e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;\n this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;\n this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;\n this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n setAxisAngleFromQuaternion(q) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n // q is assumed to be normalized\n this.w = 2 * Math.acos(q.w);\n const s = Math.sqrt(1 - q.w * q.w);\n if (s < 0.0001) {\n this.x = 1;\n this.y = 0;\n this.z = 0;\n } else {\n this.x = q.x / s;\n this.y = q.y / s;\n this.z = q.z / s;\n }\n return this;\n }\n setAxisAngleFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n let angle, x, y, z; // variables for result\n const epsilon = 0.01, epsilon2 = 0.1, te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10];\n if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {\n // singularity found\n // first check for identity matrix which must have +1 for all terms\n // in leading diagonal and zero in other terms\n if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {\n // this singularity is identity matrix so angle = 0\n this.set(1, 0, 0, 0);\n return this; // zero angle, arbitrary axis\n }\n // otherwise this singularity is angle = 180\n angle = Math.PI;\n const xx = (m11 + 1) / 2;\n const yy = (m22 + 1) / 2;\n const zz = (m33 + 1) / 2;\n const xy = (m12 + m21) / 4;\n const xz = (m13 + m31) / 4;\n const yz = (m23 + m32) / 4;\n if (xx > yy && xx > zz) {\n // m11 is the largest diagonal term\n if (xx < epsilon) {\n x = 0;\n y = 0.707106781;\n z = 0.707106781;\n } else {\n x = Math.sqrt(xx);\n y = xy / x;\n z = xz / x;\n }\n } else if (yy > zz) {\n // m22 is the largest diagonal term\n if (yy < epsilon) {\n x = 0.707106781;\n y = 0;\n z = 0.707106781;\n } else {\n y = Math.sqrt(yy);\n x = xy / y;\n z = yz / y;\n }\n } else // m33 is the largest diagonal term so base result on this\n if (zz < epsilon) {\n x = 0.707106781;\n y = 0.707106781;\n z = 0;\n } else {\n z = Math.sqrt(zz);\n x = xz / z;\n y = yz / z;\n }\n this.set(x, y, z, angle);\n return this; // return 180 deg rotation\n }\n // as we have reached here there are no singularities so we can handle normally\n let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize\n if (Math.abs(s) < 0.001) s = 1;\n // prevent divide by zero, should not happen if matrix is orthogonal and should be\n // caught by singularity test above, but I've left it in just in case\n this.x = (m32 - m23) / s;\n this.y = (m13 - m31) / s;\n this.z = (m21 - m12) / s;\n this.w = Math.acos((m11 + m22 + m33 - 1) / 2);\n return this;\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n this.w = Math.min(this.w, v.w);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n this.w = Math.max(this.w, v.w);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n this.w = Math.max(min.w, Math.min(max.w, this.w));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n this.w = Math.max(minVal, Math.min(maxVal, this.w));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n this.w = Math.floor(this.w);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n this.w = Math.ceil(this.w);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n this.w = Math.round(this.w);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n this.w = -this.w;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n }\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n this.w += (v.w - this.w) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n this.w = v1.w + (v2.w - v1.w) * alpha;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n this.w = array[offset + 3];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n array[offset + 3] = this.w;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n this.w = attribute.getW(index);\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n this.w = Math.random();\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n yield this.z;\n yield this.w;\n }\n}\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/ class $a315ee31802fb757$export$efcb1f8bf367cbfb extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(width = 1, height = 1, options = {}){\n super();\n this.isRenderTarget = true;\n this.width = width;\n this.height = height;\n this.depth = 1;\n this.scissor = new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, width, height);\n this.scissorTest = false;\n this.viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, width, height);\n const image = {\n width: width,\n height: height,\n depth: 1\n };\n if (options.encoding !== undefined) {\n // @deprecated, r152\n $a315ee31802fb757$var$warnOnce(\"THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.\");\n options.colorSpace = options.encoding === $a315ee31802fb757$export$f32388edbb32674 ? $a315ee31802fb757$export$561f394b24edfcaa : $a315ee31802fb757$export$bfcb490c2dd3db51;\n }\n this.texture = new $a315ee31802fb757$export$5431306cf43de24a(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace);\n this.texture.isRenderTargetTexture = true;\n this.texture.flipY = false;\n this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n this.samples = options.samples !== undefined ? options.samples : 0;\n }\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.texture.image.width = width;\n this.texture.image.height = height;\n this.texture.image.depth = depth;\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.scissor.copy(source.scissor);\n this.scissorTest = source.scissorTest;\n this.viewport.copy(source.viewport);\n this.texture = source.texture.clone();\n this.texture.isRenderTargetTexture = true;\n // ensure image object is not shared, see #20328\n const image = Object.assign({}, source.texture.image);\n this.texture.source = new $a315ee31802fb757$export$1d2df86270c81ecb(image);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.samples = source.samples;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nclass $a315ee31802fb757$export$3c052beb2e51e23f extends $a315ee31802fb757$export$efcb1f8bf367cbfb {\n constructor(width = 1, height = 1, options = {}){\n super(width, height, options);\n this.isWebGLRenderTarget = true;\n }\n}\nclass $a315ee31802fb757$export$dfac6c8e811406a3 extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, depth = 1){\n super(null);\n this.isDataArrayTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n this.magFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.minFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.wrapR = $a315ee31802fb757$export$9d9334239a5a5e06;\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nclass $a315ee31802fb757$export$c77a02c11ed180c7 extends $a315ee31802fb757$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, depth = 1){\n super(width, height);\n this.isWebGLArrayRenderTarget = true;\n this.depth = depth;\n this.texture = new $a315ee31802fb757$export$dfac6c8e811406a3(null, width, height, depth);\n this.texture.isRenderTargetTexture = true;\n }\n}\nclass $a315ee31802fb757$export$d7a3086320f856db extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, depth = 1){\n // We're going to add .setXXX() methods for setting properties later.\n // Users can still set in DataTexture3D directly.\n //\n //\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n // \ttexture.anisotropy = 16;\n //\n // See #14839\n super(null);\n this.isData3DTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n this.magFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.minFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.wrapR = $a315ee31802fb757$export$9d9334239a5a5e06;\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nclass $a315ee31802fb757$export$7ee06591009639df extends $a315ee31802fb757$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, depth = 1){\n super(width, height);\n this.isWebGL3DRenderTarget = true;\n this.depth = depth;\n this.texture = new $a315ee31802fb757$export$d7a3086320f856db(null, width, height, depth);\n this.texture.isRenderTargetTexture = true;\n }\n}\nclass $a315ee31802fb757$export$bd934554fb721730 extends $a315ee31802fb757$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, count = 1, options = {}){\n super(width, height, options);\n this.isWebGLMultipleRenderTargets = true;\n const texture = this.texture;\n this.texture = [];\n for(let i = 0; i < count; i++){\n this.texture[i] = texture.clone();\n this.texture[i].isRenderTargetTexture = true;\n }\n }\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n for(let i = 0, il = this.texture.length; i < il; i++){\n this.texture[i].image.width = width;\n this.texture[i].image.height = height;\n this.texture[i].image.depth = depth;\n }\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n }\n copy(source) {\n this.dispose();\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.scissor.copy(source.scissor);\n this.scissorTest = source.scissorTest;\n this.viewport.copy(source.viewport);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.texture.length = 0;\n for(let i = 0, il = source.texture.length; i < il; i++){\n this.texture[i] = source.texture[i].clone();\n this.texture[i].isRenderTargetTexture = true;\n }\n return this;\n }\n}\nclass $a315ee31802fb757$export$23d6a54f0bbc85a3 {\n constructor(x = 0, y = 0, z = 0, w = 1){\n this.isQuaternion = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n }\n static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {\n // fuzz-free, array-based Quaternion SLERP operation\n let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3];\n const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3];\n if (t === 0) {\n dst[dstOffset + 0] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n return;\n }\n if (t === 1) {\n dst[dstOffset + 0] = x1;\n dst[dstOffset + 1] = y1;\n dst[dstOffset + 2] = z1;\n dst[dstOffset + 3] = w1;\n return;\n }\n if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {\n let s = 1 - t;\n const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos;\n // Skip the Slerp for tiny steps to avoid numeric problems:\n if (sqrSin > Number.EPSILON) {\n const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir);\n s = Math.sin(s * len) / sin;\n t = Math.sin(t * len) / sin;\n }\n const tDir = t * dir;\n x0 = x0 * s + x1 * tDir;\n y0 = y0 * s + y1 * tDir;\n z0 = z0 * s + z1 * tDir;\n w0 = w0 * s + w1 * tDir;\n // Normalize in case we just did a lerp:\n if (s === 1 - t) {\n const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);\n x0 *= f;\n y0 *= f;\n z0 *= f;\n w0 *= f;\n }\n }\n dst[dstOffset] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n }\n static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {\n const x0 = src0[srcOffset0];\n const y0 = src0[srcOffset0 + 1];\n const z0 = src0[srcOffset0 + 2];\n const w0 = src0[srcOffset0 + 3];\n const x1 = src1[srcOffset1];\n const y1 = src1[srcOffset1 + 1];\n const z1 = src1[srcOffset1 + 2];\n const w1 = src1[srcOffset1 + 3];\n dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n return dst;\n }\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._onChangeCallback();\n }\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._onChangeCallback();\n }\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._onChangeCallback();\n }\n get w() {\n return this._w;\n }\n set w(value) {\n this._w = value;\n this._onChangeCallback();\n }\n set(x, y, z, w) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n this._onChangeCallback();\n return this;\n }\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._w);\n }\n copy(quaternion) {\n this._x = quaternion.x;\n this._y = quaternion.y;\n this._z = quaternion.z;\n this._w = quaternion.w;\n this._onChangeCallback();\n return this;\n }\n setFromEuler(euler, update) {\n const x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n //\tcontent/SpinCalc.m\n const cos = Math.cos;\n const sin = Math.sin;\n const c1 = cos(x / 2);\n const c2 = cos(y / 2);\n const c3 = cos(z / 2);\n const s1 = sin(x / 2);\n const s2 = sin(y / 2);\n const s3 = sin(z / 2);\n switch(order){\n case \"XYZ\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"YXZ\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case \"ZXY\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"ZYX\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case \"YZX\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"XZY\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n default:\n console.warn(\"THREE.Quaternion: .setFromEuler() encountered an unknown order: \" + order);\n }\n if (update !== false) this._onChangeCallback();\n return this;\n }\n setFromAxisAngle(axis, angle) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n const halfAngle = angle / 2, s = Math.sin(halfAngle);\n this._x = axis.x * s;\n this._y = axis.y * s;\n this._z = axis.z * s;\n this._w = Math.cos(halfAngle);\n this._onChangeCallback();\n return this;\n }\n setFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n const te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10], trace = m11 + m22 + m33;\n if (trace > 0) {\n const s = 0.5 / Math.sqrt(trace + 1.0);\n this._w = 0.25 / s;\n this._x = (m32 - m23) * s;\n this._y = (m13 - m31) * s;\n this._z = (m21 - m12) * s;\n } else if (m11 > m22 && m11 > m33) {\n const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\n this._w = (m32 - m23) / s;\n this._x = 0.25 * s;\n this._y = (m12 + m21) / s;\n this._z = (m13 + m31) / s;\n } else if (m22 > m33) {\n const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\n this._w = (m13 - m31) / s;\n this._x = (m12 + m21) / s;\n this._y = 0.25 * s;\n this._z = (m23 + m32) / s;\n } else {\n const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\n this._w = (m21 - m12) / s;\n this._x = (m13 + m31) / s;\n this._y = (m23 + m32) / s;\n this._z = 0.25 * s;\n }\n this._onChangeCallback();\n return this;\n }\n setFromUnitVectors(vFrom, vTo) {\n // assumes direction vectors vFrom and vTo are normalized\n let r = vFrom.dot(vTo) + 1;\n if (r < Number.EPSILON) {\n // vFrom and vTo point in opposite directions\n r = 0;\n if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {\n this._x = -vFrom.y;\n this._y = vFrom.x;\n this._z = 0;\n this._w = r;\n } else {\n this._x = 0;\n this._y = -vFrom.z;\n this._z = vFrom.y;\n this._w = r;\n }\n } else {\n // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n this._w = r;\n }\n return this.normalize();\n }\n angleTo(q) {\n return 2 * Math.acos(Math.abs($a315ee31802fb757$var$clamp(this.dot(q), -1, 1)));\n }\n rotateTowards(q, step) {\n const angle = this.angleTo(q);\n if (angle === 0) return this;\n const t = Math.min(1, step / angle);\n this.slerp(q, t);\n return this;\n }\n identity() {\n return this.set(0, 0, 0, 1);\n }\n invert() {\n // quaternion is assumed to have unit length\n return this.conjugate();\n }\n conjugate() {\n this._x *= -1;\n this._y *= -1;\n this._z *= -1;\n this._onChangeCallback();\n return this;\n }\n dot(v) {\n return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n }\n lengthSq() {\n return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n }\n length() {\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);\n }\n normalize() {\n let l = this.length();\n if (l === 0) {\n this._x = 0;\n this._y = 0;\n this._z = 0;\n this._w = 1;\n } else {\n l = 1 / l;\n this._x = this._x * l;\n this._y = this._y * l;\n this._z = this._z * l;\n this._w = this._w * l;\n }\n this._onChangeCallback();\n return this;\n }\n multiply(q) {\n return this.multiplyQuaternions(this, q);\n }\n premultiply(q) {\n return this.multiplyQuaternions(q, this);\n }\n multiplyQuaternions(a, b) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n this._onChangeCallback();\n return this;\n }\n slerp(qb, t) {\n if (t === 0) return this;\n if (t === 1) return this.copy(qb);\n const x = this._x, y = this._y, z = this._z, w = this._w;\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n if (cosHalfTheta < 0) {\n this._w = -qb._w;\n this._x = -qb._x;\n this._y = -qb._y;\n this._z = -qb._z;\n cosHalfTheta = -cosHalfTheta;\n } else this.copy(qb);\n if (cosHalfTheta >= 1.0) {\n this._w = w;\n this._x = x;\n this._y = y;\n this._z = z;\n return this;\n }\n const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n if (sqrSinHalfTheta <= Number.EPSILON) {\n const s = 1 - t;\n this._w = s * w + t * this._w;\n this._x = s * x + t * this._x;\n this._y = s * y + t * this._y;\n this._z = s * z + t * this._z;\n this.normalize();\n this._onChangeCallback();\n return this;\n }\n const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);\n const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);\n const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t * halfTheta) / sinHalfTheta;\n this._w = w * ratioA + this._w * ratioB;\n this._x = x * ratioA + this._x * ratioB;\n this._y = y * ratioA + this._y * ratioB;\n this._z = z * ratioA + this._z * ratioB;\n this._onChangeCallback();\n return this;\n }\n slerpQuaternions(qa, qb, t) {\n return this.copy(qa).slerp(qb, t);\n }\n random() {\n // Derived from http://planning.cs.uiuc.edu/node198.html\n // Note, this source uses w, x, y, z ordering,\n // so we swap the order below.\n const u1 = Math.random();\n const sqrt1u1 = Math.sqrt(1 - u1);\n const sqrtu1 = Math.sqrt(u1);\n const u2 = 2 * Math.PI * Math.random();\n const u3 = 2 * Math.PI * Math.random();\n return this.set(sqrt1u1 * Math.cos(u2), sqrtu1 * Math.sin(u3), sqrtu1 * Math.cos(u3), sqrt1u1 * Math.sin(u2));\n }\n equals(quaternion) {\n return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;\n }\n fromArray(array, offset = 0) {\n this._x = array[offset];\n this._y = array[offset + 1];\n this._z = array[offset + 2];\n this._w = array[offset + 3];\n this._onChangeCallback();\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._w;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this._x = attribute.getX(index);\n this._y = attribute.getY(index);\n this._z = attribute.getZ(index);\n this._w = attribute.getW(index);\n return this;\n }\n toJSON() {\n return this.toArray();\n }\n _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n _onChangeCallback() {}\n *[Symbol.iterator]() {\n yield this._x;\n yield this._y;\n yield this._z;\n yield this._w;\n }\n}\nclass $a315ee31802fb757$export$64b5c384219d3699 {\n constructor(x = 0, y = 0, z = 0){\n $a315ee31802fb757$export$64b5c384219d3699.prototype.isVector3 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n set(x, y, z) {\n if (z === undefined) z = this.z; // sprite.scale.set(x,y)\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setZ(z) {\n this.z = z;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y, this.z);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n return this;\n }\n multiplyVectors(a, b) {\n this.x = a.x * b.x;\n this.y = a.y * b.y;\n this.z = a.z * b.z;\n return this;\n }\n applyEuler(euler) {\n return this.applyQuaternion($a315ee31802fb757$var$_quaternion$4.setFromEuler(euler));\n }\n applyAxisAngle(axis, angle) {\n return this.applyQuaternion($a315ee31802fb757$var$_quaternion$4.setFromAxisAngle(axis, angle));\n }\n applyMatrix3(m) {\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6] * z;\n this.y = e[1] * x + e[4] * y + e[7] * z;\n this.z = e[2] * x + e[5] * y + e[8] * z;\n return this;\n }\n applyNormalMatrix(m) {\n return this.applyMatrix3(m).normalize();\n }\n applyMatrix4(m) {\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;\n this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;\n this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;\n return this;\n }\n applyQuaternion(q) {\n const x = this.x, y = this.y, z = this.z;\n const qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n // calculate quat * vector\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n // calculate result * inverse quat\n this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return this;\n }\n project(camera) {\n return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);\n }\n unproject(camera) {\n return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);\n }\n transformDirection(m) {\n // input: THREE.Matrix4 affine matrix\n // vector interpreted as a direction\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z;\n this.y = e[1] * x + e[5] * y + e[9] * z;\n this.z = e[2] * x + e[6] * y + e[10] * z;\n return this.normalize();\n }\n divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n this.z /= v.z;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n }\n // TODO lengthSquared?\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n return this;\n }\n cross(v) {\n return this.crossVectors(this, v);\n }\n crossVectors(a, b) {\n const ax = a.x, ay = a.y, az = a.z;\n const bx = b.x, by = b.y, bz = b.z;\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n return this;\n }\n projectOnVector(v) {\n const denominator = v.lengthSq();\n if (denominator === 0) return this.set(0, 0, 0);\n const scalar = v.dot(this) / denominator;\n return this.copy(v).multiplyScalar(scalar);\n }\n projectOnPlane(planeNormal) {\n $a315ee31802fb757$var$_vector$b.copy(this).projectOnVector(planeNormal);\n return this.sub($a315ee31802fb757$var$_vector$b);\n }\n reflect(normal) {\n // reflect incident vector off plane orthogonal to normal\n // normal is assumed to have unit length\n return this.sub($a315ee31802fb757$var$_vector$b.copy(normal).multiplyScalar(2 * this.dot(normal)));\n }\n angleTo(v) {\n const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n const theta = this.dot(v) / denominator;\n // clamp, to handle numerical problems\n return Math.acos($a315ee31802fb757$var$clamp(theta, -1, 1));\n }\n distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n distanceToSquared(v) {\n const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n return dx * dx + dy * dy + dz * dz;\n }\n manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);\n }\n setFromSpherical(s) {\n return this.setFromSphericalCoords(s.radius, s.phi, s.theta);\n }\n setFromSphericalCoords(radius, phi, theta) {\n const sinPhiRadius = Math.sin(phi) * radius;\n this.x = sinPhiRadius * Math.sin(theta);\n this.y = Math.cos(phi) * radius;\n this.z = sinPhiRadius * Math.cos(theta);\n return this;\n }\n setFromCylindrical(c) {\n return this.setFromCylindricalCoords(c.radius, c.theta, c.y);\n }\n setFromCylindricalCoords(radius, theta, y) {\n this.x = radius * Math.sin(theta);\n this.y = y;\n this.z = radius * Math.cos(theta);\n return this;\n }\n setFromMatrixPosition(m) {\n const e = m.elements;\n this.x = e[12];\n this.y = e[13];\n this.z = e[14];\n return this;\n }\n setFromMatrixScale(m) {\n const sx = this.setFromMatrixColumn(m, 0).length();\n const sy = this.setFromMatrixColumn(m, 1).length();\n const sz = this.setFromMatrixColumn(m, 2).length();\n this.x = sx;\n this.y = sy;\n this.z = sz;\n return this;\n }\n setFromMatrixColumn(m, index) {\n return this.fromArray(m.elements, index * 4);\n }\n setFromMatrix3Column(m, index) {\n return this.fromArray(m.elements, index * 3);\n }\n setFromEuler(e) {\n this.x = e._x;\n this.y = e._y;\n this.z = e._z;\n return this;\n }\n setFromColor(c) {\n this.x = c.r;\n this.y = c.g;\n this.z = c.b;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n return this;\n }\n randomDirection() {\n // Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n const u = (Math.random() - 0.5) * 2;\n const t = Math.random() * Math.PI * 2;\n const f = Math.sqrt(1 - u ** 2);\n this.x = f * Math.cos(t);\n this.y = f * Math.sin(t);\n this.z = u;\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n yield this.z;\n }\n}\nconst $a315ee31802fb757$var$_vector$b = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_quaternion$4 = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nclass $a315ee31802fb757$export$6f7d5a9418ab2aa3 {\n constructor(min = new $a315ee31802fb757$export$64b5c384219d3699(Infinity, Infinity, Infinity), max = new $a315ee31802fb757$export$64b5c384219d3699(-Infinity, -Infinity, -Infinity)){\n this.isBox3 = true;\n this.min = min;\n this.max = max;\n }\n set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n setFromArray(array) {\n this.makeEmpty();\n for(let i = 0, il = array.length; i < il; i += 3)this.expandByPoint($a315ee31802fb757$var$_vector$a.fromArray(array, i));\n return this;\n }\n setFromBufferAttribute(attribute) {\n this.makeEmpty();\n for(let i = 0, il = attribute.count; i < il; i++)this.expandByPoint($a315ee31802fb757$var$_vector$a.fromBufferAttribute(attribute, i));\n return this;\n }\n setFromPoints(points) {\n this.makeEmpty();\n for(let i = 0, il = points.length; i < il; i++)this.expandByPoint(points[i]);\n return this;\n }\n setFromCenterAndSize(center, size) {\n const halfSize = $a315ee31802fb757$var$_vector$a.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n setFromObject(object, precise = false) {\n this.makeEmpty();\n return this.expandByObject(object, precise);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n makeEmpty() {\n this.min.x = this.min.y = this.min.z = Infinity;\n this.max.x = this.max.y = this.max.z = -Infinity;\n return this;\n }\n isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;\n }\n getCenter(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n getSize(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);\n }\n expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n expandByObject(object, precise = false) {\n // Computes the world-axis-aligned bounding box of an object (including its children),\n // accounting for both the object's, and children's, world transforms\n object.updateWorldMatrix(false, false);\n if (object.boundingBox !== undefined) {\n if (object.boundingBox === null) object.computeBoundingBox();\n $a315ee31802fb757$var$_box$3.copy(object.boundingBox);\n $a315ee31802fb757$var$_box$3.applyMatrix4(object.matrixWorld);\n this.union($a315ee31802fb757$var$_box$3);\n } else {\n const geometry = object.geometry;\n if (geometry !== undefined) {\n if (precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined) {\n const position = geometry.attributes.position;\n for(let i = 0, l = position.count; i < l; i++){\n $a315ee31802fb757$var$_vector$a.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld);\n this.expandByPoint($a315ee31802fb757$var$_vector$a);\n }\n } else {\n if (geometry.boundingBox === null) geometry.computeBoundingBox();\n $a315ee31802fb757$var$_box$3.copy(geometry.boundingBox);\n $a315ee31802fb757$var$_box$3.applyMatrix4(object.matrixWorld);\n this.union($a315ee31802fb757$var$_box$3);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)this.expandByObject(children[i], precise);\n return this;\n }\n containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true;\n }\n containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;\n }\n getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));\n }\n intersectsBox(box) {\n // using 6 splitting planes to rule out intersections.\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n }\n intersectsSphere(sphere) {\n // Find the point on the AABB closest to the sphere center.\n this.clampPoint(sphere.center, $a315ee31802fb757$var$_vector$a);\n // If that point is inside the sphere, the AABB and sphere intersect.\n return $a315ee31802fb757$var$_vector$a.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;\n }\n intersectsPlane(plane) {\n // We compute the minimum and maximum dot product values. If those values\n // are on the same side (back or front) of the plane, then there is no intersection.\n let min, max;\n if (plane.normal.x > 0) {\n min = plane.normal.x * this.min.x;\n max = plane.normal.x * this.max.x;\n } else {\n min = plane.normal.x * this.max.x;\n max = plane.normal.x * this.min.x;\n }\n if (plane.normal.y > 0) {\n min += plane.normal.y * this.min.y;\n max += plane.normal.y * this.max.y;\n } else {\n min += plane.normal.y * this.max.y;\n max += plane.normal.y * this.min.y;\n }\n if (plane.normal.z > 0) {\n min += plane.normal.z * this.min.z;\n max += plane.normal.z * this.max.z;\n } else {\n min += plane.normal.z * this.max.z;\n max += plane.normal.z * this.min.z;\n }\n return min <= -plane.constant && max >= -plane.constant;\n }\n intersectsTriangle(triangle) {\n if (this.isEmpty()) return false;\n // compute box center and extents\n this.getCenter($a315ee31802fb757$var$_center);\n $a315ee31802fb757$var$_extents.subVectors(this.max, $a315ee31802fb757$var$_center);\n // translate triangle to aabb origin\n $a315ee31802fb757$var$_v0$2.subVectors(triangle.a, $a315ee31802fb757$var$_center);\n $a315ee31802fb757$var$_v1$7.subVectors(triangle.b, $a315ee31802fb757$var$_center);\n $a315ee31802fb757$var$_v2$4.subVectors(triangle.c, $a315ee31802fb757$var$_center);\n // compute edge vectors for triangle\n $a315ee31802fb757$var$_f0.subVectors($a315ee31802fb757$var$_v1$7, $a315ee31802fb757$var$_v0$2);\n $a315ee31802fb757$var$_f1.subVectors($a315ee31802fb757$var$_v2$4, $a315ee31802fb757$var$_v1$7);\n $a315ee31802fb757$var$_f2.subVectors($a315ee31802fb757$var$_v0$2, $a315ee31802fb757$var$_v2$4);\n // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n let axes = [\n 0,\n -$a315ee31802fb757$var$_f0.z,\n $a315ee31802fb757$var$_f0.y,\n 0,\n -$a315ee31802fb757$var$_f1.z,\n $a315ee31802fb757$var$_f1.y,\n 0,\n -$a315ee31802fb757$var$_f2.z,\n $a315ee31802fb757$var$_f2.y,\n $a315ee31802fb757$var$_f0.z,\n 0,\n -$a315ee31802fb757$var$_f0.x,\n $a315ee31802fb757$var$_f1.z,\n 0,\n -$a315ee31802fb757$var$_f1.x,\n $a315ee31802fb757$var$_f2.z,\n 0,\n -$a315ee31802fb757$var$_f2.x,\n -$a315ee31802fb757$var$_f0.y,\n $a315ee31802fb757$var$_f0.x,\n 0,\n -$a315ee31802fb757$var$_f1.y,\n $a315ee31802fb757$var$_f1.x,\n 0,\n -$a315ee31802fb757$var$_f2.y,\n $a315ee31802fb757$var$_f2.x,\n 0\n ];\n if (!$a315ee31802fb757$var$satForAxes(axes, $a315ee31802fb757$var$_v0$2, $a315ee31802fb757$var$_v1$7, $a315ee31802fb757$var$_v2$4, $a315ee31802fb757$var$_extents)) return false;\n // test 3 face normals from the aabb\n axes = [\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ];\n if (!$a315ee31802fb757$var$satForAxes(axes, $a315ee31802fb757$var$_v0$2, $a315ee31802fb757$var$_v1$7, $a315ee31802fb757$var$_v2$4, $a315ee31802fb757$var$_extents)) return false;\n // finally testing the face normal of the triangle\n // use already existing triangle edge vectors here\n $a315ee31802fb757$var$_triangleNormal.crossVectors($a315ee31802fb757$var$_f0, $a315ee31802fb757$var$_f1);\n axes = [\n $a315ee31802fb757$var$_triangleNormal.x,\n $a315ee31802fb757$var$_triangleNormal.y,\n $a315ee31802fb757$var$_triangleNormal.z\n ];\n return $a315ee31802fb757$var$satForAxes(axes, $a315ee31802fb757$var$_v0$2, $a315ee31802fb757$var$_v1$7, $a315ee31802fb757$var$_v2$4, $a315ee31802fb757$var$_extents);\n }\n clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n distanceToPoint(point) {\n return this.clampPoint(point, $a315ee31802fb757$var$_vector$a).distanceTo(point);\n }\n getBoundingSphere(target) {\n if (this.isEmpty()) target.makeEmpty();\n else {\n this.getCenter(target.center);\n target.radius = this.getSize($a315ee31802fb757$var$_vector$a).length() * 0.5;\n }\n return target;\n }\n intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n applyMatrix4(matrix) {\n // transform of empty box is an empty box.\n if (this.isEmpty()) return this;\n // NOTE: I am using a binary pattern to specify all 2^3 combinations below\n $a315ee31802fb757$var$_points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000\n $a315ee31802fb757$var$_points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001\n $a315ee31802fb757$var$_points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010\n $a315ee31802fb757$var$_points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011\n $a315ee31802fb757$var$_points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100\n $a315ee31802fb757$var$_points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101\n $a315ee31802fb757$var$_points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110\n $a315ee31802fb757$var$_points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111\n this.setFromPoints($a315ee31802fb757$var$_points);\n return this;\n }\n translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n}\nconst $a315ee31802fb757$var$_points = [\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699()\n];\nconst $a315ee31802fb757$var$_vector$a = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_box$3 = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\n// triangle centered vertices\nconst $a315ee31802fb757$var$_v0$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v1$7 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v2$4 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\n// triangle edge vectors\nconst $a315ee31802fb757$var$_f0 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_f1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_f2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_center = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_extents = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_triangleNormal = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_testAxis = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nfunction $a315ee31802fb757$var$satForAxes(axes, v0, v1, v2, extents) {\n for(let i = 0, j = axes.length - 3; i <= j; i += 3){\n $a315ee31802fb757$var$_testAxis.fromArray(axes, i);\n // project the aabb onto the separating axis\n const r = extents.x * Math.abs($a315ee31802fb757$var$_testAxis.x) + extents.y * Math.abs($a315ee31802fb757$var$_testAxis.y) + extents.z * Math.abs($a315ee31802fb757$var$_testAxis.z);\n // project all 3 vertices of the triangle onto the separating axis\n const p0 = v0.dot($a315ee31802fb757$var$_testAxis);\n const p1 = v1.dot($a315ee31802fb757$var$_testAxis);\n const p2 = v2.dot($a315ee31802fb757$var$_testAxis);\n // actual test, basically see if either of the most extreme of the triangle points intersects r\n if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) // points of the projected triangle are outside the projected half-length of the aabb\n // the axis is separating and we can exit\n return false;\n }\n return true;\n}\nconst $a315ee31802fb757$var$_box$2 = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\nconst $a315ee31802fb757$var$_v1$6 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v2$3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$805e8b72413ccaba {\n constructor(center = new $a315ee31802fb757$export$64b5c384219d3699(), radius = -1){\n this.center = center;\n this.radius = radius;\n }\n set(center, radius) {\n this.center.copy(center);\n this.radius = radius;\n return this;\n }\n setFromPoints(points, optionalCenter) {\n const center = this.center;\n if (optionalCenter !== undefined) center.copy(optionalCenter);\n else $a315ee31802fb757$var$_box$2.setFromPoints(points).getCenter(center);\n let maxRadiusSq = 0;\n for(let i = 0, il = points.length; i < il; i++)maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));\n this.radius = Math.sqrt(maxRadiusSq);\n return this;\n }\n copy(sphere) {\n this.center.copy(sphere.center);\n this.radius = sphere.radius;\n return this;\n }\n isEmpty() {\n return this.radius < 0;\n }\n makeEmpty() {\n this.center.set(0, 0, 0);\n this.radius = -1;\n return this;\n }\n containsPoint(point) {\n return point.distanceToSquared(this.center) <= this.radius * this.radius;\n }\n distanceToPoint(point) {\n return point.distanceTo(this.center) - this.radius;\n }\n intersectsSphere(sphere) {\n const radiusSum = this.radius + sphere.radius;\n return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;\n }\n intersectsBox(box) {\n return box.intersectsSphere(this);\n }\n intersectsPlane(plane) {\n return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;\n }\n clampPoint(point, target) {\n const deltaLengthSq = this.center.distanceToSquared(point);\n target.copy(point);\n if (deltaLengthSq > this.radius * this.radius) {\n target.sub(this.center).normalize();\n target.multiplyScalar(this.radius).add(this.center);\n }\n return target;\n }\n getBoundingBox(target) {\n if (this.isEmpty()) {\n // Empty sphere produces empty bounding box\n target.makeEmpty();\n return target;\n }\n target.set(this.center, this.center);\n target.expandByScalar(this.radius);\n return target;\n }\n applyMatrix4(matrix) {\n this.center.applyMatrix4(matrix);\n this.radius = this.radius * matrix.getMaxScaleOnAxis();\n return this;\n }\n translate(offset) {\n this.center.add(offset);\n return this;\n }\n expandByPoint(point) {\n if (this.isEmpty()) {\n this.center.copy(point);\n this.radius = 0;\n return this;\n }\n $a315ee31802fb757$var$_v1$6.subVectors(point, this.center);\n const lengthSq = $a315ee31802fb757$var$_v1$6.lengthSq();\n if (lengthSq > this.radius * this.radius) {\n // calculate the minimal sphere\n const length = Math.sqrt(lengthSq);\n const delta = (length - this.radius) * 0.5;\n this.center.addScaledVector($a315ee31802fb757$var$_v1$6, delta / length);\n this.radius += delta;\n }\n return this;\n }\n union(sphere) {\n if (sphere.isEmpty()) return this;\n if (this.isEmpty()) {\n this.copy(sphere);\n return this;\n }\n if (this.center.equals(sphere.center) === true) this.radius = Math.max(this.radius, sphere.radius);\n else {\n $a315ee31802fb757$var$_v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);\n this.expandByPoint($a315ee31802fb757$var$_v1$6.copy(sphere.center).add($a315ee31802fb757$var$_v2$3));\n this.expandByPoint($a315ee31802fb757$var$_v1$6.copy(sphere.center).sub($a315ee31802fb757$var$_v2$3));\n }\n return this;\n }\n equals(sphere) {\n return sphere.center.equals(this.center) && sphere.radius === this.radius;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $a315ee31802fb757$var$_vector$9 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_segCenter = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_segDir = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_diff = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_edge1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_edge2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_normal$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$a186db52eed6d40e {\n constructor(origin = new $a315ee31802fb757$export$64b5c384219d3699(), direction = new $a315ee31802fb757$export$64b5c384219d3699(0, 0, -1)){\n this.origin = origin;\n this.direction = direction;\n }\n set(origin, direction) {\n this.origin.copy(origin);\n this.direction.copy(direction);\n return this;\n }\n copy(ray) {\n this.origin.copy(ray.origin);\n this.direction.copy(ray.direction);\n return this;\n }\n at(t, target) {\n return target.copy(this.origin).addScaledVector(this.direction, t);\n }\n lookAt(v) {\n this.direction.copy(v).sub(this.origin).normalize();\n return this;\n }\n recast(t) {\n this.origin.copy(this.at(t, $a315ee31802fb757$var$_vector$9));\n return this;\n }\n closestPointToPoint(point, target) {\n target.subVectors(point, this.origin);\n const directionDistance = target.dot(this.direction);\n if (directionDistance < 0) return target.copy(this.origin);\n return target.copy(this.origin).addScaledVector(this.direction, directionDistance);\n }\n distanceToPoint(point) {\n return Math.sqrt(this.distanceSqToPoint(point));\n }\n distanceSqToPoint(point) {\n const directionDistance = $a315ee31802fb757$var$_vector$9.subVectors(point, this.origin).dot(this.direction);\n // point behind the ray\n if (directionDistance < 0) return this.origin.distanceToSquared(point);\n $a315ee31802fb757$var$_vector$9.copy(this.origin).addScaledVector(this.direction, directionDistance);\n return $a315ee31802fb757$var$_vector$9.distanceToSquared(point);\n }\n distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n // It returns the min distance between the ray and the segment\n // defined by v0 and v1\n // It can also set two optional targets :\n // - The closest point on the ray\n // - The closest point on the segment\n $a315ee31802fb757$var$_segCenter.copy(v0).add(v1).multiplyScalar(0.5);\n $a315ee31802fb757$var$_segDir.copy(v1).sub(v0).normalize();\n $a315ee31802fb757$var$_diff.copy(this.origin).sub($a315ee31802fb757$var$_segCenter);\n const segExtent = v0.distanceTo(v1) * 0.5;\n const a01 = -this.direction.dot($a315ee31802fb757$var$_segDir);\n const b0 = $a315ee31802fb757$var$_diff.dot(this.direction);\n const b1 = -$a315ee31802fb757$var$_diff.dot($a315ee31802fb757$var$_segDir);\n const c = $a315ee31802fb757$var$_diff.lengthSq();\n const det = Math.abs(1 - a01 * a01);\n let s0, s1, sqrDist, extDet;\n if (det > 0) {\n // The ray and segment are not parallel.\n s0 = a01 * b1 - b0;\n s1 = a01 * b0 - b1;\n extDet = segExtent * det;\n if (s0 >= 0) {\n if (s1 >= -extDet) {\n if (s1 <= extDet) {\n // region 0\n // Minimum at interior points of ray and segment.\n const invDet = 1 / det;\n s0 *= invDet;\n s1 *= invDet;\n sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;\n } else {\n // region 1\n s1 = segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n // region 5\n s1 = -segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n if (s1 <= -extDet) {\n // region 4\n s0 = Math.max(0, -(-a01 * segExtent + b0));\n s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n } else if (s1 <= extDet) {\n // region 3\n s0 = 0;\n s1 = Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = s1 * (s1 + 2 * b1) + c;\n } else {\n // region 2\n s0 = Math.max(0, -(a01 * segExtent + b0));\n s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n }\n } else {\n // Ray and segment are parallel.\n s1 = a01 > 0 ? -segExtent : segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n if (optionalPointOnRay) optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0);\n if (optionalPointOnSegment) optionalPointOnSegment.copy($a315ee31802fb757$var$_segCenter).addScaledVector($a315ee31802fb757$var$_segDir, s1);\n return sqrDist;\n }\n intersectSphere(sphere, target) {\n $a315ee31802fb757$var$_vector$9.subVectors(sphere.center, this.origin);\n const tca = $a315ee31802fb757$var$_vector$9.dot(this.direction);\n const d2 = $a315ee31802fb757$var$_vector$9.dot($a315ee31802fb757$var$_vector$9) - tca * tca;\n const radius2 = sphere.radius * sphere.radius;\n if (d2 > radius2) return null;\n const thc = Math.sqrt(radius2 - d2);\n // t0 = first intersect point - entrance on front of sphere\n const t0 = tca - thc;\n // t1 = second intersect point - exit point on back of sphere\n const t1 = tca + thc;\n // test to see if t1 is behind the ray - if so, return null\n if (t1 < 0) return null;\n // test to see if t0 is behind the ray:\n // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n // in order to always return an intersect point that is in front of the ray.\n if (t0 < 0) return this.at(t1, target);\n // else t0 is in front of the ray, so return the first collision point scaled by t0\n return this.at(t0, target);\n }\n intersectsSphere(sphere) {\n return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;\n }\n distanceToPlane(plane) {\n const denominator = plane.normal.dot(this.direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (plane.distanceToPoint(this.origin) === 0) return 0;\n // Null is preferable to undefined since undefined means.... it is undefined\n return null;\n }\n const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator;\n // Return if the ray never intersects the plane\n return t >= 0 ? t : null;\n }\n intersectPlane(plane, target) {\n const t = this.distanceToPlane(plane);\n if (t === null) return null;\n return this.at(t, target);\n }\n intersectsPlane(plane) {\n // check if the ray lies on the plane first\n const distToPoint = plane.distanceToPoint(this.origin);\n if (distToPoint === 0) return true;\n const denominator = plane.normal.dot(this.direction);\n if (denominator * distToPoint < 0) return true;\n // ray origin is behind the plane (and is pointing behind it)\n return false;\n }\n intersectBox(box, target) {\n let tmin, tmax, tymin, tymax, tzmin, tzmax;\n const invdirx = 1 / this.direction.x, invdiry = 1 / this.direction.y, invdirz = 1 / this.direction.z;\n const origin = this.origin;\n if (invdirx >= 0) {\n tmin = (box.min.x - origin.x) * invdirx;\n tmax = (box.max.x - origin.x) * invdirx;\n } else {\n tmin = (box.max.x - origin.x) * invdirx;\n tmax = (box.min.x - origin.x) * invdirx;\n }\n if (invdiry >= 0) {\n tymin = (box.min.y - origin.y) * invdiry;\n tymax = (box.max.y - origin.y) * invdiry;\n } else {\n tymin = (box.max.y - origin.y) * invdiry;\n tymax = (box.min.y - origin.y) * invdiry;\n }\n if (tmin > tymax || tymin > tmax) return null;\n if (tymin > tmin || isNaN(tmin)) tmin = tymin;\n if (tymax < tmax || isNaN(tmax)) tmax = tymax;\n if (invdirz >= 0) {\n tzmin = (box.min.z - origin.z) * invdirz;\n tzmax = (box.max.z - origin.z) * invdirz;\n } else {\n tzmin = (box.max.z - origin.z) * invdirz;\n tzmax = (box.min.z - origin.z) * invdirz;\n }\n if (tmin > tzmax || tzmin > tmax) return null;\n if (tzmin > tmin || tmin !== tmin) tmin = tzmin;\n if (tzmax < tmax || tmax !== tmax) tmax = tzmax;\n //return point closest to the ray (positive side)\n if (tmax < 0) return null;\n return this.at(tmin >= 0 ? tmin : tmax, target);\n }\n intersectsBox(box) {\n return this.intersectBox(box, $a315ee31802fb757$var$_vector$9) !== null;\n }\n intersectTriangle(a, b, c, backfaceCulling, target) {\n // Compute the offset origin, edges, and normal.\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n $a315ee31802fb757$var$_edge1.subVectors(b, a);\n $a315ee31802fb757$var$_edge2.subVectors(c, a);\n $a315ee31802fb757$var$_normal$1.crossVectors($a315ee31802fb757$var$_edge1, $a315ee31802fb757$var$_edge2);\n // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n let DdN = this.direction.dot($a315ee31802fb757$var$_normal$1);\n let sign;\n if (DdN > 0) {\n if (backfaceCulling) return null;\n sign = 1;\n } else if (DdN < 0) {\n sign = -1;\n DdN = -DdN;\n } else return null;\n $a315ee31802fb757$var$_diff.subVectors(this.origin, a);\n const DdQxE2 = sign * this.direction.dot($a315ee31802fb757$var$_edge2.crossVectors($a315ee31802fb757$var$_diff, $a315ee31802fb757$var$_edge2));\n // b1 < 0, no intersection\n if (DdQxE2 < 0) return null;\n const DdE1xQ = sign * this.direction.dot($a315ee31802fb757$var$_edge1.cross($a315ee31802fb757$var$_diff));\n // b2 < 0, no intersection\n if (DdE1xQ < 0) return null;\n // b1+b2 > 1, no intersection\n if (DdQxE2 + DdE1xQ > DdN) return null;\n // Line intersects triangle, check if ray does.\n const QdN = -sign * $a315ee31802fb757$var$_diff.dot($a315ee31802fb757$var$_normal$1);\n // t < 0, no intersection\n if (QdN < 0) return null;\n // Ray intersects triangle.\n return this.at(QdN / DdN, target);\n }\n applyMatrix4(matrix4) {\n this.origin.applyMatrix4(matrix4);\n this.direction.transformDirection(matrix4);\n return this;\n }\n equals(ray) {\n return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $a315ee31802fb757$export$2ae72fc923e5eb5 {\n constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44){\n $a315ee31802fb757$export$2ae72fc923e5eb5.prototype.isMatrix4 = true;\n this.elements = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n if (n11 !== undefined) this.set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44);\n }\n set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {\n const te = this.elements;\n te[0] = n11;\n te[4] = n12;\n te[8] = n13;\n te[12] = n14;\n te[1] = n21;\n te[5] = n22;\n te[9] = n23;\n te[13] = n24;\n te[2] = n31;\n te[6] = n32;\n te[10] = n33;\n te[14] = n34;\n te[3] = n41;\n te[7] = n42;\n te[11] = n43;\n te[15] = n44;\n return this;\n }\n identity() {\n this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n clone() {\n return new $a315ee31802fb757$export$2ae72fc923e5eb5().fromArray(this.elements);\n }\n copy(m) {\n const te = this.elements;\n const me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n te[9] = me[9];\n te[10] = me[10];\n te[11] = me[11];\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n te[15] = me[15];\n return this;\n }\n copyPosition(m) {\n const te = this.elements, me = m.elements;\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n return this;\n }\n setFromMatrix3(m) {\n const me = m.elements;\n this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);\n return this;\n }\n extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrixColumn(this, 0);\n yAxis.setFromMatrixColumn(this, 1);\n zAxis.setFromMatrixColumn(this, 2);\n return this;\n }\n makeBasis(xAxis, yAxis, zAxis) {\n this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);\n return this;\n }\n extractRotation(m) {\n // this method does not support reflection matrices\n const te = this.elements;\n const me = m.elements;\n const scaleX = 1 / $a315ee31802fb757$var$_v1$5.setFromMatrixColumn(m, 0).length();\n const scaleY = 1 / $a315ee31802fb757$var$_v1$5.setFromMatrixColumn(m, 1).length();\n const scaleZ = 1 / $a315ee31802fb757$var$_v1$5.setFromMatrixColumn(m, 2).length();\n te[0] = me[0] * scaleX;\n te[1] = me[1] * scaleX;\n te[2] = me[2] * scaleX;\n te[3] = 0;\n te[4] = me[4] * scaleY;\n te[5] = me[5] * scaleY;\n te[6] = me[6] * scaleY;\n te[7] = 0;\n te[8] = me[8] * scaleZ;\n te[9] = me[9] * scaleZ;\n te[10] = me[10] * scaleZ;\n te[11] = 0;\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n makeRotationFromEuler(euler) {\n const te = this.elements;\n const x = euler.x, y = euler.y, z = euler.z;\n const a = Math.cos(x), b = Math.sin(x);\n const c = Math.cos(y), d = Math.sin(y);\n const e = Math.cos(z), f = Math.sin(z);\n if (euler.order === \"XYZ\") {\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\n te[0] = c * e;\n te[4] = -c * f;\n te[8] = d;\n te[1] = af + be * d;\n te[5] = ae - bf * d;\n te[9] = -b * c;\n te[2] = bf - ae * d;\n te[6] = be + af * d;\n te[10] = a * c;\n } else if (euler.order === \"YXZ\") {\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\n te[0] = ce + df * b;\n te[4] = de * b - cf;\n te[8] = a * d;\n te[1] = a * f;\n te[5] = a * e;\n te[9] = -b;\n te[2] = cf * b - de;\n te[6] = df + ce * b;\n te[10] = a * c;\n } else if (euler.order === \"ZXY\") {\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\n te[0] = ce - df * b;\n te[4] = -a * f;\n te[8] = de + cf * b;\n te[1] = cf + de * b;\n te[5] = a * e;\n te[9] = df - ce * b;\n te[2] = -a * d;\n te[6] = b;\n te[10] = a * c;\n } else if (euler.order === \"ZYX\") {\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\n te[0] = c * e;\n te[4] = be * d - af;\n te[8] = ae * d + bf;\n te[1] = c * f;\n te[5] = bf * d + ae;\n te[9] = af * d - be;\n te[2] = -d;\n te[6] = b * c;\n te[10] = a * c;\n } else if (euler.order === \"YZX\") {\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n te[0] = c * e;\n te[4] = bd - ac * f;\n te[8] = bc * f + ad;\n te[1] = f;\n te[5] = a * e;\n te[9] = -b * e;\n te[2] = -d * e;\n te[6] = ad * f + bc;\n te[10] = ac - bd * f;\n } else if (euler.order === \"XZY\") {\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n te[0] = c * e;\n te[4] = -f;\n te[8] = d * e;\n te[1] = ac * f + bd;\n te[5] = a * e;\n te[9] = ad * f - bc;\n te[2] = bc * f - ad;\n te[6] = b * e;\n te[10] = bd * f + ac;\n }\n // bottom row\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n // last column\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n makeRotationFromQuaternion(q) {\n return this.compose($a315ee31802fb757$var$_zero, q, $a315ee31802fb757$var$_one);\n }\n lookAt(eye, target, up) {\n const te = this.elements;\n $a315ee31802fb757$var$_z.subVectors(eye, target);\n if ($a315ee31802fb757$var$_z.lengthSq() === 0) // eye and target are in the same position\n $a315ee31802fb757$var$_z.z = 1;\n $a315ee31802fb757$var$_z.normalize();\n $a315ee31802fb757$var$_x.crossVectors(up, $a315ee31802fb757$var$_z);\n if ($a315ee31802fb757$var$_x.lengthSq() === 0) {\n // up and z are parallel\n if (Math.abs(up.z) === 1) $a315ee31802fb757$var$_z.x += 0.0001;\n else $a315ee31802fb757$var$_z.z += 0.0001;\n $a315ee31802fb757$var$_z.normalize();\n $a315ee31802fb757$var$_x.crossVectors(up, $a315ee31802fb757$var$_z);\n }\n $a315ee31802fb757$var$_x.normalize();\n $a315ee31802fb757$var$_y.crossVectors($a315ee31802fb757$var$_z, $a315ee31802fb757$var$_x);\n te[0] = $a315ee31802fb757$var$_x.x;\n te[4] = $a315ee31802fb757$var$_y.x;\n te[8] = $a315ee31802fb757$var$_z.x;\n te[1] = $a315ee31802fb757$var$_x.y;\n te[5] = $a315ee31802fb757$var$_y.y;\n te[9] = $a315ee31802fb757$var$_z.y;\n te[2] = $a315ee31802fb757$var$_x.z;\n te[6] = $a315ee31802fb757$var$_y.z;\n te[10] = $a315ee31802fb757$var$_z.z;\n return this;\n }\n multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n multiplyMatrices(a, b) {\n const ae = a.elements;\n const be = b.elements;\n const te = this.elements;\n const a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12];\n const a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13];\n const a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14];\n const a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15];\n const b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12];\n const b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13];\n const b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14];\n const b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n return this;\n }\n multiplyScalar(s) {\n const te = this.elements;\n te[0] *= s;\n te[4] *= s;\n te[8] *= s;\n te[12] *= s;\n te[1] *= s;\n te[5] *= s;\n te[9] *= s;\n te[13] *= s;\n te[2] *= s;\n te[6] *= s;\n te[10] *= s;\n te[14] *= s;\n te[3] *= s;\n te[7] *= s;\n te[11] *= s;\n te[15] *= s;\n return this;\n }\n determinant() {\n const te = this.elements;\n const n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12];\n const n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];\n const n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];\n const n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];\n //TODO: make this more efficient\n //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);\n }\n transpose() {\n const te = this.elements;\n let tmp;\n tmp = te[1];\n te[1] = te[4];\n te[4] = tmp;\n tmp = te[2];\n te[2] = te[8];\n te[8] = tmp;\n tmp = te[6];\n te[6] = te[9];\n te[9] = tmp;\n tmp = te[3];\n te[3] = te[12];\n te[12] = tmp;\n tmp = te[7];\n te[7] = te[13];\n te[13] = tmp;\n tmp = te[11];\n te[11] = te[14];\n te[14] = tmp;\n return this;\n }\n setPosition(x, y, z) {\n const te = this.elements;\n if (x.isVector3) {\n te[12] = x.x;\n te[13] = x.y;\n te[14] = x.z;\n } else {\n te[12] = x;\n te[13] = y;\n te[14] = z;\n }\n return this;\n }\n invert() {\n // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n41 = te[3], n12 = te[4], n22 = te[5], n32 = te[6], n42 = te[7], n13 = te[8], n23 = te[9], n33 = te[10], n43 = te[11], n14 = te[12], n24 = te[13], n34 = te[14], n44 = te[15], t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n const detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;\n te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;\n te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;\n te[4] = t12 * detInv;\n te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;\n te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;\n te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;\n te[8] = t13 * detInv;\n te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;\n te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;\n te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;\n te[12] = t14 * detInv;\n te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;\n te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;\n te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;\n return this;\n }\n scale(v) {\n const te = this.elements;\n const x = v.x, y = v.y, z = v.z;\n te[0] *= x;\n te[4] *= y;\n te[8] *= z;\n te[1] *= x;\n te[5] *= y;\n te[9] *= z;\n te[2] *= x;\n te[6] *= y;\n te[10] *= z;\n te[3] *= x;\n te[7] *= y;\n te[11] *= z;\n return this;\n }\n getMaxScaleOnAxis() {\n const te = this.elements;\n const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];\n const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];\n const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];\n return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));\n }\n makeTranslation(x, y, z) {\n if (x.isVector3) this.set(1, 0, 0, x.x, 0, 1, 0, x.y, 0, 0, 1, x.z, 0, 0, 0, 1);\n else this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);\n return this;\n }\n makeRotationX(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationY(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationZ(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationAxis(axis, angle) {\n // Based on http://www.gamedev.net/reference/articles/article1199.asp\n const c = Math.cos(angle);\n const s = Math.sin(angle);\n const t = 1 - c;\n const x = axis.x, y = axis.y, z = axis.z;\n const tx = t * x, ty = t * y;\n this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);\n return this;\n }\n makeScale(x, y, z) {\n this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);\n return this;\n }\n makeShear(xy, xz, yx, yz, zx, zy) {\n this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);\n return this;\n }\n compose(position, quaternion, scale) {\n const te = this.elements;\n const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n const x2 = x + x, y2 = y + y, z2 = z + z;\n const xx = x * x2, xy = x * y2, xz = x * z2;\n const yy = y * y2, yz = y * z2, zz = z * z2;\n const wx = w * x2, wy = w * y2, wz = w * z2;\n const sx = scale.x, sy = scale.y, sz = scale.z;\n te[0] = (1 - (yy + zz)) * sx;\n te[1] = (xy + wz) * sx;\n te[2] = (xz - wy) * sx;\n te[3] = 0;\n te[4] = (xy - wz) * sy;\n te[5] = (1 - (xx + zz)) * sy;\n te[6] = (yz + wx) * sy;\n te[7] = 0;\n te[8] = (xz + wy) * sz;\n te[9] = (yz - wx) * sz;\n te[10] = (1 - (xx + yy)) * sz;\n te[11] = 0;\n te[12] = position.x;\n te[13] = position.y;\n te[14] = position.z;\n te[15] = 1;\n return this;\n }\n decompose(position, quaternion, scale) {\n const te = this.elements;\n let sx = $a315ee31802fb757$var$_v1$5.set(te[0], te[1], te[2]).length();\n const sy = $a315ee31802fb757$var$_v1$5.set(te[4], te[5], te[6]).length();\n const sz = $a315ee31802fb757$var$_v1$5.set(te[8], te[9], te[10]).length();\n // if determine is negative, we need to invert one scale\n const det = this.determinant();\n if (det < 0) sx = -sx;\n position.x = te[12];\n position.y = te[13];\n position.z = te[14];\n // scale the rotation part\n $a315ee31802fb757$var$_m1$2.copy(this);\n const invSX = 1 / sx;\n const invSY = 1 / sy;\n const invSZ = 1 / sz;\n $a315ee31802fb757$var$_m1$2.elements[0] *= invSX;\n $a315ee31802fb757$var$_m1$2.elements[1] *= invSX;\n $a315ee31802fb757$var$_m1$2.elements[2] *= invSX;\n $a315ee31802fb757$var$_m1$2.elements[4] *= invSY;\n $a315ee31802fb757$var$_m1$2.elements[5] *= invSY;\n $a315ee31802fb757$var$_m1$2.elements[6] *= invSY;\n $a315ee31802fb757$var$_m1$2.elements[8] *= invSZ;\n $a315ee31802fb757$var$_m1$2.elements[9] *= invSZ;\n $a315ee31802fb757$var$_m1$2.elements[10] *= invSZ;\n quaternion.setFromRotationMatrix($a315ee31802fb757$var$_m1$2);\n scale.x = sx;\n scale.y = sy;\n scale.z = sz;\n return this;\n }\n makePerspective(left, right, top, bottom, near, far, coordinateSystem = $a315ee31802fb757$export$5a0e9190d10875d3) {\n const te = this.elements;\n const x = 2 * near / (right - left);\n const y = 2 * near / (top - bottom);\n const a = (right + left) / (right - left);\n const b = (top + bottom) / (top - bottom);\n let c, d;\n if (coordinateSystem === $a315ee31802fb757$export$5a0e9190d10875d3) {\n c = -(far + near) / (far - near);\n d = -2 * far * near / (far - near);\n } else if (coordinateSystem === $a315ee31802fb757$export$cc83beedcb9be9ac) {\n c = -far / (far - near);\n d = -far * near / (far - near);\n } else throw new Error(\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \" + coordinateSystem);\n te[0] = x;\n te[4] = 0;\n te[8] = a;\n te[12] = 0;\n te[1] = 0;\n te[5] = y;\n te[9] = b;\n te[13] = 0;\n te[2] = 0;\n te[6] = 0;\n te[10] = c;\n te[14] = d;\n te[3] = 0;\n te[7] = 0;\n te[11] = -1;\n te[15] = 0;\n return this;\n }\n makeOrthographic(left, right, top, bottom, near, far, coordinateSystem = $a315ee31802fb757$export$5a0e9190d10875d3) {\n const te = this.elements;\n const w = 1.0 / (right - left);\n const h = 1.0 / (top - bottom);\n const p = 1.0 / (far - near);\n const x = (right + left) * w;\n const y = (top + bottom) * h;\n let z, zInv;\n if (coordinateSystem === $a315ee31802fb757$export$5a0e9190d10875d3) {\n z = (far + near) * p;\n zInv = -2 * p;\n } else if (coordinateSystem === $a315ee31802fb757$export$cc83beedcb9be9ac) {\n z = near * p;\n zInv = -1 * p;\n } else throw new Error(\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \" + coordinateSystem);\n te[0] = 2 * w;\n te[4] = 0;\n te[8] = 0;\n te[12] = -x;\n te[1] = 0;\n te[5] = 2 * h;\n te[9] = 0;\n te[13] = -y;\n te[2] = 0;\n te[6] = 0;\n te[10] = zInv;\n te[14] = -z;\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n te[15] = 1;\n return this;\n }\n equals(matrix) {\n const te = this.elements;\n const me = matrix.elements;\n for(let i = 0; i < 16; i++){\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n fromArray(array, offset = 0) {\n for(let i = 0; i < 16; i++)this.elements[i] = array[i + offset];\n return this;\n }\n toArray(array = [], offset = 0) {\n const te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n array[offset + 9] = te[9];\n array[offset + 10] = te[10];\n array[offset + 11] = te[11];\n array[offset + 12] = te[12];\n array[offset + 13] = te[13];\n array[offset + 14] = te[14];\n array[offset + 15] = te[15];\n return array;\n }\n}\nconst $a315ee31802fb757$var$_v1$5 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_m1$2 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_zero = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 0);\nconst $a315ee31802fb757$var$_one = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(1, 1, 1);\nconst $a315ee31802fb757$var$_x = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_y = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_z = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_matrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_quaternion$3 = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nclass $a315ee31802fb757$export$d93cc409a0768c5f {\n constructor(x = 0, y = 0, z = 0, order = $a315ee31802fb757$export$d93cc409a0768c5f.DEFAULT_ORDER){\n this.isEuler = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n }\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._onChangeCallback();\n }\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._onChangeCallback();\n }\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._onChangeCallback();\n }\n get order() {\n return this._order;\n }\n set order(value) {\n this._order = value;\n this._onChangeCallback();\n }\n set(x, y, z, order = this._order) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n this._onChangeCallback();\n return this;\n }\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._order);\n }\n copy(euler) {\n this._x = euler._x;\n this._y = euler._y;\n this._z = euler._z;\n this._order = euler._order;\n this._onChangeCallback();\n return this;\n }\n setFromRotationMatrix(m, order = this._order, update = true) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n const te = m.elements;\n const m11 = te[0], m12 = te[4], m13 = te[8];\n const m21 = te[1], m22 = te[5], m23 = te[9];\n const m31 = te[2], m32 = te[6], m33 = te[10];\n switch(order){\n case \"XYZ\":\n this._y = Math.asin($a315ee31802fb757$var$clamp(m13, -1, 1));\n if (Math.abs(m13) < 0.9999999) {\n this._x = Math.atan2(-m23, m33);\n this._z = Math.atan2(-m12, m11);\n } else {\n this._x = Math.atan2(m32, m22);\n this._z = 0;\n }\n break;\n case \"YXZ\":\n this._x = Math.asin(-$a315ee31802fb757$var$clamp(m23, -1, 1));\n if (Math.abs(m23) < 0.9999999) {\n this._y = Math.atan2(m13, m33);\n this._z = Math.atan2(m21, m22);\n } else {\n this._y = Math.atan2(-m31, m11);\n this._z = 0;\n }\n break;\n case \"ZXY\":\n this._x = Math.asin($a315ee31802fb757$var$clamp(m32, -1, 1));\n if (Math.abs(m32) < 0.9999999) {\n this._y = Math.atan2(-m31, m33);\n this._z = Math.atan2(-m12, m22);\n } else {\n this._y = 0;\n this._z = Math.atan2(m21, m11);\n }\n break;\n case \"ZYX\":\n this._y = Math.asin(-$a315ee31802fb757$var$clamp(m31, -1, 1));\n if (Math.abs(m31) < 0.9999999) {\n this._x = Math.atan2(m32, m33);\n this._z = Math.atan2(m21, m11);\n } else {\n this._x = 0;\n this._z = Math.atan2(-m12, m22);\n }\n break;\n case \"YZX\":\n this._z = Math.asin($a315ee31802fb757$var$clamp(m21, -1, 1));\n if (Math.abs(m21) < 0.9999999) {\n this._x = Math.atan2(-m23, m22);\n this._y = Math.atan2(-m31, m11);\n } else {\n this._x = 0;\n this._y = Math.atan2(m13, m33);\n }\n break;\n case \"XZY\":\n this._z = Math.asin(-$a315ee31802fb757$var$clamp(m12, -1, 1));\n if (Math.abs(m12) < 0.9999999) {\n this._x = Math.atan2(m32, m22);\n this._y = Math.atan2(m13, m11);\n } else {\n this._x = Math.atan2(-m23, m33);\n this._y = 0;\n }\n break;\n default:\n console.warn(\"THREE.Euler: .setFromRotationMatrix() encountered an unknown order: \" + order);\n }\n this._order = order;\n if (update === true) this._onChangeCallback();\n return this;\n }\n setFromQuaternion(q, order, update) {\n $a315ee31802fb757$var$_matrix.makeRotationFromQuaternion(q);\n return this.setFromRotationMatrix($a315ee31802fb757$var$_matrix, order, update);\n }\n setFromVector3(v, order = this._order) {\n return this.set(v.x, v.y, v.z, order);\n }\n reorder(newOrder) {\n // WARNING: this discards revolution information -bhouston\n $a315ee31802fb757$var$_quaternion$3.setFromEuler(this);\n return this.setFromQuaternion($a315ee31802fb757$var$_quaternion$3, newOrder);\n }\n equals(euler) {\n return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;\n }\n fromArray(array) {\n this._x = array[0];\n this._y = array[1];\n this._z = array[2];\n if (array[3] !== undefined) this._order = array[3];\n this._onChangeCallback();\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._order;\n return array;\n }\n _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n _onChangeCallback() {}\n *[Symbol.iterator]() {\n yield this._x;\n yield this._y;\n yield this._z;\n yield this._order;\n }\n}\n$a315ee31802fb757$export$d93cc409a0768c5f.DEFAULT_ORDER = \"XYZ\";\nclass $a315ee31802fb757$export$89312ce47c0ca777 {\n constructor(){\n this.mask = 1;\n }\n set(channel) {\n this.mask = (1 << channel | 0) >>> 0;\n }\n enable(channel) {\n this.mask |= 1 << channel | 0;\n }\n enableAll() {\n this.mask = -1;\n }\n toggle(channel) {\n this.mask ^= 1 << channel | 0;\n }\n disable(channel) {\n this.mask &= ~(1 << channel | 0);\n }\n disableAll() {\n this.mask = 0;\n }\n test(layers) {\n return (this.mask & layers.mask) !== 0;\n }\n isEnabled(channel) {\n return (this.mask & (1 << channel | 0)) !== 0;\n }\n}\nlet $a315ee31802fb757$var$_object3DId = 0;\nconst $a315ee31802fb757$var$_v1$4 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_q1 = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nconst $a315ee31802fb757$var$_m1$1 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_target = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_position$3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_scale$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_quaternion$2 = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nconst $a315ee31802fb757$var$_xAxis = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(1, 0, 0);\nconst $a315ee31802fb757$var$_yAxis = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0);\nconst $a315ee31802fb757$var$_zAxis = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 1);\nconst $a315ee31802fb757$var$_addedEvent = {\n type: \"added\"\n};\nconst $a315ee31802fb757$var$_removedEvent = {\n type: \"removed\"\n};\nclass $a315ee31802fb757$export$e4dd07dff30cc924 extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isObject3D = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$_object3DId++\n });\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.name = \"\";\n this.type = \"Object3D\";\n this.parent = null;\n this.children = [];\n this.up = $a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_UP.clone();\n const position = new $a315ee31802fb757$export$64b5c384219d3699();\n const rotation = new $a315ee31802fb757$export$d93cc409a0768c5f();\n const quaternion = new $a315ee31802fb757$export$23d6a54f0bbc85a3();\n const scale = new $a315ee31802fb757$export$64b5c384219d3699(1, 1, 1);\n function onRotationChange() {\n quaternion.setFromEuler(rotation, false);\n }\n function onQuaternionChange() {\n rotation.setFromQuaternion(quaternion, undefined, false);\n }\n rotation._onChange(onRotationChange);\n quaternion._onChange(onQuaternionChange);\n Object.defineProperties(this, {\n position: {\n configurable: true,\n enumerable: true,\n value: position\n },\n rotation: {\n configurable: true,\n enumerable: true,\n value: rotation\n },\n quaternion: {\n configurable: true,\n enumerable: true,\n value: quaternion\n },\n scale: {\n configurable: true,\n enumerable: true,\n value: scale\n },\n modelViewMatrix: {\n value: new $a315ee31802fb757$export$2ae72fc923e5eb5()\n },\n normalMatrix: {\n value: new $a315ee31802fb757$export$8ff26dafa08918()\n }\n });\n this.matrix = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.matrixWorld = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.matrixAutoUpdate = $a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_MATRIX_AUTO_UPDATE;\n this.matrixWorldNeedsUpdate = false;\n this.matrixWorldAutoUpdate = $a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n this.layers = new $a315ee31802fb757$export$89312ce47c0ca777();\n this.visible = true;\n this.castShadow = false;\n this.receiveShadow = false;\n this.frustumCulled = true;\n this.renderOrder = 0;\n this.animations = [];\n this.userData = {};\n }\n onBeforeRender() {}\n onAfterRender() {}\n applyMatrix4(matrix) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n this.matrix.premultiply(matrix);\n this.matrix.decompose(this.position, this.quaternion, this.scale);\n }\n applyQuaternion(q) {\n this.quaternion.premultiply(q);\n return this;\n }\n setRotationFromAxisAngle(axis, angle) {\n // assumes axis is normalized\n this.quaternion.setFromAxisAngle(axis, angle);\n }\n setRotationFromEuler(euler) {\n this.quaternion.setFromEuler(euler, true);\n }\n setRotationFromMatrix(m) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n this.quaternion.setFromRotationMatrix(m);\n }\n setRotationFromQuaternion(q) {\n // assumes q is normalized\n this.quaternion.copy(q);\n }\n rotateOnAxis(axis, angle) {\n // rotate object on axis in object space\n // axis is assumed to be normalized\n $a315ee31802fb757$var$_q1.setFromAxisAngle(axis, angle);\n this.quaternion.multiply($a315ee31802fb757$var$_q1);\n return this;\n }\n rotateOnWorldAxis(axis, angle) {\n // rotate object on axis in world space\n // axis is assumed to be normalized\n // method assumes no rotated parent\n $a315ee31802fb757$var$_q1.setFromAxisAngle(axis, angle);\n this.quaternion.premultiply($a315ee31802fb757$var$_q1);\n return this;\n }\n rotateX(angle) {\n return this.rotateOnAxis($a315ee31802fb757$var$_xAxis, angle);\n }\n rotateY(angle) {\n return this.rotateOnAxis($a315ee31802fb757$var$_yAxis, angle);\n }\n rotateZ(angle) {\n return this.rotateOnAxis($a315ee31802fb757$var$_zAxis, angle);\n }\n translateOnAxis(axis, distance) {\n // translate object by distance along axis in object space\n // axis is assumed to be normalized\n $a315ee31802fb757$var$_v1$4.copy(axis).applyQuaternion(this.quaternion);\n this.position.add($a315ee31802fb757$var$_v1$4.multiplyScalar(distance));\n return this;\n }\n translateX(distance) {\n return this.translateOnAxis($a315ee31802fb757$var$_xAxis, distance);\n }\n translateY(distance) {\n return this.translateOnAxis($a315ee31802fb757$var$_yAxis, distance);\n }\n translateZ(distance) {\n return this.translateOnAxis($a315ee31802fb757$var$_zAxis, distance);\n }\n localToWorld(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4(this.matrixWorld);\n }\n worldToLocal(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4($a315ee31802fb757$var$_m1$1.copy(this.matrixWorld).invert());\n }\n lookAt(x, y, z) {\n // This method does not support objects having non-uniformly-scaled parent(s)\n if (x.isVector3) $a315ee31802fb757$var$_target.copy(x);\n else $a315ee31802fb757$var$_target.set(x, y, z);\n const parent = this.parent;\n this.updateWorldMatrix(true, false);\n $a315ee31802fb757$var$_position$3.setFromMatrixPosition(this.matrixWorld);\n if (this.isCamera || this.isLight) $a315ee31802fb757$var$_m1$1.lookAt($a315ee31802fb757$var$_position$3, $a315ee31802fb757$var$_target, this.up);\n else $a315ee31802fb757$var$_m1$1.lookAt($a315ee31802fb757$var$_target, $a315ee31802fb757$var$_position$3, this.up);\n this.quaternion.setFromRotationMatrix($a315ee31802fb757$var$_m1$1);\n if (parent) {\n $a315ee31802fb757$var$_m1$1.extractRotation(parent.matrixWorld);\n $a315ee31802fb757$var$_q1.setFromRotationMatrix($a315ee31802fb757$var$_m1$1);\n this.quaternion.premultiply($a315ee31802fb757$var$_q1.invert());\n }\n }\n add(object) {\n if (arguments.length > 1) {\n for(let i = 0; i < arguments.length; i++)this.add(arguments[i]);\n return this;\n }\n if (object === this) {\n console.error(\"THREE.Object3D.add: object can't be added as a child of itself.\", object);\n return this;\n }\n if (object && object.isObject3D) {\n if (object.parent !== null) object.parent.remove(object);\n object.parent = this;\n this.children.push(object);\n object.dispatchEvent($a315ee31802fb757$var$_addedEvent);\n } else console.error(\"THREE.Object3D.add: object not an instance of THREE.Object3D.\", object);\n return this;\n }\n remove(object) {\n if (arguments.length > 1) {\n for(let i = 0; i < arguments.length; i++)this.remove(arguments[i]);\n return this;\n }\n const index = this.children.indexOf(object);\n if (index !== -1) {\n object.parent = null;\n this.children.splice(index, 1);\n object.dispatchEvent($a315ee31802fb757$var$_removedEvent);\n }\n return this;\n }\n removeFromParent() {\n const parent = this.parent;\n if (parent !== null) parent.remove(this);\n return this;\n }\n clear() {\n for(let i = 0; i < this.children.length; i++){\n const object = this.children[i];\n object.parent = null;\n object.dispatchEvent($a315ee31802fb757$var$_removedEvent);\n }\n this.children.length = 0;\n return this;\n }\n attach(object) {\n // adds object as a child of this, while maintaining the object's world transform\n // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n this.updateWorldMatrix(true, false);\n $a315ee31802fb757$var$_m1$1.copy(this.matrixWorld).invert();\n if (object.parent !== null) {\n object.parent.updateWorldMatrix(true, false);\n $a315ee31802fb757$var$_m1$1.multiply(object.parent.matrixWorld);\n }\n object.applyMatrix4($a315ee31802fb757$var$_m1$1);\n this.add(object);\n object.updateWorldMatrix(false, true);\n return this;\n }\n getObjectById(id) {\n return this.getObjectByProperty(\"id\", id);\n }\n getObjectByName(name) {\n return this.getObjectByProperty(\"name\", name);\n }\n getObjectByProperty(name, value) {\n if (this[name] === value) return this;\n for(let i = 0, l = this.children.length; i < l; i++){\n const child = this.children[i];\n const object = child.getObjectByProperty(name, value);\n if (object !== undefined) return object;\n }\n return undefined;\n }\n getObjectsByProperty(name, value) {\n let result = [];\n if (this[name] === value) result.push(this);\n for(let i = 0, l = this.children.length; i < l; i++){\n const childResult = this.children[i].getObjectsByProperty(name, value);\n if (childResult.length > 0) result = result.concat(childResult);\n }\n return result;\n }\n getWorldPosition(target) {\n this.updateWorldMatrix(true, false);\n return target.setFromMatrixPosition(this.matrixWorld);\n }\n getWorldQuaternion(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose($a315ee31802fb757$var$_position$3, target, $a315ee31802fb757$var$_scale$2);\n return target;\n }\n getWorldScale(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose($a315ee31802fb757$var$_position$3, $a315ee31802fb757$var$_quaternion$2, target);\n return target;\n }\n getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n const e = this.matrixWorld.elements;\n return target.set(e[8], e[9], e[10]).normalize();\n }\n raycast() {}\n traverse(callback) {\n callback(this);\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].traverse(callback);\n }\n traverseVisible(callback) {\n if (this.visible === false) return;\n callback(this);\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].traverseVisible(callback);\n }\n traverseAncestors(callback) {\n const parent = this.parent;\n if (parent !== null) {\n callback(parent);\n parent.traverseAncestors(callback);\n }\n }\n updateMatrix() {\n this.matrix.compose(this.position, this.quaternion, this.scale);\n this.matrixWorldNeedsUpdate = true;\n }\n updateMatrixWorld(force) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent === null) this.matrixWorld.copy(this.matrix);\n else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n this.matrixWorldNeedsUpdate = false;\n force = true;\n }\n // update children\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++){\n const child = children[i];\n if (child.matrixWorldAutoUpdate === true || force === true) child.updateMatrixWorld(force);\n }\n }\n updateWorldMatrix(updateParents, updateChildren) {\n const parent = this.parent;\n if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) parent.updateWorldMatrix(true, false);\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.parent === null) this.matrixWorld.copy(this.matrix);\n else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n // update children\n if (updateChildren === true) {\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++){\n const child = children[i];\n if (child.matrixWorldAutoUpdate === true) child.updateWorldMatrix(false, true);\n }\n }\n }\n toJSON(meta) {\n // meta is a string when called from JSON.stringify\n const isRootObject = meta === undefined || typeof meta === \"string\";\n const output = {};\n // meta is a hash used to collect geometries, materials.\n // not providing it implies that this is the root object\n // being serialized.\n if (isRootObject) {\n // initialize meta obj\n meta = {\n geometries: {},\n materials: {},\n textures: {},\n images: {},\n shapes: {},\n skeletons: {},\n animations: {},\n nodes: {}\n };\n output.metadata = {\n version: 4.6,\n type: \"Object\",\n generator: \"Object3D.toJSON\"\n };\n }\n // standard Object3D serialization\n const object = {};\n object.uuid = this.uuid;\n object.type = this.type;\n if (this.name !== \"\") object.name = this.name;\n if (this.castShadow === true) object.castShadow = true;\n if (this.receiveShadow === true) object.receiveShadow = true;\n if (this.visible === false) object.visible = false;\n if (this.frustumCulled === false) object.frustumCulled = false;\n if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;\n if (Object.keys(this.userData).length > 0) object.userData = this.userData;\n object.layers = this.layers.mask;\n object.matrix = this.matrix.toArray();\n object.up = this.up.toArray();\n if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;\n // object specific properties\n if (this.isInstancedMesh) {\n object.type = \"InstancedMesh\";\n object.count = this.count;\n object.instanceMatrix = this.instanceMatrix.toJSON();\n if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();\n }\n //\n function serialize(library, element) {\n if (library[element.uuid] === undefined) library[element.uuid] = element.toJSON(meta);\n return element.uuid;\n }\n if (this.isScene) {\n if (this.background) {\n if (this.background.isColor) object.background = this.background.toJSON();\n else if (this.background.isTexture) object.background = this.background.toJSON(meta).uuid;\n }\n if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) object.environment = this.environment.toJSON(meta).uuid;\n } else if (this.isMesh || this.isLine || this.isPoints) {\n object.geometry = serialize(meta.geometries, this.geometry);\n const parameters = this.geometry.parameters;\n if (parameters !== undefined && parameters.shapes !== undefined) {\n const shapes = parameters.shapes;\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n serialize(meta.shapes, shape);\n }\n else serialize(meta.shapes, shapes);\n }\n }\n if (this.isSkinnedMesh) {\n object.bindMode = this.bindMode;\n object.bindMatrix = this.bindMatrix.toArray();\n if (this.skeleton !== undefined) {\n serialize(meta.skeletons, this.skeleton);\n object.skeleton = this.skeleton.uuid;\n }\n }\n if (this.material !== undefined) {\n if (Array.isArray(this.material)) {\n const uuids = [];\n for(let i = 0, l = this.material.length; i < l; i++)uuids.push(serialize(meta.materials, this.material[i]));\n object.material = uuids;\n } else object.material = serialize(meta.materials, this.material);\n }\n //\n if (this.children.length > 0) {\n object.children = [];\n for(let i = 0; i < this.children.length; i++)object.children.push(this.children[i].toJSON(meta).object);\n }\n //\n if (this.animations.length > 0) {\n object.animations = [];\n for(let i = 0; i < this.animations.length; i++){\n const animation = this.animations[i];\n object.animations.push(serialize(meta.animations, animation));\n }\n }\n if (isRootObject) {\n const geometries = extractFromCache(meta.geometries);\n const materials = extractFromCache(meta.materials);\n const textures = extractFromCache(meta.textures);\n const images = extractFromCache(meta.images);\n const shapes = extractFromCache(meta.shapes);\n const skeletons = extractFromCache(meta.skeletons);\n const animations = extractFromCache(meta.animations);\n const nodes = extractFromCache(meta.nodes);\n if (geometries.length > 0) output.geometries = geometries;\n if (materials.length > 0) output.materials = materials;\n if (textures.length > 0) output.textures = textures;\n if (images.length > 0) output.images = images;\n if (shapes.length > 0) output.shapes = shapes;\n if (skeletons.length > 0) output.skeletons = skeletons;\n if (animations.length > 0) output.animations = animations;\n if (nodes.length > 0) output.nodes = nodes;\n }\n output.object = object;\n return output;\n // extract data from the cache hash\n // remove metadata on each item\n // and return as array\n function extractFromCache(cache) {\n const values = [];\n for(const key in cache){\n const data = cache[key];\n delete data.metadata;\n values.push(data);\n }\n return values;\n }\n }\n clone(recursive) {\n return new this.constructor().copy(this, recursive);\n }\n copy(source, recursive = true) {\n this.name = source.name;\n this.up.copy(source.up);\n this.position.copy(source.position);\n this.rotation.order = source.rotation.order;\n this.quaternion.copy(source.quaternion);\n this.scale.copy(source.scale);\n this.matrix.copy(source.matrix);\n this.matrixWorld.copy(source.matrixWorld);\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n this.layers.mask = source.layers.mask;\n this.visible = source.visible;\n this.castShadow = source.castShadow;\n this.receiveShadow = source.receiveShadow;\n this.frustumCulled = source.frustumCulled;\n this.renderOrder = source.renderOrder;\n this.animations = source.animations.slice();\n this.userData = JSON.parse(JSON.stringify(source.userData));\n if (recursive === true) for(let i = 0; i < source.children.length; i++){\n const child = source.children[i];\n this.add(child.clone());\n }\n return this;\n }\n}\n$a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_UP = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0);\n$a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_MATRIX_AUTO_UPDATE = true;\n$a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\nconst $a315ee31802fb757$var$_v0$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v1$3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v2$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v3$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vab = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vac = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vbc = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vap = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vbp = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vcp = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nlet $a315ee31802fb757$var$warnedGetUV = false;\nclass $a315ee31802fb757$export$5a465592bfe74b48 {\n constructor(a = new $a315ee31802fb757$export$64b5c384219d3699(), b = new $a315ee31802fb757$export$64b5c384219d3699(), c = new $a315ee31802fb757$export$64b5c384219d3699()){\n this.a = a;\n this.b = b;\n this.c = c;\n }\n static getNormal(a, b, c, target) {\n target.subVectors(c, b);\n $a315ee31802fb757$var$_v0$1.subVectors(a, b);\n target.cross($a315ee31802fb757$var$_v0$1);\n const targetLengthSq = target.lengthSq();\n if (targetLengthSq > 0) return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));\n return target.set(0, 0, 0);\n }\n // static/instance method to calculate barycentric coordinates\n // based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n static getBarycoord(point, a, b, c, target) {\n $a315ee31802fb757$var$_v0$1.subVectors(c, a);\n $a315ee31802fb757$var$_v1$3.subVectors(b, a);\n $a315ee31802fb757$var$_v2$2.subVectors(point, a);\n const dot00 = $a315ee31802fb757$var$_v0$1.dot($a315ee31802fb757$var$_v0$1);\n const dot01 = $a315ee31802fb757$var$_v0$1.dot($a315ee31802fb757$var$_v1$3);\n const dot02 = $a315ee31802fb757$var$_v0$1.dot($a315ee31802fb757$var$_v2$2);\n const dot11 = $a315ee31802fb757$var$_v1$3.dot($a315ee31802fb757$var$_v1$3);\n const dot12 = $a315ee31802fb757$var$_v1$3.dot($a315ee31802fb757$var$_v2$2);\n const denom = dot00 * dot11 - dot01 * dot01;\n // collinear or singular triangle\n if (denom === 0) // arbitrary location outside of triangle?\n // not sure if this is the best idea, maybe should be returning undefined\n return target.set(-2, -1, -1);\n const invDenom = 1 / denom;\n const u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n const v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n // barycentric coordinates must always sum to 1\n return target.set(1 - u - v, v, u);\n }\n static containsPoint(point, a, b, c) {\n this.getBarycoord(point, a, b, c, $a315ee31802fb757$var$_v3$1);\n return $a315ee31802fb757$var$_v3$1.x >= 0 && $a315ee31802fb757$var$_v3$1.y >= 0 && $a315ee31802fb757$var$_v3$1.x + $a315ee31802fb757$var$_v3$1.y <= 1;\n }\n static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) {\n if ($a315ee31802fb757$var$warnedGetUV === false) {\n console.warn(\"THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().\");\n $a315ee31802fb757$var$warnedGetUV = true;\n }\n return this.getInterpolation(point, p1, p2, p3, uv1, uv2, uv3, target);\n }\n static getInterpolation(point, p1, p2, p3, v1, v2, v3, target) {\n this.getBarycoord(point, p1, p2, p3, $a315ee31802fb757$var$_v3$1);\n target.setScalar(0);\n target.addScaledVector(v1, $a315ee31802fb757$var$_v3$1.x);\n target.addScaledVector(v2, $a315ee31802fb757$var$_v3$1.y);\n target.addScaledVector(v3, $a315ee31802fb757$var$_v3$1.z);\n return target;\n }\n static isFrontFacing(a, b, c, direction) {\n $a315ee31802fb757$var$_v0$1.subVectors(c, b);\n $a315ee31802fb757$var$_v1$3.subVectors(a, b);\n // strictly front facing\n return $a315ee31802fb757$var$_v0$1.cross($a315ee31802fb757$var$_v1$3).dot(direction) < 0 ? true : false;\n }\n set(a, b, c) {\n this.a.copy(a);\n this.b.copy(b);\n this.c.copy(c);\n return this;\n }\n setFromPointsAndIndices(points, i0, i1, i2) {\n this.a.copy(points[i0]);\n this.b.copy(points[i1]);\n this.c.copy(points[i2]);\n return this;\n }\n setFromAttributeAndIndices(attribute, i0, i1, i2) {\n this.a.fromBufferAttribute(attribute, i0);\n this.b.fromBufferAttribute(attribute, i1);\n this.c.fromBufferAttribute(attribute, i2);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(triangle) {\n this.a.copy(triangle.a);\n this.b.copy(triangle.b);\n this.c.copy(triangle.c);\n return this;\n }\n getArea() {\n $a315ee31802fb757$var$_v0$1.subVectors(this.c, this.b);\n $a315ee31802fb757$var$_v1$3.subVectors(this.a, this.b);\n return $a315ee31802fb757$var$_v0$1.cross($a315ee31802fb757$var$_v1$3).length() * 0.5;\n }\n getMidpoint(target) {\n return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);\n }\n getNormal(target) {\n return $a315ee31802fb757$export$5a465592bfe74b48.getNormal(this.a, this.b, this.c, target);\n }\n getPlane(target) {\n return target.setFromCoplanarPoints(this.a, this.b, this.c);\n }\n getBarycoord(point, target) {\n return $a315ee31802fb757$export$5a465592bfe74b48.getBarycoord(point, this.a, this.b, this.c, target);\n }\n getUV(point, uv1, uv2, uv3, target) {\n if ($a315ee31802fb757$var$warnedGetUV === false) {\n console.warn(\"THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().\");\n $a315ee31802fb757$var$warnedGetUV = true;\n }\n return $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation(point, this.a, this.b, this.c, uv1, uv2, uv3, target);\n }\n getInterpolation(point, v1, v2, v3, target) {\n return $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target);\n }\n containsPoint(point) {\n return $a315ee31802fb757$export$5a465592bfe74b48.containsPoint(point, this.a, this.b, this.c);\n }\n isFrontFacing(direction) {\n return $a315ee31802fb757$export$5a465592bfe74b48.isFrontFacing(this.a, this.b, this.c, direction);\n }\n intersectsBox(box) {\n return box.intersectsTriangle(this);\n }\n closestPointToPoint(p, target) {\n const a = this.a, b = this.b, c = this.c;\n let v, w;\n // algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n // under the accompanying license; see chapter 5.1.5 for detailed explanation.\n // basically, we're distinguishing which of the voronoi regions of the triangle\n // the point lies in with the minimum amount of redundant computation.\n $a315ee31802fb757$var$_vab.subVectors(b, a);\n $a315ee31802fb757$var$_vac.subVectors(c, a);\n $a315ee31802fb757$var$_vap.subVectors(p, a);\n const d1 = $a315ee31802fb757$var$_vab.dot($a315ee31802fb757$var$_vap);\n const d2 = $a315ee31802fb757$var$_vac.dot($a315ee31802fb757$var$_vap);\n if (d1 <= 0 && d2 <= 0) // vertex region of A; barycentric coords (1, 0, 0)\n return target.copy(a);\n $a315ee31802fb757$var$_vbp.subVectors(p, b);\n const d3 = $a315ee31802fb757$var$_vab.dot($a315ee31802fb757$var$_vbp);\n const d4 = $a315ee31802fb757$var$_vac.dot($a315ee31802fb757$var$_vbp);\n if (d3 >= 0 && d4 <= d3) // vertex region of B; barycentric coords (0, 1, 0)\n return target.copy(b);\n const vc = d1 * d4 - d3 * d2;\n if (vc <= 0 && d1 >= 0 && d3 <= 0) {\n v = d1 / (d1 - d3);\n // edge region of AB; barycentric coords (1-v, v, 0)\n return target.copy(a).addScaledVector($a315ee31802fb757$var$_vab, v);\n }\n $a315ee31802fb757$var$_vcp.subVectors(p, c);\n const d5 = $a315ee31802fb757$var$_vab.dot($a315ee31802fb757$var$_vcp);\n const d6 = $a315ee31802fb757$var$_vac.dot($a315ee31802fb757$var$_vcp);\n if (d6 >= 0 && d5 <= d6) // vertex region of C; barycentric coords (0, 0, 1)\n return target.copy(c);\n const vb = d5 * d2 - d1 * d6;\n if (vb <= 0 && d2 >= 0 && d6 <= 0) {\n w = d2 / (d2 - d6);\n // edge region of AC; barycentric coords (1-w, 0, w)\n return target.copy(a).addScaledVector($a315ee31802fb757$var$_vac, w);\n }\n const va = d3 * d6 - d5 * d4;\n if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {\n $a315ee31802fb757$var$_vbc.subVectors(c, b);\n w = (d4 - d3) / (d4 - d3 + (d5 - d6));\n // edge region of BC; barycentric coords (0, 1-w, w)\n return target.copy(b).addScaledVector($a315ee31802fb757$var$_vbc, w); // edge region of BC\n }\n // face region\n const denom = 1 / (va + vb + vc);\n // u = va * denom\n v = vb * denom;\n w = vc * denom;\n return target.copy(a).addScaledVector($a315ee31802fb757$var$_vab, v).addScaledVector($a315ee31802fb757$var$_vac, w);\n }\n equals(triangle) {\n return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);\n }\n}\nlet $a315ee31802fb757$var$materialId = 0;\nclass $a315ee31802fb757$export$a2d8b23205c25948 extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isMaterial = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$materialId++\n });\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.name = \"\";\n this.type = \"Material\";\n this.blending = $a315ee31802fb757$export$5b29a26d96ee6af0;\n this.side = $a315ee31802fb757$export$2ede184fc2998901;\n this.vertexColors = false;\n this.opacity = 1;\n this.transparent = false;\n this.alphaHash = false;\n this.blendSrc = $a315ee31802fb757$export$d5773124e86cf28c;\n this.blendDst = $a315ee31802fb757$export$11d468cc7f19e971;\n this.blendEquation = $a315ee31802fb757$export$20183a0484ce21a0;\n this.blendSrcAlpha = null;\n this.blendDstAlpha = null;\n this.blendEquationAlpha = null;\n this.depthFunc = $a315ee31802fb757$export$296f78a0b892f81a;\n this.depthTest = true;\n this.depthWrite = true;\n this.stencilWriteMask = 0xff;\n this.stencilFunc = $a315ee31802fb757$export$14cf96713ddd97a8;\n this.stencilRef = 0;\n this.stencilFuncMask = 0xff;\n this.stencilFail = $a315ee31802fb757$export$9f542ae4b5baca34;\n this.stencilZFail = $a315ee31802fb757$export$9f542ae4b5baca34;\n this.stencilZPass = $a315ee31802fb757$export$9f542ae4b5baca34;\n this.stencilWrite = false;\n this.clippingPlanes = null;\n this.clipIntersection = false;\n this.clipShadows = false;\n this.shadowSide = null;\n this.colorWrite = true;\n this.precision = null; // override the renderer's default precision for this material\n this.polygonOffset = false;\n this.polygonOffsetFactor = 0;\n this.polygonOffsetUnits = 0;\n this.dithering = false;\n this.alphaToCoverage = false;\n this.premultipliedAlpha = false;\n this.forceSinglePass = false;\n this.visible = true;\n this.toneMapped = true;\n this.userData = {};\n this.version = 0;\n this._alphaTest = 0;\n }\n get alphaTest() {\n return this._alphaTest;\n }\n set alphaTest(value) {\n if (this._alphaTest > 0 !== value > 0) this.version++;\n this._alphaTest = value;\n }\n onBuild() {}\n onBeforeRender() {}\n onBeforeCompile() {}\n customProgramCacheKey() {\n return this.onBeforeCompile.toString();\n }\n setValues(values) {\n if (values === undefined) return;\n for(const key in values){\n const newValue = values[key];\n if (newValue === undefined) {\n console.warn(`THREE.Material: parameter '${key}' has value of undefined.`);\n continue;\n }\n const currentValue = this[key];\n if (currentValue === undefined) {\n console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`);\n continue;\n }\n if (currentValue && currentValue.isColor) currentValue.set(newValue);\n else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) currentValue.copy(newValue);\n else this[key] = newValue;\n }\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (isRootObject) meta = {\n textures: {},\n images: {}\n };\n const data = {\n metadata: {\n version: 4.6,\n type: \"Material\",\n generator: \"Material.toJSON\"\n }\n };\n // standard Material serialization\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== \"\") data.name = this.name;\n if (this.color && this.color.isColor) data.color = this.color.getHex();\n if (this.roughness !== undefined) data.roughness = this.roughness;\n if (this.metalness !== undefined) data.metalness = this.metalness;\n if (this.sheen !== undefined) data.sheen = this.sheen;\n if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();\n if (this.sheenRoughness !== undefined) data.sheenRoughness = this.sheenRoughness;\n if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();\n if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;\n if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();\n if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;\n if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();\n if (this.shininess !== undefined) data.shininess = this.shininess;\n if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;\n if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;\n if (this.clearcoatMap && this.clearcoatMap.isTexture) data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;\n if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;\n if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {\n data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;\n data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n }\n if (this.iridescence !== undefined) data.iridescence = this.iridescence;\n if (this.iridescenceIOR !== undefined) data.iridescenceIOR = this.iridescenceIOR;\n if (this.iridescenceThicknessRange !== undefined) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n if (this.iridescenceMap && this.iridescenceMap.isTexture) data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid;\n if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid;\n if (this.anisotropy !== undefined) data.anisotropy = this.anisotropy;\n if (this.anisotropyRotation !== undefined) data.anisotropyRotation = this.anisotropyRotation;\n if (this.anisotropyMap && this.anisotropyMap.isTexture) data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid;\n if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;\n if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;\n if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;\n if (this.lightMap && this.lightMap.isTexture) {\n data.lightMap = this.lightMap.toJSON(meta).uuid;\n data.lightMapIntensity = this.lightMapIntensity;\n }\n if (this.aoMap && this.aoMap.isTexture) {\n data.aoMap = this.aoMap.toJSON(meta).uuid;\n data.aoMapIntensity = this.aoMapIntensity;\n }\n if (this.bumpMap && this.bumpMap.isTexture) {\n data.bumpMap = this.bumpMap.toJSON(meta).uuid;\n data.bumpScale = this.bumpScale;\n }\n if (this.normalMap && this.normalMap.isTexture) {\n data.normalMap = this.normalMap.toJSON(meta).uuid;\n data.normalMapType = this.normalMapType;\n data.normalScale = this.normalScale.toArray();\n }\n if (this.displacementMap && this.displacementMap.isTexture) {\n data.displacementMap = this.displacementMap.toJSON(meta).uuid;\n data.displacementScale = this.displacementScale;\n data.displacementBias = this.displacementBias;\n }\n if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;\n if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;\n if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;\n if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;\n if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;\n if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;\n if (this.envMap && this.envMap.isTexture) {\n data.envMap = this.envMap.toJSON(meta).uuid;\n if (this.combine !== undefined) data.combine = this.combine;\n }\n if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;\n if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;\n if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;\n if (this.gradientMap && this.gradientMap.isTexture) data.gradientMap = this.gradientMap.toJSON(meta).uuid;\n if (this.transmission !== undefined) data.transmission = this.transmission;\n if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;\n if (this.thickness !== undefined) data.thickness = this.thickness;\n if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;\n if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;\n if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();\n if (this.size !== undefined) data.size = this.size;\n if (this.shadowSide !== null) data.shadowSide = this.shadowSide;\n if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;\n if (this.blending !== $a315ee31802fb757$export$5b29a26d96ee6af0) data.blending = this.blending;\n if (this.side !== $a315ee31802fb757$export$2ede184fc2998901) data.side = this.side;\n if (this.vertexColors) data.vertexColors = true;\n if (this.opacity < 1) data.opacity = this.opacity;\n if (this.transparent === true) data.transparent = this.transparent;\n data.depthFunc = this.depthFunc;\n data.depthTest = this.depthTest;\n data.depthWrite = this.depthWrite;\n data.colorWrite = this.colorWrite;\n data.stencilWrite = this.stencilWrite;\n data.stencilWriteMask = this.stencilWriteMask;\n data.stencilFunc = this.stencilFunc;\n data.stencilRef = this.stencilRef;\n data.stencilFuncMask = this.stencilFuncMask;\n data.stencilFail = this.stencilFail;\n data.stencilZFail = this.stencilZFail;\n data.stencilZPass = this.stencilZPass;\n // rotation (SpriteMaterial)\n if (this.rotation !== undefined && this.rotation !== 0) data.rotation = this.rotation;\n if (this.polygonOffset === true) data.polygonOffset = true;\n if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;\n if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;\n if (this.linewidth !== undefined && this.linewidth !== 1) data.linewidth = this.linewidth;\n if (this.dashSize !== undefined) data.dashSize = this.dashSize;\n if (this.gapSize !== undefined) data.gapSize = this.gapSize;\n if (this.scale !== undefined) data.scale = this.scale;\n if (this.dithering === true) data.dithering = true;\n if (this.alphaTest > 0) data.alphaTest = this.alphaTest;\n if (this.alphaHash === true) data.alphaHash = this.alphaHash;\n if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;\n if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;\n if (this.forceSinglePass === true) data.forceSinglePass = this.forceSinglePass;\n if (this.wireframe === true) data.wireframe = this.wireframe;\n if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;\n if (this.wireframeLinecap !== \"round\") data.wireframeLinecap = this.wireframeLinecap;\n if (this.wireframeLinejoin !== \"round\") data.wireframeLinejoin = this.wireframeLinejoin;\n if (this.flatShading === true) data.flatShading = this.flatShading;\n if (this.visible === false) data.visible = false;\n if (this.toneMapped === false) data.toneMapped = false;\n if (this.fog === false) data.fog = false;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n // TODO: Copied from Object3D.toJSON\n function extractFromCache(cache) {\n const values = [];\n for(const key in cache){\n const data = cache[key];\n delete data.metadata;\n values.push(data);\n }\n return values;\n }\n if (isRootObject) {\n const textures = extractFromCache(meta.textures);\n const images = extractFromCache(meta.images);\n if (textures.length > 0) data.textures = textures;\n if (images.length > 0) data.images = images;\n }\n return data;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.name = source.name;\n this.blending = source.blending;\n this.side = source.side;\n this.vertexColors = source.vertexColors;\n this.opacity = source.opacity;\n this.transparent = source.transparent;\n this.blendSrc = source.blendSrc;\n this.blendDst = source.blendDst;\n this.blendEquation = source.blendEquation;\n this.blendSrcAlpha = source.blendSrcAlpha;\n this.blendDstAlpha = source.blendDstAlpha;\n this.blendEquationAlpha = source.blendEquationAlpha;\n this.depthFunc = source.depthFunc;\n this.depthTest = source.depthTest;\n this.depthWrite = source.depthWrite;\n this.stencilWriteMask = source.stencilWriteMask;\n this.stencilFunc = source.stencilFunc;\n this.stencilRef = source.stencilRef;\n this.stencilFuncMask = source.stencilFuncMask;\n this.stencilFail = source.stencilFail;\n this.stencilZFail = source.stencilZFail;\n this.stencilZPass = source.stencilZPass;\n this.stencilWrite = source.stencilWrite;\n const srcPlanes = source.clippingPlanes;\n let dstPlanes = null;\n if (srcPlanes !== null) {\n const n = srcPlanes.length;\n dstPlanes = new Array(n);\n for(let i = 0; i !== n; ++i)dstPlanes[i] = srcPlanes[i].clone();\n }\n this.clippingPlanes = dstPlanes;\n this.clipIntersection = source.clipIntersection;\n this.clipShadows = source.clipShadows;\n this.shadowSide = source.shadowSide;\n this.colorWrite = source.colorWrite;\n this.precision = source.precision;\n this.polygonOffset = source.polygonOffset;\n this.polygonOffsetFactor = source.polygonOffsetFactor;\n this.polygonOffsetUnits = source.polygonOffsetUnits;\n this.dithering = source.dithering;\n this.alphaTest = source.alphaTest;\n this.alphaHash = source.alphaHash;\n this.alphaToCoverage = source.alphaToCoverage;\n this.premultipliedAlpha = source.premultipliedAlpha;\n this.forceSinglePass = source.forceSinglePass;\n this.visible = source.visible;\n this.toneMapped = source.toneMapped;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n}\nconst $a315ee31802fb757$var$_colorKeywords = {\n \"aliceblue\": 0xF0F8FF,\n \"antiquewhite\": 0xFAEBD7,\n \"aqua\": 0x00FFFF,\n \"aquamarine\": 0x7FFFD4,\n \"azure\": 0xF0FFFF,\n \"beige\": 0xF5F5DC,\n \"bisque\": 0xFFE4C4,\n \"black\": 0x000000,\n \"blanchedalmond\": 0xFFEBCD,\n \"blue\": 0x0000FF,\n \"blueviolet\": 0x8A2BE2,\n \"brown\": 0xA52A2A,\n \"burlywood\": 0xDEB887,\n \"cadetblue\": 0x5F9EA0,\n \"chartreuse\": 0x7FFF00,\n \"chocolate\": 0xD2691E,\n \"coral\": 0xFF7F50,\n \"cornflowerblue\": 0x6495ED,\n \"cornsilk\": 0xFFF8DC,\n \"crimson\": 0xDC143C,\n \"cyan\": 0x00FFFF,\n \"darkblue\": 0x00008B,\n \"darkcyan\": 0x008B8B,\n \"darkgoldenrod\": 0xB8860B,\n \"darkgray\": 0xA9A9A9,\n \"darkgreen\": 0x006400,\n \"darkgrey\": 0xA9A9A9,\n \"darkkhaki\": 0xBDB76B,\n \"darkmagenta\": 0x8B008B,\n \"darkolivegreen\": 0x556B2F,\n \"darkorange\": 0xFF8C00,\n \"darkorchid\": 0x9932CC,\n \"darkred\": 0x8B0000,\n \"darksalmon\": 0xE9967A,\n \"darkseagreen\": 0x8FBC8F,\n \"darkslateblue\": 0x483D8B,\n \"darkslategray\": 0x2F4F4F,\n \"darkslategrey\": 0x2F4F4F,\n \"darkturquoise\": 0x00CED1,\n \"darkviolet\": 0x9400D3,\n \"deeppink\": 0xFF1493,\n \"deepskyblue\": 0x00BFFF,\n \"dimgray\": 0x696969,\n \"dimgrey\": 0x696969,\n \"dodgerblue\": 0x1E90FF,\n \"firebrick\": 0xB22222,\n \"floralwhite\": 0xFFFAF0,\n \"forestgreen\": 0x228B22,\n \"fuchsia\": 0xFF00FF,\n \"gainsboro\": 0xDCDCDC,\n \"ghostwhite\": 0xF8F8FF,\n \"gold\": 0xFFD700,\n \"goldenrod\": 0xDAA520,\n \"gray\": 0x808080,\n \"green\": 0x008000,\n \"greenyellow\": 0xADFF2F,\n \"grey\": 0x808080,\n \"honeydew\": 0xF0FFF0,\n \"hotpink\": 0xFF69B4,\n \"indianred\": 0xCD5C5C,\n \"indigo\": 0x4B0082,\n \"ivory\": 0xFFFFF0,\n \"khaki\": 0xF0E68C,\n \"lavender\": 0xE6E6FA,\n \"lavenderblush\": 0xFFF0F5,\n \"lawngreen\": 0x7CFC00,\n \"lemonchiffon\": 0xFFFACD,\n \"lightblue\": 0xADD8E6,\n \"lightcoral\": 0xF08080,\n \"lightcyan\": 0xE0FFFF,\n \"lightgoldenrodyellow\": 0xFAFAD2,\n \"lightgray\": 0xD3D3D3,\n \"lightgreen\": 0x90EE90,\n \"lightgrey\": 0xD3D3D3,\n \"lightpink\": 0xFFB6C1,\n \"lightsalmon\": 0xFFA07A,\n \"lightseagreen\": 0x20B2AA,\n \"lightskyblue\": 0x87CEFA,\n \"lightslategray\": 0x778899,\n \"lightslategrey\": 0x778899,\n \"lightsteelblue\": 0xB0C4DE,\n \"lightyellow\": 0xFFFFE0,\n \"lime\": 0x00FF00,\n \"limegreen\": 0x32CD32,\n \"linen\": 0xFAF0E6,\n \"magenta\": 0xFF00FF,\n \"maroon\": 0x800000,\n \"mediumaquamarine\": 0x66CDAA,\n \"mediumblue\": 0x0000CD,\n \"mediumorchid\": 0xBA55D3,\n \"mediumpurple\": 0x9370DB,\n \"mediumseagreen\": 0x3CB371,\n \"mediumslateblue\": 0x7B68EE,\n \"mediumspringgreen\": 0x00FA9A,\n \"mediumturquoise\": 0x48D1CC,\n \"mediumvioletred\": 0xC71585,\n \"midnightblue\": 0x191970,\n \"mintcream\": 0xF5FFFA,\n \"mistyrose\": 0xFFE4E1,\n \"moccasin\": 0xFFE4B5,\n \"navajowhite\": 0xFFDEAD,\n \"navy\": 0x000080,\n \"oldlace\": 0xFDF5E6,\n \"olive\": 0x808000,\n \"olivedrab\": 0x6B8E23,\n \"orange\": 0xFFA500,\n \"orangered\": 0xFF4500,\n \"orchid\": 0xDA70D6,\n \"palegoldenrod\": 0xEEE8AA,\n \"palegreen\": 0x98FB98,\n \"paleturquoise\": 0xAFEEEE,\n \"palevioletred\": 0xDB7093,\n \"papayawhip\": 0xFFEFD5,\n \"peachpuff\": 0xFFDAB9,\n \"peru\": 0xCD853F,\n \"pink\": 0xFFC0CB,\n \"plum\": 0xDDA0DD,\n \"powderblue\": 0xB0E0E6,\n \"purple\": 0x800080,\n \"rebeccapurple\": 0x663399,\n \"red\": 0xFF0000,\n \"rosybrown\": 0xBC8F8F,\n \"royalblue\": 0x4169E1,\n \"saddlebrown\": 0x8B4513,\n \"salmon\": 0xFA8072,\n \"sandybrown\": 0xF4A460,\n \"seagreen\": 0x2E8B57,\n \"seashell\": 0xFFF5EE,\n \"sienna\": 0xA0522D,\n \"silver\": 0xC0C0C0,\n \"skyblue\": 0x87CEEB,\n \"slateblue\": 0x6A5ACD,\n \"slategray\": 0x708090,\n \"slategrey\": 0x708090,\n \"snow\": 0xFFFAFA,\n \"springgreen\": 0x00FF7F,\n \"steelblue\": 0x4682B4,\n \"tan\": 0xD2B48C,\n \"teal\": 0x008080,\n \"thistle\": 0xD8BFD8,\n \"tomato\": 0xFF6347,\n \"turquoise\": 0x40E0D0,\n \"violet\": 0xEE82EE,\n \"wheat\": 0xF5DEB3,\n \"white\": 0xFFFFFF,\n \"whitesmoke\": 0xF5F5F5,\n \"yellow\": 0xFFFF00,\n \"yellowgreen\": 0x9ACD32\n};\nconst $a315ee31802fb757$var$_hslA = {\n h: 0,\n s: 0,\n l: 0\n};\nconst $a315ee31802fb757$var$_hslB = {\n h: 0,\n s: 0,\n l: 0\n};\nfunction $a315ee31802fb757$var$hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 0.5) return q;\n if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);\n return p;\n}\nclass $a315ee31802fb757$export$892596cec99bc70e {\n constructor(r, g, b){\n this.isColor = true;\n this.r = 1;\n this.g = 1;\n this.b = 1;\n return this.set(r, g, b);\n }\n set(r, g, b) {\n if (g === undefined && b === undefined) {\n // r is THREE.Color, hex or string\n const value = r;\n if (value && value.isColor) this.copy(value);\n else if (typeof value === \"number\") this.setHex(value);\n else if (typeof value === \"string\") this.setStyle(value);\n } else this.setRGB(r, g, b);\n return this;\n }\n setScalar(scalar) {\n this.r = scalar;\n this.g = scalar;\n this.b = scalar;\n return this;\n }\n setHex(hex, colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n hex = Math.floor(hex);\n this.r = (hex >> 16 & 255) / 255;\n this.g = (hex >> 8 & 255) / 255;\n this.b = (hex & 255) / 255;\n $a315ee31802fb757$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setRGB(r, g, b, colorSpace1 = $a315ee31802fb757$export$5e6fd513f44698c.workingColorSpace) {\n this.r = r;\n this.g = g;\n this.b = b;\n $a315ee31802fb757$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setHSL(h, s, l, colorSpace1 = $a315ee31802fb757$export$5e6fd513f44698c.workingColorSpace) {\n // h,s,l ranges are in 0.0 - 1.0\n h = $a315ee31802fb757$var$euclideanModulo(h, 1);\n s = $a315ee31802fb757$var$clamp(s, 0, 1);\n l = $a315ee31802fb757$var$clamp(l, 0, 1);\n if (s === 0) this.r = this.g = this.b = l;\n else {\n const p = l <= 0.5 ? l * (1 + s) : l + s - l * s;\n const q = 2 * l - p;\n this.r = $a315ee31802fb757$var$hue2rgb(q, p, h + 1 / 3);\n this.g = $a315ee31802fb757$var$hue2rgb(q, p, h);\n this.b = $a315ee31802fb757$var$hue2rgb(q, p, h - 1 / 3);\n }\n $a315ee31802fb757$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setStyle(style, colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n function handleAlpha(string) {\n if (string === undefined) return;\n if (parseFloat(string) < 1) console.warn(\"THREE.Color: Alpha component of \" + style + \" will be ignored.\");\n }\n let m;\n if (m = /^(\\w+)\\(([^\\)]*)\\)/.exec(style)) {\n // rgb / hsl\n let color;\n const name = m[1];\n const components = m[2];\n switch(name){\n case \"rgb\":\n case \"rgba\":\n if (color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(255,0,0) rgba(255,0,0,0.5)\n handleAlpha(color[4]);\n return this.setRGB(Math.min(255, parseInt(color[1], 10)) / 255, Math.min(255, parseInt(color[2], 10)) / 255, Math.min(255, parseInt(color[3], 10)) / 255, colorSpace1);\n }\n if (color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n handleAlpha(color[4]);\n return this.setRGB(Math.min(100, parseInt(color[1], 10)) / 100, Math.min(100, parseInt(color[2], 10)) / 100, Math.min(100, parseInt(color[3], 10)) / 100, colorSpace1);\n }\n break;\n case \"hsl\":\n case \"hsla\":\n if (color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n handleAlpha(color[4]);\n return this.setHSL(parseFloat(color[1]) / 360, parseFloat(color[2]) / 100, parseFloat(color[3]) / 100, colorSpace1);\n }\n break;\n default:\n console.warn(\"THREE.Color: Unknown color model \" + style);\n }\n } else if (m = /^\\#([A-Fa-f\\d]+)$/.exec(style)) {\n // hex color\n const hex = m[1];\n const size = hex.length;\n if (size === 3) // #ff0\n return this.setRGB(parseInt(hex.charAt(0), 16) / 15, parseInt(hex.charAt(1), 16) / 15, parseInt(hex.charAt(2), 16) / 15, colorSpace1);\n else if (size === 6) // #ff0000\n return this.setHex(parseInt(hex, 16), colorSpace1);\n else console.warn(\"THREE.Color: Invalid hex color \" + style);\n } else if (style && style.length > 0) return this.setColorName(style, colorSpace1);\n return this;\n }\n setColorName(style, colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n // color keywords\n const hex = $a315ee31802fb757$var$_colorKeywords[style.toLowerCase()];\n if (hex !== undefined) // red\n this.setHex(hex, colorSpace1);\n else // unknown color\n console.warn(\"THREE.Color: Unknown color \" + style);\n return this;\n }\n clone() {\n return new this.constructor(this.r, this.g, this.b);\n }\n copy(color) {\n this.r = color.r;\n this.g = color.g;\n this.b = color.b;\n return this;\n }\n copySRGBToLinear(color) {\n this.r = $a315ee31802fb757$var$SRGBToLinear(color.r);\n this.g = $a315ee31802fb757$var$SRGBToLinear(color.g);\n this.b = $a315ee31802fb757$var$SRGBToLinear(color.b);\n return this;\n }\n copyLinearToSRGB(color) {\n this.r = $a315ee31802fb757$var$LinearToSRGB(color.r);\n this.g = $a315ee31802fb757$var$LinearToSRGB(color.g);\n this.b = $a315ee31802fb757$var$LinearToSRGB(color.b);\n return this;\n }\n convertSRGBToLinear() {\n this.copySRGBToLinear(this);\n return this;\n }\n convertLinearToSRGB() {\n this.copyLinearToSRGB(this);\n return this;\n }\n getHex(colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n $a315ee31802fb757$export$5e6fd513f44698c.fromWorkingColorSpace($a315ee31802fb757$var$_color.copy(this), colorSpace1);\n return Math.round($a315ee31802fb757$var$clamp($a315ee31802fb757$var$_color.r * 255, 0, 255)) * 65536 + Math.round($a315ee31802fb757$var$clamp($a315ee31802fb757$var$_color.g * 255, 0, 255)) * 256 + Math.round($a315ee31802fb757$var$clamp($a315ee31802fb757$var$_color.b * 255, 0, 255));\n }\n getHexString(colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n return (\"000000\" + this.getHex(colorSpace1).toString(16)).slice(-6);\n }\n getHSL(target, colorSpace1 = $a315ee31802fb757$export$5e6fd513f44698c.workingColorSpace) {\n // h,s,l ranges are in 0.0 - 1.0\n $a315ee31802fb757$export$5e6fd513f44698c.fromWorkingColorSpace($a315ee31802fb757$var$_color.copy(this), colorSpace1);\n const r = $a315ee31802fb757$var$_color.r, g = $a315ee31802fb757$var$_color.g, b = $a315ee31802fb757$var$_color.b;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let hue, saturation;\n const lightness = (min + max) / 2.0;\n if (min === max) {\n hue = 0;\n saturation = 0;\n } else {\n const delta = max - min;\n saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);\n switch(max){\n case r:\n hue = (g - b) / delta + (g < b ? 6 : 0);\n break;\n case g:\n hue = (b - r) / delta + 2;\n break;\n case b:\n hue = (r - g) / delta + 4;\n break;\n }\n hue /= 6;\n }\n target.h = hue;\n target.s = saturation;\n target.l = lightness;\n return target;\n }\n getRGB(target, colorSpace1 = $a315ee31802fb757$export$5e6fd513f44698c.workingColorSpace) {\n $a315ee31802fb757$export$5e6fd513f44698c.fromWorkingColorSpace($a315ee31802fb757$var$_color.copy(this), colorSpace1);\n target.r = $a315ee31802fb757$var$_color.r;\n target.g = $a315ee31802fb757$var$_color.g;\n target.b = $a315ee31802fb757$var$_color.b;\n return target;\n }\n getStyle(colorSpace1 = $a315ee31802fb757$export$561f394b24edfcaa) {\n $a315ee31802fb757$export$5e6fd513f44698c.fromWorkingColorSpace($a315ee31802fb757$var$_color.copy(this), colorSpace1);\n const r = $a315ee31802fb757$var$_color.r, g = $a315ee31802fb757$var$_color.g, b = $a315ee31802fb757$var$_color.b;\n if (colorSpace1 !== $a315ee31802fb757$export$561f394b24edfcaa) // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n return `color(${colorSpace1} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`;\n return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`;\n }\n offsetHSL(h, s, l) {\n this.getHSL($a315ee31802fb757$var$_hslA);\n $a315ee31802fb757$var$_hslA.h += h;\n $a315ee31802fb757$var$_hslA.s += s;\n $a315ee31802fb757$var$_hslA.l += l;\n this.setHSL($a315ee31802fb757$var$_hslA.h, $a315ee31802fb757$var$_hslA.s, $a315ee31802fb757$var$_hslA.l);\n return this;\n }\n add(color) {\n this.r += color.r;\n this.g += color.g;\n this.b += color.b;\n return this;\n }\n addColors(color1, color2) {\n this.r = color1.r + color2.r;\n this.g = color1.g + color2.g;\n this.b = color1.b + color2.b;\n return this;\n }\n addScalar(s) {\n this.r += s;\n this.g += s;\n this.b += s;\n return this;\n }\n sub(color) {\n this.r = Math.max(0, this.r - color.r);\n this.g = Math.max(0, this.g - color.g);\n this.b = Math.max(0, this.b - color.b);\n return this;\n }\n multiply(color) {\n this.r *= color.r;\n this.g *= color.g;\n this.b *= color.b;\n return this;\n }\n multiplyScalar(s) {\n this.r *= s;\n this.g *= s;\n this.b *= s;\n return this;\n }\n lerp(color, alpha) {\n this.r += (color.r - this.r) * alpha;\n this.g += (color.g - this.g) * alpha;\n this.b += (color.b - this.b) * alpha;\n return this;\n }\n lerpColors(color1, color2, alpha) {\n this.r = color1.r + (color2.r - color1.r) * alpha;\n this.g = color1.g + (color2.g - color1.g) * alpha;\n this.b = color1.b + (color2.b - color1.b) * alpha;\n return this;\n }\n lerpHSL(color, alpha) {\n this.getHSL($a315ee31802fb757$var$_hslA);\n color.getHSL($a315ee31802fb757$var$_hslB);\n const h = $a315ee31802fb757$var$lerp($a315ee31802fb757$var$_hslA.h, $a315ee31802fb757$var$_hslB.h, alpha);\n const s = $a315ee31802fb757$var$lerp($a315ee31802fb757$var$_hslA.s, $a315ee31802fb757$var$_hslB.s, alpha);\n const l = $a315ee31802fb757$var$lerp($a315ee31802fb757$var$_hslA.l, $a315ee31802fb757$var$_hslB.l, alpha);\n this.setHSL(h, s, l);\n return this;\n }\n setFromVector3(v) {\n this.r = v.x;\n this.g = v.y;\n this.b = v.z;\n return this;\n }\n applyMatrix3(m) {\n const r = this.r, g = this.g, b = this.b;\n const e = m.elements;\n this.r = e[0] * r + e[3] * g + e[6] * b;\n this.g = e[1] * r + e[4] * g + e[7] * b;\n this.b = e[2] * r + e[5] * g + e[8] * b;\n return this;\n }\n equals(c) {\n return c.r === this.r && c.g === this.g && c.b === this.b;\n }\n fromArray(array, offset = 0) {\n this.r = array[offset];\n this.g = array[offset + 1];\n this.b = array[offset + 2];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.r;\n array[offset + 1] = this.g;\n array[offset + 2] = this.b;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.r = attribute.getX(index);\n this.g = attribute.getY(index);\n this.b = attribute.getZ(index);\n return this;\n }\n toJSON() {\n return this.getHex();\n }\n *[Symbol.iterator]() {\n yield this.r;\n yield this.g;\n yield this.b;\n }\n}\nconst $a315ee31802fb757$var$_color = /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e();\n$a315ee31802fb757$export$892596cec99bc70e.NAMES = $a315ee31802fb757$var$_colorKeywords;\nclass $a315ee31802fb757$export$55cbcc9b622fe1f5 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshBasicMaterial = true;\n this.type = \"MeshBasicMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff); // emissive\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $a315ee31802fb757$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n}\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\nconst $a315ee31802fb757$var$_tables = /*@__PURE__*/ $a315ee31802fb757$var$_generateTables();\nfunction $a315ee31802fb757$var$_generateTables() {\n // float32 to float16 helpers\n const buffer = new ArrayBuffer(4);\n const floatView = new Float32Array(buffer);\n const uint32View = new Uint32Array(buffer);\n const baseTable = new Uint32Array(512);\n const shiftTable = new Uint32Array(512);\n for(let i = 0; i < 256; ++i){\n const e = i - 127;\n // very small number (0, -0)\n if (e < -27) {\n baseTable[i] = 0x0000;\n baseTable[i | 0x100] = 0x8000;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n // small number (denorm)\n } else if (e < -14) {\n baseTable[i] = 0x0400 >> -e - 14;\n baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;\n shiftTable[i] = -e - 1;\n shiftTable[i | 0x100] = -e - 1;\n // normal number\n } else if (e <= 15) {\n baseTable[i] = e + 15 << 10;\n baseTable[i | 0x100] = e + 15 << 10 | 0x8000;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n // large number (Infinity, -Infinity)\n } else if (e < 128) {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n // stay (NaN, Infinity, -Infinity)\n } else {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n }\n }\n // float16 to float32 helpers\n const mantissaTable = new Uint32Array(2048);\n const exponentTable = new Uint32Array(64);\n const offsetTable = new Uint32Array(64);\n for(let i = 1; i < 1024; ++i){\n let m = i << 13; // zero pad mantissa bits\n let e = 0; // zero exponent\n // normalized\n while((m & 0x00800000) === 0){\n m <<= 1;\n e -= 0x00800000; // decrement exponent\n }\n m &= -8388609; // clear leading 1 bit\n e += 0x38800000; // adjust bias\n mantissaTable[i] = m | e;\n }\n for(let i = 1024; i < 2048; ++i)mantissaTable[i] = 0x38000000 + (i - 1024 << 13);\n for(let i = 1; i < 31; ++i)exponentTable[i] = i << 23;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n for(let i = 33; i < 63; ++i)exponentTable[i] = 0x80000000 + (i - 32 << 23);\n exponentTable[63] = 0xc7800000;\n for(let i = 1; i < 64; ++i)if (i !== 32) offsetTable[i] = 1024;\n return {\n floatView: floatView,\n uint32View: uint32View,\n baseTable: baseTable,\n shiftTable: shiftTable,\n mantissaTable: mantissaTable,\n exponentTable: exponentTable,\n offsetTable: offsetTable\n };\n}\n// float32 to float16\nfunction $a315ee31802fb757$var$toHalfFloat(val) {\n if (Math.abs(val) > 65504) console.warn(\"THREE.DataUtils.toHalfFloat(): Value out of range.\");\n val = $a315ee31802fb757$var$clamp(val, -65504, 65504);\n $a315ee31802fb757$var$_tables.floatView[0] = val;\n const f = $a315ee31802fb757$var$_tables.uint32View[0];\n const e = f >> 23 & 0x1ff;\n return $a315ee31802fb757$var$_tables.baseTable[e] + ((f & 0x007fffff) >> $a315ee31802fb757$var$_tables.shiftTable[e]);\n}\n// float16 to float32\nfunction $a315ee31802fb757$var$fromHalfFloat(val) {\n const m = val >> 10;\n $a315ee31802fb757$var$_tables.uint32View[0] = $a315ee31802fb757$var$_tables.mantissaTable[$a315ee31802fb757$var$_tables.offsetTable[m] + (val & 0x3ff)] + $a315ee31802fb757$var$_tables.exponentTable[m];\n return $a315ee31802fb757$var$_tables.floatView[0];\n}\nconst $a315ee31802fb757$export$11ce8b759162cc80 = {\n toHalfFloat: $a315ee31802fb757$var$toHalfFloat,\n fromHalfFloat: $a315ee31802fb757$var$fromHalfFloat\n};\nconst $a315ee31802fb757$var$_vector$8 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vector2$1 = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nclass $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized = false){\n if (Array.isArray(array)) throw new TypeError(\"THREE.BufferAttribute: array should be a Typed Array.\");\n this.isBufferAttribute = true;\n this.name = \"\";\n this.array = array;\n this.itemSize = itemSize;\n this.count = array !== undefined ? array.length / itemSize : 0;\n this.normalized = normalized;\n this.usage = $a315ee31802fb757$export$763e8360f4d7f77d;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.gpuType = $a315ee31802fb757$export$f6d331659b644596;\n this.version = 0;\n }\n onUploadCallback() {}\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n copy(source) {\n this.name = source.name;\n this.array = new source.array.constructor(source.array);\n this.itemSize = source.itemSize;\n this.count = source.count;\n this.normalized = source.normalized;\n this.usage = source.usage;\n this.gpuType = source.gpuType;\n return this;\n }\n copyAt(index1, attribute, index2) {\n index1 *= this.itemSize;\n index2 *= attribute.itemSize;\n for(let i = 0, l = this.itemSize; i < l; i++)this.array[index1 + i] = attribute.array[index2 + i];\n return this;\n }\n copyArray(array) {\n this.array.set(array);\n return this;\n }\n applyMatrix3(m) {\n if (this.itemSize === 2) for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector2$1.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector2$1.applyMatrix3(m);\n this.setXY(i, $a315ee31802fb757$var$_vector2$1.x, $a315ee31802fb757$var$_vector2$1.y);\n }\n else if (this.itemSize === 3) for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$8.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$8.applyMatrix3(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$8.x, $a315ee31802fb757$var$_vector$8.y, $a315ee31802fb757$var$_vector$8.z);\n }\n return this;\n }\n applyMatrix4(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$8.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$8.applyMatrix4(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$8.x, $a315ee31802fb757$var$_vector$8.y, $a315ee31802fb757$var$_vector$8.z);\n }\n return this;\n }\n applyNormalMatrix(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$8.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$8.applyNormalMatrix(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$8.x, $a315ee31802fb757$var$_vector$8.y, $a315ee31802fb757$var$_vector$8.z);\n }\n return this;\n }\n transformDirection(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$8.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$8.transformDirection(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$8.x, $a315ee31802fb757$var$_vector$8.y, $a315ee31802fb757$var$_vector$8.z);\n }\n return this;\n }\n set(value, offset = 0) {\n // Matching BufferAttribute constructor, do not normalize the array.\n this.array.set(value, offset);\n return this;\n }\n getComponent(index, component) {\n let value = this.array[index * this.itemSize + component];\n if (this.normalized) value = $a315ee31802fb757$var$denormalize(value, this.array);\n return value;\n }\n setComponent(index, component, value) {\n if (this.normalized) value = $a315ee31802fb757$var$normalize(value, this.array);\n this.array[index * this.itemSize + component] = value;\n return this;\n }\n getX(index) {\n let x = this.array[index * this.itemSize];\n if (this.normalized) x = $a315ee31802fb757$var$denormalize(x, this.array);\n return x;\n }\n setX(index, x) {\n if (this.normalized) x = $a315ee31802fb757$var$normalize(x, this.array);\n this.array[index * this.itemSize] = x;\n return this;\n }\n getY(index) {\n let y = this.array[index * this.itemSize + 1];\n if (this.normalized) y = $a315ee31802fb757$var$denormalize(y, this.array);\n return y;\n }\n setY(index, y) {\n if (this.normalized) y = $a315ee31802fb757$var$normalize(y, this.array);\n this.array[index * this.itemSize + 1] = y;\n return this;\n }\n getZ(index) {\n let z = this.array[index * this.itemSize + 2];\n if (this.normalized) z = $a315ee31802fb757$var$denormalize(z, this.array);\n return z;\n }\n setZ(index, z) {\n if (this.normalized) z = $a315ee31802fb757$var$normalize(z, this.array);\n this.array[index * this.itemSize + 2] = z;\n return this;\n }\n getW(index) {\n let w = this.array[index * this.itemSize + 3];\n if (this.normalized) w = $a315ee31802fb757$var$denormalize(w, this.array);\n return w;\n }\n setW(index, w) {\n if (this.normalized) w = $a315ee31802fb757$var$normalize(w, this.array);\n this.array[index * this.itemSize + 3] = w;\n return this;\n }\n setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n return this;\n }\n setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n w = $a315ee31802fb757$var$normalize(w, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n this.array[index + 3] = w;\n return this;\n }\n onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n clone() {\n return new this.constructor(this.array, this.itemSize).copy(this);\n }\n toJSON() {\n const data = {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: Array.from(this.array),\n normalized: this.normalized\n };\n if (this.name !== \"\") data.name = this.name;\n if (this.usage !== $a315ee31802fb757$export$763e8360f4d7f77d) data.usage = this.usage;\n if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;\n return data;\n }\n}\n//\nclass $a315ee31802fb757$export$f9ff2d6a20248cbf extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int8Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$cacc90cf35d11cdd extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint8Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$baaa85a1a812c157 extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint8ClampedArray(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$2b755a102ccdcefe extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int16Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$640a853f68025f2e extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint16Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$46b369aed2968a0a extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int32Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$7eb8c9fa25cd5bd6 extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint32Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$dbd3698c64958d69 extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint16Array(array), itemSize, normalized);\n this.isFloat16BufferAttribute = true;\n }\n getX(index) {\n let x = $a315ee31802fb757$var$fromHalfFloat(this.array[index * this.itemSize]);\n if (this.normalized) x = $a315ee31802fb757$var$denormalize(x, this.array);\n return x;\n }\n setX(index, x) {\n if (this.normalized) x = $a315ee31802fb757$var$normalize(x, this.array);\n this.array[index * this.itemSize] = $a315ee31802fb757$var$toHalfFloat(x);\n return this;\n }\n getY(index) {\n let y = $a315ee31802fb757$var$fromHalfFloat(this.array[index * this.itemSize + 1]);\n if (this.normalized) y = $a315ee31802fb757$var$denormalize(y, this.array);\n return y;\n }\n setY(index, y) {\n if (this.normalized) y = $a315ee31802fb757$var$normalize(y, this.array);\n this.array[index * this.itemSize + 1] = $a315ee31802fb757$var$toHalfFloat(y);\n return this;\n }\n getZ(index) {\n let z = $a315ee31802fb757$var$fromHalfFloat(this.array[index * this.itemSize + 2]);\n if (this.normalized) z = $a315ee31802fb757$var$denormalize(z, this.array);\n return z;\n }\n setZ(index, z) {\n if (this.normalized) z = $a315ee31802fb757$var$normalize(z, this.array);\n this.array[index * this.itemSize + 2] = $a315ee31802fb757$var$toHalfFloat(z);\n return this;\n }\n getW(index) {\n let w = $a315ee31802fb757$var$fromHalfFloat(this.array[index * this.itemSize + 3]);\n if (this.normalized) w = $a315ee31802fb757$var$denormalize(w, this.array);\n return w;\n }\n setW(index, w) {\n if (this.normalized) w = $a315ee31802fb757$var$normalize(w, this.array);\n this.array[index * this.itemSize + 3] = $a315ee31802fb757$var$toHalfFloat(w);\n return this;\n }\n setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n }\n this.array[index + 0] = $a315ee31802fb757$var$toHalfFloat(x);\n this.array[index + 1] = $a315ee31802fb757$var$toHalfFloat(y);\n return this;\n }\n setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n }\n this.array[index + 0] = $a315ee31802fb757$var$toHalfFloat(x);\n this.array[index + 1] = $a315ee31802fb757$var$toHalfFloat(y);\n this.array[index + 2] = $a315ee31802fb757$var$toHalfFloat(z);\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n w = $a315ee31802fb757$var$normalize(w, this.array);\n }\n this.array[index + 0] = $a315ee31802fb757$var$toHalfFloat(x);\n this.array[index + 1] = $a315ee31802fb757$var$toHalfFloat(y);\n this.array[index + 2] = $a315ee31802fb757$var$toHalfFloat(z);\n this.array[index + 3] = $a315ee31802fb757$var$toHalfFloat(w);\n return this;\n }\n}\nclass $a315ee31802fb757$export$cbe7a62641830ebd extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Float32Array(array), itemSize, normalized);\n }\n}\nclass $a315ee31802fb757$export$9e0ade74842adbb8 extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Float64Array(array), itemSize, normalized);\n }\n}\nlet $a315ee31802fb757$var$_id$1 = 0;\nconst $a315ee31802fb757$var$_m1 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_obj = /*@__PURE__*/ new $a315ee31802fb757$export$e4dd07dff30cc924();\nconst $a315ee31802fb757$var$_offset = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_box$1 = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\nconst $a315ee31802fb757$var$_boxMorphTargets = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\nconst $a315ee31802fb757$var$_vector$7 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$b7be63a67df8959 extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isBufferGeometry = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$_id$1++\n });\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.name = \"\";\n this.type = \"BufferGeometry\";\n this.index = null;\n this.attributes = {};\n this.morphAttributes = {};\n this.morphTargetsRelative = false;\n this.groups = [];\n this.boundingBox = null;\n this.boundingSphere = null;\n this.drawRange = {\n start: 0,\n count: Infinity\n };\n this.userData = {};\n }\n getIndex() {\n return this.index;\n }\n setIndex(index) {\n if (Array.isArray(index)) this.index = new ($a315ee31802fb757$var$arrayNeedsUint32(index) ? $a315ee31802fb757$export$7eb8c9fa25cd5bd6 : $a315ee31802fb757$export$640a853f68025f2e)(index, 1);\n else this.index = index;\n return this;\n }\n getAttribute(name) {\n return this.attributes[name];\n }\n setAttribute(name, attribute) {\n this.attributes[name] = attribute;\n return this;\n }\n deleteAttribute(name) {\n delete this.attributes[name];\n return this;\n }\n hasAttribute(name) {\n return this.attributes[name] !== undefined;\n }\n addGroup(start, count, materialIndex = 0) {\n this.groups.push({\n start: start,\n count: count,\n materialIndex: materialIndex\n });\n }\n clearGroups() {\n this.groups = [];\n }\n setDrawRange(start, count) {\n this.drawRange.start = start;\n this.drawRange.count = count;\n }\n applyMatrix4(matrix) {\n const position = this.attributes.position;\n if (position !== undefined) {\n position.applyMatrix4(matrix);\n position.needsUpdate = true;\n }\n const normal = this.attributes.normal;\n if (normal !== undefined) {\n const normalMatrix = new $a315ee31802fb757$export$8ff26dafa08918().getNormalMatrix(matrix);\n normal.applyNormalMatrix(normalMatrix);\n normal.needsUpdate = true;\n }\n const tangent = this.attributes.tangent;\n if (tangent !== undefined) {\n tangent.transformDirection(matrix);\n tangent.needsUpdate = true;\n }\n if (this.boundingBox !== null) this.computeBoundingBox();\n if (this.boundingSphere !== null) this.computeBoundingSphere();\n return this;\n }\n applyQuaternion(q) {\n $a315ee31802fb757$var$_m1.makeRotationFromQuaternion(q);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n rotateX(angle) {\n // rotate geometry around world x-axis\n $a315ee31802fb757$var$_m1.makeRotationX(angle);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n rotateY(angle) {\n // rotate geometry around world y-axis\n $a315ee31802fb757$var$_m1.makeRotationY(angle);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n rotateZ(angle) {\n // rotate geometry around world z-axis\n $a315ee31802fb757$var$_m1.makeRotationZ(angle);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n translate(x, y, z) {\n // translate geometry\n $a315ee31802fb757$var$_m1.makeTranslation(x, y, z);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n scale(x, y, z) {\n // scale geometry\n $a315ee31802fb757$var$_m1.makeScale(x, y, z);\n this.applyMatrix4($a315ee31802fb757$var$_m1);\n return this;\n }\n lookAt(vector) {\n $a315ee31802fb757$var$_obj.lookAt(vector);\n $a315ee31802fb757$var$_obj.updateMatrix();\n this.applyMatrix4($a315ee31802fb757$var$_obj.matrix);\n return this;\n }\n center() {\n this.computeBoundingBox();\n this.boundingBox.getCenter($a315ee31802fb757$var$_offset).negate();\n this.translate($a315ee31802fb757$var$_offset.x, $a315ee31802fb757$var$_offset.y, $a315ee31802fb757$var$_offset.z);\n return this;\n }\n setFromPoints(points) {\n const position = [];\n for(let i = 0, l = points.length; i < l; i++){\n const point = points[i];\n position.push(point.x, point.y, point.z || 0);\n }\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(position, 3));\n return this;\n }\n computeBoundingBox() {\n if (this.boundingBox === null) this.boundingBox = new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\n const position = this.attributes.position;\n const morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingBox.set(new $a315ee31802fb757$export$64b5c384219d3699(-Infinity, -Infinity, -Infinity), new $a315ee31802fb757$export$64b5c384219d3699(Infinity, Infinity, Infinity));\n return;\n }\n if (position !== undefined) {\n this.boundingBox.setFromBufferAttribute(position);\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n $a315ee31802fb757$var$_box$1.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n $a315ee31802fb757$var$_vector$7.addVectors(this.boundingBox.min, $a315ee31802fb757$var$_box$1.min);\n this.boundingBox.expandByPoint($a315ee31802fb757$var$_vector$7);\n $a315ee31802fb757$var$_vector$7.addVectors(this.boundingBox.max, $a315ee31802fb757$var$_box$1.max);\n this.boundingBox.expandByPoint($a315ee31802fb757$var$_vector$7);\n } else {\n this.boundingBox.expandByPoint($a315ee31802fb757$var$_box$1.min);\n this.boundingBox.expandByPoint($a315ee31802fb757$var$_box$1.max);\n }\n }\n } else this.boundingBox.makeEmpty();\n if (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);\n }\n computeBoundingSphere() {\n if (this.boundingSphere === null) this.boundingSphere = new $a315ee31802fb757$export$805e8b72413ccaba();\n const position = this.attributes.position;\n const morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingSphere.set(new $a315ee31802fb757$export$64b5c384219d3699(), Infinity);\n return;\n }\n if (position) {\n // first, find the center of the bounding sphere\n const center = this.boundingSphere.center;\n $a315ee31802fb757$var$_box$1.setFromBufferAttribute(position);\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n $a315ee31802fb757$var$_boxMorphTargets.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n $a315ee31802fb757$var$_vector$7.addVectors($a315ee31802fb757$var$_box$1.min, $a315ee31802fb757$var$_boxMorphTargets.min);\n $a315ee31802fb757$var$_box$1.expandByPoint($a315ee31802fb757$var$_vector$7);\n $a315ee31802fb757$var$_vector$7.addVectors($a315ee31802fb757$var$_box$1.max, $a315ee31802fb757$var$_boxMorphTargets.max);\n $a315ee31802fb757$var$_box$1.expandByPoint($a315ee31802fb757$var$_vector$7);\n } else {\n $a315ee31802fb757$var$_box$1.expandByPoint($a315ee31802fb757$var$_boxMorphTargets.min);\n $a315ee31802fb757$var$_box$1.expandByPoint($a315ee31802fb757$var$_boxMorphTargets.max);\n }\n }\n $a315ee31802fb757$var$_box$1.getCenter(center);\n // second, try to find a boundingSphere with a radius smaller than the\n // boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n let maxRadiusSq = 0;\n for(let i = 0, il = position.count; i < il; i++){\n $a315ee31802fb757$var$_vector$7.fromBufferAttribute(position, i);\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared($a315ee31802fb757$var$_vector$7));\n }\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n const morphTargetsRelative = this.morphTargetsRelative;\n for(let j = 0, jl = morphAttribute.count; j < jl; j++){\n $a315ee31802fb757$var$_vector$7.fromBufferAttribute(morphAttribute, j);\n if (morphTargetsRelative) {\n $a315ee31802fb757$var$_offset.fromBufferAttribute(position, j);\n $a315ee31802fb757$var$_vector$7.add($a315ee31802fb757$var$_offset);\n }\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared($a315ee31802fb757$var$_vector$7));\n }\n }\n this.boundingSphere.radius = Math.sqrt(maxRadiusSq);\n if (isNaN(this.boundingSphere.radius)) console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this);\n }\n }\n computeTangents() {\n const index = this.index;\n const attributes = this.attributes;\n // based on http://www.terathon.com/code/tangent.html\n // (per vertex tangents)\n if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {\n console.error(\"THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)\");\n return;\n }\n const indices = index.array;\n const positions = attributes.position.array;\n const normals = attributes.normal.array;\n const uvs = attributes.uv.array;\n const nVertices = positions.length / 3;\n if (this.hasAttribute(\"tangent\") === false) this.setAttribute(\"tangent\", new $a315ee31802fb757$export$8dea267bd6bde117(new Float32Array(4 * nVertices), 4));\n const tangents = this.getAttribute(\"tangent\").array;\n const tan1 = [], tan2 = [];\n for(let i = 0; i < nVertices; i++){\n tan1[i] = new $a315ee31802fb757$export$64b5c384219d3699();\n tan2[i] = new $a315ee31802fb757$export$64b5c384219d3699();\n }\n const vA = new $a315ee31802fb757$export$64b5c384219d3699(), vB = new $a315ee31802fb757$export$64b5c384219d3699(), vC = new $a315ee31802fb757$export$64b5c384219d3699(), uvA = new $a315ee31802fb757$export$c977b3e384af9ae1(), uvB = new $a315ee31802fb757$export$c977b3e384af9ae1(), uvC = new $a315ee31802fb757$export$c977b3e384af9ae1(), sdir = new $a315ee31802fb757$export$64b5c384219d3699(), tdir = new $a315ee31802fb757$export$64b5c384219d3699();\n function handleTriangle(a, b, c) {\n vA.fromArray(positions, a * 3);\n vB.fromArray(positions, b * 3);\n vC.fromArray(positions, c * 3);\n uvA.fromArray(uvs, a * 2);\n uvB.fromArray(uvs, b * 2);\n uvC.fromArray(uvs, c * 2);\n vB.sub(vA);\n vC.sub(vA);\n uvB.sub(uvA);\n uvC.sub(uvA);\n const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y);\n // silently ignore degenerate uv triangles having coincident or colinear vertices\n if (!isFinite(r)) return;\n sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);\n tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);\n tan1[a].add(sdir);\n tan1[b].add(sdir);\n tan1[c].add(sdir);\n tan2[a].add(tdir);\n tan2[b].add(tdir);\n tan2[c].add(tdir);\n }\n let groups = this.groups;\n if (groups.length === 0) groups = [\n {\n start: 0,\n count: indices.length\n }\n ];\n for(let i = 0, il = groups.length; i < il; ++i){\n const group = groups[i];\n const start = group.start;\n const count = group.count;\n for(let j = start, jl = start + count; j < jl; j += 3)handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);\n }\n const tmp = new $a315ee31802fb757$export$64b5c384219d3699(), tmp2 = new $a315ee31802fb757$export$64b5c384219d3699();\n const n = new $a315ee31802fb757$export$64b5c384219d3699(), n2 = new $a315ee31802fb757$export$64b5c384219d3699();\n function handleVertex(v) {\n n.fromArray(normals, v * 3);\n n2.copy(n);\n const t = tan1[v];\n // Gram-Schmidt orthogonalize\n tmp.copy(t);\n tmp.sub(n.multiplyScalar(n.dot(t))).normalize();\n // Calculate handedness\n tmp2.crossVectors(n2, t);\n const test = tmp2.dot(tan2[v]);\n const w = test < 0.0 ? -1 : 1.0;\n tangents[v * 4] = tmp.x;\n tangents[v * 4 + 1] = tmp.y;\n tangents[v * 4 + 2] = tmp.z;\n tangents[v * 4 + 3] = w;\n }\n for(let i = 0, il = groups.length; i < il; ++i){\n const group = groups[i];\n const start = group.start;\n const count = group.count;\n for(let j = start, jl = start + count; j < jl; j += 3){\n handleVertex(indices[j + 0]);\n handleVertex(indices[j + 1]);\n handleVertex(indices[j + 2]);\n }\n }\n }\n computeVertexNormals() {\n const index = this.index;\n const positionAttribute = this.getAttribute(\"position\");\n if (positionAttribute !== undefined) {\n let normalAttribute = this.getAttribute(\"normal\");\n if (normalAttribute === undefined) {\n normalAttribute = new $a315ee31802fb757$export$8dea267bd6bde117(new Float32Array(positionAttribute.count * 3), 3);\n this.setAttribute(\"normal\", normalAttribute);\n } else // reset existing normals to zero\n for(let i = 0, il = normalAttribute.count; i < il; i++)normalAttribute.setXYZ(i, 0, 0, 0);\n const pA = new $a315ee31802fb757$export$64b5c384219d3699(), pB = new $a315ee31802fb757$export$64b5c384219d3699(), pC = new $a315ee31802fb757$export$64b5c384219d3699();\n const nA = new $a315ee31802fb757$export$64b5c384219d3699(), nB = new $a315ee31802fb757$export$64b5c384219d3699(), nC = new $a315ee31802fb757$export$64b5c384219d3699();\n const cb = new $a315ee31802fb757$export$64b5c384219d3699(), ab = new $a315ee31802fb757$export$64b5c384219d3699();\n // indexed elements\n if (index) for(let i = 0, il = index.count; i < il; i += 3){\n const vA = index.getX(i + 0);\n const vB = index.getX(i + 1);\n const vC = index.getX(i + 2);\n pA.fromBufferAttribute(positionAttribute, vA);\n pB.fromBufferAttribute(positionAttribute, vB);\n pC.fromBufferAttribute(positionAttribute, vC);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n nA.fromBufferAttribute(normalAttribute, vA);\n nB.fromBufferAttribute(normalAttribute, vB);\n nC.fromBufferAttribute(normalAttribute, vC);\n nA.add(cb);\n nB.add(cb);\n nC.add(cb);\n normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);\n normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);\n normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);\n }\n else // non-indexed elements (unconnected triangle soup)\n for(let i = 0, il = positionAttribute.count; i < il; i += 3){\n pA.fromBufferAttribute(positionAttribute, i + 0);\n pB.fromBufferAttribute(positionAttribute, i + 1);\n pC.fromBufferAttribute(positionAttribute, i + 2);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z);\n }\n this.normalizeNormals();\n normalAttribute.needsUpdate = true;\n }\n }\n normalizeNormals() {\n const normals = this.attributes.normal;\n for(let i = 0, il = normals.count; i < il; i++){\n $a315ee31802fb757$var$_vector$7.fromBufferAttribute(normals, i);\n $a315ee31802fb757$var$_vector$7.normalize();\n normals.setXYZ(i, $a315ee31802fb757$var$_vector$7.x, $a315ee31802fb757$var$_vector$7.y, $a315ee31802fb757$var$_vector$7.z);\n }\n }\n toNonIndexed() {\n function convertBufferAttribute(attribute, indices) {\n const array = attribute.array;\n const itemSize = attribute.itemSize;\n const normalized = attribute.normalized;\n const array2 = new array.constructor(indices.length * itemSize);\n let index = 0, index2 = 0;\n for(let i = 0, l = indices.length; i < l; i++){\n if (attribute.isInterleavedBufferAttribute) index = indices[i] * attribute.data.stride + attribute.offset;\n else index = indices[i] * itemSize;\n for(let j = 0; j < itemSize; j++)array2[index2++] = array[index++];\n }\n return new $a315ee31802fb757$export$8dea267bd6bde117(array2, itemSize, normalized);\n }\n //\n if (this.index === null) {\n console.warn(\"THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.\");\n return this;\n }\n const geometry2 = new $a315ee31802fb757$export$b7be63a67df8959();\n const indices = this.index.array;\n const attributes = this.attributes;\n // attributes\n for(const name in attributes){\n const attribute = attributes[name];\n const newAttribute = convertBufferAttribute(attribute, indices);\n geometry2.setAttribute(name, newAttribute);\n }\n // morph attributes\n const morphAttributes = this.morphAttributes;\n for(const name in morphAttributes){\n const morphArray = [];\n const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes\n for(let i = 0, il = morphAttribute.length; i < il; i++){\n const attribute = morphAttribute[i];\n const newAttribute = convertBufferAttribute(attribute, indices);\n morphArray.push(newAttribute);\n }\n geometry2.morphAttributes[name] = morphArray;\n }\n geometry2.morphTargetsRelative = this.morphTargetsRelative;\n // groups\n const groups = this.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n geometry2.addGroup(group.start, group.count, group.materialIndex);\n }\n return geometry2;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"BufferGeometry\",\n generator: \"BufferGeometry.toJSON\"\n }\n };\n // standard BufferGeometry serialization\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== \"\") data.name = this.name;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n if (this.parameters !== undefined) {\n const parameters = this.parameters;\n for(const key in parameters)if (parameters[key] !== undefined) data[key] = parameters[key];\n return data;\n }\n // for simplicity the code assumes attributes are not shared across geometries, see #15811\n data.data = {\n attributes: {}\n };\n const index = this.index;\n if (index !== null) data.data.index = {\n type: index.array.constructor.name,\n array: Array.prototype.slice.call(index.array)\n };\n const attributes = this.attributes;\n for(const key in attributes){\n const attribute = attributes[key];\n data.data.attributes[key] = attribute.toJSON(data.data);\n }\n const morphAttributes = {};\n let hasMorphAttributes = false;\n for(const key in this.morphAttributes){\n const attributeArray = this.morphAttributes[key];\n const array = [];\n for(let i = 0, il = attributeArray.length; i < il; i++){\n const attribute = attributeArray[i];\n array.push(attribute.toJSON(data.data));\n }\n if (array.length > 0) {\n morphAttributes[key] = array;\n hasMorphAttributes = true;\n }\n }\n if (hasMorphAttributes) {\n data.data.morphAttributes = morphAttributes;\n data.data.morphTargetsRelative = this.morphTargetsRelative;\n }\n const groups = this.groups;\n if (groups.length > 0) data.data.groups = JSON.parse(JSON.stringify(groups));\n const boundingSphere = this.boundingSphere;\n if (boundingSphere !== null) data.data.boundingSphere = {\n center: boundingSphere.center.toArray(),\n radius: boundingSphere.radius\n };\n return data;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n // reset\n this.index = null;\n this.attributes = {};\n this.morphAttributes = {};\n this.groups = [];\n this.boundingBox = null;\n this.boundingSphere = null;\n // used for storing cloned, shared data\n const data = {};\n // name\n this.name = source.name;\n // index\n const index = source.index;\n if (index !== null) this.setIndex(index.clone(data));\n // attributes\n const attributes = source.attributes;\n for(const name in attributes){\n const attribute = attributes[name];\n this.setAttribute(name, attribute.clone(data));\n }\n // morph attributes\n const morphAttributes = source.morphAttributes;\n for(const name in morphAttributes){\n const array = [];\n const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes\n for(let i = 0, l = morphAttribute.length; i < l; i++)array.push(morphAttribute[i].clone(data));\n this.morphAttributes[name] = array;\n }\n this.morphTargetsRelative = source.morphTargetsRelative;\n // groups\n const groups = source.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n this.addGroup(group.start, group.count, group.materialIndex);\n }\n // bounding box\n const boundingBox = source.boundingBox;\n if (boundingBox !== null) this.boundingBox = boundingBox.clone();\n // bounding sphere\n const boundingSphere = source.boundingSphere;\n if (boundingSphere !== null) this.boundingSphere = boundingSphere.clone();\n // draw range\n this.drawRange.start = source.drawRange.start;\n this.drawRange.count = source.drawRange.count;\n // user data\n this.userData = source.userData;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nconst $a315ee31802fb757$var$_inverseMatrix$3 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_ray$3 = /*@__PURE__*/ new $a315ee31802fb757$export$a186db52eed6d40e();\nconst $a315ee31802fb757$var$_sphere$5 = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nconst $a315ee31802fb757$var$_sphereHitAt = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vA$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vB$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vC$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_tempA = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_morphA = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_uvA$1 = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_uvB$1 = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_uvC$1 = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_normalA = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_normalB = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_normalC = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_intersectionPoint = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_intersectionPointWorld = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$e176487c05830cc5 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(geometry = new $a315ee31802fb757$export$b7be63a67df8959(), material = new $a315ee31802fb757$export$55cbcc9b622fe1f5()){\n super();\n this.isMesh = true;\n this.type = \"Mesh\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.morphTargetInfluences !== undefined) this.morphTargetInfluences = source.morphTargetInfluences.slice();\n if (source.morphTargetDictionary !== undefined) this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n getVertexPosition(index, target) {\n const geometry = this.geometry;\n const position = geometry.attributes.position;\n const morphPosition = geometry.morphAttributes.position;\n const morphTargetsRelative = geometry.morphTargetsRelative;\n target.fromBufferAttribute(position, index);\n const morphInfluences = this.morphTargetInfluences;\n if (morphPosition && morphInfluences) {\n $a315ee31802fb757$var$_morphA.set(0, 0, 0);\n for(let i = 0, il = morphPosition.length; i < il; i++){\n const influence = morphInfluences[i];\n const morphAttribute = morphPosition[i];\n if (influence === 0) continue;\n $a315ee31802fb757$var$_tempA.fromBufferAttribute(morphAttribute, index);\n if (morphTargetsRelative) $a315ee31802fb757$var$_morphA.addScaledVector($a315ee31802fb757$var$_tempA, influence);\n else $a315ee31802fb757$var$_morphA.addScaledVector($a315ee31802fb757$var$_tempA.sub(target), influence);\n }\n target.add($a315ee31802fb757$var$_morphA);\n }\n return target;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const material = this.material;\n const matrixWorld = this.matrixWorld;\n if (material === undefined) return;\n // test with bounding sphere in world space\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$5.copy(geometry.boundingSphere);\n $a315ee31802fb757$var$_sphere$5.applyMatrix4(matrixWorld);\n // check distance from ray origin to bounding sphere\n $a315ee31802fb757$var$_ray$3.copy(raycaster.ray).recast(raycaster.near);\n if ($a315ee31802fb757$var$_sphere$5.containsPoint($a315ee31802fb757$var$_ray$3.origin) === false) {\n if ($a315ee31802fb757$var$_ray$3.intersectSphere($a315ee31802fb757$var$_sphere$5, $a315ee31802fb757$var$_sphereHitAt) === null) return;\n if ($a315ee31802fb757$var$_ray$3.origin.distanceToSquared($a315ee31802fb757$var$_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) return;\n }\n // convert ray to local space of mesh\n $a315ee31802fb757$var$_inverseMatrix$3.copy(matrixWorld).invert();\n $a315ee31802fb757$var$_ray$3.copy(raycaster.ray).applyMatrix4($a315ee31802fb757$var$_inverseMatrix$3);\n // test with bounding box in local space\n if (geometry.boundingBox !== null) {\n if ($a315ee31802fb757$var$_ray$3.intersectsBox(geometry.boundingBox) === false) return;\n }\n // test for intersections with geometry\n this._computeIntersections(raycaster, intersects, $a315ee31802fb757$var$_ray$3);\n }\n _computeIntersections(raycaster, intersects, rayLocalSpace) {\n let intersection;\n const geometry = this.geometry;\n const material = this.material;\n const index = geometry.index;\n const position = geometry.attributes.position;\n const uv = geometry.attributes.uv;\n const uv1 = geometry.attributes.uv1;\n const normal = geometry.attributes.normal;\n const groups = geometry.groups;\n const drawRange = geometry.drawRange;\n if (index !== null) {\n // indexed buffer geometry\n if (Array.isArray(material)) for(let i = 0, il = groups.length; i < il; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n const start = Math.max(group.start, drawRange.start);\n const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));\n for(let j = start, jl = end; j < jl; j += 3){\n const a = index.getX(j);\n const b = index.getX(j + 1);\n const c = index.getX(j + 2);\n intersection = $a315ee31802fb757$var$checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics\n intersection.face.materialIndex = group.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i += 3){\n const a = index.getX(i);\n const b = index.getX(i + 1);\n const c = index.getX(i + 2);\n intersection = $a315ee31802fb757$var$checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n } else if (position !== undefined) {\n // non-indexed buffer geometry\n if (Array.isArray(material)) for(let i = 0, il = groups.length; i < il; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n const start = Math.max(group.start, drawRange.start);\n const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));\n for(let j = start, jl = end; j < jl; j += 3){\n const a = j;\n const b = j + 1;\n const c = j + 2;\n intersection = $a315ee31802fb757$var$checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics\n intersection.face.materialIndex = group.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(position.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i += 3){\n const a = i;\n const b = i + 1;\n const c = i + 2;\n intersection = $a315ee31802fb757$var$checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n }\n }\n}\nfunction $a315ee31802fb757$var$checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {\n let intersect;\n if (material.side === $a315ee31802fb757$export$d9f0486e75b5ace) intersect = ray.intersectTriangle(pC, pB, pA, true, point);\n else intersect = ray.intersectTriangle(pA, pB, pC, material.side === $a315ee31802fb757$export$2ede184fc2998901, point);\n if (intersect === null) return null;\n $a315ee31802fb757$var$_intersectionPointWorld.copy(point);\n $a315ee31802fb757$var$_intersectionPointWorld.applyMatrix4(object.matrixWorld);\n const distance = raycaster.ray.origin.distanceTo($a315ee31802fb757$var$_intersectionPointWorld);\n if (distance < raycaster.near || distance > raycaster.far) return null;\n return {\n distance: distance,\n point: $a315ee31802fb757$var$_intersectionPointWorld.clone(),\n object: object\n };\n}\nfunction $a315ee31802fb757$var$checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) {\n object.getVertexPosition(a, $a315ee31802fb757$var$_vA$1);\n object.getVertexPosition(b, $a315ee31802fb757$var$_vB$1);\n object.getVertexPosition(c, $a315ee31802fb757$var$_vC$1);\n const intersection = $a315ee31802fb757$var$checkIntersection(object, material, raycaster, ray, $a315ee31802fb757$var$_vA$1, $a315ee31802fb757$var$_vB$1, $a315ee31802fb757$var$_vC$1, $a315ee31802fb757$var$_intersectionPoint);\n if (intersection) {\n if (uv) {\n $a315ee31802fb757$var$_uvA$1.fromBufferAttribute(uv, a);\n $a315ee31802fb757$var$_uvB$1.fromBufferAttribute(uv, b);\n $a315ee31802fb757$var$_uvC$1.fromBufferAttribute(uv, c);\n intersection.uv = $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation($a315ee31802fb757$var$_intersectionPoint, $a315ee31802fb757$var$_vA$1, $a315ee31802fb757$var$_vB$1, $a315ee31802fb757$var$_vC$1, $a315ee31802fb757$var$_uvA$1, $a315ee31802fb757$var$_uvB$1, $a315ee31802fb757$var$_uvC$1, new $a315ee31802fb757$export$c977b3e384af9ae1());\n }\n if (uv1) {\n $a315ee31802fb757$var$_uvA$1.fromBufferAttribute(uv1, a);\n $a315ee31802fb757$var$_uvB$1.fromBufferAttribute(uv1, b);\n $a315ee31802fb757$var$_uvC$1.fromBufferAttribute(uv1, c);\n intersection.uv1 = $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation($a315ee31802fb757$var$_intersectionPoint, $a315ee31802fb757$var$_vA$1, $a315ee31802fb757$var$_vB$1, $a315ee31802fb757$var$_vC$1, $a315ee31802fb757$var$_uvA$1, $a315ee31802fb757$var$_uvB$1, $a315ee31802fb757$var$_uvC$1, new $a315ee31802fb757$export$c977b3e384af9ae1());\n intersection.uv2 = intersection.uv1; // @deprecated, r152\n }\n if (normal) {\n $a315ee31802fb757$var$_normalA.fromBufferAttribute(normal, a);\n $a315ee31802fb757$var$_normalB.fromBufferAttribute(normal, b);\n $a315ee31802fb757$var$_normalC.fromBufferAttribute(normal, c);\n intersection.normal = $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation($a315ee31802fb757$var$_intersectionPoint, $a315ee31802fb757$var$_vA$1, $a315ee31802fb757$var$_vB$1, $a315ee31802fb757$var$_vC$1, $a315ee31802fb757$var$_normalA, $a315ee31802fb757$var$_normalB, $a315ee31802fb757$var$_normalC, new $a315ee31802fb757$export$64b5c384219d3699());\n if (intersection.normal.dot(ray.direction) > 0) intersection.normal.multiplyScalar(-1);\n }\n const face = {\n a: a,\n b: b,\n c: c,\n normal: new $a315ee31802fb757$export$64b5c384219d3699(),\n materialIndex: 0\n };\n $a315ee31802fb757$export$5a465592bfe74b48.getNormal($a315ee31802fb757$var$_vA$1, $a315ee31802fb757$var$_vB$1, $a315ee31802fb757$var$_vC$1, face.normal);\n intersection.face = face;\n }\n return intersection;\n}\nclass $a315ee31802fb757$export$33e43285f7406bd5 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1){\n super();\n this.type = \"BoxGeometry\";\n this.parameters = {\n width: width,\n height: height,\n depth: depth,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n depthSegments: depthSegments\n };\n const scope = this;\n // segments\n widthSegments = Math.floor(widthSegments);\n heightSegments = Math.floor(heightSegments);\n depthSegments = Math.floor(depthSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let numberOfVertices = 0;\n let groupStart = 0;\n // build each side of the box geometry\n buildPlane(\"z\", \"y\", \"x\", -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px\n buildPlane(\"z\", \"y\", \"x\", 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx\n buildPlane(\"x\", \"z\", \"y\", 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py\n buildPlane(\"x\", \"z\", \"y\", 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny\n buildPlane(\"x\", \"y\", \"z\", 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz\n buildPlane(\"x\", \"y\", \"z\", -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) {\n const segmentWidth = width / gridX;\n const segmentHeight = height / gridY;\n const widthHalf = width / 2;\n const heightHalf = height / 2;\n const depthHalf = depth / 2;\n const gridX1 = gridX + 1;\n const gridY1 = gridY + 1;\n let vertexCounter = 0;\n let groupCount = 0;\n const vector = new $a315ee31802fb757$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let iy = 0; iy < gridY1; iy++){\n const y = iy * segmentHeight - heightHalf;\n for(let ix = 0; ix < gridX1; ix++){\n const x = ix * segmentWidth - widthHalf;\n // set values to correct vector component\n vector[u] = x * udir;\n vector[v] = y * vdir;\n vector[w] = depthHalf;\n // now apply vector to vertex buffer\n vertices.push(vector.x, vector.y, vector.z);\n // set values to correct vector component\n vector[u] = 0;\n vector[v] = 0;\n vector[w] = depth > 0 ? 1 : -1;\n // now apply vector to normal buffer\n normals.push(vector.x, vector.y, vector.z);\n // uvs\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n // counters\n vertexCounter += 1;\n }\n }\n // indices\n // 1. you need three indices to draw a single face\n // 2. a single segment consists of two faces\n // 3. so we need to generate six (2*3) indices per segment\n for(let iy = 0; iy < gridY; iy++)for(let ix = 0; ix < gridX; ix++){\n const a = numberOfVertices + ix + gridX1 * iy;\n const b = numberOfVertices + ix + gridX1 * (iy + 1);\n const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1);\n const d = numberOfVertices + (ix + 1) + gridX1 * iy;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n // increase counter\n groupCount += 6;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, materialIndex);\n // calculate new start value for groups\n groupStart += groupCount;\n // update total number of vertices\n numberOfVertices += vertexCounter;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$33e43285f7406bd5(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);\n }\n}\n/**\n * Uniform Utilities\n */ function $a315ee31802fb757$var$cloneUniforms(src) {\n const dst = {};\n for(const u in src){\n dst[u] = {};\n for(const p in src[u]){\n const property = src[u][p];\n if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {\n if (property.isRenderTargetTexture) {\n console.warn(\"UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().\");\n dst[u][p] = null;\n } else dst[u][p] = property.clone();\n } else if (Array.isArray(property)) dst[u][p] = property.slice();\n else dst[u][p] = property;\n }\n }\n return dst;\n}\nfunction $a315ee31802fb757$var$mergeUniforms(uniforms) {\n const merged = {};\n for(let u = 0; u < uniforms.length; u++){\n const tmp = $a315ee31802fb757$var$cloneUniforms(uniforms[u]);\n for(const p in tmp)merged[p] = tmp[p];\n }\n return merged;\n}\nfunction $a315ee31802fb757$var$cloneUniformsGroups(src) {\n const dst = [];\n for(let u = 0; u < src.length; u++)dst.push(src[u].clone());\n return dst;\n}\nfunction $a315ee31802fb757$var$getUnlitUniformColorSpace(renderer) {\n if (renderer.getRenderTarget() === null) // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n return renderer.outputColorSpace;\n return $a315ee31802fb757$export$42429b3acfb233a4;\n}\n// Legacy\nconst $a315ee31802fb757$export$d8ecdf8615bfea69 = {\n clone: $a315ee31802fb757$var$cloneUniforms,\n merge: $a315ee31802fb757$var$mergeUniforms\n};\nvar $a315ee31802fb757$var$default_vertex = \"void main() {\\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\nvar $a315ee31802fb757$var$default_fragment = \"void main() {\\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\nclass $a315ee31802fb757$export$83c7d75d550a8b0d extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isShaderMaterial = true;\n this.type = \"ShaderMaterial\";\n this.defines = {};\n this.uniforms = {};\n this.uniformsGroups = [];\n this.vertexShader = $a315ee31802fb757$var$default_vertex;\n this.fragmentShader = $a315ee31802fb757$var$default_fragment;\n this.linewidth = 1;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.fog = false; // set to use scene fog\n this.lights = false; // set to use scene lights\n this.clipping = false; // set to use user-defined clipping planes\n this.forceSinglePass = true;\n this.extensions = {\n derivatives: false,\n fragDepth: false,\n drawBuffers: false,\n shaderTextureLOD: false // set to use shader texture LOD\n };\n // When rendered geometry doesn't include these attributes but the material does,\n // use these default values in WebGL. This avoids errors when buffer data is missing.\n this.defaultAttributeValues = {\n \"color\": [\n 1,\n 1,\n 1\n ],\n \"uv\": [\n 0,\n 0\n ],\n \"uv1\": [\n 0,\n 0\n ]\n };\n this.index0AttributeName = undefined;\n this.uniformsNeedUpdate = false;\n this.glslVersion = null;\n if (parameters !== undefined) this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.fragmentShader = source.fragmentShader;\n this.vertexShader = source.vertexShader;\n this.uniforms = $a315ee31802fb757$var$cloneUniforms(source.uniforms);\n this.uniformsGroups = $a315ee31802fb757$var$cloneUniformsGroups(source.uniformsGroups);\n this.defines = Object.assign({}, source.defines);\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.fog = source.fog;\n this.lights = source.lights;\n this.clipping = source.clipping;\n this.extensions = Object.assign({}, source.extensions);\n this.glslVersion = source.glslVersion;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.glslVersion = this.glslVersion;\n data.uniforms = {};\n for(const name in this.uniforms){\n const uniform = this.uniforms[name];\n const value = uniform.value;\n if (value && value.isTexture) data.uniforms[name] = {\n type: \"t\",\n value: value.toJSON(meta).uuid\n };\n else if (value && value.isColor) data.uniforms[name] = {\n type: \"c\",\n value: value.getHex()\n };\n else if (value && value.isVector2) data.uniforms[name] = {\n type: \"v2\",\n value: value.toArray()\n };\n else if (value && value.isVector3) data.uniforms[name] = {\n type: \"v3\",\n value: value.toArray()\n };\n else if (value && value.isVector4) data.uniforms[name] = {\n type: \"v4\",\n value: value.toArray()\n };\n else if (value && value.isMatrix3) data.uniforms[name] = {\n type: \"m3\",\n value: value.toArray()\n };\n else if (value && value.isMatrix4) data.uniforms[name] = {\n type: \"m4\",\n value: value.toArray()\n };\n else data.uniforms[name] = {\n value: value\n };\n }\n if (Object.keys(this.defines).length > 0) data.defines = this.defines;\n data.vertexShader = this.vertexShader;\n data.fragmentShader = this.fragmentShader;\n data.lights = this.lights;\n data.clipping = this.clipping;\n const extensions = {};\n for(const key in this.extensions)if (this.extensions[key] === true) extensions[key] = true;\n if (Object.keys(extensions).length > 0) data.extensions = extensions;\n return data;\n }\n}\nclass $a315ee31802fb757$export$79f141de891a5fed extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isCamera = true;\n this.type = \"Camera\";\n this.matrixWorldInverse = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.projectionMatrix = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.projectionMatrixInverse = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.coordinateSystem = $a315ee31802fb757$export$5a0e9190d10875d3;\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.matrixWorldInverse.copy(source.matrixWorldInverse);\n this.projectionMatrix.copy(source.projectionMatrix);\n this.projectionMatrixInverse.copy(source.projectionMatrixInverse);\n this.coordinateSystem = source.coordinateSystem;\n return this;\n }\n getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n const e = this.matrixWorld.elements;\n return target.set(-e[8], -e[9], -e[10]).normalize();\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n updateWorldMatrix(updateParents, updateChildren) {\n super.updateWorldMatrix(updateParents, updateChildren);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $a315ee31802fb757$export$74e4ae24825f68d7 extends $a315ee31802fb757$export$79f141de891a5fed {\n constructor(fov = 50, aspect = 1, near = 0.1, far = 2000){\n super();\n this.isPerspectiveCamera = true;\n this.type = \"PerspectiveCamera\";\n this.fov = fov;\n this.zoom = 1;\n this.near = near;\n this.far = far;\n this.focus = 10;\n this.aspect = aspect;\n this.view = null;\n this.filmGauge = 35; // width of the film (default in millimeters)\n this.filmOffset = 0; // horizontal film offset (same unit as gauge)\n this.updateProjectionMatrix();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.fov = source.fov;\n this.zoom = source.zoom;\n this.near = source.near;\n this.far = source.far;\n this.focus = source.focus;\n this.aspect = source.aspect;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n this.filmGauge = source.filmGauge;\n this.filmOffset = source.filmOffset;\n return this;\n }\n /**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */ setFocalLength(focalLength) {\n /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n this.fov = $a315ee31802fb757$var$RAD2DEG * 2 * Math.atan(vExtentSlope);\n this.updateProjectionMatrix();\n }\n /**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */ getFocalLength() {\n const vExtentSlope = Math.tan($a315ee31802fb757$var$DEG2RAD * 0.5 * this.fov);\n return 0.5 * this.getFilmHeight() / vExtentSlope;\n }\n getEffectiveFOV() {\n return $a315ee31802fb757$var$RAD2DEG * 2 * Math.atan(Math.tan($a315ee31802fb757$var$DEG2RAD * 0.5 * this.fov) / this.zoom);\n }\n getFilmWidth() {\n // film not completely covered in portrait format (aspect < 1)\n return this.filmGauge * Math.min(this.aspect, 1);\n }\n getFilmHeight() {\n // film not completely covered in landscape format (aspect > 1)\n return this.filmGauge / Math.max(this.aspect, 1);\n }\n /**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */ setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n this.aspect = fullWidth / fullHeight;\n if (this.view === null) this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n clearViewOffset() {\n if (this.view !== null) this.view.enabled = false;\n this.updateProjectionMatrix();\n }\n updateProjectionMatrix() {\n const near = this.near;\n let top = near * Math.tan($a315ee31802fb757$var$DEG2RAD * 0.5 * this.fov) / this.zoom;\n let height = 2 * top;\n let width = this.aspect * height;\n let left = -0.5 * width;\n const view = this.view;\n if (this.view !== null && this.view.enabled) {\n const fullWidth = view.fullWidth, fullHeight = view.fullHeight;\n left += view.offsetX * width / fullWidth;\n top -= view.offsetY * height / fullHeight;\n width *= view.width / fullWidth;\n height *= view.height / fullHeight;\n }\n const skew = this.filmOffset;\n if (skew !== 0) left += near * skew / this.getFilmWidth();\n this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.fov = this.fov;\n data.object.zoom = this.zoom;\n data.object.near = this.near;\n data.object.far = this.far;\n data.object.focus = this.focus;\n data.object.aspect = this.aspect;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n data.object.filmGauge = this.filmGauge;\n data.object.filmOffset = this.filmOffset;\n return data;\n }\n}\nconst $a315ee31802fb757$var$fov = -90; // negative fov is not an error\nconst $a315ee31802fb757$var$aspect = 1;\nclass $a315ee31802fb757$export$d0cdd0bd804995de extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(near, far, renderTarget){\n super();\n this.type = \"CubeCamera\";\n this.renderTarget = renderTarget;\n this.coordinateSystem = null;\n const cameraPX = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraPX.layers = this.layers;\n this.add(cameraPX);\n const cameraNX = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraNX.layers = this.layers;\n this.add(cameraNX);\n const cameraPY = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraPY.layers = this.layers;\n this.add(cameraPY);\n const cameraNY = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraNY.layers = this.layers;\n this.add(cameraNY);\n const cameraPZ = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraPZ.layers = this.layers;\n this.add(cameraPZ);\n const cameraNZ = new $a315ee31802fb757$export$74e4ae24825f68d7($a315ee31802fb757$var$fov, $a315ee31802fb757$var$aspect, near, far);\n cameraNZ.layers = this.layers;\n this.add(cameraNZ);\n }\n updateCoordinateSystem() {\n const coordinateSystem = this.coordinateSystem;\n const cameras = this.children.concat();\n const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = cameras;\n for (const camera of cameras)this.remove(camera);\n if (coordinateSystem === $a315ee31802fb757$export$5a0e9190d10875d3) {\n cameraPX.up.set(0, 1, 0);\n cameraPX.lookAt(1, 0, 0);\n cameraNX.up.set(0, 1, 0);\n cameraNX.lookAt(-1, 0, 0);\n cameraPY.up.set(0, 0, -1);\n cameraPY.lookAt(0, 1, 0);\n cameraNY.up.set(0, 0, 1);\n cameraNY.lookAt(0, -1, 0);\n cameraPZ.up.set(0, 1, 0);\n cameraPZ.lookAt(0, 0, 1);\n cameraNZ.up.set(0, 1, 0);\n cameraNZ.lookAt(0, 0, -1);\n } else if (coordinateSystem === $a315ee31802fb757$export$cc83beedcb9be9ac) {\n cameraPX.up.set(0, -1, 0);\n cameraPX.lookAt(-1, 0, 0);\n cameraNX.up.set(0, -1, 0);\n cameraNX.lookAt(1, 0, 0);\n cameraPY.up.set(0, 0, 1);\n cameraPY.lookAt(0, 1, 0);\n cameraNY.up.set(0, 0, -1);\n cameraNY.lookAt(0, -1, 0);\n cameraPZ.up.set(0, -1, 0);\n cameraPZ.lookAt(0, 0, 1);\n cameraNZ.up.set(0, -1, 0);\n cameraNZ.lookAt(0, 0, -1);\n } else throw new Error(\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \" + coordinateSystem);\n for (const camera of cameras){\n this.add(camera);\n camera.updateMatrixWorld();\n }\n }\n update(renderer, scene) {\n if (this.parent === null) this.updateMatrixWorld();\n const renderTarget = this.renderTarget;\n if (this.coordinateSystem !== renderer.coordinateSystem) {\n this.coordinateSystem = renderer.coordinateSystem;\n this.updateCoordinateSystem();\n }\n const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children;\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n renderer.xr.enabled = false;\n const generateMipmaps = renderTarget.texture.generateMipmaps;\n renderTarget.texture.generateMipmaps = false;\n renderer.setRenderTarget(renderTarget, 0);\n renderer.render(scene, cameraPX);\n renderer.setRenderTarget(renderTarget, 1);\n renderer.render(scene, cameraNX);\n renderer.setRenderTarget(renderTarget, 2);\n renderer.render(scene, cameraPY);\n renderer.setRenderTarget(renderTarget, 3);\n renderer.render(scene, cameraNY);\n renderer.setRenderTarget(renderTarget, 4);\n renderer.render(scene, cameraPZ);\n renderTarget.texture.generateMipmaps = generateMipmaps;\n renderer.setRenderTarget(renderTarget, 5);\n renderer.render(scene, cameraNZ);\n renderer.setRenderTarget(currentRenderTarget);\n renderer.xr.enabled = currentXrEnabled;\n renderTarget.texture.needsPMREMUpdate = true;\n }\n}\nclass $a315ee31802fb757$export$ee2e5a18258a4049 extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1){\n images = images !== undefined ? images : [];\n mapping = mapping !== undefined ? mapping : $a315ee31802fb757$export$8759762a6477f2c4;\n super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isCubeTexture = true;\n this.flipY = false;\n }\n get images() {\n return this.image;\n }\n set images(value) {\n this.image = value;\n }\n}\nclass $a315ee31802fb757$export$ac386671d651941e extends $a315ee31802fb757$export$3c052beb2e51e23f {\n constructor(size = 1, options = {}){\n super(size, size, options);\n this.isWebGLCubeRenderTarget = true;\n const image = {\n width: size,\n height: size,\n depth: 1\n };\n const images = [\n image,\n image,\n image,\n image,\n image,\n image\n ];\n if (options.encoding !== undefined) {\n // @deprecated, r152\n $a315ee31802fb757$var$warnOnce(\"THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.\");\n options.colorSpace = options.encoding === $a315ee31802fb757$export$f32388edbb32674 ? $a315ee31802fb757$export$561f394b24edfcaa : $a315ee31802fb757$export$bfcb490c2dd3db51;\n }\n this.texture = new $a315ee31802fb757$export$ee2e5a18258a4049(images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace);\n // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n this.texture.isRenderTargetTexture = true;\n this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n }\n fromEquirectangularTexture(renderer, texture) {\n this.texture.type = texture.type;\n this.texture.colorSpace = texture.colorSpace;\n this.texture.generateMipmaps = texture.generateMipmaps;\n this.texture.minFilter = texture.minFilter;\n this.texture.magFilter = texture.magFilter;\n const shader = {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n fragmentShader: /* glsl */ `\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n };\n const geometry = new $a315ee31802fb757$export$33e43285f7406bd5(5, 5, 5);\n const material = new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"CubemapFromEquirect\",\n uniforms: $a315ee31802fb757$var$cloneUniforms(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n side: $a315ee31802fb757$export$d9f0486e75b5ace,\n blending: $a315ee31802fb757$export$63b8d6b580fc65ba\n });\n material.uniforms.tEquirect.value = texture;\n const mesh = new $a315ee31802fb757$export$e176487c05830cc5(geometry, material);\n const currentMinFilter = texture.minFilter;\n // Avoid blurred poles\n if (texture.minFilter === $a315ee31802fb757$export$5d8599b6a933fb1b) texture.minFilter = $a315ee31802fb757$export$8a72f490b25c56c8;\n const camera = new $a315ee31802fb757$export$d0cdd0bd804995de(1, 10, this);\n camera.update(renderer, mesh);\n texture.minFilter = currentMinFilter;\n mesh.geometry.dispose();\n mesh.material.dispose();\n return this;\n }\n clear(renderer, color, depth, stencil) {\n const currentRenderTarget = renderer.getRenderTarget();\n for(let i = 0; i < 6; i++){\n renderer.setRenderTarget(this, i);\n renderer.clear(color, depth, stencil);\n }\n renderer.setRenderTarget(currentRenderTarget);\n }\n}\nconst $a315ee31802fb757$var$_vector1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vector2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_normalMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918();\nclass $a315ee31802fb757$export$7ff5ac152ef991b0 {\n constructor(normal = new $a315ee31802fb757$export$64b5c384219d3699(1, 0, 0), constant = 0){\n this.isPlane = true;\n // normal is assumed to be normalized\n this.normal = normal;\n this.constant = constant;\n }\n set(normal, constant) {\n this.normal.copy(normal);\n this.constant = constant;\n return this;\n }\n setComponents(x, y, z, w) {\n this.normal.set(x, y, z);\n this.constant = w;\n return this;\n }\n setFromNormalAndCoplanarPoint(normal, point) {\n this.normal.copy(normal);\n this.constant = -point.dot(this.normal);\n return this;\n }\n setFromCoplanarPoints(a, b, c) {\n const normal = $a315ee31802fb757$var$_vector1.subVectors(c, b).cross($a315ee31802fb757$var$_vector2.subVectors(a, b)).normalize();\n // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n this.setFromNormalAndCoplanarPoint(normal, a);\n return this;\n }\n copy(plane) {\n this.normal.copy(plane.normal);\n this.constant = plane.constant;\n return this;\n }\n normalize() {\n // Note: will lead to a divide by zero if the plane is invalid.\n const inverseNormalLength = 1.0 / this.normal.length();\n this.normal.multiplyScalar(inverseNormalLength);\n this.constant *= inverseNormalLength;\n return this;\n }\n negate() {\n this.constant *= -1;\n this.normal.negate();\n return this;\n }\n distanceToPoint(point) {\n return this.normal.dot(point) + this.constant;\n }\n distanceToSphere(sphere) {\n return this.distanceToPoint(sphere.center) - sphere.radius;\n }\n projectPoint(point, target) {\n return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));\n }\n intersectLine(line, target) {\n const direction = line.delta($a315ee31802fb757$var$_vector1);\n const denominator = this.normal.dot(direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (this.distanceToPoint(line.start) === 0) return target.copy(line.start);\n // Unsure if this is the correct method to handle this case.\n return null;\n }\n const t = -(line.start.dot(this.normal) + this.constant) / denominator;\n if (t < 0 || t > 1) return null;\n return target.copy(line.start).addScaledVector(direction, t);\n }\n intersectsLine(line) {\n // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n const startSign = this.distanceToPoint(line.start);\n const endSign = this.distanceToPoint(line.end);\n return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;\n }\n intersectsBox(box) {\n return box.intersectsPlane(this);\n }\n intersectsSphere(sphere) {\n return sphere.intersectsPlane(this);\n }\n coplanarPoint(target) {\n return target.copy(this.normal).multiplyScalar(-this.constant);\n }\n applyMatrix4(matrix, optionalNormalMatrix) {\n const normalMatrix = optionalNormalMatrix || $a315ee31802fb757$var$_normalMatrix.getNormalMatrix(matrix);\n const referencePoint = this.coplanarPoint($a315ee31802fb757$var$_vector1).applyMatrix4(matrix);\n const normal = this.normal.applyMatrix3(normalMatrix).normalize();\n this.constant = -referencePoint.dot(normal);\n return this;\n }\n translate(offset) {\n this.constant -= offset.dot(this.normal);\n return this;\n }\n equals(plane) {\n return plane.normal.equals(this.normal) && plane.constant === this.constant;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $a315ee31802fb757$var$_sphere$4 = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nconst $a315ee31802fb757$var$_vector$6 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$35efe6f4c85463d2 {\n constructor(p0 = new $a315ee31802fb757$export$7ff5ac152ef991b0(), p1 = new $a315ee31802fb757$export$7ff5ac152ef991b0(), p2 = new $a315ee31802fb757$export$7ff5ac152ef991b0(), p3 = new $a315ee31802fb757$export$7ff5ac152ef991b0(), p4 = new $a315ee31802fb757$export$7ff5ac152ef991b0(), p5 = new $a315ee31802fb757$export$7ff5ac152ef991b0()){\n this.planes = [\n p0,\n p1,\n p2,\n p3,\n p4,\n p5\n ];\n }\n set(p0, p1, p2, p3, p4, p5) {\n const planes = this.planes;\n planes[0].copy(p0);\n planes[1].copy(p1);\n planes[2].copy(p2);\n planes[3].copy(p3);\n planes[4].copy(p4);\n planes[5].copy(p5);\n return this;\n }\n copy(frustum) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++)planes[i].copy(frustum.planes[i]);\n return this;\n }\n setFromProjectionMatrix(m, coordinateSystem = $a315ee31802fb757$export$5a0e9190d10875d3) {\n const planes = this.planes;\n const me = m.elements;\n const me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3];\n const me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7];\n const me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11];\n const me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15];\n planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize();\n planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize();\n planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize();\n planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize();\n planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize();\n if (coordinateSystem === $a315ee31802fb757$export$5a0e9190d10875d3) planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize();\n else if (coordinateSystem === $a315ee31802fb757$export$cc83beedcb9be9ac) planes[5].setComponents(me2, me6, me10, me14).normalize();\n else throw new Error(\"THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: \" + coordinateSystem);\n return this;\n }\n intersectsObject(object) {\n if (object.boundingSphere !== undefined) {\n if (object.boundingSphere === null) object.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$4.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);\n } else {\n const geometry = object.geometry;\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$4.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);\n }\n return this.intersectsSphere($a315ee31802fb757$var$_sphere$4);\n }\n intersectsSprite(sprite) {\n $a315ee31802fb757$var$_sphere$4.center.set(0, 0, 0);\n $a315ee31802fb757$var$_sphere$4.radius = 0.7071067811865476;\n $a315ee31802fb757$var$_sphere$4.applyMatrix4(sprite.matrixWorld);\n return this.intersectsSphere($a315ee31802fb757$var$_sphere$4);\n }\n intersectsSphere(sphere) {\n const planes = this.planes;\n const center = sphere.center;\n const negRadius = -sphere.radius;\n for(let i = 0; i < 6; i++){\n const distance = planes[i].distanceToPoint(center);\n if (distance < negRadius) return false;\n }\n return true;\n }\n intersectsBox(box) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++){\n const plane = planes[i];\n // corner at max distance\n $a315ee31802fb757$var$_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n $a315ee31802fb757$var$_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n $a315ee31802fb757$var$_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n if (plane.distanceToPoint($a315ee31802fb757$var$_vector$6) < 0) return false;\n }\n return true;\n }\n containsPoint(point) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++){\n if (planes[i].distanceToPoint(point) < 0) return false;\n }\n return true;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nfunction $a315ee31802fb757$var$WebGLAnimation() {\n let context = null;\n let isAnimating = false;\n let animationLoop = null;\n let requestId = null;\n function onAnimationFrame(time, frame) {\n animationLoop(time, frame);\n requestId = context.requestAnimationFrame(onAnimationFrame);\n }\n return {\n start: function() {\n if (isAnimating === true) return;\n if (animationLoop === null) return;\n requestId = context.requestAnimationFrame(onAnimationFrame);\n isAnimating = true;\n },\n stop: function() {\n context.cancelAnimationFrame(requestId);\n isAnimating = false;\n },\n setAnimationLoop: function(callback) {\n animationLoop = callback;\n },\n setContext: function(value) {\n context = value;\n }\n };\n}\nfunction $a315ee31802fb757$var$WebGLAttributes(gl, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n const buffers = new WeakMap();\n function createBuffer(attribute, bufferType) {\n const array = attribute.array;\n const usage = attribute.usage;\n const buffer = gl.createBuffer();\n gl.bindBuffer(bufferType, buffer);\n gl.bufferData(bufferType, array, usage);\n attribute.onUploadCallback();\n let type;\n if (array instanceof Float32Array) type = gl.FLOAT;\n else if (array instanceof Uint16Array) {\n if (attribute.isFloat16BufferAttribute) {\n if (isWebGL2) type = gl.HALF_FLOAT;\n else throw new Error(\"THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.\");\n } else type = gl.UNSIGNED_SHORT;\n } else if (array instanceof Int16Array) type = gl.SHORT;\n else if (array instanceof Uint32Array) type = gl.UNSIGNED_INT;\n else if (array instanceof Int32Array) type = gl.INT;\n else if (array instanceof Int8Array) type = gl.BYTE;\n else if (array instanceof Uint8Array) type = gl.UNSIGNED_BYTE;\n else if (array instanceof Uint8ClampedArray) type = gl.UNSIGNED_BYTE;\n else throw new Error(\"THREE.WebGLAttributes: Unsupported buffer data format: \" + array);\n return {\n buffer: buffer,\n type: type,\n bytesPerElement: array.BYTES_PER_ELEMENT,\n version: attribute.version\n };\n }\n function updateBuffer(buffer, attribute, bufferType) {\n const array = attribute.array;\n const updateRange = attribute.updateRange;\n gl.bindBuffer(bufferType, buffer);\n if (updateRange.count === -1) // Not using update ranges\n gl.bufferSubData(bufferType, 0, array);\n else {\n if (isWebGL2) gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array, updateRange.offset, updateRange.count);\n else gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count));\n updateRange.count = -1; // reset range\n }\n attribute.onUploadCallback();\n }\n //\n function get(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n return buffers.get(attribute);\n }\n function remove(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n const data = buffers.get(attribute);\n if (data) {\n gl.deleteBuffer(data.buffer);\n buffers.delete(attribute);\n }\n }\n function update(attribute, bufferType) {\n if (attribute.isGLBufferAttribute) {\n const cached = buffers.get(attribute);\n if (!cached || cached.version < attribute.version) buffers.set(attribute, {\n buffer: attribute.buffer,\n type: attribute.type,\n bytesPerElement: attribute.elementSize,\n version: attribute.version\n });\n return;\n }\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n const data = buffers.get(attribute);\n if (data === undefined) buffers.set(attribute, createBuffer(attribute, bufferType));\n else if (data.version < attribute.version) {\n updateBuffer(data.buffer, attribute, bufferType);\n data.version = attribute.version;\n }\n }\n return {\n get: get,\n remove: remove,\n update: update\n };\n}\nclass $a315ee31802fb757$export$967d831af31f69ce extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1){\n super();\n this.type = \"PlaneGeometry\";\n this.parameters = {\n width: width,\n height: height,\n widthSegments: widthSegments,\n heightSegments: heightSegments\n };\n const width_half = width / 2;\n const height_half = height / 2;\n const gridX = Math.floor(widthSegments);\n const gridY = Math.floor(heightSegments);\n const gridX1 = gridX + 1;\n const gridY1 = gridY + 1;\n const segment_width = width / gridX;\n const segment_height = height / gridY;\n //\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n for(let iy = 0; iy < gridY1; iy++){\n const y = iy * segment_height - height_half;\n for(let ix = 0; ix < gridX1; ix++){\n const x = ix * segment_width - width_half;\n vertices.push(x, -y, 0);\n normals.push(0, 0, 1);\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n }\n }\n for(let iy = 0; iy < gridY; iy++)for(let ix = 0; ix < gridX; ix++){\n const a = ix + gridX1 * iy;\n const b = ix + gridX1 * (iy + 1);\n const c = ix + 1 + gridX1 * (iy + 1);\n const d = ix + 1 + gridX1 * iy;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$967d831af31f69ce(data.width, data.height, data.widthSegments, data.heightSegments);\n }\n}\nvar $a315ee31802fb757$var$alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\nvar $a315ee31802fb757$var$alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\tconst float ALPHA_HASH_SCALE = 0.05;\\n\tfloat hash2D( vec2 value ) {\\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\t}\\n\tfloat hash3D( vec3 value ) {\\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\t}\\n\tfloat getAlphaHashThreshold( vec3 position ) {\\n\t\tfloat maxDeriv = max(\\n\t\t\tlength( dFdx( position.xyz ) ),\\n\t\t\tlength( dFdy( position.xyz ) )\\n\t\t);\\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\t\tvec2 pixScales = vec2(\\n\t\t\texp2( floor( log2( pixScale ) ) ),\\n\t\t\texp2( ceil( log2( pixScale ) ) )\\n\t\t);\\n\t\tvec2 alpha = vec2(\\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\\n\t\t);\\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\t\tvec3 cases = vec3(\\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\t\t);\\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\\n\t\t\t: cases.z;\\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\nvar $a315ee31802fb757$var$alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\tuniform sampler2D alphaMap;\\n#endif\";\nvar $a315ee31802fb757$var$alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\nvar $a315ee31802fb757$var$alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\tuniform float alphaTest;\\n#endif\";\nvar $a315ee31802fb757$var$aomap_fragment = \"#ifdef USE_AOMAP\\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\tuniform sampler2D aoMap;\\n\tuniform float aoMapIntensity;\\n#endif\";\nvar $a315ee31802fb757$var$begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\tvPosition = vec3( position );\\n#endif\";\nvar $a315ee31802fb757$var$beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\nvar $a315ee31802fb757$var$bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\tfloat G = G_BlinnPhong_Implicit( );\\n\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\treturn F * ( G * D );\\n} // validated\";\nvar $a315ee31802fb757$var$iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\tconst mat3 XYZ_TO_REC709 = mat3(\\n\t\t 3.2404542, -0.9692660, 0.0556434,\\n\t\t-1.5371385, 1.8760108, -0.2040259,\\n\t\t-0.4985314, 0.0415560, 1.0572252\\n\t);\\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\t}\\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\t}\\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\t}\\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\t\txyz /= 1.0685e-7;\\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\t\treturn rgb;\\n\t}\\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\t\tvec3 I;\\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\t\tif ( cosTheta2Sq < 0.0 ) {\\n\t\t\treturn vec3( 1.0 );\\n\t\t}\\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\t\tfloat T121 = 1.0 - R12;\\n\t\tfloat phi12 = 0.0;\\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\t\tfloat phi21 = PI - phi12;\\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\t\tvec3 phi23 = vec3( 0.0 );\\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\t\tvec3 phi = vec3( phi21 ) + phi23;\\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\t\tvec3 r123 = sqrt( R123 );\\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\t\tvec3 C0 = R12 + Rs;\\n\t\tI = C0;\\n\t\tvec3 Cm = Rs - T121;\\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\\n\t\t\tCm *= r123;\\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\t\t\tI += Cm * Sm;\\n\t\t}\\n\t\treturn max( I, vec3( 0.0 ) );\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\tuniform sampler2D bumpMap;\\n\tuniform float bumpScale;\\n\tvec2 dHdxy_fwd() {\\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\t\treturn vec2( dBx, dBy );\\n\t}\\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\\n\t\tvec3 vN = surf_norm;\\n\t\tvec3 R1 = cross( vSigmaY, vN );\\n\t\tvec3 R2 = cross( vN, vSigmaX );\\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\tvarying vec3 vClipPosition;\\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\nvar $a315ee31802fb757$var$clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\tvarying vec3 vClipPosition;\\n#endif\";\nvar $a315ee31802fb757$var$clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\tvClipPosition = - mvPosition.xyz;\\n#endif\";\nvar $a315ee31802fb757$var$color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\tdiffuseColor.rgb *= vColor;\\n#endif\";\nvar $a315ee31802fb757$var$color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\tvarying vec3 vColor;\\n#endif\";\nvar $a315ee31802fb757$var$color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\tvarying vec3 vColor;\\n#endif\";\nvar $a315ee31802fb757$var$color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\nvar $a315ee31802fb757$var$common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\tfloat precisionSafeLength( vec3 v ) {\\n\t\tfloat maxComponent = max3( abs( v ) );\\n\t\treturn length( v / maxComponent ) * maxComponent;\\n\t}\\n#endif\\nstruct IncidentLight {\\n\tvec3 color;\\n\tvec3 direction;\\n\tbool visible;\\n};\\nstruct ReflectedLight {\\n\tvec3 directDiffuse;\\n\tvec3 directSpecular;\\n\tvec3 indirectDiffuse;\\n\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\tvec3 position;\\n\tvec3 normal;\\n\tvec3 viewDir;\\n#ifdef USE_CLEARCOAT\\n\tvec3 clearcoatNormal;\\n#endif\\n};\\n#ifdef USE_ALPHAHASH\\n\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\tmat3 tmp;\\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\nvar $a315ee31802fb757$var$cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\t#define cubeUV_minMipLevel 4.0\\n\t#define cubeUV_minTileSize 16.0\\n\tfloat getFace( vec3 direction ) {\\n\t\tvec3 absDirection = abs( direction );\\n\t\tfloat face = - 1.0;\\n\t\tif ( absDirection.x > absDirection.z ) {\\n\t\t\tif ( absDirection.x > absDirection.y )\\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\t\t\telse\\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\t\t} else {\\n\t\t\tif ( absDirection.z > absDirection.y )\\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\t\t\telse\\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\t\t}\\n\t\treturn face;\\n\t}\\n\tvec2 getUV( vec3 direction, float face ) {\\n\t\tvec2 uv;\\n\t\tif ( face == 0.0 ) {\\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\t\t} else if ( face == 1.0 ) {\\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\t\t} else if ( face == 2.0 ) {\\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\t\t} else if ( face == 3.0 ) {\\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\t\t} else if ( face == 4.0 ) {\\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\t\t} else {\\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\t\t}\\n\t\treturn 0.5 * ( uv + 1.0 );\\n\t}\\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\t\tfloat face = getFace( direction );\\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\t\tfloat faceSize = exp2( mipInt );\\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\t\tif ( face > 2.0 ) {\\n\t\t\tuv.y += faceSize;\\n\t\t\tface -= 3.0;\\n\t\t}\\n\t\tuv.x += face * faceSize;\\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\t\t#ifdef texture2DGradEXT\\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\t\t#else\\n\t\t\treturn texture2D( envMap, uv ).rgb;\\n\t\t#endif\\n\t}\\n\t#define cubeUV_r0 1.0\\n\t#define cubeUV_v0 0.339\\n\t#define cubeUV_m0 - 2.0\\n\t#define cubeUV_r1 0.8\\n\t#define cubeUV_v1 0.276\\n\t#define cubeUV_m1 - 1.0\\n\t#define cubeUV_r4 0.4\\n\t#define cubeUV_v4 0.046\\n\t#define cubeUV_m4 2.0\\n\t#define cubeUV_r5 0.305\\n\t#define cubeUV_v5 0.016\\n\t#define cubeUV_m5 3.0\\n\t#define cubeUV_r6 0.21\\n\t#define cubeUV_v6 0.0038\\n\t#define cubeUV_m6 4.0\\n\tfloat roughnessToMip( float roughness ) {\\n\t\tfloat mip = 0.0;\\n\t\tif ( roughness >= cubeUV_r1 ) {\\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\t\t} else if ( roughness >= cubeUV_r4 ) {\\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\t\t} else if ( roughness >= cubeUV_r5 ) {\\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\t\t} else if ( roughness >= cubeUV_r6 ) {\\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\t\t} else {\\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\\n\t\treturn mip;\\n\t}\\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\t\tfloat mipF = fract( mip );\\n\t\tfloat mipInt = floor( mip );\\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\t\tif ( mipF == 0.0 ) {\\n\t\t\treturn vec4( color0, 1.0 );\\n\t\t} else {\\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\t\t}\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\tuniform sampler2D displacementMap;\\n\tuniform float displacementScale;\\n\tuniform float displacementBias;\\n#endif\";\nvar $a315ee31802fb757$var$displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\nvar $a315ee31802fb757$var$emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\nvar $a315ee31802fb757$var$emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\tuniform sampler2D emissiveMap;\\n#endif\";\nvar $a315ee31802fb757$var$colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\nvar $a315ee31802fb757$var$colorspace_pars_fragment = \"vec4 LinearToLinear( in vec4 value ) {\\n\treturn value;\\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}\";\nvar $a315ee31802fb757$var$envmap_fragment = \"#ifdef USE_ENVMAP\\n\t#ifdef ENV_WORLDPOS\\n\t\tvec3 cameraToFrag;\\n\t\tif ( isOrthographic ) {\\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\t\t} else {\\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\t\t}\\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\t\t#ifdef ENVMAP_MODE_REFLECTION\\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\t\t#else\\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\t\t#endif\\n\t#else\\n\t\tvec3 reflectVec = vReflect;\\n\t#endif\\n\t#ifdef ENVMAP_TYPE_CUBE\\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\t#else\\n\t\tvec4 envColor = vec4( 0.0 );\\n\t#endif\\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\t#elif defined( ENVMAP_BLENDING_MIX )\\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\t#elif defined( ENVMAP_BLENDING_ADD )\\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\tuniform float envMapIntensity;\\n\tuniform float flipEnvMap;\\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\";\nvar $a315ee31802fb757$var$envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\tuniform float reflectivity;\\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\nvar $a315ee31802fb757$var$envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$fog_vertex = \"#ifdef USE_FOG\\n\tvFogDepth = - mvPosition.z;\\n#endif\";\nvar $a315ee31802fb757$var$fog_pars_vertex = \"#ifdef USE_FOG\\n\tvarying float vFogDepth;\\n#endif\";\nvar $a315ee31802fb757$var$fog_fragment = \"#ifdef USE_FOG\\n\t#ifdef FOG_EXP2\\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\t#else\\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\t#endif\\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\nvar $a315ee31802fb757$var$fog_pars_fragment = \"#ifdef USE_FOG\\n\tuniform vec3 fogColor;\\n\tvarying float vFogDepth;\\n\t#ifdef FOG_EXP2\\n\t\tuniform float fogDensity;\\n\t#else\\n\t\tuniform float fogNear;\\n\t\tuniform float fogFar;\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$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 vec3( texture2D( gradientMap, coord ).r );\\n\t#else\\n\t\tvec2 fw = fwidth( coord ) * 0.5;\\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\t#endif\\n}\";\nvar $a315ee31802fb757$var$lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\nvar $a315ee31802fb757$var$lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\tuniform sampler2D lightMap;\\n\tuniform float lightMapIntensity;\\n#endif\";\nvar $a315ee31802fb757$var$lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\nvar $a315ee31802fb757$var$lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\tvec3 diffuseColor;\\n\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\";\nvar $a315ee31802fb757$var$lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\tvec3 irradiance = ambientLightColor;\\n\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\t#if defined ( LEGACY_LIGHTS )\\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\t\t}\\n\t\treturn 1.0;\\n\t#else\\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\t\tif ( cutoffDistance > 0.0 ) {\\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\t\t}\\n\t\treturn distanceFalloff;\\n\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\tstruct DirectionalLight {\\n\t\tvec3 direction;\\n\t\tvec3 color;\\n\t};\\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tlight.color = directionalLight.color;\\n\t\tlight.direction = directionalLight.direction;\\n\t\tlight.visible = true;\\n\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\tstruct PointLight {\\n\t\tvec3 position;\\n\t\tvec3 color;\\n\t\tfloat distance;\\n\t\tfloat decay;\\n\t};\\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tvec3 lVector = pointLight.position - geometry.position;\\n\t\tlight.direction = normalize( lVector );\\n\t\tfloat lightDistance = length( lVector );\\n\t\tlight.color = pointLight.color;\\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\tstruct SpotLight {\\n\t\tvec3 position;\\n\t\tvec3 direction;\\n\t\tvec3 color;\\n\t\tfloat distance;\\n\t\tfloat decay;\\n\t\tfloat coneCos;\\n\t\tfloat penumbraCos;\\n\t};\\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tvec3 lVector = spotLight.position - geometry.position;\\n\t\tlight.direction = normalize( lVector );\\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\t\tif ( spotAttenuation > 0.0 ) {\\n\t\t\tfloat lightDistance = length( lVector );\\n\t\t\tlight.color = spotLight.color * spotAttenuation;\\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\t\t} else {\\n\t\t\tlight.color = vec3( 0.0 );\\n\t\t\tlight.visible = false;\\n\t\t}\\n\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\tstruct RectAreaLight {\\n\t\tvec3 color;\\n\t\tvec3 position;\\n\t\tvec3 halfWidth;\\n\t\tvec3 halfHeight;\\n\t};\\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\tstruct HemisphereLight {\\n\t\tvec3 direction;\\n\t\tvec3 skyColor;\\n\t\tvec3 groundColor;\\n\t};\\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\t\treturn irradiance;\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\\n\t\t#else\\n\t\t\treturn vec3( 0.0 );\\n\t\t#endif\\n\t}\\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\t\t\treturn envMapColor.rgb * envMapIntensity;\\n\t\t#else\\n\t\t\treturn vec3( 0.0 );\\n\t\t#endif\\n\t}\\n\t#ifdef USE_ANISOTROPY\\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\t\t\t#else\\n\t\t\t\treturn vec3( 0.0 );\\n\t\t\t#endif\\n\t\t}\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\nvar $a315ee31802fb757$var$lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\";\nvar $a315ee31802fb757$var$lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\nvar $a315ee31802fb757$var$lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\tvec3 diffuseColor;\\n\tvec3 specularColor;\\n\tfloat specularShininess;\\n\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\";\nvar $a315ee31802fb757$var$lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\tmaterial.ior = ior;\\n\t#ifdef USE_SPECULAR\\n\t\tfloat specularIntensityFactor = specularIntensity;\\n\t\tvec3 specularColorFactor = specularColor;\\n\t\t#ifdef USE_SPECULAR_COLORMAP\\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\t\t#endif\\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\t\t#endif\\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\t#else\\n\t\tfloat specularIntensityFactor = 1.0;\\n\t\tvec3 specularColorFactor = vec3( 1.0 );\\n\t\tmaterial.specularF90 = 1.0;\\n\t#endif\\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tmaterial.clearcoat = clearcoat;\\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\tmaterial.clearcoatF90 = 1.0;\\n\t#ifdef USE_CLEARCOATMAP\\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\t#endif\\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_IRIDESCENCE\\n\tmaterial.iridescence = iridescence;\\n\tmaterial.iridescenceIOR = iridescenceIOR;\\n\t#ifdef USE_IRIDESCENCEMAP\\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\t#endif\\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\t#else\\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\tmaterial.sheenColor = sheenColor;\\n\t#ifdef USE_SHEEN_COLORMAP\\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\t#endif\\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\t#ifdef USE_ANISOTROPYMAP\\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\t#else\\n\t\tvec2 anisotropyV = anisotropyVector;\\n\t#endif\\n\tmaterial.anisotropy = length( anisotropyV );\\n\tanisotropyV /= material.anisotropy;\\n\tmaterial.anisotropy = saturate( material.anisotropy );\\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\\n#endif\";\nvar $a315ee31802fb757$var$lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\tvec3 diffuseColor;\\n\tfloat roughness;\\n\tvec3 specularColor;\\n\tfloat specularF90;\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat clearcoat;\\n\t\tfloat clearcoatRoughness;\\n\t\tvec3 clearcoatF0;\\n\t\tfloat clearcoatF90;\\n\t#endif\\n\t#ifdef USE_IRIDESCENCE\\n\t\tfloat iridescence;\\n\t\tfloat iridescenceIOR;\\n\t\tfloat iridescenceThickness;\\n\t\tvec3 iridescenceFresnel;\\n\t\tvec3 iridescenceF0;\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tvec3 sheenColor;\\n\t\tfloat sheenRoughness;\\n\t#endif\\n\t#ifdef IOR\\n\t\tfloat ior;\\n\t#endif\\n\t#ifdef USE_TRANSMISSION\\n\t\tfloat transmission;\\n\t\tfloat transmissionAlpha;\\n\t\tfloat thickness;\\n\t\tfloat attenuationDistance;\\n\t\tvec3 attenuationColor;\\n\t#endif\\n\t#ifdef USE_ANISOTROPY\\n\t\tfloat anisotropy;\\n\t\tfloat alphaT;\\n\t\tvec3 anisotropyT;\\n\t\tvec3 anisotropyB;\\n\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec3 sheenSpecular = vec3( 0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\tfloat a2 = pow2( alpha );\\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\tfloat a2 = pow2( alpha );\\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\t\tfloat v = 0.5 / ( gv + gl );\\n\t\treturn saturate(v);\\n\t}\\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\t\tfloat a2 = alphaT * alphaB;\\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\t\thighp float v2 = dot( v, v );\\n\t\tfloat w2 = a2 / v2;\\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\t\tvec3 f0 = material.clearcoatF0;\\n\t\tfloat f90 = material.clearcoatF90;\\n\t\tfloat roughness = material.clearcoatRoughness;\\n\t\tfloat alpha = pow2( roughness );\\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\t\tfloat D = D_GGX( alpha, dotNH );\\n\t\treturn F * ( V * D );\\n\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\tvec3 f0 = material.specularColor;\\n\tfloat f90 = material.specularF90;\\n\tfloat roughness = material.roughness;\\n\tfloat alpha = pow2( roughness );\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\t#ifdef USE_IRIDESCENCE\\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\t#endif\\n\t#ifdef USE_ANISOTROPY\\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\t#else\\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\t\tfloat D = D_GGX( alpha, dotNH );\\n\t#endif\\n\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\tconst float LUT_SIZE = 64.0;\\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\tfloat dotNV = saturate( dot( N, V ) );\\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\tfloat l = length( f );\\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\tfloat x = dot( v1, v2 );\\n\tfloat y = abs( x );\\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\tfloat v = a / b;\\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\tvec3 lightNormal = cross( v1, v2 );\\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\tvec3 T1, T2;\\n\tT1 = normalize( V - N * dot( V, N ) );\\n\tT2 = - cross( N, T1 );\\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\tvec3 coords[ 4 ];\\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\tvec3 vectorFormFactor = vec3( 0.0 );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\tfloat alpha = pow2( roughness );\\n\tfloat invAlpha = 1.0 / alpha;\\n\tfloat cos2h = dotNH * dotNH;\\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\tfloat V = V_Neubelt( dotNV, dotNL );\\n\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat r2 = roughness * roughness;\\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\tvec4 r = roughness * c0 + c1;\\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\t#ifdef USE_IRIDESCENCE\\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\t#else\\n\t\tvec3 Fr = specularColor;\\n\t#endif\\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\tfloat Ess = fab.x + fab.y;\\n\tfloat Ems = 1.0 - Ess;\\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\tsingleScatter += FssEss;\\n\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\t\tvec3 normal = geometry.normal;\\n\t\tvec3 viewDir = geometry.viewDir;\\n\t\tvec3 position = geometry.position;\\n\t\tvec3 lightPos = rectAreaLight.position;\\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\t\tvec3 lightColor = rectAreaLight.color;\\n\t\tfloat roughness = material.roughness;\\n\t\tvec3 rectCoords[ 4 ];\\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\t\tvec4 t1 = texture2D( ltc_1, uv );\\n\t\tvec4 t2 = texture2D( ltc_2, uv );\\n\t\tmat3 mInv = mat3(\\n\t\t\tvec3( t1.x, 0, t1.y ),\\n\t\t\tvec3( 0, 1, 0 ),\\n\t\t\tvec3( t1.z, 0, t1.w )\\n\t\t);\\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\t#endif\\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\t#ifdef USE_CLEARCOAT\\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\\n\t#endif\\n\tvec3 singleScattering = vec3( 0.0 );\\n\tvec3 multiScattering = vec3( 0.0 );\\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\t#ifdef USE_IRIDESCENCE\\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\t#else\\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\t#endif\\n\tvec3 totalScattering = singleScattering + multiScattering;\\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Physical\\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\nvar $a315ee31802fb757$var$lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\\n\tif ( material.iridescenceThickness == 0.0 ) {\\n\t\tmaterial.iridescence = 0.0;\\n\t} else {\\n\t\tmaterial.iridescence = saturate( material.iridescence );\\n\t}\\n\tif ( material.iridescence > 0.0 ) {\\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\tPointLight pointLight;\\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\tPointLightShadow pointLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\t\tpointLight = pointLights[ i ];\\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\t\tpointLightShadow = pointLightShadows[ i ];\\n\t\tdirectLight.color *= ( 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\tvec4 spotColor;\\n\tvec3 spotLightCoord;\\n\tbool inSpotLightMap;\\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\tSpotLightShadow spotLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\t\tspotLight = spotLights[ i ];\\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\t\t#else\\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\t\t#endif\\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\t\t#endif\\n\t\t#undef SPOT_LIGHT_MAP_INDEX\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\tspotLightShadow = spotLightShadows[ i ];\\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\t\t#endif\\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\tDirectionalLight directionalLight;\\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\tDirectionalLightShadow directionalLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\t\tdirectionalLight = directionalLights[ i ];\\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\t\t#endif\\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\tRectAreaLight rectAreaLight;\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\t\trectAreaLight = rectAreaLights[ i ];\\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\tvec3 iblIrradiance = vec3( 0.0 );\\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\tvec3 radiance = vec3( 0.0 );\\n\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\nvar $a315ee31802fb757$var$lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\t#ifdef USE_LIGHTMAP\\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\t\tirradiance += lightMapIrradiance;\\n\t#endif\\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\t#ifdef USE_ANISOTROPY\\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\\n\t#else\\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\t#endif\\n\t#ifdef USE_CLEARCOAT\\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$map_fragment = \"#ifdef USE_MAP\\n\tdiffuseColor *= texture2D( map, vMapUv );\\n#endif\";\nvar $a315ee31802fb757$var$map_pars_fragment = \"#ifdef USE_MAP\\n\tuniform sampler2D map;\\n#endif\";\nvar $a315ee31802fb757$var$map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\t#if defined( USE_POINTS_UV )\\n\t\tvec2 uv = vUv;\\n\t#else\\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\t#endif\\n#endif\\n#ifdef USE_MAP\\n\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\nvar $a315ee31802fb757$var$map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\tvarying vec2 vUv;\\n#else\\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\t\tuniform mat3 uvTransform;\\n\t#endif\\n#endif\\n#ifdef USE_MAP\\n\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tuniform sampler2D alphaMap;\\n#endif\";\nvar $a315ee31802fb757$var$metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\nvar $a315ee31802fb757$var$metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\tuniform sampler2D metalnessMap;\\n#endif\";\nvar $a315ee31802fb757$var$morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\tvColor *= morphTargetBaseInfluence;\\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t#if defined( USE_COLOR_ALPHA )\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\t\t#elif defined( USE_COLOR )\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\t\t#endif\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\tobjectNormal *= morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\t\t}\\n\t#else\\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\tuniform float morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\t\tuniform sampler2DArray morphTargetsTexture;\\n\t\tuniform ivec2 morphTargetsTextureSize;\\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\t\t}\\n\t#else\\n\t\t#ifndef USE_MORPHNORMALS\\n\t\t\tuniform float morphTargetInfluences[ 8 ];\\n\t\t#else\\n\t\t\tuniform float morphTargetInfluences[ 4 ];\\n\t\t#endif\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\ttransformed *= morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\t\t}\\n\t#else\\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\t\t#ifndef USE_MORPHNORMALS\\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\t\t#endif\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\tvec3 fdx = dFdx( vViewPosition );\\n\tvec3 fdy = dFdy( vViewPosition );\\n\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\tvec3 normal = normalize( vNormal );\\n\t#ifdef DOUBLE_SIDED\\n\t\tnormal *= faceDirection;\\n\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\t#ifdef USE_TANGENT\\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\t#else\\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\t\t#if defined( USE_NORMALMAP )\\n\t\t\tvNormalMapUv\\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\t\t\tvClearcoatNormalMapUv\\n\t\t#else\\n\t\t\tvUv\\n\t\t#endif\\n\t\t);\\n\t#endif\\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\t\ttbn[0] *= faceDirection;\\n\t\ttbn[1] *= faceDirection;\\n\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\t#ifdef USE_TANGENT\\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\t#else\\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\t#endif\\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\t\ttbn2[0] *= faceDirection;\\n\t\ttbn2[1] *= faceDirection;\\n\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\nvar $a315ee31802fb757$var$normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\t#ifdef FLIP_SIDED\\n\t\tnormal = - normal;\\n\t#endif\\n\t#ifdef DOUBLE_SIDED\\n\t\tnormal = normal * faceDirection;\\n\t#endif\\n\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\tmapN.xy *= normalScale;\\n\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\nvar $a315ee31802fb757$var$normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n\t#ifdef USE_TANGENT\\n\t\tvarying vec3 vTangent;\\n\t\tvarying vec3 vBitangent;\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n\t#ifdef USE_TANGENT\\n\t\tvarying vec3 vTangent;\\n\t\tvarying vec3 vBitangent;\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$normal_vertex = \"#ifndef FLAT_SHADED\\n\tvNormal = normalize( transformedNormal );\\n\t#ifdef USE_TANGENT\\n\t\tvTangent = normalize( transformedTangent );\\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\tuniform sampler2D normalMap;\\n\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\\n\t\tvec2 st0 = dFdx( uv.st );\\n\t\tvec2 st1 = dFdy( uv.st );\\n\t\tvec3 N = surf_norm;\\n\t\tvec3 q1perp = cross( q1, N );\\n\t\tvec3 q0perp = cross( N, q0 );\\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\t\treturn mat3( T * scale, B * scale, N );\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\nvar $a315ee31802fb757$var$clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\nvar $a315ee31802fb757$var$clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tuniform sampler2D clearcoatNormalMap;\\n\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\nvar $a315ee31802fb757$var$iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\nvar $a315ee31802fb757$var$opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\nvar $a315ee31802fb757$var$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}\\nvec2 packDepthToRG( in highp float v ) {\\n\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\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 depth, const in float near, const in float far ) {\\n\treturn depth * ( 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 depth, const in float near, const in float far ) {\\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\nvar $a315ee31802fb757$var$premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\nvar $a315ee31802fb757$var$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;\";\nvar $a315ee31802fb757$var$dithering_fragment = \"#ifdef DITHERING\\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\troughnessFactor *= texelRoughness.g;\\n#endif\";\nvar $a315ee31802fb757$var$roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\tuniform sampler2D roughnessMap;\\n#endif\";\nvar $a315ee31802fb757$var$shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tstruct DirectionalLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t\tstruct SpotLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tstruct PointLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t\tfloat shadowCameraNear;\\n\t\t\tfloat shadowCameraFar;\\n\t\t};\\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\t#endif\\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\t}\\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\t}\\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\t\tfloat occlusion = 1.0;\\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\t\tfloat hard_shadow = step( compare , distribution.x );\\n\t\tif (hard_shadow != 1.0 ) {\\n\t\t\tfloat distance = compare - distribution.x ;\\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\t\t}\\n\t\treturn occlusion;\\n\t}\\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\t\tfloat shadow = 1.0;\\n\t\tshadowCoord.xyz /= shadowCoord.w;\\n\t\tshadowCoord.z += shadowBias;\\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\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\";\nvar $a315ee31802fb757$var$shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tstruct DirectionalLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\t\tstruct SpotLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tstruct PointLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t\tfloat shadowCameraNear;\\n\t\t\tfloat shadowCameraFar;\\n\t\t};\\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\t#endif\\n#endif\";\nvar $a315ee31802fb757$var$shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\t\tshadowWorldPosition = worldPosition;\\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\t\t#endif\\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\";\nvar $a315ee31802fb757$var$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, vSpotLightCoord[ 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}\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\tuniform mat4 bindMatrix;\\n\tuniform mat4 bindMatrixInverse;\\n\tuniform highp sampler2D boneTexture;\\n\tuniform int boneTextureSize;\\n\tmat4 getBoneMatrix( const in float i ) {\\n\t\tfloat j = i * 4.0;\\n\t\tfloat x = mod( j, float( boneTextureSize ) );\\n\t\tfloat y = floor( j / float( boneTextureSize ) );\\n\t\tfloat dx = 1.0 / float( boneTextureSize );\\n\t\tfloat dy = 1.0 / float( boneTextureSize );\\n\t\ty = dy * ( y + 0.5 );\\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\t\treturn bone;\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$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\";\nvar $a315ee31802fb757$var$specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\tspecularStrength = texelSpecular.r;\\n#else\\n\tspecularStrength = 1.0;\\n#endif\";\nvar $a315ee31802fb757$var$specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\tuniform sampler2D specularMap;\\n#endif\";\nvar $a315ee31802fb757$var$tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\nvar $a315ee31802fb757$var$tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\tcolor *= toneMappingExposure;\\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\tcolor *= toneMappingExposure;\\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\tconst mat3 ACESInputMat = mat3(\\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\\n\t);\\n\tconst mat3 ACESOutputMat = mat3(\\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\\n\t);\\n\tcolor *= toneMappingExposure / 0.6;\\n\tcolor = ACESInputMat * color;\\n\tcolor = RRTAndODTFit( color );\\n\tcolor = ACESOutputMat * color;\\n\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\nvar $a315ee31802fb757$var$transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\tmaterial.transmission = transmission;\\n\tmaterial.transmissionAlpha = 1.0;\\n\tmaterial.thickness = thickness;\\n\tmaterial.attenuationDistance = attenuationDistance;\\n\tmaterial.attenuationColor = attenuationColor;\\n\t#ifdef USE_TRANSMISSIONMAP\\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\t#endif\\n\t#ifdef USE_THICKNESSMAP\\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\t#endif\\n\tvec3 pos = vWorldPosition;\\n\tvec3 v = normalize( cameraPosition - pos );\\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\tvec4 transmitted = getIBLVolumeRefraction(\\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\t\tmaterial.attenuationColor, material.attenuationDistance );\\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\nvar $a315ee31802fb757$var$transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\tuniform float transmission;\\n\tuniform float thickness;\\n\tuniform float attenuationDistance;\\n\tuniform vec3 attenuationColor;\\n\t#ifdef USE_TRANSMISSIONMAP\\n\t\tuniform sampler2D transmissionMap;\\n\t#endif\\n\t#ifdef USE_THICKNESSMAP\\n\t\tuniform sampler2D thicknessMap;\\n\t#endif\\n\tuniform vec2 transmissionSamplerSize;\\n\tuniform sampler2D transmissionSamplerMap;\\n\tuniform mat4 modelMatrix;\\n\tuniform mat4 projectionMatrix;\\n\tvarying vec3 vWorldPosition;\\n\tfloat w0( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\t}\\n\tfloat w1( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\t}\\n\tfloat w2( float a ){\\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\t}\\n\tfloat w3( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\t}\\n\tfloat g0( float a ) {\\n\t\treturn w0( a ) + w1( a );\\n\t}\\n\tfloat g1( float a ) {\\n\t\treturn w2( a ) + w3( a );\\n\t}\\n\tfloat h0( float a ) {\\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\t}\\n\tfloat h1( float a ) {\\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\t}\\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\t\tuv = uv * texelSize.zw + 0.5;\\n\t\tvec2 iuv = floor( uv );\\n\t\tvec2 fuv = fract( uv );\\n\t\tfloat g0x = g0( fuv.x );\\n\t\tfloat g1x = g1( fuv.x );\\n\t\tfloat h0x = h0( fuv.x );\\n\t\tfloat h1x = h1( fuv.x );\\n\t\tfloat h0y = h0( fuv.y );\\n\t\tfloat h1y = h1( fuv.y );\\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\t}\\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\t\treturn mix( fSample, cSample, fract( lod ) );\\n\t}\\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\t\tvec3 modelScale;\\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\\n\t}\\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\t}\\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\t}\\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\t\tif ( isinf( attenuationDistance ) ) {\\n\t\t\treturn vec3( 1.0 );\\n\t\t} else {\\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\\n\t\t}\\n\t}\\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\t\tvec3 refractedRayExit = position + transmissionRay;\\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\t\trefractionCoords += 1.0;\\n\t\trefractionCoords /= 2.0;\\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\t}\\n#endif\";\nvar $a315ee31802fb757$var$uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tuniform mat3 transmissionMapTransform;\\n\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tuniform mat3 thicknessMapTransform;\\n\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar $a315ee31802fb757$var$uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\tuniform mat3 mapTransform;\\n\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tuniform mat3 alphaMapTransform;\\n\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tuniform mat3 lightMapTransform;\\n\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\tuniform mat3 aoMapTransform;\\n\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tuniform mat3 bumpMapTransform;\\n\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tuniform mat3 normalMapTransform;\\n\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\tuniform mat3 displacementMapTransform;\\n\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tuniform mat3 emissiveMapTransform;\\n\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tuniform mat3 metalnessMapTransform;\\n\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tuniform mat3 roughnessMapTransform;\\n\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tuniform mat3 anisotropyMapTransform;\\n\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tuniform mat3 clearcoatMapTransform;\\n\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tuniform mat3 clearcoatNormalMapTransform;\\n\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tuniform mat3 clearcoatRoughnessMapTransform;\\n\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tuniform mat3 sheenColorMapTransform;\\n\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tuniform mat3 sheenRoughnessMapTransform;\\n\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tuniform mat3 iridescenceMapTransform;\\n\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tuniform mat3 iridescenceThicknessMapTransform;\\n\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tuniform mat3 specularMapTransform;\\n\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tuniform mat3 specularColorMapTransform;\\n\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tuniform mat3 specularIntensityMapTransform;\\n\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tuniform mat3 transmissionMapTransform;\\n\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tuniform mat3 thicknessMapTransform;\\n\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar $a315ee31802fb757$var$uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\nvar $a315ee31802fb757$var$worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\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\";\nconst $a315ee31802fb757$var$vertex$h = \"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}\";\nconst $a315ee31802fb757$var$fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\tvec4 texColor = texture2D( t2D, vUv );\\n\ttexColor.rgb *= backgroundIntensity;\\n\tgl_FragColor = texColor;\\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n\tgl_Position.z = gl_Position.w;\\n}\";\nconst $a315ee31802fb757$var$fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\t#ifdef ENVMAP_TYPE_CUBE\\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\t#else\\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\t#endif\\n\ttexColor.rgb *= backgroundIntensity;\\n\tgl_FragColor = texColor;\\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n\tgl_Position.z = gl_Position.w;\\n}\";\nconst $a315ee31802fb757$var$fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\tgl_FragColor = texColor;\\n\tgl_FragColor.a *= opacity;\\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\t#include \\n\t#include \\n\t#ifdef USE_DISPLACEMENTMAP\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvHighPrecisionZW = gl_Position.zw;\\n}\";\nconst $a315ee31802fb757$var$fragment$e = \"#if DEPTH_PACKING == 3200\\n\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( 1.0 );\\n\t#if DEPTH_PACKING == 3200\\n\t\tdiffuseColor.a = opacity;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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}\";\nconst $a315ee31802fb757$var$vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#ifdef USE_DISPLACEMENTMAP\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvWorldPosition = worldPosition.xyz;\\n}\";\nconst $a315ee31802fb757$var$fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\t#include \\n\tvec4 diffuseColor = vec4( 1.0 );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tfloat dist = length( vWorldPosition - referencePosition );\\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\tdist = saturate( dist );\\n\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\nconst $a315ee31802fb757$var$vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvec3 direction = normalize( vWorldDirection );\\n\tvec2 sampleUV = equirectUv( direction );\\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\tvLineDistance = scale * lineDistance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\t#ifdef USE_LIGHTMAP\\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\t#else\\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\t#endif\\n\t#include \\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n}\";\nconst $a315ee31802fb757$var$fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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#else\\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\t#endif\\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\nconst $a315ee31802fb757$var$fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\t#ifdef OPAQUE\\n\t\tgl_FragColor.a = 1.0;\\n\t#endif\\n}\";\nconst $a315ee31802fb757$var$vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n#ifdef USE_TRANSMISSION\\n\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\nconst $a315ee31802fb757$var$fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\t#define IOR\\n\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\tuniform float specularIntensity;\\n\tuniform vec3 specularColor;\\n\t#ifdef USE_SPECULAR_COLORMAP\\n\t\tuniform sampler2D specularColorMap;\\n\t#endif\\n\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\t\tuniform sampler2D specularIntensityMap;\\n\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tuniform float clearcoat;\\n\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\tuniform float iridescence;\\n\tuniform float iridescenceIOR;\\n\tuniform float iridescenceThicknessMinimum;\\n\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\tuniform vec3 sheenColor;\\n\tuniform float sheenRoughness;\\n\t#ifdef USE_SHEEN_COLORMAP\\n\t\tuniform sampler2D sheenColorMap;\\n\t#endif\\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\t\tuniform sampler2D sheenRoughnessMap;\\n\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\tuniform vec2 anisotropyVector;\\n\t#ifdef USE_ANISOTROPYMAP\\n\t\tuniform sampler2D anisotropyMap;\\n\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\t#include \\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\t#ifdef USE_SHEEN\\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\\n\t#endif\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\tvarying vec2 vUv;\\n\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\t#ifdef USE_POINTS_UV\\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec3 outgoingLight = vec3( 0.0 );\\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$var$fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec3 outgoingLight = vec3( 0.0 );\\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $a315ee31802fb757$export$955f9f2e84c43c8b = {\n alphahash_fragment: $a315ee31802fb757$var$alphahash_fragment,\n alphahash_pars_fragment: $a315ee31802fb757$var$alphahash_pars_fragment,\n alphamap_fragment: $a315ee31802fb757$var$alphamap_fragment,\n alphamap_pars_fragment: $a315ee31802fb757$var$alphamap_pars_fragment,\n alphatest_fragment: $a315ee31802fb757$var$alphatest_fragment,\n alphatest_pars_fragment: $a315ee31802fb757$var$alphatest_pars_fragment,\n aomap_fragment: $a315ee31802fb757$var$aomap_fragment,\n aomap_pars_fragment: $a315ee31802fb757$var$aomap_pars_fragment,\n begin_vertex: $a315ee31802fb757$var$begin_vertex,\n beginnormal_vertex: $a315ee31802fb757$var$beginnormal_vertex,\n bsdfs: $a315ee31802fb757$var$bsdfs,\n iridescence_fragment: $a315ee31802fb757$var$iridescence_fragment,\n bumpmap_pars_fragment: $a315ee31802fb757$var$bumpmap_pars_fragment,\n clipping_planes_fragment: $a315ee31802fb757$var$clipping_planes_fragment,\n clipping_planes_pars_fragment: $a315ee31802fb757$var$clipping_planes_pars_fragment,\n clipping_planes_pars_vertex: $a315ee31802fb757$var$clipping_planes_pars_vertex,\n clipping_planes_vertex: $a315ee31802fb757$var$clipping_planes_vertex,\n color_fragment: $a315ee31802fb757$var$color_fragment,\n color_pars_fragment: $a315ee31802fb757$var$color_pars_fragment,\n color_pars_vertex: $a315ee31802fb757$var$color_pars_vertex,\n color_vertex: $a315ee31802fb757$var$color_vertex,\n common: $a315ee31802fb757$var$common,\n cube_uv_reflection_fragment: $a315ee31802fb757$var$cube_uv_reflection_fragment,\n defaultnormal_vertex: $a315ee31802fb757$var$defaultnormal_vertex,\n displacementmap_pars_vertex: $a315ee31802fb757$var$displacementmap_pars_vertex,\n displacementmap_vertex: $a315ee31802fb757$var$displacementmap_vertex,\n emissivemap_fragment: $a315ee31802fb757$var$emissivemap_fragment,\n emissivemap_pars_fragment: $a315ee31802fb757$var$emissivemap_pars_fragment,\n colorspace_fragment: $a315ee31802fb757$var$colorspace_fragment,\n colorspace_pars_fragment: $a315ee31802fb757$var$colorspace_pars_fragment,\n envmap_fragment: $a315ee31802fb757$var$envmap_fragment,\n envmap_common_pars_fragment: $a315ee31802fb757$var$envmap_common_pars_fragment,\n envmap_pars_fragment: $a315ee31802fb757$var$envmap_pars_fragment,\n envmap_pars_vertex: $a315ee31802fb757$var$envmap_pars_vertex,\n envmap_physical_pars_fragment: $a315ee31802fb757$var$envmap_physical_pars_fragment,\n envmap_vertex: $a315ee31802fb757$var$envmap_vertex,\n fog_vertex: $a315ee31802fb757$var$fog_vertex,\n fog_pars_vertex: $a315ee31802fb757$var$fog_pars_vertex,\n fog_fragment: $a315ee31802fb757$var$fog_fragment,\n fog_pars_fragment: $a315ee31802fb757$var$fog_pars_fragment,\n gradientmap_pars_fragment: $a315ee31802fb757$var$gradientmap_pars_fragment,\n lightmap_fragment: $a315ee31802fb757$var$lightmap_fragment,\n lightmap_pars_fragment: $a315ee31802fb757$var$lightmap_pars_fragment,\n lights_lambert_fragment: $a315ee31802fb757$var$lights_lambert_fragment,\n lights_lambert_pars_fragment: $a315ee31802fb757$var$lights_lambert_pars_fragment,\n lights_pars_begin: $a315ee31802fb757$var$lights_pars_begin,\n lights_toon_fragment: $a315ee31802fb757$var$lights_toon_fragment,\n lights_toon_pars_fragment: $a315ee31802fb757$var$lights_toon_pars_fragment,\n lights_phong_fragment: $a315ee31802fb757$var$lights_phong_fragment,\n lights_phong_pars_fragment: $a315ee31802fb757$var$lights_phong_pars_fragment,\n lights_physical_fragment: $a315ee31802fb757$var$lights_physical_fragment,\n lights_physical_pars_fragment: $a315ee31802fb757$var$lights_physical_pars_fragment,\n lights_fragment_begin: $a315ee31802fb757$var$lights_fragment_begin,\n lights_fragment_maps: $a315ee31802fb757$var$lights_fragment_maps,\n lights_fragment_end: $a315ee31802fb757$var$lights_fragment_end,\n logdepthbuf_fragment: $a315ee31802fb757$var$logdepthbuf_fragment,\n logdepthbuf_pars_fragment: $a315ee31802fb757$var$logdepthbuf_pars_fragment,\n logdepthbuf_pars_vertex: $a315ee31802fb757$var$logdepthbuf_pars_vertex,\n logdepthbuf_vertex: $a315ee31802fb757$var$logdepthbuf_vertex,\n map_fragment: $a315ee31802fb757$var$map_fragment,\n map_pars_fragment: $a315ee31802fb757$var$map_pars_fragment,\n map_particle_fragment: $a315ee31802fb757$var$map_particle_fragment,\n map_particle_pars_fragment: $a315ee31802fb757$var$map_particle_pars_fragment,\n metalnessmap_fragment: $a315ee31802fb757$var$metalnessmap_fragment,\n metalnessmap_pars_fragment: $a315ee31802fb757$var$metalnessmap_pars_fragment,\n morphcolor_vertex: $a315ee31802fb757$var$morphcolor_vertex,\n morphnormal_vertex: $a315ee31802fb757$var$morphnormal_vertex,\n morphtarget_pars_vertex: $a315ee31802fb757$var$morphtarget_pars_vertex,\n morphtarget_vertex: $a315ee31802fb757$var$morphtarget_vertex,\n normal_fragment_begin: $a315ee31802fb757$var$normal_fragment_begin,\n normal_fragment_maps: $a315ee31802fb757$var$normal_fragment_maps,\n normal_pars_fragment: $a315ee31802fb757$var$normal_pars_fragment,\n normal_pars_vertex: $a315ee31802fb757$var$normal_pars_vertex,\n normal_vertex: $a315ee31802fb757$var$normal_vertex,\n normalmap_pars_fragment: $a315ee31802fb757$var$normalmap_pars_fragment,\n clearcoat_normal_fragment_begin: $a315ee31802fb757$var$clearcoat_normal_fragment_begin,\n clearcoat_normal_fragment_maps: $a315ee31802fb757$var$clearcoat_normal_fragment_maps,\n clearcoat_pars_fragment: $a315ee31802fb757$var$clearcoat_pars_fragment,\n iridescence_pars_fragment: $a315ee31802fb757$var$iridescence_pars_fragment,\n opaque_fragment: $a315ee31802fb757$var$opaque_fragment,\n packing: $a315ee31802fb757$var$packing,\n premultiplied_alpha_fragment: $a315ee31802fb757$var$premultiplied_alpha_fragment,\n project_vertex: $a315ee31802fb757$var$project_vertex,\n dithering_fragment: $a315ee31802fb757$var$dithering_fragment,\n dithering_pars_fragment: $a315ee31802fb757$var$dithering_pars_fragment,\n roughnessmap_fragment: $a315ee31802fb757$var$roughnessmap_fragment,\n roughnessmap_pars_fragment: $a315ee31802fb757$var$roughnessmap_pars_fragment,\n shadowmap_pars_fragment: $a315ee31802fb757$var$shadowmap_pars_fragment,\n shadowmap_pars_vertex: $a315ee31802fb757$var$shadowmap_pars_vertex,\n shadowmap_vertex: $a315ee31802fb757$var$shadowmap_vertex,\n shadowmask_pars_fragment: $a315ee31802fb757$var$shadowmask_pars_fragment,\n skinbase_vertex: $a315ee31802fb757$var$skinbase_vertex,\n skinning_pars_vertex: $a315ee31802fb757$var$skinning_pars_vertex,\n skinning_vertex: $a315ee31802fb757$var$skinning_vertex,\n skinnormal_vertex: $a315ee31802fb757$var$skinnormal_vertex,\n specularmap_fragment: $a315ee31802fb757$var$specularmap_fragment,\n specularmap_pars_fragment: $a315ee31802fb757$var$specularmap_pars_fragment,\n tonemapping_fragment: $a315ee31802fb757$var$tonemapping_fragment,\n tonemapping_pars_fragment: $a315ee31802fb757$var$tonemapping_pars_fragment,\n transmission_fragment: $a315ee31802fb757$var$transmission_fragment,\n transmission_pars_fragment: $a315ee31802fb757$var$transmission_pars_fragment,\n uv_pars_fragment: $a315ee31802fb757$var$uv_pars_fragment,\n uv_pars_vertex: $a315ee31802fb757$var$uv_pars_vertex,\n uv_vertex: $a315ee31802fb757$var$uv_vertex,\n worldpos_vertex: $a315ee31802fb757$var$worldpos_vertex,\n background_vert: $a315ee31802fb757$var$vertex$h,\n background_frag: $a315ee31802fb757$var$fragment$h,\n backgroundCube_vert: $a315ee31802fb757$var$vertex$g,\n backgroundCube_frag: $a315ee31802fb757$var$fragment$g,\n cube_vert: $a315ee31802fb757$var$vertex$f,\n cube_frag: $a315ee31802fb757$var$fragment$f,\n depth_vert: $a315ee31802fb757$var$vertex$e,\n depth_frag: $a315ee31802fb757$var$fragment$e,\n distanceRGBA_vert: $a315ee31802fb757$var$vertex$d,\n distanceRGBA_frag: $a315ee31802fb757$var$fragment$d,\n equirect_vert: $a315ee31802fb757$var$vertex$c,\n equirect_frag: $a315ee31802fb757$var$fragment$c,\n linedashed_vert: $a315ee31802fb757$var$vertex$b,\n linedashed_frag: $a315ee31802fb757$var$fragment$b,\n meshbasic_vert: $a315ee31802fb757$var$vertex$a,\n meshbasic_frag: $a315ee31802fb757$var$fragment$a,\n meshlambert_vert: $a315ee31802fb757$var$vertex$9,\n meshlambert_frag: $a315ee31802fb757$var$fragment$9,\n meshmatcap_vert: $a315ee31802fb757$var$vertex$8,\n meshmatcap_frag: $a315ee31802fb757$var$fragment$8,\n meshnormal_vert: $a315ee31802fb757$var$vertex$7,\n meshnormal_frag: $a315ee31802fb757$var$fragment$7,\n meshphong_vert: $a315ee31802fb757$var$vertex$6,\n meshphong_frag: $a315ee31802fb757$var$fragment$6,\n meshphysical_vert: $a315ee31802fb757$var$vertex$5,\n meshphysical_frag: $a315ee31802fb757$var$fragment$5,\n meshtoon_vert: $a315ee31802fb757$var$vertex$4,\n meshtoon_frag: $a315ee31802fb757$var$fragment$4,\n points_vert: $a315ee31802fb757$var$vertex$3,\n points_frag: $a315ee31802fb757$var$fragment$3,\n shadow_vert: $a315ee31802fb757$var$vertex$2,\n shadow_frag: $a315ee31802fb757$var$fragment$2,\n sprite_vert: $a315ee31802fb757$var$vertex$1,\n sprite_frag: $a315ee31802fb757$var$fragment$1\n};\n/**\n * Uniforms library for shared webgl shaders\n */ const $a315ee31802fb757$export$6643083551874bf5 = {\n common: {\n diffuse: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n }\n },\n specularmap: {\n specularMap: {\n value: null\n },\n specularMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n envmap: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n reflectivity: {\n value: 1.0\n },\n ior: {\n value: 1.5\n },\n refractionRatio: {\n value: 0.98\n }\n },\n aomap: {\n aoMap: {\n value: null\n },\n aoMapIntensity: {\n value: 1\n },\n aoMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n lightmap: {\n lightMap: {\n value: null\n },\n lightMapIntensity: {\n value: 1\n },\n lightMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n bumpmap: {\n bumpMap: {\n value: null\n },\n bumpMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n bumpScale: {\n value: 1\n }\n },\n normalmap: {\n normalMap: {\n value: null\n },\n normalMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n normalScale: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1)\n }\n },\n displacementmap: {\n displacementMap: {\n value: null\n },\n displacementMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n displacementScale: {\n value: 1\n },\n displacementBias: {\n value: 0\n }\n },\n emissivemap: {\n emissiveMap: {\n value: null\n },\n emissiveMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n metalnessmap: {\n metalnessMap: {\n value: null\n },\n metalnessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n roughnessmap: {\n roughnessMap: {\n value: null\n },\n roughnessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n gradientmap: {\n gradientMap: {\n value: null\n }\n },\n fog: {\n fogDensity: {\n value: 0.00025\n },\n fogNear: {\n value: 1\n },\n fogFar: {\n value: 2000\n },\n fogColor: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0xffffff)\n }\n },\n lights: {\n ambientLightColor: {\n value: []\n },\n lightProbe: {\n value: []\n },\n directionalLights: {\n value: [],\n properties: {\n direction: {},\n color: {}\n }\n },\n directionalLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n directionalShadowMap: {\n value: []\n },\n directionalShadowMatrix: {\n value: []\n },\n spotLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n direction: {},\n distance: {},\n coneCos: {},\n penumbraCos: {},\n decay: {}\n }\n },\n spotLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n spotLightMap: {\n value: []\n },\n spotShadowMap: {\n value: []\n },\n spotLightMatrix: {\n value: []\n },\n pointLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n decay: {},\n distance: {}\n }\n },\n pointLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {},\n shadowCameraNear: {},\n shadowCameraFar: {}\n }\n },\n pointShadowMap: {\n value: []\n },\n pointShadowMatrix: {\n value: []\n },\n hemisphereLights: {\n value: [],\n properties: {\n direction: {},\n skyColor: {},\n groundColor: {}\n }\n },\n // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n rectAreaLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n width: {},\n height: {}\n }\n },\n ltc_1: {\n value: null\n },\n ltc_2: {\n value: null\n }\n },\n points: {\n diffuse: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n size: {\n value: 1.0\n },\n scale: {\n value: 1.0\n },\n map: {\n value: null\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n },\n uvTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n },\n sprite: {\n diffuse: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n center: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, 0.5)\n },\n rotation: {\n value: 0.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n }\n }\n};\nconst $a315ee31802fb757$export$bee4a7d47f8f5014 = {\n basic: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.specularmap,\n $a315ee31802fb757$export$6643083551874bf5.envmap,\n $a315ee31802fb757$export$6643083551874bf5.aomap,\n $a315ee31802fb757$export$6643083551874bf5.lightmap,\n $a315ee31802fb757$export$6643083551874bf5.fog\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshbasic_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshbasic_frag\n },\n lambert: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.specularmap,\n $a315ee31802fb757$export$6643083551874bf5.envmap,\n $a315ee31802fb757$export$6643083551874bf5.aomap,\n $a315ee31802fb757$export$6643083551874bf5.lightmap,\n $a315ee31802fb757$export$6643083551874bf5.emissivemap,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n $a315ee31802fb757$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshlambert_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshlambert_frag\n },\n phong: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.specularmap,\n $a315ee31802fb757$export$6643083551874bf5.envmap,\n $a315ee31802fb757$export$6643083551874bf5.aomap,\n $a315ee31802fb757$export$6643083551874bf5.lightmap,\n $a315ee31802fb757$export$6643083551874bf5.emissivemap,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n $a315ee31802fb757$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n },\n specular: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x111111)\n },\n shininess: {\n value: 30\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphong_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphong_frag\n },\n standard: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.envmap,\n $a315ee31802fb757$export$6643083551874bf5.aomap,\n $a315ee31802fb757$export$6643083551874bf5.lightmap,\n $a315ee31802fb757$export$6643083551874bf5.emissivemap,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n $a315ee31802fb757$export$6643083551874bf5.roughnessmap,\n $a315ee31802fb757$export$6643083551874bf5.metalnessmap,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n $a315ee31802fb757$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n },\n roughness: {\n value: 1.0\n },\n metalness: {\n value: 0.0\n },\n envMapIntensity: {\n value: 1\n } // temporary\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphysical_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphysical_frag\n },\n toon: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.aomap,\n $a315ee31802fb757$export$6643083551874bf5.lightmap,\n $a315ee31802fb757$export$6643083551874bf5.emissivemap,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n $a315ee31802fb757$export$6643083551874bf5.gradientmap,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n $a315ee31802fb757$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshtoon_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshtoon_frag\n },\n matcap: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n {\n matcap: {\n value: null\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshmatcap_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshmatcap_frag\n },\n points: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.points,\n $a315ee31802fb757$export$6643083551874bf5.fog\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.points_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.points_frag\n },\n dashed: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n {\n scale: {\n value: 1\n },\n dashSize: {\n value: 1\n },\n totalSize: {\n value: 2\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.linedashed_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.linedashed_frag\n },\n depth: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.depth_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.depth_frag\n },\n normal: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.bumpmap,\n $a315ee31802fb757$export$6643083551874bf5.normalmap,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n {\n opacity: {\n value: 1.0\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshnormal_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshnormal_frag\n },\n sprite: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.sprite,\n $a315ee31802fb757$export$6643083551874bf5.fog\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.sprite_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.sprite_frag\n },\n background: {\n uniforms: {\n uvTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n t2D: {\n value: null\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.background_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.background_frag\n },\n backgroundCube: {\n uniforms: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n backgroundBlurriness: {\n value: 0\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.backgroundCube_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.backgroundCube_frag\n },\n cube: {\n uniforms: {\n tCube: {\n value: null\n },\n tFlip: {\n value: -1\n },\n opacity: {\n value: 1.0\n }\n },\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.cube_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.cube_frag\n },\n equirect: {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.equirect_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.equirect_frag\n },\n distanceRGBA: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.common,\n $a315ee31802fb757$export$6643083551874bf5.displacementmap,\n {\n referencePosition: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699()\n },\n nearDistance: {\n value: 1\n },\n farDistance: {\n value: 1000\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.distanceRGBA_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.distanceRGBA_frag\n },\n shadow: {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$6643083551874bf5.lights,\n $a315ee31802fb757$export$6643083551874bf5.fog,\n {\n color: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x00000)\n },\n opacity: {\n value: 1.0\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.shadow_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.shadow_frag\n }\n};\n$a315ee31802fb757$export$bee4a7d47f8f5014.physical = {\n uniforms: /*@__PURE__*/ $a315ee31802fb757$var$mergeUniforms([\n $a315ee31802fb757$export$bee4a7d47f8f5014.standard.uniforms,\n {\n clearcoat: {\n value: 0\n },\n clearcoatMap: {\n value: null\n },\n clearcoatMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n clearcoatNormalMap: {\n value: null\n },\n clearcoatNormalMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n clearcoatNormalScale: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1)\n },\n clearcoatRoughness: {\n value: 0\n },\n clearcoatRoughnessMap: {\n value: null\n },\n clearcoatRoughnessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n iridescence: {\n value: 0\n },\n iridescenceMap: {\n value: null\n },\n iridescenceMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n iridescenceIOR: {\n value: 1.3\n },\n iridescenceThicknessMinimum: {\n value: 100\n },\n iridescenceThicknessMaximum: {\n value: 400\n },\n iridescenceThicknessMap: {\n value: null\n },\n iridescenceThicknessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n sheen: {\n value: 0\n },\n sheenColor: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n },\n sheenColorMap: {\n value: null\n },\n sheenColorMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n sheenRoughness: {\n value: 1\n },\n sheenRoughnessMap: {\n value: null\n },\n sheenRoughnessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n transmission: {\n value: 0\n },\n transmissionMap: {\n value: null\n },\n transmissionMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n transmissionSamplerSize: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1()\n },\n transmissionSamplerMap: {\n value: null\n },\n thickness: {\n value: 0\n },\n thicknessMap: {\n value: null\n },\n thicknessMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n attenuationDistance: {\n value: 0\n },\n attenuationColor: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(0x000000)\n },\n specularColor: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e(1, 1, 1)\n },\n specularColorMap: {\n value: null\n },\n specularColorMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n specularIntensity: {\n value: 1\n },\n specularIntensityMap: {\n value: null\n },\n specularIntensityMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n },\n anisotropyVector: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1()\n },\n anisotropyMap: {\n value: null\n },\n anisotropyMapTransform: {\n value: /*@__PURE__*/ new $a315ee31802fb757$export$8ff26dafa08918()\n }\n }\n ]),\n vertexShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphysical_vert,\n fragmentShader: $a315ee31802fb757$export$955f9f2e84c43c8b.meshphysical_frag\n};\nconst $a315ee31802fb757$var$_rgb = {\n r: 0,\n b: 0,\n g: 0\n};\nfunction $a315ee31802fb757$var$WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) {\n const clearColor = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n let clearAlpha = alpha === true ? 0 : 1;\n let planeMesh;\n let boxMesh;\n let currentBackground = null;\n let currentBackgroundVersion = 0;\n let currentTonemapping = null;\n function render(renderList, scene) {\n let forceClear = false;\n let background = scene.isScene === true ? scene.background : null;\n if (background && background.isTexture) {\n const usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n background = (usePMREM ? cubeuvmaps : cubemaps).get(background);\n }\n if (background === null) setClear(clearColor, clearAlpha);\n else if (background && background.isColor) {\n setClear(background, 1);\n forceClear = true;\n }\n const xr = renderer.xr;\n const environmentBlendMode = xr.getEnvironmentBlendMode();\n switch(environmentBlendMode){\n case \"opaque\":\n forceClear = true;\n break;\n case \"additive\":\n state.buffers.color.setClear(0, 0, 0, 1, premultipliedAlpha);\n forceClear = true;\n break;\n case \"alpha-blend\":\n state.buffers.color.setClear(0, 0, 0, 0, premultipliedAlpha);\n forceClear = true;\n break;\n }\n if (renderer.autoClear || forceClear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);\n if (background && (background.isCubeTexture || background.mapping === $a315ee31802fb757$export$dbf3e70ff37af79)) {\n if (boxMesh === undefined) {\n boxMesh = new $a315ee31802fb757$export$e176487c05830cc5(new $a315ee31802fb757$export$33e43285f7406bd5(1, 1, 1), new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"BackgroundCubeMaterial\",\n uniforms: $a315ee31802fb757$var$cloneUniforms($a315ee31802fb757$export$bee4a7d47f8f5014.backgroundCube.uniforms),\n vertexShader: $a315ee31802fb757$export$bee4a7d47f8f5014.backgroundCube.vertexShader,\n fragmentShader: $a315ee31802fb757$export$bee4a7d47f8f5014.backgroundCube.fragmentShader,\n side: $a315ee31802fb757$export$d9f0486e75b5ace,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n boxMesh.geometry.deleteAttribute(\"normal\");\n boxMesh.geometry.deleteAttribute(\"uv\");\n boxMesh.onBeforeRender = function(renderer, scene, camera) {\n this.matrixWorld.copyPosition(camera.matrixWorld);\n };\n // add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(boxMesh.material, \"envMap\", {\n get: function() {\n return this.uniforms.envMap.value;\n }\n });\n objects.update(boxMesh);\n }\n boxMesh.material.uniforms.envMap.value = background;\n boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;\n boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n boxMesh.material.toneMapped = background.colorSpace === $a315ee31802fb757$export$561f394b24edfcaa ? false : true;\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n boxMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n boxMesh.layers.enableAll();\n // push to the pre-sorted opaque render list\n renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null);\n } else if (background && background.isTexture) {\n if (planeMesh === undefined) {\n planeMesh = new $a315ee31802fb757$export$e176487c05830cc5(new $a315ee31802fb757$export$967d831af31f69ce(2, 2), new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"BackgroundMaterial\",\n uniforms: $a315ee31802fb757$var$cloneUniforms($a315ee31802fb757$export$bee4a7d47f8f5014.background.uniforms),\n vertexShader: $a315ee31802fb757$export$bee4a7d47f8f5014.background.vertexShader,\n fragmentShader: $a315ee31802fb757$export$bee4a7d47f8f5014.background.fragmentShader,\n side: $a315ee31802fb757$export$2ede184fc2998901,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n planeMesh.geometry.deleteAttribute(\"normal\");\n // add \"map\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(planeMesh.material, \"map\", {\n get: function() {\n return this.uniforms.t2D.value;\n }\n });\n objects.update(planeMesh);\n }\n planeMesh.material.uniforms.t2D.value = background;\n planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n planeMesh.material.toneMapped = background.colorSpace === $a315ee31802fb757$export$561f394b24edfcaa ? false : true;\n if (background.matrixAutoUpdate === true) background.updateMatrix();\n planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n planeMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n planeMesh.layers.enableAll();\n // push to the pre-sorted opaque render list\n renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null);\n }\n }\n function setClear(color, alpha) {\n color.getRGB($a315ee31802fb757$var$_rgb, $a315ee31802fb757$var$getUnlitUniformColorSpace(renderer));\n state.buffers.color.setClear($a315ee31802fb757$var$_rgb.r, $a315ee31802fb757$var$_rgb.g, $a315ee31802fb757$var$_rgb.b, alpha, premultipliedAlpha);\n }\n return {\n getClearColor: function() {\n return clearColor;\n },\n setClearColor: function(color, alpha = 1) {\n clearColor.set(color);\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n getClearAlpha: function() {\n return clearAlpha;\n },\n setClearAlpha: function(alpha) {\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n render: render\n };\n}\nfunction $a315ee31802fb757$var$WebGLBindingStates(gl, extensions, attributes, capabilities) {\n const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n const extension = capabilities.isWebGL2 ? null : extensions.get(\"OES_vertex_array_object\");\n const vaoAvailable = capabilities.isWebGL2 || extension !== null;\n const bindingStates = {};\n const defaultState = createBindingState(null);\n let currentState = defaultState;\n let forceUpdate = false;\n function setup(object, material, program, geometry, index) {\n let updateBuffers = false;\n if (vaoAvailable) {\n const state = getBindingState(geometry, program, material);\n if (currentState !== state) {\n currentState = state;\n bindVertexArrayObject(currentState.object);\n }\n updateBuffers = needsUpdate(object, geometry, program, index);\n if (updateBuffers) saveCache(object, geometry, program, index);\n } else {\n const wireframe = material.wireframe === true;\n if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) {\n currentState.geometry = geometry.id;\n currentState.program = program.id;\n currentState.wireframe = wireframe;\n updateBuffers = true;\n }\n }\n if (index !== null) attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);\n if (updateBuffers || forceUpdate) {\n forceUpdate = false;\n setupVertexAttributes(object, material, program, geometry);\n if (index !== null) gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer);\n }\n }\n function createVertexArrayObject() {\n if (capabilities.isWebGL2) return gl.createVertexArray();\n return extension.createVertexArrayOES();\n }\n function bindVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.bindVertexArray(vao);\n return extension.bindVertexArrayOES(vao);\n }\n function deleteVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.deleteVertexArray(vao);\n return extension.deleteVertexArrayOES(vao);\n }\n function getBindingState(geometry, program, material) {\n const wireframe = material.wireframe === true;\n let programMap = bindingStates[geometry.id];\n if (programMap === undefined) {\n programMap = {};\n bindingStates[geometry.id] = programMap;\n }\n let stateMap = programMap[program.id];\n if (stateMap === undefined) {\n stateMap = {};\n programMap[program.id] = stateMap;\n }\n let state = stateMap[wireframe];\n if (state === undefined) {\n state = createBindingState(createVertexArrayObject());\n stateMap[wireframe] = state;\n }\n return state;\n }\n function createBindingState(vao) {\n const newAttributes = [];\n const enabledAttributes = [];\n const attributeDivisors = [];\n for(let i = 0; i < maxVertexAttributes; i++){\n newAttributes[i] = 0;\n enabledAttributes[i] = 0;\n attributeDivisors[i] = 0;\n }\n return {\n // for backward compatibility on non-VAO support browser\n geometry: null,\n program: null,\n wireframe: false,\n newAttributes: newAttributes,\n enabledAttributes: enabledAttributes,\n attributeDivisors: attributeDivisors,\n object: vao,\n attributes: {},\n index: null\n };\n }\n function needsUpdate(object, geometry, program, index) {\n const cachedAttributes = currentState.attributes;\n const geometryAttributes = geometry.attributes;\n let attributesNum = 0;\n const programAttributes = program.getAttributes();\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n const cachedAttribute = cachedAttributes[name];\n let geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (cachedAttribute === undefined) return true;\n if (cachedAttribute.attribute !== geometryAttribute) return true;\n if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true;\n attributesNum++;\n }\n }\n if (currentState.attributesNum !== attributesNum) return true;\n if (currentState.index !== index) return true;\n return false;\n }\n function saveCache(object, geometry, program, index) {\n const cache = {};\n const attributes = geometry.attributes;\n let attributesNum = 0;\n const programAttributes = program.getAttributes();\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n let attribute = attributes[name];\n if (attribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) attribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) attribute = object.instanceColor;\n }\n const data = {};\n data.attribute = attribute;\n if (attribute && attribute.data) data.data = attribute.data;\n cache[name] = data;\n attributesNum++;\n }\n }\n currentState.attributes = cache;\n currentState.attributesNum = attributesNum;\n currentState.index = index;\n }\n function initAttributes() {\n const newAttributes = currentState.newAttributes;\n for(let i = 0, il = newAttributes.length; i < il; i++)newAttributes[i] = 0;\n }\n function enableAttribute(attribute) {\n enableAttributeAndDivisor(attribute, 0);\n }\n function enableAttributeAndDivisor(attribute, meshPerAttribute) {\n const newAttributes = currentState.newAttributes;\n const enabledAttributes = currentState.enabledAttributes;\n const attributeDivisors = currentState.attributeDivisors;\n newAttributes[attribute] = 1;\n if (enabledAttributes[attribute] === 0) {\n gl.enableVertexAttribArray(attribute);\n enabledAttributes[attribute] = 1;\n }\n if (attributeDivisors[attribute] !== meshPerAttribute) {\n const extension = capabilities.isWebGL2 ? gl : extensions.get(\"ANGLE_instanced_arrays\");\n extension[capabilities.isWebGL2 ? \"vertexAttribDivisor\" : \"vertexAttribDivisorANGLE\"](attribute, meshPerAttribute);\n attributeDivisors[attribute] = meshPerAttribute;\n }\n }\n function disableUnusedAttributes() {\n const newAttributes = currentState.newAttributes;\n const enabledAttributes = currentState.enabledAttributes;\n for(let i = 0, il = enabledAttributes.length; i < il; i++)if (enabledAttributes[i] !== newAttributes[i]) {\n gl.disableVertexAttribArray(i);\n enabledAttributes[i] = 0;\n }\n }\n function vertexAttribPointer(index, size, type, normalized, stride, offset, integer) {\n if (integer === true) gl.vertexAttribIPointer(index, size, type, stride, offset);\n else gl.vertexAttribPointer(index, size, type, normalized, stride, offset);\n }\n function setupVertexAttributes(object, material, program, geometry) {\n if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) {\n if (extensions.get(\"ANGLE_instanced_arrays\") === null) return;\n }\n initAttributes();\n const geometryAttributes = geometry.attributes;\n const programAttributes = program.getAttributes();\n const materialDefaultAttributeValues = material.defaultAttributeValues;\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n let geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (geometryAttribute !== undefined) {\n const normalized = geometryAttribute.normalized;\n const size = geometryAttribute.itemSize;\n const attribute = attributes.get(geometryAttribute);\n // TODO Attribute may not be available on context restore\n if (attribute === undefined) continue;\n const buffer = attribute.buffer;\n const type = attribute.type;\n const bytesPerElement = attribute.bytesPerElement;\n // check for integer attributes (WebGL 2 only)\n const integer = capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === $a315ee31802fb757$export$5c612977753abe2);\n if (geometryAttribute.isInterleavedBufferAttribute) {\n const data = geometryAttribute.data;\n const stride = data.stride;\n const offset = geometryAttribute.offset;\n if (data.isInstancedInterleavedBuffer) {\n for(let i = 0; i < programAttribute.locationSize; i++)enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute);\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) geometry._maxInstanceCount = data.meshPerAttribute * data.count;\n } else for(let i = 0; i < programAttribute.locationSize; i++)enableAttribute(programAttribute.location + i);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n for(let i = 0; i < programAttribute.locationSize; i++)vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement, integer);\n } else {\n if (geometryAttribute.isInstancedBufferAttribute) {\n for(let i = 0; i < programAttribute.locationSize; i++)enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute);\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n } else for(let i = 0; i < programAttribute.locationSize; i++)enableAttribute(programAttribute.location + i);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n for(let i = 0; i < programAttribute.locationSize; i++)vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement, integer);\n }\n } else if (materialDefaultAttributeValues !== undefined) {\n const value = materialDefaultAttributeValues[name];\n if (value !== undefined) switch(value.length){\n case 2:\n gl.vertexAttrib2fv(programAttribute.location, value);\n break;\n case 3:\n gl.vertexAttrib3fv(programAttribute.location, value);\n break;\n case 4:\n gl.vertexAttrib4fv(programAttribute.location, value);\n break;\n default:\n gl.vertexAttrib1fv(programAttribute.location, value);\n }\n }\n }\n }\n disableUnusedAttributes();\n }\n function dispose() {\n reset();\n for(const geometryId in bindingStates){\n const programMap = bindingStates[geometryId];\n for(const programId in programMap){\n const stateMap = programMap[programId];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometryId];\n }\n }\n function releaseStatesOfGeometry(geometry) {\n if (bindingStates[geometry.id] === undefined) return;\n const programMap = bindingStates[geometry.id];\n for(const programId in programMap){\n const stateMap = programMap[programId];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometry.id];\n }\n function releaseStatesOfProgram(program) {\n for(const geometryId in bindingStates){\n const programMap = bindingStates[geometryId];\n if (programMap[program.id] === undefined) continue;\n const stateMap = programMap[program.id];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[program.id];\n }\n }\n function reset() {\n resetDefaultState();\n forceUpdate = true;\n if (currentState === defaultState) return;\n currentState = defaultState;\n bindVertexArrayObject(currentState.object);\n }\n // for backward-compatibility\n function resetDefaultState() {\n defaultState.geometry = null;\n defaultState.program = null;\n defaultState.wireframe = false;\n }\n return {\n setup: setup,\n reset: reset,\n resetDefaultState: resetDefaultState,\n dispose: dispose,\n releaseStatesOfGeometry: releaseStatesOfGeometry,\n releaseStatesOfProgram: releaseStatesOfProgram,\n initAttributes: initAttributes,\n enableAttribute: enableAttribute,\n disableUnusedAttributes: disableUnusedAttributes\n };\n}\nfunction $a315ee31802fb757$var$WebGLBufferRenderer(gl, extensions, info, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n let mode;\n function setMode(value) {\n mode = value;\n }\n function render(start, count) {\n gl.drawArrays(mode, start, count);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n let extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = \"drawArraysInstanced\";\n } else {\n extension = extensions.get(\"ANGLE_instanced_arrays\");\n methodName = \"drawArraysInstancedANGLE\";\n if (extension === null) {\n console.error(\"THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");\n return;\n }\n }\n extension[methodName](mode, start, count, primcount);\n info.update(count, mode, primcount);\n }\n //\n this.setMode = setMode;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction $a315ee31802fb757$var$WebGLCapabilities(gl, extensions, parameters) {\n let maxAnisotropy;\n function getMaxAnisotropy() {\n if (maxAnisotropy !== undefined) return maxAnisotropy;\n if (extensions.has(\"EXT_texture_filter_anisotropic\") === true) {\n const extension = extensions.get(\"EXT_texture_filter_anisotropic\");\n maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n } else maxAnisotropy = 0;\n return maxAnisotropy;\n }\n function getMaxPrecision(precision) {\n if (precision === \"highp\") {\n if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) return \"highp\";\n precision = \"mediump\";\n }\n if (precision === \"mediump\") {\n if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) return \"mediump\";\n }\n return \"lowp\";\n }\n const isWebGL2 = typeof WebGL2RenderingContext !== \"undefined\" && gl.constructor.name === \"WebGL2RenderingContext\";\n let precision = parameters.precision !== undefined ? parameters.precision : \"highp\";\n const maxPrecision = getMaxPrecision(precision);\n if (maxPrecision !== precision) {\n console.warn(\"THREE.WebGLRenderer:\", precision, \"not supported, using\", maxPrecision, \"instead.\");\n precision = maxPrecision;\n }\n const drawBuffers = isWebGL2 || extensions.has(\"WEBGL_draw_buffers\");\n const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS);\n const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n const vertexTextures = maxVertexTextures > 0;\n const floatFragmentTextures = isWebGL2 || extensions.has(\"OES_texture_float\");\n const floatVertexTextures = vertexTextures && floatFragmentTextures;\n const maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;\n return {\n isWebGL2: isWebGL2,\n drawBuffers: drawBuffers,\n getMaxAnisotropy: getMaxAnisotropy,\n getMaxPrecision: getMaxPrecision,\n precision: precision,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n maxTextures: maxTextures,\n maxVertexTextures: maxVertexTextures,\n maxTextureSize: maxTextureSize,\n maxCubemapSize: maxCubemapSize,\n maxAttributes: maxAttributes,\n maxVertexUniforms: maxVertexUniforms,\n maxVaryings: maxVaryings,\n maxFragmentUniforms: maxFragmentUniforms,\n vertexTextures: vertexTextures,\n floatFragmentTextures: floatFragmentTextures,\n floatVertexTextures: floatVertexTextures,\n maxSamples: maxSamples\n };\n}\nfunction $a315ee31802fb757$var$WebGLClipping(properties) {\n const scope = this;\n let globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false;\n const plane = new $a315ee31802fb757$export$7ff5ac152ef991b0(), viewNormalMatrix = new $a315ee31802fb757$export$8ff26dafa08918(), uniform = {\n value: null,\n needsUpdate: false\n };\n this.uniform = uniform;\n this.numPlanes = 0;\n this.numIntersection = 0;\n this.init = function(planes, enableLocalClipping) {\n const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to\n // run another frame in order to reset the state:\n numGlobalPlanes !== 0 || localClippingEnabled;\n localClippingEnabled = enableLocalClipping;\n numGlobalPlanes = planes.length;\n return enabled;\n };\n this.beginShadows = function() {\n renderingShadows = true;\n projectPlanes(null);\n };\n this.endShadows = function() {\n renderingShadows = false;\n };\n this.setGlobalState = function(planes, camera) {\n globalState = projectPlanes(planes, camera, 0);\n };\n this.setState = function(material, camera, useCache) {\n const planes = material.clippingPlanes, clipIntersection = material.clipIntersection, clipShadows = material.clipShadows;\n const materialProperties = properties.get(material);\n if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) {\n // there's no local clipping\n if (renderingShadows) // there's no global clipping\n projectPlanes(null);\n else resetGlobalState();\n } else {\n const nGlobal = renderingShadows ? 0 : numGlobalPlanes, lGlobal = nGlobal * 4;\n let dstArray = materialProperties.clippingState || null;\n uniform.value = dstArray; // ensure unique state\n dstArray = projectPlanes(planes, camera, lGlobal, useCache);\n for(let i = 0; i !== lGlobal; ++i)dstArray[i] = globalState[i];\n materialProperties.clippingState = dstArray;\n this.numIntersection = clipIntersection ? this.numPlanes : 0;\n this.numPlanes += nGlobal;\n }\n };\n function resetGlobalState() {\n if (uniform.value !== globalState) {\n uniform.value = globalState;\n uniform.needsUpdate = numGlobalPlanes > 0;\n }\n scope.numPlanes = numGlobalPlanes;\n scope.numIntersection = 0;\n }\n function projectPlanes(planes, camera, dstOffset, skipTransform) {\n const nPlanes = planes !== null ? planes.length : 0;\n let dstArray = null;\n if (nPlanes !== 0) {\n dstArray = uniform.value;\n if (skipTransform !== true || dstArray === null) {\n const flatSize = dstOffset + nPlanes * 4, viewMatrix = camera.matrixWorldInverse;\n viewNormalMatrix.getNormalMatrix(viewMatrix);\n if (dstArray === null || dstArray.length < flatSize) dstArray = new Float32Array(flatSize);\n for(let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4){\n plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);\n plane.normal.toArray(dstArray, i4);\n dstArray[i4 + 3] = plane.constant;\n }\n }\n uniform.value = dstArray;\n uniform.needsUpdate = true;\n }\n scope.numPlanes = nPlanes;\n scope.numIntersection = 0;\n return dstArray;\n }\n}\nfunction $a315ee31802fb757$var$WebGLCubeMaps(renderer) {\n let cubemaps = new WeakMap();\n function mapTextureMapping(texture, mapping) {\n if (mapping === $a315ee31802fb757$export$d64030b316d3b087) texture.mapping = $a315ee31802fb757$export$8759762a6477f2c4;\n else if (mapping === $a315ee31802fb757$export$ee99d97d46898098) texture.mapping = $a315ee31802fb757$export$dc59f8aed047f61d;\n return texture;\n }\n function get(texture) {\n if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {\n const mapping = texture.mapping;\n if (mapping === $a315ee31802fb757$export$d64030b316d3b087 || mapping === $a315ee31802fb757$export$ee99d97d46898098) {\n if (cubemaps.has(texture)) {\n const cubemap = cubemaps.get(texture).texture;\n return mapTextureMapping(cubemap, texture.mapping);\n } else {\n const image = texture.image;\n if (image && image.height > 0) {\n const renderTarget = new $a315ee31802fb757$export$ac386671d651941e(image.height / 2);\n renderTarget.fromEquirectangularTexture(renderer, texture);\n cubemaps.set(texture, renderTarget);\n texture.addEventListener(\"dispose\", onTextureDispose);\n return mapTextureMapping(renderTarget.texture, texture.mapping);\n } else // image not yet ready. try the conversion next frame\n return null;\n }\n }\n }\n return texture;\n }\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n const cubemap = cubemaps.get(texture);\n if (cubemap !== undefined) {\n cubemaps.delete(texture);\n cubemap.dispose();\n }\n }\n function dispose() {\n cubemaps = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nclass $a315ee31802fb757$export$9ebf355ee4ed261b extends $a315ee31802fb757$export$79f141de891a5fed {\n constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000){\n super();\n this.isOrthographicCamera = true;\n this.type = \"OrthographicCamera\";\n this.zoom = 1;\n this.view = null;\n this.left = left;\n this.right = right;\n this.top = top;\n this.bottom = bottom;\n this.near = near;\n this.far = far;\n this.updateProjectionMatrix();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.left = source.left;\n this.right = source.right;\n this.top = source.top;\n this.bottom = source.bottom;\n this.near = source.near;\n this.far = source.far;\n this.zoom = source.zoom;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n return this;\n }\n setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n if (this.view === null) this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n clearViewOffset() {\n if (this.view !== null) this.view.enabled = false;\n this.updateProjectionMatrix();\n }\n updateProjectionMatrix() {\n const dx = (this.right - this.left) / (2 * this.zoom);\n const dy = (this.top - this.bottom) / (2 * this.zoom);\n const cx = (this.right + this.left) / 2;\n const cy = (this.top + this.bottom) / 2;\n let left = cx - dx;\n let right = cx + dx;\n let top = cy + dy;\n let bottom = cy - dy;\n if (this.view !== null && this.view.enabled) {\n const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;\n const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;\n left += scaleW * this.view.offsetX;\n right = left + scaleW * this.view.width;\n top -= scaleH * this.view.offsetY;\n bottom = top - scaleH * this.view.height;\n }\n this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far, this.coordinateSystem);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.zoom = this.zoom;\n data.object.left = this.left;\n data.object.right = this.right;\n data.object.top = this.top;\n data.object.bottom = this.bottom;\n data.object.near = this.near;\n data.object.far = this.far;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n return data;\n }\n}\nconst $a315ee31802fb757$var$LOD_MIN = 4;\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst $a315ee31802fb757$var$EXTRA_LOD_SIGMA = [\n 0.125,\n 0.215,\n 0.35,\n 0.446,\n 0.526,\n 0.582\n];\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst $a315ee31802fb757$var$MAX_SAMPLES = 20;\nconst $a315ee31802fb757$var$_flatCamera = /*@__PURE__*/ new $a315ee31802fb757$export$9ebf355ee4ed261b();\nconst $a315ee31802fb757$var$_clearColor = /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e();\nlet $a315ee31802fb757$var$_oldTarget = null;\n// Golden Ratio\nconst $a315ee31802fb757$var$PHI = (1 + Math.sqrt(5)) / 2;\nconst $a315ee31802fb757$var$INV_PHI = 1 / $a315ee31802fb757$var$PHI;\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst $a315ee31802fb757$var$_axisDirections = [\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(1, 1, 1),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(-1, 1, 1),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(1, 1, -1),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(-1, 1, -1),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, $a315ee31802fb757$var$PHI, $a315ee31802fb757$var$INV_PHI),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(0, $a315ee31802fb757$var$PHI, -$a315ee31802fb757$var$INV_PHI),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699($a315ee31802fb757$var$INV_PHI, 0, $a315ee31802fb757$var$PHI),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(-$a315ee31802fb757$var$INV_PHI, 0, $a315ee31802fb757$var$PHI),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699($a315ee31802fb757$var$PHI, $a315ee31802fb757$var$INV_PHI, 0),\n /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699(-$a315ee31802fb757$var$PHI, $a315ee31802fb757$var$INV_PHI, 0)\n];\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/ class $a315ee31802fb757$export$6add42717753e221 {\n constructor(renderer){\n this._renderer = renderer;\n this._pingPongRenderTarget = null;\n this._lodMax = 0;\n this._cubeSize = 0;\n this._lodPlanes = [];\n this._sizeLods = [];\n this._sigmas = [];\n this._blurMaterial = null;\n this._cubemapMaterial = null;\n this._equirectMaterial = null;\n this._compileMaterial(this._blurMaterial);\n }\n /**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */ fromScene(scene, sigma = 0, near = 0.1, far = 100) {\n $a315ee31802fb757$var$_oldTarget = this._renderer.getRenderTarget();\n this._setSize(256);\n const cubeUVRenderTarget = this._allocateTargets();\n cubeUVRenderTarget.depthBuffer = true;\n this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget);\n if (sigma > 0) this._blur(cubeUVRenderTarget, 0, 0, sigma);\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n /**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */ fromEquirectangular(equirectangular, renderTarget = null) {\n return this._fromTexture(equirectangular, renderTarget);\n }\n /**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */ fromCubemap(cubemap, renderTarget = null) {\n return this._fromTexture(cubemap, renderTarget);\n }\n /**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */ compileCubemapShader() {\n if (this._cubemapMaterial === null) {\n this._cubemapMaterial = $a315ee31802fb757$var$_getCubemapMaterial();\n this._compileMaterial(this._cubemapMaterial);\n }\n }\n /**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */ compileEquirectangularShader() {\n if (this._equirectMaterial === null) {\n this._equirectMaterial = $a315ee31802fb757$var$_getEquirectMaterial();\n this._compileMaterial(this._equirectMaterial);\n }\n }\n /**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */ dispose() {\n this._dispose();\n if (this._cubemapMaterial !== null) this._cubemapMaterial.dispose();\n if (this._equirectMaterial !== null) this._equirectMaterial.dispose();\n }\n // private interface\n _setSize(cubeSize) {\n this._lodMax = Math.floor(Math.log2(cubeSize));\n this._cubeSize = Math.pow(2, this._lodMax);\n }\n _dispose() {\n if (this._blurMaterial !== null) this._blurMaterial.dispose();\n if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose();\n for(let i = 0; i < this._lodPlanes.length; i++)this._lodPlanes[i].dispose();\n }\n _cleanup(outputTarget) {\n this._renderer.setRenderTarget($a315ee31802fb757$var$_oldTarget);\n outputTarget.scissorTest = false;\n $a315ee31802fb757$var$_setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height);\n }\n _fromTexture(texture, renderTarget) {\n if (texture.mapping === $a315ee31802fb757$export$8759762a6477f2c4 || texture.mapping === $a315ee31802fb757$export$dc59f8aed047f61d) this._setSize(texture.image.length === 0 ? 16 : texture.image[0].width || texture.image[0].image.width);\n else this._setSize(texture.image.width / 4);\n $a315ee31802fb757$var$_oldTarget = this._renderer.getRenderTarget();\n const cubeUVRenderTarget = renderTarget || this._allocateTargets();\n this._textureToCubeUV(texture, cubeUVRenderTarget);\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n _allocateTargets() {\n const width = 3 * Math.max(this._cubeSize, 112);\n const height = 4 * this._cubeSize;\n const params = {\n magFilter: $a315ee31802fb757$export$8a72f490b25c56c8,\n minFilter: $a315ee31802fb757$export$8a72f490b25c56c8,\n generateMipmaps: false,\n type: $a315ee31802fb757$export$2697304443f382bc,\n format: $a315ee31802fb757$export$3f8bb04b555a363c,\n colorSpace: $a315ee31802fb757$export$42429b3acfb233a4,\n depthBuffer: false\n };\n const cubeUVRenderTarget = $a315ee31802fb757$var$_createRenderTarget(width, height, params);\n if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height) {\n if (this._pingPongRenderTarget !== null) this._dispose();\n this._pingPongRenderTarget = $a315ee31802fb757$var$_createRenderTarget(width, height, params);\n const { _lodMax: _lodMax } = this;\n ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = $a315ee31802fb757$var$_createPlanes(_lodMax));\n this._blurMaterial = $a315ee31802fb757$var$_getBlurShader(_lodMax, width, height);\n }\n return cubeUVRenderTarget;\n }\n _compileMaterial(material) {\n const tmpMesh = new $a315ee31802fb757$export$e176487c05830cc5(this._lodPlanes[0], material);\n this._renderer.compile(tmpMesh, $a315ee31802fb757$var$_flatCamera);\n }\n _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) {\n const fov = 90;\n const aspect = 1;\n const cubeCamera = new $a315ee31802fb757$export$74e4ae24825f68d7(fov, aspect, near, far);\n const upSign = [\n 1,\n -1,\n 1,\n 1,\n 1,\n 1\n ];\n const forwardSign = [\n 1,\n 1,\n 1,\n -1,\n -1,\n -1\n ];\n const renderer = this._renderer;\n const originalAutoClear = renderer.autoClear;\n const toneMapping = renderer.toneMapping;\n renderer.getClearColor($a315ee31802fb757$var$_clearColor);\n renderer.toneMapping = $a315ee31802fb757$export$9fcb6b4294603b2;\n renderer.autoClear = false;\n const backgroundMaterial = new $a315ee31802fb757$export$55cbcc9b622fe1f5({\n name: \"PMREM.Background\",\n side: $a315ee31802fb757$export$d9f0486e75b5ace,\n depthWrite: false,\n depthTest: false\n });\n const backgroundBox = new $a315ee31802fb757$export$e176487c05830cc5(new $a315ee31802fb757$export$33e43285f7406bd5(), backgroundMaterial);\n let useSolidColor = false;\n const background = scene.background;\n if (background) {\n if (background.isColor) {\n backgroundMaterial.color.copy(background);\n scene.background = null;\n useSolidColor = true;\n }\n } else {\n backgroundMaterial.color.copy($a315ee31802fb757$var$_clearColor);\n useSolidColor = true;\n }\n for(let i = 0; i < 6; i++){\n const col = i % 3;\n if (col === 0) {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(forwardSign[i], 0, 0);\n } else if (col === 1) {\n cubeCamera.up.set(0, 0, upSign[i]);\n cubeCamera.lookAt(0, forwardSign[i], 0);\n } else {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(0, 0, forwardSign[i]);\n }\n const size = this._cubeSize;\n $a315ee31802fb757$var$_setViewport(cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n if (useSolidColor) renderer.render(backgroundBox, cubeCamera);\n renderer.render(scene, cubeCamera);\n }\n backgroundBox.geometry.dispose();\n backgroundBox.material.dispose();\n renderer.toneMapping = toneMapping;\n renderer.autoClear = originalAutoClear;\n scene.background = background;\n }\n _textureToCubeUV(texture, cubeUVRenderTarget) {\n const renderer = this._renderer;\n const isCubeTexture = texture.mapping === $a315ee31802fb757$export$8759762a6477f2c4 || texture.mapping === $a315ee31802fb757$export$dc59f8aed047f61d;\n if (isCubeTexture) {\n if (this._cubemapMaterial === null) this._cubemapMaterial = $a315ee31802fb757$var$_getCubemapMaterial();\n this._cubemapMaterial.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1;\n } else if (this._equirectMaterial === null) this._equirectMaterial = $a315ee31802fb757$var$_getEquirectMaterial();\n const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n const mesh = new $a315ee31802fb757$export$e176487c05830cc5(this._lodPlanes[0], material);\n const uniforms = material.uniforms;\n uniforms[\"envMap\"].value = texture;\n const size = this._cubeSize;\n $a315ee31802fb757$var$_setViewport(cubeUVRenderTarget, 0, 0, 3 * size, 2 * size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n renderer.render(mesh, $a315ee31802fb757$var$_flatCamera);\n }\n _applyPMREM(cubeUVRenderTarget) {\n const renderer = this._renderer;\n const autoClear = renderer.autoClear;\n renderer.autoClear = false;\n for(let i = 1; i < this._lodPlanes.length; i++){\n const sigma = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]);\n const poleAxis = $a315ee31802fb757$var$_axisDirections[(i - 1) % $a315ee31802fb757$var$_axisDirections.length];\n this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis);\n }\n renderer.autoClear = autoClear;\n }\n /**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */ _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {\n const pingPongRenderTarget = this._pingPongRenderTarget;\n this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, \"latitudinal\", poleAxis);\n this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, \"longitudinal\", poleAxis);\n }\n _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {\n const renderer = this._renderer;\n const blurMaterial = this._blurMaterial;\n if (direction !== \"latitudinal\" && direction !== \"longitudinal\") console.error(\"blur direction must be either latitudinal or longitudinal!\");\n // Number of standard deviations at which to cut off the discrete approximation.\n const STANDARD_DEVIATIONS = 3;\n const blurMesh = new $a315ee31802fb757$export$e176487c05830cc5(this._lodPlanes[lodOut], blurMaterial);\n const blurUniforms = blurMaterial.uniforms;\n const pixels = this._sizeLods[lodIn] - 1;\n const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * $a315ee31802fb757$var$MAX_SAMPLES - 1);\n const sigmaPixels = sigmaRadians / radiansPerPixel;\n const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : $a315ee31802fb757$var$MAX_SAMPLES;\n if (samples > $a315ee31802fb757$var$MAX_SAMPLES) console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${$a315ee31802fb757$var$MAX_SAMPLES}`);\n const weights = [];\n let sum = 0;\n for(let i = 0; i < $a315ee31802fb757$var$MAX_SAMPLES; ++i){\n const x = i / sigmaPixels;\n const weight = Math.exp(-x * x / 2);\n weights.push(weight);\n if (i === 0) sum += weight;\n else if (i < samples) sum += 2 * weight;\n }\n for(let i = 0; i < weights.length; i++)weights[i] = weights[i] / sum;\n blurUniforms[\"envMap\"].value = targetIn.texture;\n blurUniforms[\"samples\"].value = samples;\n blurUniforms[\"weights\"].value = weights;\n blurUniforms[\"latitudinal\"].value = direction === \"latitudinal\";\n if (poleAxis) blurUniforms[\"poleAxis\"].value = poleAxis;\n const { _lodMax: _lodMax } = this;\n blurUniforms[\"dTheta\"].value = radiansPerPixel;\n blurUniforms[\"mipInt\"].value = _lodMax - lodIn;\n const outputSize = this._sizeLods[lodOut];\n const x = 3 * outputSize * (lodOut > _lodMax - $a315ee31802fb757$var$LOD_MIN ? lodOut - _lodMax + $a315ee31802fb757$var$LOD_MIN : 0);\n const y = 4 * (this._cubeSize - outputSize);\n $a315ee31802fb757$var$_setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);\n renderer.setRenderTarget(targetOut);\n renderer.render(blurMesh, $a315ee31802fb757$var$_flatCamera);\n }\n}\nfunction $a315ee31802fb757$var$_createPlanes(lodMax) {\n const lodPlanes = [];\n const sizeLods = [];\n const sigmas = [];\n let lod = lodMax;\n const totalLods = lodMax - $a315ee31802fb757$var$LOD_MIN + 1 + $a315ee31802fb757$var$EXTRA_LOD_SIGMA.length;\n for(let i = 0; i < totalLods; i++){\n const sizeLod = Math.pow(2, lod);\n sizeLods.push(sizeLod);\n let sigma = 1.0 / sizeLod;\n if (i > lodMax - $a315ee31802fb757$var$LOD_MIN) sigma = $a315ee31802fb757$var$EXTRA_LOD_SIGMA[i - lodMax + $a315ee31802fb757$var$LOD_MIN - 1];\n else if (i === 0) sigma = 0;\n sigmas.push(sigma);\n const texelSize = 1.0 / (sizeLod - 2);\n const min = -texelSize;\n const max = 1 + texelSize;\n const uv1 = [\n min,\n min,\n max,\n min,\n max,\n max,\n min,\n min,\n max,\n max,\n min,\n max\n ];\n const cubeFaces = 6;\n const vertices = 6;\n const positionSize = 3;\n const uvSize = 2;\n const faceIndexSize = 1;\n const position = new Float32Array(positionSize * vertices * cubeFaces);\n const uv = new Float32Array(uvSize * vertices * cubeFaces);\n const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);\n for(let face = 0; face < cubeFaces; face++){\n const x = face % 3 * 2 / 3 - 1;\n const y = face > 2 ? 0 : -1;\n const coordinates = [\n x,\n y,\n 0,\n x + 2 / 3,\n y,\n 0,\n x + 2 / 3,\n y + 1,\n 0,\n x,\n y,\n 0,\n x + 2 / 3,\n y + 1,\n 0,\n x,\n y + 1,\n 0\n ];\n position.set(coordinates, positionSize * vertices * face);\n uv.set(uv1, uvSize * vertices * face);\n const fill = [\n face,\n face,\n face,\n face,\n face,\n face\n ];\n faceIndex.set(fill, faceIndexSize * vertices * face);\n }\n const planes = new $a315ee31802fb757$export$b7be63a67df8959();\n planes.setAttribute(\"position\", new $a315ee31802fb757$export$8dea267bd6bde117(position, positionSize));\n planes.setAttribute(\"uv\", new $a315ee31802fb757$export$8dea267bd6bde117(uv, uvSize));\n planes.setAttribute(\"faceIndex\", new $a315ee31802fb757$export$8dea267bd6bde117(faceIndex, faceIndexSize));\n lodPlanes.push(planes);\n if (lod > $a315ee31802fb757$var$LOD_MIN) lod--;\n }\n return {\n lodPlanes: lodPlanes,\n sizeLods: sizeLods,\n sigmas: sigmas\n };\n}\nfunction $a315ee31802fb757$var$_createRenderTarget(width, height, params) {\n const cubeUVRenderTarget = new $a315ee31802fb757$export$3c052beb2e51e23f(width, height, params);\n cubeUVRenderTarget.texture.mapping = $a315ee31802fb757$export$dbf3e70ff37af79;\n cubeUVRenderTarget.texture.name = \"PMREM.cubeUv\";\n cubeUVRenderTarget.scissorTest = true;\n return cubeUVRenderTarget;\n}\nfunction $a315ee31802fb757$var$_setViewport(target, x, y, width, height) {\n target.viewport.set(x, y, width, height);\n target.scissor.set(x, y, width, height);\n}\nfunction $a315ee31802fb757$var$_getBlurShader(lodMax, width, height) {\n const weights = new Float32Array($a315ee31802fb757$var$MAX_SAMPLES);\n const poleAxis = new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0);\n const shaderMaterial = new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"SphericalGaussianBlur\",\n defines: {\n \"n\": $a315ee31802fb757$var$MAX_SAMPLES,\n \"CUBEUV_TEXEL_WIDTH\": 1.0 / width,\n \"CUBEUV_TEXEL_HEIGHT\": 1.0 / height,\n \"CUBEUV_MAX_MIP\": `${lodMax}.0`\n },\n uniforms: {\n \"envMap\": {\n value: null\n },\n \"samples\": {\n value: 1\n },\n \"weights\": {\n value: weights\n },\n \"latitudinal\": {\n value: false\n },\n \"dTheta\": {\n value: 0\n },\n \"mipInt\": {\n value: 0\n },\n \"poleAxis\": {\n value: poleAxis\n }\n },\n vertexShader: $a315ee31802fb757$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n blending: $a315ee31802fb757$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n return shaderMaterial;\n}\nfunction $a315ee31802fb757$var$_getEquirectMaterial() {\n return new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"EquirectangularToCubeUV\",\n uniforms: {\n \"envMap\": {\n value: null\n }\n },\n vertexShader: $a315ee31802fb757$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n blending: $a315ee31802fb757$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction $a315ee31802fb757$var$_getCubemapMaterial() {\n return new $a315ee31802fb757$export$83c7d75d550a8b0d({\n name: \"CubemapToCubeUV\",\n uniforms: {\n \"envMap\": {\n value: null\n },\n \"flipEnvMap\": {\n value: -1\n }\n },\n vertexShader: $a315ee31802fb757$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n blending: $a315ee31802fb757$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction $a315ee31802fb757$var$_getCommonVertexShader() {\n return /* glsl */ `\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n}\nfunction $a315ee31802fb757$var$WebGLCubeUVMaps(renderer) {\n let cubeUVmaps = new WeakMap();\n let pmremGenerator = null;\n function get(texture) {\n if (texture && texture.isTexture) {\n const mapping = texture.mapping;\n const isEquirectMap = mapping === $a315ee31802fb757$export$d64030b316d3b087 || mapping === $a315ee31802fb757$export$ee99d97d46898098;\n const isCubeMap = mapping === $a315ee31802fb757$export$8759762a6477f2c4 || mapping === $a315ee31802fb757$export$dc59f8aed047f61d;\n // equirect/cube map to cubeUV conversion\n if (isEquirectMap || isCubeMap) {\n if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) {\n texture.needsPMREMUpdate = false;\n let renderTarget = cubeUVmaps.get(texture);\n if (pmremGenerator === null) pmremGenerator = new $a315ee31802fb757$export$6add42717753e221(renderer);\n renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture, renderTarget) : pmremGenerator.fromCubemap(texture, renderTarget);\n cubeUVmaps.set(texture, renderTarget);\n return renderTarget.texture;\n } else {\n if (cubeUVmaps.has(texture)) return cubeUVmaps.get(texture).texture;\n else {\n const image = texture.image;\n if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) {\n if (pmremGenerator === null) pmremGenerator = new $a315ee31802fb757$export$6add42717753e221(renderer);\n const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture);\n cubeUVmaps.set(texture, renderTarget);\n texture.addEventListener(\"dispose\", onTextureDispose);\n return renderTarget.texture;\n } else // image not yet ready. try the conversion next frame\n return null;\n }\n }\n }\n }\n return texture;\n }\n function isCubeTextureComplete(image) {\n let count = 0;\n const length = 6;\n for(let i = 0; i < length; i++)if (image[i] !== undefined) count++;\n return count === length;\n }\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n const cubemapUV = cubeUVmaps.get(texture);\n if (cubemapUV !== undefined) {\n cubeUVmaps.delete(texture);\n cubemapUV.dispose();\n }\n }\n function dispose() {\n cubeUVmaps = new WeakMap();\n if (pmremGenerator !== null) {\n pmremGenerator.dispose();\n pmremGenerator = null;\n }\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction $a315ee31802fb757$var$WebGLExtensions(gl) {\n const extensions = {};\n function getExtension(name) {\n if (extensions[name] !== undefined) return extensions[name];\n let extension;\n switch(name){\n case \"WEBGL_depth_texture\":\n extension = gl.getExtension(\"WEBGL_depth_texture\") || gl.getExtension(\"MOZ_WEBGL_depth_texture\") || gl.getExtension(\"WEBKIT_WEBGL_depth_texture\");\n break;\n case \"EXT_texture_filter_anisotropic\":\n extension = gl.getExtension(\"EXT_texture_filter_anisotropic\") || gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\") || gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\");\n break;\n case \"WEBGL_compressed_texture_s3tc\":\n extension = gl.getExtension(\"WEBGL_compressed_texture_s3tc\") || gl.getExtension(\"MOZ_WEBGL_compressed_texture_s3tc\") || gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc\");\n break;\n case \"WEBGL_compressed_texture_pvrtc\":\n extension = gl.getExtension(\"WEBGL_compressed_texture_pvrtc\") || gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\");\n break;\n default:\n extension = gl.getExtension(name);\n }\n extensions[name] = extension;\n return extension;\n }\n return {\n has: function(name) {\n return getExtension(name) !== null;\n },\n init: function(capabilities) {\n if (capabilities.isWebGL2) getExtension(\"EXT_color_buffer_float\");\n else {\n getExtension(\"WEBGL_depth_texture\");\n getExtension(\"OES_texture_float\");\n getExtension(\"OES_texture_half_float\");\n getExtension(\"OES_texture_half_float_linear\");\n getExtension(\"OES_standard_derivatives\");\n getExtension(\"OES_element_index_uint\");\n getExtension(\"OES_vertex_array_object\");\n getExtension(\"ANGLE_instanced_arrays\");\n }\n getExtension(\"OES_texture_float_linear\");\n getExtension(\"EXT_color_buffer_half_float\");\n getExtension(\"WEBGL_multisampled_render_to_texture\");\n },\n get: function(name) {\n const extension = getExtension(name);\n if (extension === null) console.warn(\"THREE.WebGLRenderer: \" + name + \" extension not supported.\");\n return extension;\n }\n };\n}\nfunction $a315ee31802fb757$var$WebGLGeometries(gl, attributes, info, bindingStates) {\n const geometries = {};\n const wireframeAttributes = new WeakMap();\n function onGeometryDispose(event) {\n const geometry = event.target;\n if (geometry.index !== null) attributes.remove(geometry.index);\n for(const name in geometry.attributes)attributes.remove(geometry.attributes[name]);\n for(const name in geometry.morphAttributes){\n const array = geometry.morphAttributes[name];\n for(let i = 0, l = array.length; i < l; i++)attributes.remove(array[i]);\n }\n geometry.removeEventListener(\"dispose\", onGeometryDispose);\n delete geometries[geometry.id];\n const attribute = wireframeAttributes.get(geometry);\n if (attribute) {\n attributes.remove(attribute);\n wireframeAttributes.delete(geometry);\n }\n bindingStates.releaseStatesOfGeometry(geometry);\n if (geometry.isInstancedBufferGeometry === true) delete geometry._maxInstanceCount;\n //\n info.memory.geometries--;\n }\n function get(object, geometry) {\n if (geometries[geometry.id] === true) return geometry;\n geometry.addEventListener(\"dispose\", onGeometryDispose);\n geometries[geometry.id] = true;\n info.memory.geometries++;\n return geometry;\n }\n function update(geometry) {\n const geometryAttributes = geometry.attributes;\n // Updating index buffer in VAO now. See WebGLBindingStates.\n for(const name in geometryAttributes)attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER);\n // morph targets\n const morphAttributes = geometry.morphAttributes;\n for(const name in morphAttributes){\n const array = morphAttributes[name];\n for(let i = 0, l = array.length; i < l; i++)attributes.update(array[i], gl.ARRAY_BUFFER);\n }\n }\n function updateWireframeAttribute(geometry) {\n const indices = [];\n const geometryIndex = geometry.index;\n const geometryPosition = geometry.attributes.position;\n let version = 0;\n if (geometryIndex !== null) {\n const array = geometryIndex.array;\n version = geometryIndex.version;\n for(let i = 0, l = array.length; i < l; i += 3){\n const a = array[i + 0];\n const b = array[i + 1];\n const c = array[i + 2];\n indices.push(a, b, b, c, c, a);\n }\n } else if (geometryPosition !== undefined) {\n const array = geometryPosition.array;\n version = geometryPosition.version;\n for(let i = 0, l = array.length / 3 - 1; i < l; i += 3){\n const a = i + 0;\n const b = i + 1;\n const c = i + 2;\n indices.push(a, b, b, c, c, a);\n }\n } else return;\n const attribute = new ($a315ee31802fb757$var$arrayNeedsUint32(indices) ? $a315ee31802fb757$export$7eb8c9fa25cd5bd6 : $a315ee31802fb757$export$640a853f68025f2e)(indices, 1);\n attribute.version = version;\n // Updating index buffer in VAO now. See WebGLBindingStates\n //\n const previousAttribute = wireframeAttributes.get(geometry);\n if (previousAttribute) attributes.remove(previousAttribute);\n //\n wireframeAttributes.set(geometry, attribute);\n }\n function getWireframeAttribute(geometry) {\n const currentAttribute = wireframeAttributes.get(geometry);\n if (currentAttribute) {\n const geometryIndex = geometry.index;\n if (geometryIndex !== null) // if the attribute is obsolete, create a new one\n {\n if (currentAttribute.version < geometryIndex.version) updateWireframeAttribute(geometry);\n }\n } else updateWireframeAttribute(geometry);\n return wireframeAttributes.get(geometry);\n }\n return {\n get: get,\n update: update,\n getWireframeAttribute: getWireframeAttribute\n };\n}\nfunction $a315ee31802fb757$var$WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n let mode;\n function setMode(value) {\n mode = value;\n }\n let type, bytesPerElement;\n function setIndex(value) {\n type = value.type;\n bytesPerElement = value.bytesPerElement;\n }\n function render(start, count) {\n gl.drawElements(mode, count, type, start * bytesPerElement);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n let extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = \"drawElementsInstanced\";\n } else {\n extension = extensions.get(\"ANGLE_instanced_arrays\");\n methodName = \"drawElementsInstancedANGLE\";\n if (extension === null) {\n console.error(\"THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");\n return;\n }\n }\n extension[methodName](mode, count, type, start * bytesPerElement, primcount);\n info.update(count, mode, primcount);\n }\n //\n this.setMode = setMode;\n this.setIndex = setIndex;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction $a315ee31802fb757$var$WebGLInfo(gl) {\n const memory = {\n geometries: 0,\n textures: 0\n };\n const render = {\n frame: 0,\n calls: 0,\n triangles: 0,\n points: 0,\n lines: 0\n };\n function update(count, mode, instanceCount) {\n render.calls++;\n switch(mode){\n case gl.TRIANGLES:\n render.triangles += instanceCount * (count / 3);\n break;\n case gl.LINES:\n render.lines += instanceCount * (count / 2);\n break;\n case gl.LINE_STRIP:\n render.lines += instanceCount * (count - 1);\n break;\n case gl.LINE_LOOP:\n render.lines += instanceCount * count;\n break;\n case gl.POINTS:\n render.points += instanceCount * count;\n break;\n default:\n console.error(\"THREE.WebGLInfo: Unknown draw mode:\", mode);\n break;\n }\n }\n function reset() {\n render.calls = 0;\n render.triangles = 0;\n render.points = 0;\n render.lines = 0;\n }\n return {\n memory: memory,\n render: render,\n programs: null,\n autoReset: true,\n reset: reset,\n update: update\n };\n}\nfunction $a315ee31802fb757$var$numericalSort(a, b) {\n return a[0] - b[0];\n}\nfunction $a315ee31802fb757$var$absNumericalSort(a, b) {\n return Math.abs(b[1]) - Math.abs(a[1]);\n}\nfunction $a315ee31802fb757$var$WebGLMorphtargets(gl, capabilities, textures) {\n const influencesList = {};\n const morphInfluences = new Float32Array(8);\n const morphTextures = new WeakMap();\n const morph = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n const workInfluences = [];\n for(let i = 0; i < 8; i++)workInfluences[i] = [\n i,\n 0\n ];\n function update(object, geometry, program) {\n const objectInfluences = object.morphTargetInfluences;\n if (capabilities.isWebGL2 === true) {\n // instead of using attributes, the WebGL 2 code path encodes morph targets\n // into an array of data textures. Each layer represents a single morph target.\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n let entry = morphTextures.get(geometry);\n if (entry === undefined || entry.count !== morphTargetsCount) {\n if (entry !== undefined) entry.texture.dispose();\n const hasMorphPosition = geometry.morphAttributes.position !== undefined;\n const hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n const hasMorphColors = geometry.morphAttributes.color !== undefined;\n const morphTargets = geometry.morphAttributes.position || [];\n const morphNormals = geometry.morphAttributes.normal || [];\n const morphColors = geometry.morphAttributes.color || [];\n let vertexDataCount = 0;\n if (hasMorphPosition === true) vertexDataCount = 1;\n if (hasMorphNormals === true) vertexDataCount = 2;\n if (hasMorphColors === true) vertexDataCount = 3;\n let width = geometry.attributes.position.count * vertexDataCount;\n let height = 1;\n if (width > capabilities.maxTextureSize) {\n height = Math.ceil(width / capabilities.maxTextureSize);\n width = capabilities.maxTextureSize;\n }\n const buffer = new Float32Array(width * height * 4 * morphTargetsCount);\n const texture = new $a315ee31802fb757$export$dfac6c8e811406a3(buffer, width, height, morphTargetsCount);\n texture.type = $a315ee31802fb757$export$f6d331659b644596;\n texture.needsUpdate = true;\n // fill buffer\n const vertexDataStride = vertexDataCount * 4;\n for(let i = 0; i < morphTargetsCount; i++){\n const morphTarget = morphTargets[i];\n const morphNormal = morphNormals[i];\n const morphColor = morphColors[i];\n const offset = width * height * 4 * i;\n for(let j = 0; j < morphTarget.count; j++){\n const stride = j * vertexDataStride;\n if (hasMorphPosition === true) {\n morph.fromBufferAttribute(morphTarget, j);\n buffer[offset + stride + 0] = morph.x;\n buffer[offset + stride + 1] = morph.y;\n buffer[offset + stride + 2] = morph.z;\n buffer[offset + stride + 3] = 0;\n }\n if (hasMorphNormals === true) {\n morph.fromBufferAttribute(morphNormal, j);\n buffer[offset + stride + 4] = morph.x;\n buffer[offset + stride + 5] = morph.y;\n buffer[offset + stride + 6] = morph.z;\n buffer[offset + stride + 7] = 0;\n }\n if (hasMorphColors === true) {\n morph.fromBufferAttribute(morphColor, j);\n buffer[offset + stride + 8] = morph.x;\n buffer[offset + stride + 9] = morph.y;\n buffer[offset + stride + 10] = morph.z;\n buffer[offset + stride + 11] = morphColor.itemSize === 4 ? morph.w : 1;\n }\n }\n }\n entry = {\n count: morphTargetsCount,\n texture: texture,\n size: new $a315ee31802fb757$export$c977b3e384af9ae1(width, height)\n };\n morphTextures.set(geometry, entry);\n function disposeTexture() {\n texture.dispose();\n morphTextures.delete(geometry);\n geometry.removeEventListener(\"dispose\", disposeTexture);\n }\n geometry.addEventListener(\"dispose\", disposeTexture);\n }\n //\n let morphInfluencesSum = 0;\n for(let i = 0; i < objectInfluences.length; i++)morphInfluencesSum += objectInfluences[i];\n const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n program.getUniforms().setValue(gl, \"morphTargetBaseInfluence\", morphBaseInfluence);\n program.getUniforms().setValue(gl, \"morphTargetInfluences\", objectInfluences);\n program.getUniforms().setValue(gl, \"morphTargetsTexture\", entry.texture, textures);\n program.getUniforms().setValue(gl, \"morphTargetsTextureSize\", entry.size);\n } else {\n // When object doesn't have morph target influences defined, we treat it as a 0-length array\n // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n const length = objectInfluences === undefined ? 0 : objectInfluences.length;\n let influences = influencesList[geometry.id];\n if (influences === undefined || influences.length !== length) {\n // initialise list\n influences = [];\n for(let i = 0; i < length; i++)influences[i] = [\n i,\n 0\n ];\n influencesList[geometry.id] = influences;\n }\n // Collect influences\n for(let i = 0; i < length; i++){\n const influence = influences[i];\n influence[0] = i;\n influence[1] = objectInfluences[i];\n }\n influences.sort($a315ee31802fb757$var$absNumericalSort);\n for(let i = 0; i < 8; i++)if (i < length && influences[i][1]) {\n workInfluences[i][0] = influences[i][0];\n workInfluences[i][1] = influences[i][1];\n } else {\n workInfluences[i][0] = Number.MAX_SAFE_INTEGER;\n workInfluences[i][1] = 0;\n }\n workInfluences.sort($a315ee31802fb757$var$numericalSort);\n const morphTargets = geometry.morphAttributes.position;\n const morphNormals = geometry.morphAttributes.normal;\n let morphInfluencesSum = 0;\n for(let i = 0; i < 8; i++){\n const influence = workInfluences[i];\n const index = influence[0];\n const value = influence[1];\n if (index !== Number.MAX_SAFE_INTEGER && value) {\n if (morphTargets && geometry.getAttribute(\"morphTarget\" + i) !== morphTargets[index]) geometry.setAttribute(\"morphTarget\" + i, morphTargets[index]);\n if (morphNormals && geometry.getAttribute(\"morphNormal\" + i) !== morphNormals[index]) geometry.setAttribute(\"morphNormal\" + i, morphNormals[index]);\n morphInfluences[i] = value;\n morphInfluencesSum += value;\n } else {\n if (morphTargets && geometry.hasAttribute(\"morphTarget\" + i) === true) geometry.deleteAttribute(\"morphTarget\" + i);\n if (morphNormals && geometry.hasAttribute(\"morphNormal\" + i) === true) geometry.deleteAttribute(\"morphNormal\" + i);\n morphInfluences[i] = 0;\n }\n }\n // GLSL shader uses formula baseinfluence * base + sum(target * influence)\n // This allows us to switch between absolute morphs and relative morphs without changing shader code\n // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n program.getUniforms().setValue(gl, \"morphTargetBaseInfluence\", morphBaseInfluence);\n program.getUniforms().setValue(gl, \"morphTargetInfluences\", morphInfluences);\n }\n }\n return {\n update: update\n };\n}\nfunction $a315ee31802fb757$var$WebGLObjects(gl, geometries, attributes, info) {\n let updateMap = new WeakMap();\n function update(object) {\n const frame = info.render.frame;\n const geometry = object.geometry;\n const buffergeometry = geometries.get(object, geometry);\n // Update once per frame\n if (updateMap.get(buffergeometry) !== frame) {\n geometries.update(buffergeometry);\n updateMap.set(buffergeometry, frame);\n }\n if (object.isInstancedMesh) {\n if (object.hasEventListener(\"dispose\", onInstancedMeshDispose) === false) object.addEventListener(\"dispose\", onInstancedMeshDispose);\n if (updateMap.get(object) !== frame) {\n attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER);\n if (object.instanceColor !== null) attributes.update(object.instanceColor, gl.ARRAY_BUFFER);\n updateMap.set(object, frame);\n }\n }\n if (object.isSkinnedMesh) {\n const skeleton = object.skeleton;\n if (updateMap.get(skeleton) !== frame) {\n skeleton.update();\n updateMap.set(skeleton, frame);\n }\n }\n return buffergeometry;\n }\n function dispose() {\n updateMap = new WeakMap();\n }\n function onInstancedMeshDispose(event) {\n const instancedMesh = event.target;\n instancedMesh.removeEventListener(\"dispose\", onInstancedMeshDispose);\n attributes.remove(instancedMesh.instanceMatrix);\n if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor);\n }\n return {\n update: update,\n dispose: dispose\n };\n}\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */ const $a315ee31802fb757$var$emptyTexture = /*@__PURE__*/ new $a315ee31802fb757$export$5431306cf43de24a();\nconst $a315ee31802fb757$var$emptyArrayTexture = /*@__PURE__*/ new $a315ee31802fb757$export$dfac6c8e811406a3();\nconst $a315ee31802fb757$var$empty3dTexture = /*@__PURE__*/ new $a315ee31802fb757$export$d7a3086320f856db();\nconst $a315ee31802fb757$var$emptyCubeTexture = /*@__PURE__*/ new $a315ee31802fb757$export$ee2e5a18258a4049();\n// --- Utilities ---\n// Array Caches (provide typed arrays for temporary by size)\nconst $a315ee31802fb757$var$arrayCacheF32 = [];\nconst $a315ee31802fb757$var$arrayCacheI32 = [];\n// Float32Array caches used for uploading Matrix uniforms\nconst $a315ee31802fb757$var$mat4array = new Float32Array(16);\nconst $a315ee31802fb757$var$mat3array = new Float32Array(9);\nconst $a315ee31802fb757$var$mat2array = new Float32Array(4);\n// Flattening for arrays of vectors and matrices\nfunction $a315ee31802fb757$var$flatten(array, nBlocks, blockSize) {\n const firstElem = array[0];\n if (firstElem <= 0 || firstElem > 0) return array;\n // unoptimized: ! isNaN( firstElem )\n // see http://jacksondunstan.com/articles/983\n const n = nBlocks * blockSize;\n let r = $a315ee31802fb757$var$arrayCacheF32[n];\n if (r === undefined) {\n r = new Float32Array(n);\n $a315ee31802fb757$var$arrayCacheF32[n] = r;\n }\n if (nBlocks !== 0) {\n firstElem.toArray(r, 0);\n for(let i = 1, offset = 0; i !== nBlocks; ++i){\n offset += blockSize;\n array[i].toArray(r, offset);\n }\n }\n return r;\n}\nfunction $a315ee31802fb757$var$arraysEqual(a, b) {\n if (a.length !== b.length) return false;\n for(let i = 0, l = a.length; i < l; i++){\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\nfunction $a315ee31802fb757$var$copyArray(a, b) {\n for(let i = 0, l = b.length; i < l; i++)a[i] = b[i];\n}\n// Texture unit allocation\nfunction $a315ee31802fb757$var$allocTexUnits(textures, n) {\n let r = $a315ee31802fb757$var$arrayCacheI32[n];\n if (r === undefined) {\n r = new Int32Array(n);\n $a315ee31802fb757$var$arrayCacheI32[n] = r;\n }\n for(let i = 0; i !== n; ++i)r[i] = textures.allocateTextureUnit();\n return r;\n}\n// --- Setters ---\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n// Single scalar\nfunction $a315ee31802fb757$var$setValueV1f(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1f(this.addr, v);\n cache[0] = v;\n}\n// Single float vector (from flat array or THREE.VectorN)\nfunction $a315ee31802fb757$var$setValueV2f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2f(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform2fv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV3f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3f(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else if (v.r !== undefined) {\n if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) {\n gl.uniform3f(this.addr, v.r, v.g, v.b);\n cache[0] = v.r;\n cache[1] = v.g;\n cache[2] = v.b;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform3fv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV4f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4f(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform4fv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\n// Single matrix (from flat array or THREE.MatrixN)\nfunction $a315ee31802fb757$var$setValueM2(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix2fv(this.addr, false, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, elements)) return;\n $a315ee31802fb757$var$mat2array.set(elements);\n gl.uniformMatrix2fv(this.addr, false, $a315ee31802fb757$var$mat2array);\n $a315ee31802fb757$var$copyArray(cache, elements);\n }\n}\nfunction $a315ee31802fb757$var$setValueM3(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix3fv(this.addr, false, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, elements)) return;\n $a315ee31802fb757$var$mat3array.set(elements);\n gl.uniformMatrix3fv(this.addr, false, $a315ee31802fb757$var$mat3array);\n $a315ee31802fb757$var$copyArray(cache, elements);\n }\n}\nfunction $a315ee31802fb757$var$setValueM4(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix4fv(this.addr, false, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, elements)) return;\n $a315ee31802fb757$var$mat4array.set(elements);\n gl.uniformMatrix4fv(this.addr, false, $a315ee31802fb757$var$mat4array);\n $a315ee31802fb757$var$copyArray(cache, elements);\n }\n}\n// Single integer / boolean\nfunction $a315ee31802fb757$var$setValueV1i(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1i(this.addr, v);\n cache[0] = v;\n}\n// Single integer / boolean vector (from flat array or THREE.VectorN)\nfunction $a315ee31802fb757$var$setValueV2i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2i(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform2iv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV3i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3i(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform3iv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV4i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform4iv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\n// Single unsigned integer\nfunction $a315ee31802fb757$var$setValueV1ui(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1ui(this.addr, v);\n cache[0] = v;\n}\n// Single unsigned integer vector (from flat array or THREE.VectorN)\nfunction $a315ee31802fb757$var$setValueV2ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2ui(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform2uiv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV3ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3ui(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform3uiv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\nfunction $a315ee31802fb757$var$setValueV4ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($a315ee31802fb757$var$arraysEqual(cache, v)) return;\n gl.uniform4uiv(this.addr, v);\n $a315ee31802fb757$var$copyArray(cache, v);\n }\n}\n// Single texture (2D / Cube)\nfunction $a315ee31802fb757$var$setValueT1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2D(v || $a315ee31802fb757$var$emptyTexture, unit);\n}\nfunction $a315ee31802fb757$var$setValueT3D1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture3D(v || $a315ee31802fb757$var$empty3dTexture, unit);\n}\nfunction $a315ee31802fb757$var$setValueT6(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTextureCube(v || $a315ee31802fb757$var$emptyCubeTexture, unit);\n}\nfunction $a315ee31802fb757$var$setValueT2DArray1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2DArray(v || $a315ee31802fb757$var$emptyArrayTexture, unit);\n}\n// Helper to pick the right setter for the singular case\nfunction $a315ee31802fb757$var$getSingularSetter(type) {\n switch(type){\n case 0x1406:\n return $a315ee31802fb757$var$setValueV1f; // FLOAT\n case 0x8b50:\n return $a315ee31802fb757$var$setValueV2f; // _VEC2\n case 0x8b51:\n return $a315ee31802fb757$var$setValueV3f; // _VEC3\n case 0x8b52:\n return $a315ee31802fb757$var$setValueV4f; // _VEC4\n case 0x8b5a:\n return $a315ee31802fb757$var$setValueM2; // _MAT2\n case 0x8b5b:\n return $a315ee31802fb757$var$setValueM3; // _MAT3\n case 0x8b5c:\n return $a315ee31802fb757$var$setValueM4; // _MAT4\n case 0x1404:\n case 0x8b56:\n return $a315ee31802fb757$var$setValueV1i; // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return $a315ee31802fb757$var$setValueV2i; // _VEC2\n case 0x8b54:\n case 0x8b58:\n return $a315ee31802fb757$var$setValueV3i; // _VEC3\n case 0x8b55:\n case 0x8b59:\n return $a315ee31802fb757$var$setValueV4i; // _VEC4\n case 0x1405:\n return $a315ee31802fb757$var$setValueV1ui; // UINT\n case 0x8dc6:\n return $a315ee31802fb757$var$setValueV2ui; // _VEC2\n case 0x8dc7:\n return $a315ee31802fb757$var$setValueV3ui; // _VEC3\n case 0x8dc8:\n return $a315ee31802fb757$var$setValueV4ui; // _VEC4\n case 0x8b5e:\n case 0x8d66:\n case 0x8dca:\n case 0x8dd2:\n case 0x8b62:\n return $a315ee31802fb757$var$setValueT1;\n case 0x8b5f:\n case 0x8dcb:\n case 0x8dd3:\n return $a315ee31802fb757$var$setValueT3D1;\n case 0x8b60:\n case 0x8dcc:\n case 0x8dd4:\n case 0x8dc5:\n return $a315ee31802fb757$var$setValueT6;\n case 0x8dc1:\n case 0x8dcf:\n case 0x8dd7:\n case 0x8dc4:\n return $a315ee31802fb757$var$setValueT2DArray1;\n }\n}\n// Array of scalars\nfunction $a315ee31802fb757$var$setValueV1fArray(gl, v) {\n gl.uniform1fv(this.addr, v);\n}\n// Array of vectors (from flat array or array of THREE.VectorN)\nfunction $a315ee31802fb757$var$setValueV2fArray(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 2);\n gl.uniform2fv(this.addr, data);\n}\nfunction $a315ee31802fb757$var$setValueV3fArray(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 3);\n gl.uniform3fv(this.addr, data);\n}\nfunction $a315ee31802fb757$var$setValueV4fArray(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 4);\n gl.uniform4fv(this.addr, data);\n}\n// Array of matrices (from flat array or array of THREE.MatrixN)\nfunction $a315ee31802fb757$var$setValueM2Array(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 4);\n gl.uniformMatrix2fv(this.addr, false, data);\n}\nfunction $a315ee31802fb757$var$setValueM3Array(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 9);\n gl.uniformMatrix3fv(this.addr, false, data);\n}\nfunction $a315ee31802fb757$var$setValueM4Array(gl, v) {\n const data = $a315ee31802fb757$var$flatten(v, this.size, 16);\n gl.uniformMatrix4fv(this.addr, false, data);\n}\n// Array of integer / boolean\nfunction $a315ee31802fb757$var$setValueV1iArray(gl, v) {\n gl.uniform1iv(this.addr, v);\n}\n// Array of integer / boolean vectors (from flat array)\nfunction $a315ee31802fb757$var$setValueV2iArray(gl, v) {\n gl.uniform2iv(this.addr, v);\n}\nfunction $a315ee31802fb757$var$setValueV3iArray(gl, v) {\n gl.uniform3iv(this.addr, v);\n}\nfunction $a315ee31802fb757$var$setValueV4iArray(gl, v) {\n gl.uniform4iv(this.addr, v);\n}\n// Array of unsigned integer\nfunction $a315ee31802fb757$var$setValueV1uiArray(gl, v) {\n gl.uniform1uiv(this.addr, v);\n}\n// Array of unsigned integer vectors (from flat array)\nfunction $a315ee31802fb757$var$setValueV2uiArray(gl, v) {\n gl.uniform2uiv(this.addr, v);\n}\nfunction $a315ee31802fb757$var$setValueV3uiArray(gl, v) {\n gl.uniform3uiv(this.addr, v);\n}\nfunction $a315ee31802fb757$var$setValueV4uiArray(gl, v) {\n gl.uniform4uiv(this.addr, v);\n}\n// Array of textures (2D / 3D / Cube / 2DArray)\nfunction $a315ee31802fb757$var$setValueT1Array(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $a315ee31802fb757$var$allocTexUnits(textures, n);\n if (!$a315ee31802fb757$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $a315ee31802fb757$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture2D(v[i] || $a315ee31802fb757$var$emptyTexture, units[i]);\n}\nfunction $a315ee31802fb757$var$setValueT3DArray(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $a315ee31802fb757$var$allocTexUnits(textures, n);\n if (!$a315ee31802fb757$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $a315ee31802fb757$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture3D(v[i] || $a315ee31802fb757$var$empty3dTexture, units[i]);\n}\nfunction $a315ee31802fb757$var$setValueT6Array(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $a315ee31802fb757$var$allocTexUnits(textures, n);\n if (!$a315ee31802fb757$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $a315ee31802fb757$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTextureCube(v[i] || $a315ee31802fb757$var$emptyCubeTexture, units[i]);\n}\nfunction $a315ee31802fb757$var$setValueT2DArrayArray(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $a315ee31802fb757$var$allocTexUnits(textures, n);\n if (!$a315ee31802fb757$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $a315ee31802fb757$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture2DArray(v[i] || $a315ee31802fb757$var$emptyArrayTexture, units[i]);\n}\n// Helper to pick the right setter for a pure (bottom-level) array\nfunction $a315ee31802fb757$var$getPureArraySetter(type) {\n switch(type){\n case 0x1406:\n return $a315ee31802fb757$var$setValueV1fArray; // FLOAT\n case 0x8b50:\n return $a315ee31802fb757$var$setValueV2fArray; // _VEC2\n case 0x8b51:\n return $a315ee31802fb757$var$setValueV3fArray; // _VEC3\n case 0x8b52:\n return $a315ee31802fb757$var$setValueV4fArray; // _VEC4\n case 0x8b5a:\n return $a315ee31802fb757$var$setValueM2Array; // _MAT2\n case 0x8b5b:\n return $a315ee31802fb757$var$setValueM3Array; // _MAT3\n case 0x8b5c:\n return $a315ee31802fb757$var$setValueM4Array; // _MAT4\n case 0x1404:\n case 0x8b56:\n return $a315ee31802fb757$var$setValueV1iArray; // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return $a315ee31802fb757$var$setValueV2iArray; // _VEC2\n case 0x8b54:\n case 0x8b58:\n return $a315ee31802fb757$var$setValueV3iArray; // _VEC3\n case 0x8b55:\n case 0x8b59:\n return $a315ee31802fb757$var$setValueV4iArray; // _VEC4\n case 0x1405:\n return $a315ee31802fb757$var$setValueV1uiArray; // UINT\n case 0x8dc6:\n return $a315ee31802fb757$var$setValueV2uiArray; // _VEC2\n case 0x8dc7:\n return $a315ee31802fb757$var$setValueV3uiArray; // _VEC3\n case 0x8dc8:\n return $a315ee31802fb757$var$setValueV4uiArray; // _VEC4\n case 0x8b5e:\n case 0x8d66:\n case 0x8dca:\n case 0x8dd2:\n case 0x8b62:\n return $a315ee31802fb757$var$setValueT1Array;\n case 0x8b5f:\n case 0x8dcb:\n case 0x8dd3:\n return $a315ee31802fb757$var$setValueT3DArray;\n case 0x8b60:\n case 0x8dcc:\n case 0x8dd4:\n case 0x8dc5:\n return $a315ee31802fb757$var$setValueT6Array;\n case 0x8dc1:\n case 0x8dcf:\n case 0x8dd7:\n case 0x8dc4:\n return $a315ee31802fb757$var$setValueT2DArrayArray;\n }\n}\n// --- Uniform Classes ---\nclass $a315ee31802fb757$var$SingleUniform {\n constructor(id, activeInfo, addr){\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.setValue = $a315ee31802fb757$var$getSingularSetter(activeInfo.type);\n // this.path = activeInfo.name; // DEBUG\n }\n}\nclass $a315ee31802fb757$var$PureArrayUniform {\n constructor(id, activeInfo, addr){\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.size = activeInfo.size;\n this.setValue = $a315ee31802fb757$var$getPureArraySetter(activeInfo.type);\n // this.path = activeInfo.name; // DEBUG\n }\n}\nclass $a315ee31802fb757$var$StructuredUniform {\n constructor(id){\n this.id = id;\n this.seq = [];\n this.map = {};\n }\n setValue(gl, value, textures) {\n const seq = this.seq;\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i];\n u.setValue(gl, value[u.id], textures);\n }\n }\n}\n// --- Top-level ---\n// Parser - builds up the property tree from the path strings\nconst $a315ee31802fb757$var$RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\nfunction $a315ee31802fb757$var$addUniform(container, uniformObject) {\n container.seq.push(uniformObject);\n container.map[uniformObject.id] = uniformObject;\n}\nfunction $a315ee31802fb757$var$parseUniform(activeInfo, addr, container) {\n const path = activeInfo.name, pathLength = path.length;\n // reset RegExp object, because of the early exit of a previous run\n $a315ee31802fb757$var$RePathPart.lastIndex = 0;\n while(true){\n const match = $a315ee31802fb757$var$RePathPart.exec(path), matchEnd = $a315ee31802fb757$var$RePathPart.lastIndex;\n let id = match[1];\n const idIsIndex = match[2] === \"]\", subscript = match[3];\n if (idIsIndex) id = id | 0; // convert to integer\n if (subscript === undefined || subscript === \"[\" && matchEnd + 2 === pathLength) {\n // bare name or \"pure\" bottom-level array \"[0]\" suffix\n $a315ee31802fb757$var$addUniform(container, subscript === undefined ? new $a315ee31802fb757$var$SingleUniform(id, activeInfo, addr) : new $a315ee31802fb757$var$PureArrayUniform(id, activeInfo, addr));\n break;\n } else {\n // step into inner node / create it in case it doesn't exist\n const map = container.map;\n let next = map[id];\n if (next === undefined) {\n next = new $a315ee31802fb757$var$StructuredUniform(id);\n $a315ee31802fb757$var$addUniform(container, next);\n }\n container = next;\n }\n }\n}\n// Root Container\nclass $a315ee31802fb757$var$WebGLUniforms {\n constructor(gl, program){\n this.seq = [];\n this.map = {};\n const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n for(let i = 0; i < n; ++i){\n const info = gl.getActiveUniform(program, i), addr = gl.getUniformLocation(program, info.name);\n $a315ee31802fb757$var$parseUniform(info, addr, this);\n }\n }\n setValue(gl, name, value, textures) {\n const u = this.map[name];\n if (u !== undefined) u.setValue(gl, value, textures);\n }\n setOptional(gl, object, name) {\n const v = object[name];\n if (v !== undefined) this.setValue(gl, name, v);\n }\n static upload(gl, seq, values, textures) {\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i], v = values[u.id];\n if (v.needsUpdate !== false) // note: always updating when .needsUpdate is undefined\n u.setValue(gl, v.value, textures);\n }\n }\n static seqWithValue(seq, values) {\n const r = [];\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i];\n if (u.id in values) r.push(u);\n }\n return r;\n }\n}\nfunction $a315ee31802fb757$var$WebGLShader(gl, type, string) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, string);\n gl.compileShader(shader);\n return shader;\n}\nlet $a315ee31802fb757$var$programIdCount = 0;\nfunction $a315ee31802fb757$var$handleSource(string, errorLine) {\n const lines = string.split(\"\\n\");\n const lines2 = [];\n const from = Math.max(errorLine - 6, 0);\n const to = Math.min(errorLine + 6, lines.length);\n for(let i = from; i < to; i++){\n const line = i + 1;\n lines2.push(`${line === errorLine ? \">\" : \" \"} ${line}: ${lines[i]}`);\n }\n return lines2.join(\"\\n\");\n}\nfunction $a315ee31802fb757$var$getEncodingComponents(colorSpace1) {\n switch(colorSpace1){\n case $a315ee31802fb757$export$42429b3acfb233a4:\n return [\n \"Linear\",\n \"( value )\"\n ];\n case $a315ee31802fb757$export$561f394b24edfcaa:\n return [\n \"sRGB\",\n \"( value )\"\n ];\n default:\n console.warn(\"THREE.WebGLProgram: Unsupported color space:\", colorSpace1);\n return [\n \"Linear\",\n \"( value )\"\n ];\n }\n}\nfunction $a315ee31802fb757$var$getShaderErrors(gl, shader, type) {\n const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n const errors = gl.getShaderInfoLog(shader).trim();\n if (status && errors === \"\") return \"\";\n const errorMatches = /ERROR: 0:(\\d+)/.exec(errors);\n if (errorMatches) {\n // --enable-privileged-webgl-extension\n // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n const errorLine = parseInt(errorMatches[1]);\n return type.toUpperCase() + \"\\n\\n\" + errors + \"\\n\\n\" + $a315ee31802fb757$var$handleSource(gl.getShaderSource(shader), errorLine);\n } else return errors;\n}\nfunction $a315ee31802fb757$var$getTexelEncodingFunction(functionName, colorSpace1) {\n const components = $a315ee31802fb757$var$getEncodingComponents(colorSpace1);\n return \"vec4 \" + functionName + \"( vec4 value ) { return LinearTo\" + components[0] + components[1] + \"; }\";\n}\nfunction $a315ee31802fb757$var$getToneMappingFunction(functionName, toneMapping) {\n let toneMappingName;\n switch(toneMapping){\n case $a315ee31802fb757$export$98f52c2a46c598ca:\n toneMappingName = \"Linear\";\n break;\n case $a315ee31802fb757$export$74b25e54b3bcd548:\n toneMappingName = \"Reinhard\";\n break;\n case $a315ee31802fb757$export$932b3dd283d4a366:\n toneMappingName = \"OptimizedCineon\";\n break;\n case $a315ee31802fb757$export$a0d98fe6d7e4af64:\n toneMappingName = \"ACESFilmic\";\n break;\n case $a315ee31802fb757$export$2c7b09c1e9abfb5e:\n toneMappingName = \"Custom\";\n break;\n default:\n console.warn(\"THREE.WebGLProgram: Unsupported toneMapping:\", toneMapping);\n toneMappingName = \"Linear\";\n }\n return \"vec3 \" + functionName + \"( vec3 color ) { return \" + toneMappingName + \"ToneMapping( color ); }\";\n}\nfunction $a315ee31802fb757$var$generateExtensions(parameters) {\n const chunks = [\n parameters.extensionDerivatives || !!parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === \"physical\" ? \"#extension GL_OES_standard_derivatives : enable\" : \"\",\n (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? \"#extension GL_EXT_frag_depth : enable\" : \"\",\n parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? \"#extension GL_EXT_draw_buffers : require\" : \"\",\n (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? \"#extension GL_EXT_shader_texture_lod : enable\" : \"\"\n ];\n return chunks.filter($a315ee31802fb757$var$filterEmptyLine).join(\"\\n\");\n}\nfunction $a315ee31802fb757$var$generateDefines(defines) {\n const chunks = [];\n for(const name in defines){\n const value = defines[name];\n if (value === false) continue;\n chunks.push(\"#define \" + name + \" \" + value);\n }\n return chunks.join(\"\\n\");\n}\nfunction $a315ee31802fb757$var$fetchAttributeLocations(gl, program) {\n const attributes = {};\n const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n for(let i = 0; i < n; i++){\n const info = gl.getActiveAttrib(program, i);\n const name = info.name;\n let locationSize = 1;\n if (info.type === gl.FLOAT_MAT2) locationSize = 2;\n if (info.type === gl.FLOAT_MAT3) locationSize = 3;\n if (info.type === gl.FLOAT_MAT4) locationSize = 4;\n // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n attributes[name] = {\n type: info.type,\n location: gl.getAttribLocation(program, name),\n locationSize: locationSize\n };\n }\n return attributes;\n}\nfunction $a315ee31802fb757$var$filterEmptyLine(string) {\n return string !== \"\";\n}\nfunction $a315ee31802fb757$var$replaceLightNums(string, parameters) {\n const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);\n}\nfunction $a315ee31802fb757$var$replaceClippingPlaneNums(string, parameters) {\n return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);\n}\n// Resolve Includes\nconst $a315ee31802fb757$var$includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\nfunction $a315ee31802fb757$var$resolveIncludes(string) {\n return string.replace($a315ee31802fb757$var$includePattern, $a315ee31802fb757$var$includeReplacer);\n}\nconst $a315ee31802fb757$var$shaderChunkMap = new Map([\n [\n \"encodings_fragment\",\n \"colorspace_fragment\"\n ],\n [\n \"encodings_pars_fragment\",\n \"colorspace_pars_fragment\"\n ],\n [\n \"output_fragment\",\n \"opaque_fragment\"\n ]\n]);\nfunction $a315ee31802fb757$var$includeReplacer(match, include) {\n let string = $a315ee31802fb757$export$955f9f2e84c43c8b[include];\n if (string === undefined) {\n const newInclude = $a315ee31802fb757$var$shaderChunkMap.get(include);\n if (newInclude !== undefined) {\n string = $a315ee31802fb757$export$955f9f2e84c43c8b[newInclude];\n console.warn('THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude);\n } else throw new Error(\"Can not resolve #include <\" + include + \">\");\n }\n return $a315ee31802fb757$var$resolveIncludes(string);\n}\n// Unroll Loops\nconst $a315ee31802fb757$var$unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\nfunction $a315ee31802fb757$var$unrollLoops(string) {\n return string.replace($a315ee31802fb757$var$unrollLoopPattern, $a315ee31802fb757$var$loopReplacer);\n}\nfunction $a315ee31802fb757$var$loopReplacer(match, start, end, snippet) {\n let string = \"\";\n for(let i = parseInt(start); i < parseInt(end); i++)string += snippet.replace(/\\[\\s*i\\s*\\]/g, \"[ \" + i + \" ]\").replace(/UNROLLED_LOOP_INDEX/g, i);\n return string;\n}\n//\nfunction $a315ee31802fb757$var$generatePrecision(parameters) {\n let precisionstring = \"precision \" + parameters.precision + \" float;\\nprecision \" + parameters.precision + \" int;\";\n if (parameters.precision === \"highp\") precisionstring += \"\\n#define HIGH_PRECISION\";\n else if (parameters.precision === \"mediump\") precisionstring += \"\\n#define MEDIUM_PRECISION\";\n else if (parameters.precision === \"lowp\") precisionstring += \"\\n#define LOW_PRECISION\";\n return precisionstring;\n}\nfunction $a315ee31802fb757$var$generateShadowMapTypeDefine(parameters) {\n let shadowMapTypeDefine = \"SHADOWMAP_TYPE_BASIC\";\n if (parameters.shadowMapType === $a315ee31802fb757$export$5813f879eee7cd88) shadowMapTypeDefine = \"SHADOWMAP_TYPE_PCF\";\n else if (parameters.shadowMapType === $a315ee31802fb757$export$a47c4b43a1be34f0) shadowMapTypeDefine = \"SHADOWMAP_TYPE_PCF_SOFT\";\n else if (parameters.shadowMapType === $a315ee31802fb757$export$896ae1ade6c829c4) shadowMapTypeDefine = \"SHADOWMAP_TYPE_VSM\";\n return shadowMapTypeDefine;\n}\nfunction $a315ee31802fb757$var$generateEnvMapTypeDefine(parameters) {\n let envMapTypeDefine = \"ENVMAP_TYPE_CUBE\";\n if (parameters.envMap) switch(parameters.envMapMode){\n case $a315ee31802fb757$export$8759762a6477f2c4:\n case $a315ee31802fb757$export$dc59f8aed047f61d:\n envMapTypeDefine = \"ENVMAP_TYPE_CUBE\";\n break;\n case $a315ee31802fb757$export$dbf3e70ff37af79:\n envMapTypeDefine = \"ENVMAP_TYPE_CUBE_UV\";\n break;\n }\n return envMapTypeDefine;\n}\nfunction $a315ee31802fb757$var$generateEnvMapModeDefine(parameters) {\n let envMapModeDefine = \"ENVMAP_MODE_REFLECTION\";\n if (parameters.envMap) switch(parameters.envMapMode){\n case $a315ee31802fb757$export$dc59f8aed047f61d:\n envMapModeDefine = \"ENVMAP_MODE_REFRACTION\";\n break;\n }\n return envMapModeDefine;\n}\nfunction $a315ee31802fb757$var$generateEnvMapBlendingDefine(parameters) {\n let envMapBlendingDefine = \"ENVMAP_BLENDING_NONE\";\n if (parameters.envMap) switch(parameters.combine){\n case $a315ee31802fb757$export$e50ac29801f1774d:\n envMapBlendingDefine = \"ENVMAP_BLENDING_MULTIPLY\";\n break;\n case $a315ee31802fb757$export$9f9d94f963c85479:\n envMapBlendingDefine = \"ENVMAP_BLENDING_MIX\";\n break;\n case $a315ee31802fb757$export$e641dc52bc3494aa:\n envMapBlendingDefine = \"ENVMAP_BLENDING_ADD\";\n break;\n }\n return envMapBlendingDefine;\n}\nfunction $a315ee31802fb757$var$generateCubeUVSize(parameters) {\n const imageHeight = parameters.envMapCubeUVHeight;\n if (imageHeight === null) return null;\n const maxMip = Math.log2(imageHeight) - 2;\n const texelHeight = 1.0 / imageHeight;\n const texelWidth = 1.0 / (3 * Math.max(Math.pow(2, maxMip), 112));\n return {\n texelWidth: texelWidth,\n texelHeight: texelHeight,\n maxMip: maxMip\n };\n}\nfunction $a315ee31802fb757$var$WebGLProgram(renderer, cacheKey, parameters, bindingStates) {\n // TODO Send this event to Three.js DevTools\n // console.log( 'WebGLProgram', cacheKey );\n const gl = renderer.getContext();\n const defines = parameters.defines;\n let vertexShader = parameters.vertexShader;\n let fragmentShader = parameters.fragmentShader;\n const shadowMapTypeDefine = $a315ee31802fb757$var$generateShadowMapTypeDefine(parameters);\n const envMapTypeDefine = $a315ee31802fb757$var$generateEnvMapTypeDefine(parameters);\n const envMapModeDefine = $a315ee31802fb757$var$generateEnvMapModeDefine(parameters);\n const envMapBlendingDefine = $a315ee31802fb757$var$generateEnvMapBlendingDefine(parameters);\n const envMapCubeUVSize = $a315ee31802fb757$var$generateCubeUVSize(parameters);\n const customExtensions = parameters.isWebGL2 ? \"\" : $a315ee31802fb757$var$generateExtensions(parameters);\n const customDefines = $a315ee31802fb757$var$generateDefines(defines);\n const program = gl.createProgram();\n let prefixVertex, prefixFragment;\n let versionString = parameters.glslVersion ? \"#version \" + parameters.glslVersion + \"\\n\" : \"\";\n if (parameters.isRawShaderMaterial) {\n prefixVertex = [\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines\n ].filter($a315ee31802fb757$var$filterEmptyLine).join(\"\\n\");\n if (prefixVertex.length > 0) prefixVertex += \"\\n\";\n prefixFragment = [\n customExtensions,\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines\n ].filter($a315ee31802fb757$var$filterEmptyLine).join(\"\\n\");\n if (prefixFragment.length > 0) prefixFragment += \"\\n\";\n } else {\n prefixVertex = [\n $a315ee31802fb757$var$generatePrecision(parameters),\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines,\n parameters.instancing ? \"#define USE_INSTANCING\" : \"\",\n parameters.instancingColor ? \"#define USE_INSTANCING_COLOR\" : \"\",\n parameters.useFog && parameters.fog ? \"#define USE_FOG\" : \"\",\n parameters.useFog && parameters.fogExp2 ? \"#define FOG_EXP2\" : \"\",\n parameters.map ? \"#define USE_MAP\" : \"\",\n parameters.envMap ? \"#define USE_ENVMAP\" : \"\",\n parameters.envMap ? \"#define \" + envMapModeDefine : \"\",\n parameters.lightMap ? \"#define USE_LIGHTMAP\" : \"\",\n parameters.aoMap ? \"#define USE_AOMAP\" : \"\",\n parameters.bumpMap ? \"#define USE_BUMPMAP\" : \"\",\n parameters.normalMap ? \"#define USE_NORMALMAP\" : \"\",\n parameters.normalMapObjectSpace ? \"#define USE_NORMALMAP_OBJECTSPACE\" : \"\",\n parameters.normalMapTangentSpace ? \"#define USE_NORMALMAP_TANGENTSPACE\" : \"\",\n parameters.displacementMap ? \"#define USE_DISPLACEMENTMAP\" : \"\",\n parameters.emissiveMap ? \"#define USE_EMISSIVEMAP\" : \"\",\n parameters.anisotropyMap ? \"#define USE_ANISOTROPYMAP\" : \"\",\n parameters.clearcoatMap ? \"#define USE_CLEARCOATMAP\" : \"\",\n parameters.clearcoatRoughnessMap ? \"#define USE_CLEARCOAT_ROUGHNESSMAP\" : \"\",\n parameters.clearcoatNormalMap ? \"#define USE_CLEARCOAT_NORMALMAP\" : \"\",\n parameters.iridescenceMap ? \"#define USE_IRIDESCENCEMAP\" : \"\",\n parameters.iridescenceThicknessMap ? \"#define USE_IRIDESCENCE_THICKNESSMAP\" : \"\",\n parameters.specularMap ? \"#define USE_SPECULARMAP\" : \"\",\n parameters.specularColorMap ? \"#define USE_SPECULAR_COLORMAP\" : \"\",\n parameters.specularIntensityMap ? \"#define USE_SPECULAR_INTENSITYMAP\" : \"\",\n parameters.roughnessMap ? \"#define USE_ROUGHNESSMAP\" : \"\",\n parameters.metalnessMap ? \"#define USE_METALNESSMAP\" : \"\",\n parameters.alphaMap ? \"#define USE_ALPHAMAP\" : \"\",\n parameters.alphaHash ? \"#define USE_ALPHAHASH\" : \"\",\n parameters.transmission ? \"#define USE_TRANSMISSION\" : \"\",\n parameters.transmissionMap ? \"#define USE_TRANSMISSIONMAP\" : \"\",\n parameters.thicknessMap ? \"#define USE_THICKNESSMAP\" : \"\",\n parameters.sheenColorMap ? \"#define USE_SHEEN_COLORMAP\" : \"\",\n parameters.sheenRoughnessMap ? \"#define USE_SHEEN_ROUGHNESSMAP\" : \"\",\n //\n parameters.mapUv ? \"#define MAP_UV \" + parameters.mapUv : \"\",\n parameters.alphaMapUv ? \"#define ALPHAMAP_UV \" + parameters.alphaMapUv : \"\",\n parameters.lightMapUv ? \"#define LIGHTMAP_UV \" + parameters.lightMapUv : \"\",\n parameters.aoMapUv ? \"#define AOMAP_UV \" + parameters.aoMapUv : \"\",\n parameters.emissiveMapUv ? \"#define EMISSIVEMAP_UV \" + parameters.emissiveMapUv : \"\",\n parameters.bumpMapUv ? \"#define BUMPMAP_UV \" + parameters.bumpMapUv : \"\",\n parameters.normalMapUv ? \"#define NORMALMAP_UV \" + parameters.normalMapUv : \"\",\n parameters.displacementMapUv ? \"#define DISPLACEMENTMAP_UV \" + parameters.displacementMapUv : \"\",\n parameters.metalnessMapUv ? \"#define METALNESSMAP_UV \" + parameters.metalnessMapUv : \"\",\n parameters.roughnessMapUv ? \"#define ROUGHNESSMAP_UV \" + parameters.roughnessMapUv : \"\",\n parameters.anisotropyMapUv ? \"#define ANISOTROPYMAP_UV \" + parameters.anisotropyMapUv : \"\",\n parameters.clearcoatMapUv ? \"#define CLEARCOATMAP_UV \" + parameters.clearcoatMapUv : \"\",\n parameters.clearcoatNormalMapUv ? \"#define CLEARCOAT_NORMALMAP_UV \" + parameters.clearcoatNormalMapUv : \"\",\n parameters.clearcoatRoughnessMapUv ? \"#define CLEARCOAT_ROUGHNESSMAP_UV \" + parameters.clearcoatRoughnessMapUv : \"\",\n parameters.iridescenceMapUv ? \"#define IRIDESCENCEMAP_UV \" + parameters.iridescenceMapUv : \"\",\n parameters.iridescenceThicknessMapUv ? \"#define IRIDESCENCE_THICKNESSMAP_UV \" + parameters.iridescenceThicknessMapUv : \"\",\n parameters.sheenColorMapUv ? \"#define SHEEN_COLORMAP_UV \" + parameters.sheenColorMapUv : \"\",\n parameters.sheenRoughnessMapUv ? \"#define SHEEN_ROUGHNESSMAP_UV \" + parameters.sheenRoughnessMapUv : \"\",\n parameters.specularMapUv ? \"#define SPECULARMAP_UV \" + parameters.specularMapUv : \"\",\n parameters.specularColorMapUv ? \"#define SPECULAR_COLORMAP_UV \" + parameters.specularColorMapUv : \"\",\n parameters.specularIntensityMapUv ? \"#define SPECULAR_INTENSITYMAP_UV \" + parameters.specularIntensityMapUv : \"\",\n parameters.transmissionMapUv ? \"#define TRANSMISSIONMAP_UV \" + parameters.transmissionMapUv : \"\",\n parameters.thicknessMapUv ? \"#define THICKNESSMAP_UV \" + parameters.thicknessMapUv : \"\",\n //\n parameters.vertexTangents && parameters.flatShading === false ? \"#define USE_TANGENT\" : \"\",\n parameters.vertexColors ? \"#define USE_COLOR\" : \"\",\n parameters.vertexAlphas ? \"#define USE_COLOR_ALPHA\" : \"\",\n parameters.vertexUv1s ? \"#define USE_UV1\" : \"\",\n parameters.vertexUv2s ? \"#define USE_UV2\" : \"\",\n parameters.vertexUv3s ? \"#define USE_UV3\" : \"\",\n parameters.pointsUvs ? \"#define USE_POINTS_UV\" : \"\",\n parameters.flatShading ? \"#define FLAT_SHADED\" : \"\",\n parameters.skinning ? \"#define USE_SKINNING\" : \"\",\n parameters.morphTargets ? \"#define USE_MORPHTARGETS\" : \"\",\n parameters.morphNormals && parameters.flatShading === false ? \"#define USE_MORPHNORMALS\" : \"\",\n parameters.morphColors && parameters.isWebGL2 ? \"#define USE_MORPHCOLORS\" : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_TEXTURE\" : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_TEXTURE_STRIDE \" + parameters.morphTextureStride : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_COUNT \" + parameters.morphTargetsCount : \"\",\n parameters.doubleSided ? \"#define DOUBLE_SIDED\" : \"\",\n parameters.flipSided ? \"#define FLIP_SIDED\" : \"\",\n parameters.shadowMapEnabled ? \"#define USE_SHADOWMAP\" : \"\",\n parameters.shadowMapEnabled ? \"#define \" + shadowMapTypeDefine : \"\",\n parameters.sizeAttenuation ? \"#define USE_SIZEATTENUATION\" : \"\",\n parameters.useLegacyLights ? \"#define LEGACY_LIGHTS\" : \"\",\n parameters.logarithmicDepthBuffer ? \"#define USE_LOGDEPTHBUF\" : \"\",\n parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? \"#define USE_LOGDEPTHBUF_EXT\" : \"\",\n \"uniform mat4 modelMatrix;\",\n \"uniform mat4 modelViewMatrix;\",\n \"uniform mat4 projectionMatrix;\",\n \"uniform mat4 viewMatrix;\",\n \"uniform mat3 normalMatrix;\",\n \"uniform vec3 cameraPosition;\",\n \"uniform bool isOrthographic;\",\n \"#ifdef USE_INSTANCING\",\n \"\tattribute mat4 instanceMatrix;\",\n \"#endif\",\n \"#ifdef USE_INSTANCING_COLOR\",\n \"\tattribute vec3 instanceColor;\",\n \"#endif\",\n \"attribute vec3 position;\",\n \"attribute vec3 normal;\",\n \"attribute vec2 uv;\",\n \"#ifdef USE_UV1\",\n \"\tattribute vec2 uv1;\",\n \"#endif\",\n \"#ifdef USE_UV2\",\n \"\tattribute vec2 uv2;\",\n \"#endif\",\n \"#ifdef USE_UV3\",\n \"\tattribute vec2 uv3;\",\n \"#endif\",\n \"#ifdef USE_TANGENT\",\n \"\tattribute vec4 tangent;\",\n \"#endif\",\n \"#if defined( USE_COLOR_ALPHA )\",\n \"\tattribute vec4 color;\",\n \"#elif defined( USE_COLOR )\",\n \"\tattribute vec3 color;\",\n \"#endif\",\n \"#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )\",\n \"\tattribute vec3 morphTarget0;\",\n \"\tattribute vec3 morphTarget1;\",\n \"\tattribute vec3 morphTarget2;\",\n \"\tattribute vec3 morphTarget3;\",\n \"\t#ifdef USE_MORPHNORMALS\",\n \"\t\tattribute vec3 morphNormal0;\",\n \"\t\tattribute vec3 morphNormal1;\",\n \"\t\tattribute vec3 morphNormal2;\",\n \"\t\tattribute vec3 morphNormal3;\",\n \"\t#else\",\n \"\t\tattribute vec3 morphTarget4;\",\n \"\t\tattribute vec3 morphTarget5;\",\n \"\t\tattribute vec3 morphTarget6;\",\n \"\t\tattribute vec3 morphTarget7;\",\n \"\t#endif\",\n \"#endif\",\n \"#ifdef USE_SKINNING\",\n \"\tattribute vec4 skinIndex;\",\n \"\tattribute vec4 skinWeight;\",\n \"#endif\",\n \"\\n\"\n ].filter($a315ee31802fb757$var$filterEmptyLine).join(\"\\n\");\n prefixFragment = [\n customExtensions,\n $a315ee31802fb757$var$generatePrecision(parameters),\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines,\n parameters.useFog && parameters.fog ? \"#define USE_FOG\" : \"\",\n parameters.useFog && parameters.fogExp2 ? \"#define FOG_EXP2\" : \"\",\n parameters.map ? \"#define USE_MAP\" : \"\",\n parameters.matcap ? \"#define USE_MATCAP\" : \"\",\n parameters.envMap ? \"#define USE_ENVMAP\" : \"\",\n parameters.envMap ? \"#define \" + envMapTypeDefine : \"\",\n parameters.envMap ? \"#define \" + envMapModeDefine : \"\",\n parameters.envMap ? \"#define \" + envMapBlendingDefine : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_TEXEL_WIDTH \" + envMapCubeUVSize.texelWidth : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_TEXEL_HEIGHT \" + envMapCubeUVSize.texelHeight : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_MAX_MIP \" + envMapCubeUVSize.maxMip + \".0\" : \"\",\n parameters.lightMap ? \"#define USE_LIGHTMAP\" : \"\",\n parameters.aoMap ? \"#define USE_AOMAP\" : \"\",\n parameters.bumpMap ? \"#define USE_BUMPMAP\" : \"\",\n parameters.normalMap ? \"#define USE_NORMALMAP\" : \"\",\n parameters.normalMapObjectSpace ? \"#define USE_NORMALMAP_OBJECTSPACE\" : \"\",\n parameters.normalMapTangentSpace ? \"#define USE_NORMALMAP_TANGENTSPACE\" : \"\",\n parameters.emissiveMap ? \"#define USE_EMISSIVEMAP\" : \"\",\n parameters.anisotropy ? \"#define USE_ANISOTROPY\" : \"\",\n parameters.anisotropyMap ? \"#define USE_ANISOTROPYMAP\" : \"\",\n parameters.clearcoat ? \"#define USE_CLEARCOAT\" : \"\",\n parameters.clearcoatMap ? \"#define USE_CLEARCOATMAP\" : \"\",\n parameters.clearcoatRoughnessMap ? \"#define USE_CLEARCOAT_ROUGHNESSMAP\" : \"\",\n parameters.clearcoatNormalMap ? \"#define USE_CLEARCOAT_NORMALMAP\" : \"\",\n parameters.iridescence ? \"#define USE_IRIDESCENCE\" : \"\",\n parameters.iridescenceMap ? \"#define USE_IRIDESCENCEMAP\" : \"\",\n parameters.iridescenceThicknessMap ? \"#define USE_IRIDESCENCE_THICKNESSMAP\" : \"\",\n parameters.specularMap ? \"#define USE_SPECULARMAP\" : \"\",\n parameters.specularColorMap ? \"#define USE_SPECULAR_COLORMAP\" : \"\",\n parameters.specularIntensityMap ? \"#define USE_SPECULAR_INTENSITYMAP\" : \"\",\n parameters.roughnessMap ? \"#define USE_ROUGHNESSMAP\" : \"\",\n parameters.metalnessMap ? \"#define USE_METALNESSMAP\" : \"\",\n parameters.alphaMap ? \"#define USE_ALPHAMAP\" : \"\",\n parameters.alphaTest ? \"#define USE_ALPHATEST\" : \"\",\n parameters.alphaHash ? \"#define USE_ALPHAHASH\" : \"\",\n parameters.sheen ? \"#define USE_SHEEN\" : \"\",\n parameters.sheenColorMap ? \"#define USE_SHEEN_COLORMAP\" : \"\",\n parameters.sheenRoughnessMap ? \"#define USE_SHEEN_ROUGHNESSMAP\" : \"\",\n parameters.transmission ? \"#define USE_TRANSMISSION\" : \"\",\n parameters.transmissionMap ? \"#define USE_TRANSMISSIONMAP\" : \"\",\n parameters.thicknessMap ? \"#define USE_THICKNESSMAP\" : \"\",\n parameters.vertexTangents && parameters.flatShading === false ? \"#define USE_TANGENT\" : \"\",\n parameters.vertexColors || parameters.instancingColor ? \"#define USE_COLOR\" : \"\",\n parameters.vertexAlphas ? \"#define USE_COLOR_ALPHA\" : \"\",\n parameters.vertexUv1s ? \"#define USE_UV1\" : \"\",\n parameters.vertexUv2s ? \"#define USE_UV2\" : \"\",\n parameters.vertexUv3s ? \"#define USE_UV3\" : \"\",\n parameters.pointsUvs ? \"#define USE_POINTS_UV\" : \"\",\n parameters.gradientMap ? \"#define USE_GRADIENTMAP\" : \"\",\n parameters.flatShading ? \"#define FLAT_SHADED\" : \"\",\n parameters.doubleSided ? \"#define DOUBLE_SIDED\" : \"\",\n parameters.flipSided ? \"#define FLIP_SIDED\" : \"\",\n parameters.shadowMapEnabled ? \"#define USE_SHADOWMAP\" : \"\",\n parameters.shadowMapEnabled ? \"#define \" + shadowMapTypeDefine : \"\",\n parameters.premultipliedAlpha ? \"#define PREMULTIPLIED_ALPHA\" : \"\",\n parameters.useLegacyLights ? \"#define LEGACY_LIGHTS\" : \"\",\n parameters.logarithmicDepthBuffer ? \"#define USE_LOGDEPTHBUF\" : \"\",\n parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? \"#define USE_LOGDEPTHBUF_EXT\" : \"\",\n \"uniform mat4 viewMatrix;\",\n \"uniform vec3 cameraPosition;\",\n \"uniform bool isOrthographic;\",\n parameters.toneMapping !== $a315ee31802fb757$export$9fcb6b4294603b2 ? \"#define TONE_MAPPING\" : \"\",\n parameters.toneMapping !== $a315ee31802fb757$export$9fcb6b4294603b2 ? $a315ee31802fb757$export$955f9f2e84c43c8b[\"tonemapping_pars_fragment\"] : \"\",\n parameters.toneMapping !== $a315ee31802fb757$export$9fcb6b4294603b2 ? $a315ee31802fb757$var$getToneMappingFunction(\"toneMapping\", parameters.toneMapping) : \"\",\n parameters.dithering ? \"#define DITHERING\" : \"\",\n parameters.opaque ? \"#define OPAQUE\" : \"\",\n $a315ee31802fb757$export$955f9f2e84c43c8b[\"colorspace_pars_fragment\"],\n $a315ee31802fb757$var$getTexelEncodingFunction(\"linearToOutputTexel\", parameters.outputColorSpace),\n parameters.useDepthPacking ? \"#define DEPTH_PACKING \" + parameters.depthPacking : \"\",\n \"\\n\"\n ].filter($a315ee31802fb757$var$filterEmptyLine).join(\"\\n\");\n }\n vertexShader = $a315ee31802fb757$var$resolveIncludes(vertexShader);\n vertexShader = $a315ee31802fb757$var$replaceLightNums(vertexShader, parameters);\n vertexShader = $a315ee31802fb757$var$replaceClippingPlaneNums(vertexShader, parameters);\n fragmentShader = $a315ee31802fb757$var$resolveIncludes(fragmentShader);\n fragmentShader = $a315ee31802fb757$var$replaceLightNums(fragmentShader, parameters);\n fragmentShader = $a315ee31802fb757$var$replaceClippingPlaneNums(fragmentShader, parameters);\n vertexShader = $a315ee31802fb757$var$unrollLoops(vertexShader);\n fragmentShader = $a315ee31802fb757$var$unrollLoops(fragmentShader);\n if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) {\n // GLSL 3.0 conversion for built-in materials and ShaderMaterial\n versionString = \"#version 300 es\\n\";\n prefixVertex = [\n \"precision mediump sampler2DArray;\",\n \"#define attribute in\",\n \"#define varying out\",\n \"#define texture2D texture\"\n ].join(\"\\n\") + \"\\n\" + prefixVertex;\n prefixFragment = [\n \"#define varying in\",\n parameters.glslVersion === $a315ee31802fb757$export$f63012db5506e7dd ? \"\" : \"layout(location = 0) out highp vec4 pc_fragColor;\",\n parameters.glslVersion === $a315ee31802fb757$export$f63012db5506e7dd ? \"\" : \"#define gl_FragColor pc_fragColor\",\n \"#define gl_FragDepthEXT gl_FragDepth\",\n \"#define texture2D texture\",\n \"#define textureCube texture\",\n \"#define texture2DProj textureProj\",\n \"#define texture2DLodEXT textureLod\",\n \"#define texture2DProjLodEXT textureProjLod\",\n \"#define textureCubeLodEXT textureLod\",\n \"#define texture2DGradEXT textureGrad\",\n \"#define texture2DProjGradEXT textureProjGrad\",\n \"#define textureCubeGradEXT textureGrad\"\n ].join(\"\\n\") + \"\\n\" + prefixFragment;\n }\n const vertexGlsl = versionString + prefixVertex + vertexShader;\n const fragmentGlsl = versionString + prefixFragment + fragmentShader;\n // console.log( '*VERTEX*', vertexGlsl );\n // console.log( '*FRAGMENT*', fragmentGlsl );\n const glVertexShader = $a315ee31802fb757$var$WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl);\n const glFragmentShader = $a315ee31802fb757$var$WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl);\n gl.attachShader(program, glVertexShader);\n gl.attachShader(program, glFragmentShader);\n // Force a particular attribute to index 0.\n if (parameters.index0AttributeName !== undefined) gl.bindAttribLocation(program, 0, parameters.index0AttributeName);\n else if (parameters.morphTargets === true) // programs with morphTargets displace position out of attribute 0\n gl.bindAttribLocation(program, 0, \"position\");\n gl.linkProgram(program);\n // check for link errors\n if (renderer.debug.checkShaderErrors) {\n const programLog = gl.getProgramInfoLog(program).trim();\n const vertexLog = gl.getShaderInfoLog(glVertexShader).trim();\n const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim();\n let runnable = true;\n let haveDiagnostics = true;\n if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {\n runnable = false;\n if (typeof renderer.debug.onShaderError === \"function\") renderer.debug.onShaderError(gl, program, glVertexShader, glFragmentShader);\n else {\n // default error reporting\n const vertexErrors = $a315ee31802fb757$var$getShaderErrors(gl, glVertexShader, \"vertex\");\n const fragmentErrors = $a315ee31802fb757$var$getShaderErrors(gl, glFragmentShader, \"fragment\");\n console.error(\"THREE.WebGLProgram: Shader Error \" + gl.getError() + \" - \" + \"VALIDATE_STATUS \" + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + \"\\n\\n\" + \"Program Info Log: \" + programLog + \"\\n\" + vertexErrors + \"\\n\" + fragmentErrors);\n }\n } else if (programLog !== \"\") console.warn(\"THREE.WebGLProgram: Program Info Log:\", programLog);\n else if (vertexLog === \"\" || fragmentLog === \"\") haveDiagnostics = false;\n if (haveDiagnostics) this.diagnostics = {\n runnable: runnable,\n programLog: programLog,\n vertexShader: {\n log: vertexLog,\n prefix: prefixVertex\n },\n fragmentShader: {\n log: fragmentLog,\n prefix: prefixFragment\n }\n };\n }\n // Clean up\n // Crashes in iOS9 and iOS10. #18402\n // gl.detachShader( program, glVertexShader );\n // gl.detachShader( program, glFragmentShader );\n gl.deleteShader(glVertexShader);\n gl.deleteShader(glFragmentShader);\n // set up caching for uniform locations\n let cachedUniforms;\n this.getUniforms = function() {\n if (cachedUniforms === undefined) cachedUniforms = new $a315ee31802fb757$var$WebGLUniforms(gl, program);\n return cachedUniforms;\n };\n // set up caching for attribute locations\n let cachedAttributes;\n this.getAttributes = function() {\n if (cachedAttributes === undefined) cachedAttributes = $a315ee31802fb757$var$fetchAttributeLocations(gl, program);\n return cachedAttributes;\n };\n // free resource\n this.destroy = function() {\n bindingStates.releaseStatesOfProgram(this);\n gl.deleteProgram(program);\n this.program = undefined;\n };\n //\n this.type = parameters.shaderType;\n this.name = parameters.shaderName;\n this.id = $a315ee31802fb757$var$programIdCount++;\n this.cacheKey = cacheKey;\n this.usedTimes = 1;\n this.program = program;\n this.vertexShader = glVertexShader;\n this.fragmentShader = glFragmentShader;\n return this;\n}\nlet $a315ee31802fb757$var$_id = 0;\nclass $a315ee31802fb757$var$WebGLShaderCache {\n constructor(){\n this.shaderCache = new Map();\n this.materialCache = new Map();\n }\n update(material) {\n const vertexShader = material.vertexShader;\n const fragmentShader = material.fragmentShader;\n const vertexShaderStage = this._getShaderStage(vertexShader);\n const fragmentShaderStage = this._getShaderStage(fragmentShader);\n const materialShaders = this._getShaderCacheForMaterial(material);\n if (materialShaders.has(vertexShaderStage) === false) {\n materialShaders.add(vertexShaderStage);\n vertexShaderStage.usedTimes++;\n }\n if (materialShaders.has(fragmentShaderStage) === false) {\n materialShaders.add(fragmentShaderStage);\n fragmentShaderStage.usedTimes++;\n }\n return this;\n }\n remove(material) {\n const materialShaders = this.materialCache.get(material);\n for (const shaderStage of materialShaders){\n shaderStage.usedTimes--;\n if (shaderStage.usedTimes === 0) this.shaderCache.delete(shaderStage.code);\n }\n this.materialCache.delete(material);\n return this;\n }\n getVertexShaderID(material) {\n return this._getShaderStage(material.vertexShader).id;\n }\n getFragmentShaderID(material) {\n return this._getShaderStage(material.fragmentShader).id;\n }\n dispose() {\n this.shaderCache.clear();\n this.materialCache.clear();\n }\n _getShaderCacheForMaterial(material) {\n const cache = this.materialCache;\n let set = cache.get(material);\n if (set === undefined) {\n set = new Set();\n cache.set(material, set);\n }\n return set;\n }\n _getShaderStage(code) {\n const cache = this.shaderCache;\n let stage = cache.get(code);\n if (stage === undefined) {\n stage = new $a315ee31802fb757$var$WebGLShaderStage(code);\n cache.set(code, stage);\n }\n return stage;\n }\n}\nclass $a315ee31802fb757$var$WebGLShaderStage {\n constructor(code){\n this.id = $a315ee31802fb757$var$_id++;\n this.code = code;\n this.usedTimes = 0;\n }\n}\nfunction $a315ee31802fb757$var$WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) {\n const _programLayers = new $a315ee31802fb757$export$89312ce47c0ca777();\n const _customShaders = new $a315ee31802fb757$var$WebGLShaderCache();\n const programs = [];\n const IS_WEBGL2 = capabilities.isWebGL2;\n const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n let precision = capabilities.precision;\n const shaderIDs = {\n MeshDepthMaterial: \"depth\",\n MeshDistanceMaterial: \"distanceRGBA\",\n MeshNormalMaterial: \"normal\",\n MeshBasicMaterial: \"basic\",\n MeshLambertMaterial: \"lambert\",\n MeshPhongMaterial: \"phong\",\n MeshToonMaterial: \"toon\",\n MeshStandardMaterial: \"physical\",\n MeshPhysicalMaterial: \"physical\",\n MeshMatcapMaterial: \"matcap\",\n LineBasicMaterial: \"basic\",\n LineDashedMaterial: \"dashed\",\n PointsMaterial: \"points\",\n ShadowMaterial: \"shadow\",\n SpriteMaterial: \"sprite\"\n };\n function getChannel(value) {\n if (value === 0) return \"uv\";\n return `uv${value}`;\n }\n function getParameters(material, lights, shadows, scene, object) {\n const fog = scene.fog;\n const geometry = object.geometry;\n const environment = material.isMeshStandardMaterial ? scene.environment : null;\n const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n const envMapCubeUVHeight = !!envMap && envMap.mapping === $a315ee31802fb757$export$dbf3e70ff37af79 ? envMap.image.height : null;\n const shaderID = shaderIDs[material.type];\n // heuristics to create shader parameters according to lights in the scene\n // (not to blow over maxLights budget)\n if (material.precision !== null) {\n precision = capabilities.getMaxPrecision(material.precision);\n if (precision !== material.precision) console.warn(\"THREE.WebGLProgram.getParameters:\", material.precision, \"not supported, using\", precision, \"instead.\");\n }\n //\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n let morphTextureStride = 0;\n if (geometry.morphAttributes.position !== undefined) morphTextureStride = 1;\n if (geometry.morphAttributes.normal !== undefined) morphTextureStride = 2;\n if (geometry.morphAttributes.color !== undefined) morphTextureStride = 3;\n //\n let vertexShader, fragmentShader;\n let customVertexShaderID, customFragmentShaderID;\n if (shaderID) {\n const shader = $a315ee31802fb757$export$bee4a7d47f8f5014[shaderID];\n vertexShader = shader.vertexShader;\n fragmentShader = shader.fragmentShader;\n } else {\n vertexShader = material.vertexShader;\n fragmentShader = material.fragmentShader;\n _customShaders.update(material);\n customVertexShaderID = _customShaders.getVertexShaderID(material);\n customFragmentShaderID = _customShaders.getFragmentShaderID(material);\n }\n const currentRenderTarget = renderer.getRenderTarget();\n const IS_INSTANCEDMESH = object.isInstancedMesh === true;\n const HAS_MAP = !!material.map;\n const HAS_MATCAP = !!material.matcap;\n const HAS_ENVMAP = !!envMap;\n const HAS_AOMAP = !!material.aoMap;\n const HAS_LIGHTMAP = !!material.lightMap;\n const HAS_BUMPMAP = !!material.bumpMap;\n const HAS_NORMALMAP = !!material.normalMap;\n const HAS_DISPLACEMENTMAP = !!material.displacementMap;\n const HAS_EMISSIVEMAP = !!material.emissiveMap;\n const HAS_METALNESSMAP = !!material.metalnessMap;\n const HAS_ROUGHNESSMAP = !!material.roughnessMap;\n const HAS_ANISOTROPY = material.anisotropy > 0;\n const HAS_CLEARCOAT = material.clearcoat > 0;\n const HAS_IRIDESCENCE = material.iridescence > 0;\n const HAS_SHEEN = material.sheen > 0;\n const HAS_TRANSMISSION = material.transmission > 0;\n const HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !!material.anisotropyMap;\n const HAS_CLEARCOATMAP = HAS_CLEARCOAT && !!material.clearcoatMap;\n const HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !!material.clearcoatNormalMap;\n const HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !!material.clearcoatRoughnessMap;\n const HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !!material.iridescenceMap;\n const HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !!material.iridescenceThicknessMap;\n const HAS_SHEEN_COLORMAP = HAS_SHEEN && !!material.sheenColorMap;\n const HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !!material.sheenRoughnessMap;\n const HAS_SPECULARMAP = !!material.specularMap;\n const HAS_SPECULAR_COLORMAP = !!material.specularColorMap;\n const HAS_SPECULAR_INTENSITYMAP = !!material.specularIntensityMap;\n const HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !!material.transmissionMap;\n const HAS_THICKNESSMAP = HAS_TRANSMISSION && !!material.thicknessMap;\n const HAS_GRADIENTMAP = !!material.gradientMap;\n const HAS_ALPHAMAP = !!material.alphaMap;\n const HAS_ALPHATEST = material.alphaTest > 0;\n const HAS_ALPHAHASH = !!material.alphaHash;\n const HAS_EXTENSIONS = !!material.extensions;\n const HAS_ATTRIBUTE_UV1 = !!geometry.attributes.uv1;\n const HAS_ATTRIBUTE_UV2 = !!geometry.attributes.uv2;\n const HAS_ATTRIBUTE_UV3 = !!geometry.attributes.uv3;\n let toneMapping = $a315ee31802fb757$export$9fcb6b4294603b2;\n if (material.toneMapped) {\n if (currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true) toneMapping = renderer.toneMapping;\n }\n const parameters = {\n isWebGL2: IS_WEBGL2,\n shaderID: shaderID,\n shaderType: material.type,\n shaderName: material.name,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n defines: material.defines,\n customVertexShaderID: customVertexShaderID,\n customFragmentShaderID: customFragmentShaderID,\n isRawShaderMaterial: material.isRawShaderMaterial === true,\n glslVersion: material.glslVersion,\n precision: precision,\n instancing: IS_INSTANCEDMESH,\n instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : $a315ee31802fb757$export$42429b3acfb233a4,\n map: HAS_MAP,\n matcap: HAS_MATCAP,\n envMap: HAS_ENVMAP,\n envMapMode: HAS_ENVMAP && envMap.mapping,\n envMapCubeUVHeight: envMapCubeUVHeight,\n aoMap: HAS_AOMAP,\n lightMap: HAS_LIGHTMAP,\n bumpMap: HAS_BUMPMAP,\n normalMap: HAS_NORMALMAP,\n displacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n emissiveMap: HAS_EMISSIVEMAP,\n normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === $a315ee31802fb757$export$9990ad26f9db5b2c,\n normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === $a315ee31802fb757$export$2852a58ebdac27b8,\n metalnessMap: HAS_METALNESSMAP,\n roughnessMap: HAS_ROUGHNESSMAP,\n anisotropy: HAS_ANISOTROPY,\n anisotropyMap: HAS_ANISOTROPYMAP,\n clearcoat: HAS_CLEARCOAT,\n clearcoatMap: HAS_CLEARCOATMAP,\n clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n iridescence: HAS_IRIDESCENCE,\n iridescenceMap: HAS_IRIDESCENCEMAP,\n iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n sheen: HAS_SHEEN,\n sheenColorMap: HAS_SHEEN_COLORMAP,\n sheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n specularMap: HAS_SPECULARMAP,\n specularColorMap: HAS_SPECULAR_COLORMAP,\n specularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n transmission: HAS_TRANSMISSION,\n transmissionMap: HAS_TRANSMISSIONMAP,\n thicknessMap: HAS_THICKNESSMAP,\n gradientMap: HAS_GRADIENTMAP,\n opaque: material.transparent === false && material.blending === $a315ee31802fb757$export$5b29a26d96ee6af0,\n alphaMap: HAS_ALPHAMAP,\n alphaTest: HAS_ALPHATEST,\n alphaHash: HAS_ALPHAHASH,\n combine: material.combine,\n //\n mapUv: HAS_MAP && getChannel(material.map.channel),\n aoMapUv: HAS_AOMAP && getChannel(material.aoMap.channel),\n lightMapUv: HAS_LIGHTMAP && getChannel(material.lightMap.channel),\n bumpMapUv: HAS_BUMPMAP && getChannel(material.bumpMap.channel),\n normalMapUv: HAS_NORMALMAP && getChannel(material.normalMap.channel),\n displacementMapUv: HAS_DISPLACEMENTMAP && getChannel(material.displacementMap.channel),\n emissiveMapUv: HAS_EMISSIVEMAP && getChannel(material.emissiveMap.channel),\n metalnessMapUv: HAS_METALNESSMAP && getChannel(material.metalnessMap.channel),\n roughnessMapUv: HAS_ROUGHNESSMAP && getChannel(material.roughnessMap.channel),\n anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel(material.anisotropyMap.channel),\n clearcoatMapUv: HAS_CLEARCOATMAP && getChannel(material.clearcoatMap.channel),\n clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel(material.clearcoatNormalMap.channel),\n clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel(material.clearcoatRoughnessMap.channel),\n iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel(material.iridescenceMap.channel),\n iridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel(material.iridescenceThicknessMap.channel),\n sheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel(material.sheenColorMap.channel),\n sheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel(material.sheenRoughnessMap.channel),\n specularMapUv: HAS_SPECULARMAP && getChannel(material.specularMap.channel),\n specularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel(material.specularColorMap.channel),\n specularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel(material.specularIntensityMap.channel),\n transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel(material.transmissionMap.channel),\n thicknessMapUv: HAS_THICKNESSMAP && getChannel(material.thicknessMap.channel),\n alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),\n //\n vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),\n vertexColors: material.vertexColors,\n vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n vertexUv1s: HAS_ATTRIBUTE_UV1,\n vertexUv2s: HAS_ATTRIBUTE_UV2,\n vertexUv3s: HAS_ATTRIBUTE_UV3,\n pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),\n fog: !!fog,\n useFog: material.fog === true,\n fogExp2: fog && fog.isFogExp2,\n flatShading: material.flatShading === true,\n sizeAttenuation: material.sizeAttenuation === true,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n skinning: object.isSkinnedMesh === true,\n morphTargets: geometry.morphAttributes.position !== undefined,\n morphNormals: geometry.morphAttributes.normal !== undefined,\n morphColors: geometry.morphAttributes.color !== undefined,\n morphTargetsCount: morphTargetsCount,\n morphTextureStride: morphTextureStride,\n numDirLights: lights.directional.length,\n numPointLights: lights.point.length,\n numSpotLights: lights.spot.length,\n numSpotLightMaps: lights.spotLightMap.length,\n numRectAreaLights: lights.rectArea.length,\n numHemiLights: lights.hemi.length,\n numDirLightShadows: lights.directionalShadowMap.length,\n numPointLightShadows: lights.pointShadowMap.length,\n numSpotLightShadows: lights.spotShadowMap.length,\n numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n numClippingPlanes: clipping.numPlanes,\n numClipIntersection: clipping.numIntersection,\n dithering: material.dithering,\n shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n shadowMapType: renderer.shadowMap.type,\n toneMapping: toneMapping,\n useLegacyLights: renderer._useLegacyLights,\n premultipliedAlpha: material.premultipliedAlpha,\n doubleSided: material.side === $a315ee31802fb757$export$3b296b6f144d5b03,\n flipSided: material.side === $a315ee31802fb757$export$d9f0486e75b5ace,\n useDepthPacking: material.depthPacking >= 0,\n depthPacking: material.depthPacking || 0,\n index0AttributeName: material.index0AttributeName,\n extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n rendererExtensionFragDepth: IS_WEBGL2 || extensions.has(\"EXT_frag_depth\"),\n rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has(\"WEBGL_draw_buffers\"),\n rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has(\"EXT_shader_texture_lod\"),\n customProgramCacheKey: material.customProgramCacheKey()\n };\n return parameters;\n }\n function getProgramCacheKey(parameters) {\n const array = [];\n if (parameters.shaderID) array.push(parameters.shaderID);\n else {\n array.push(parameters.customVertexShaderID);\n array.push(parameters.customFragmentShaderID);\n }\n if (parameters.defines !== undefined) for(const name in parameters.defines){\n array.push(name);\n array.push(parameters.defines[name]);\n }\n if (parameters.isRawShaderMaterial === false) {\n getProgramCacheKeyParameters(array, parameters);\n getProgramCacheKeyBooleans(array, parameters);\n array.push(renderer.outputColorSpace);\n }\n array.push(parameters.customProgramCacheKey);\n return array.join();\n }\n function getProgramCacheKeyParameters(array, parameters) {\n array.push(parameters.precision);\n array.push(parameters.outputColorSpace);\n array.push(parameters.envMapMode);\n array.push(parameters.envMapCubeUVHeight);\n array.push(parameters.mapUv);\n array.push(parameters.alphaMapUv);\n array.push(parameters.lightMapUv);\n array.push(parameters.aoMapUv);\n array.push(parameters.bumpMapUv);\n array.push(parameters.normalMapUv);\n array.push(parameters.displacementMapUv);\n array.push(parameters.emissiveMapUv);\n array.push(parameters.metalnessMapUv);\n array.push(parameters.roughnessMapUv);\n array.push(parameters.anisotropyMapUv);\n array.push(parameters.clearcoatMapUv);\n array.push(parameters.clearcoatNormalMapUv);\n array.push(parameters.clearcoatRoughnessMapUv);\n array.push(parameters.iridescenceMapUv);\n array.push(parameters.iridescenceThicknessMapUv);\n array.push(parameters.sheenColorMapUv);\n array.push(parameters.sheenRoughnessMapUv);\n array.push(parameters.specularMapUv);\n array.push(parameters.specularColorMapUv);\n array.push(parameters.specularIntensityMapUv);\n array.push(parameters.transmissionMapUv);\n array.push(parameters.thicknessMapUv);\n array.push(parameters.combine);\n array.push(parameters.fogExp2);\n array.push(parameters.sizeAttenuation);\n array.push(parameters.morphTargetsCount);\n array.push(parameters.morphAttributeCount);\n array.push(parameters.numDirLights);\n array.push(parameters.numPointLights);\n array.push(parameters.numSpotLights);\n array.push(parameters.numSpotLightMaps);\n array.push(parameters.numHemiLights);\n array.push(parameters.numRectAreaLights);\n array.push(parameters.numDirLightShadows);\n array.push(parameters.numPointLightShadows);\n array.push(parameters.numSpotLightShadows);\n array.push(parameters.numSpotLightShadowsWithMaps);\n array.push(parameters.shadowMapType);\n array.push(parameters.toneMapping);\n array.push(parameters.numClippingPlanes);\n array.push(parameters.numClipIntersection);\n array.push(parameters.depthPacking);\n }\n function getProgramCacheKeyBooleans(array, parameters) {\n _programLayers.disableAll();\n if (parameters.isWebGL2) _programLayers.enable(0);\n if (parameters.supportsVertexTextures) _programLayers.enable(1);\n if (parameters.instancing) _programLayers.enable(2);\n if (parameters.instancingColor) _programLayers.enable(3);\n if (parameters.matcap) _programLayers.enable(4);\n if (parameters.envMap) _programLayers.enable(5);\n if (parameters.normalMapObjectSpace) _programLayers.enable(6);\n if (parameters.normalMapTangentSpace) _programLayers.enable(7);\n if (parameters.clearcoat) _programLayers.enable(8);\n if (parameters.iridescence) _programLayers.enable(9);\n if (parameters.alphaTest) _programLayers.enable(10);\n if (parameters.vertexColors) _programLayers.enable(11);\n if (parameters.vertexAlphas) _programLayers.enable(12);\n if (parameters.vertexUv1s) _programLayers.enable(13);\n if (parameters.vertexUv2s) _programLayers.enable(14);\n if (parameters.vertexUv3s) _programLayers.enable(15);\n if (parameters.vertexTangents) _programLayers.enable(16);\n if (parameters.anisotropy) _programLayers.enable(17);\n array.push(_programLayers.mask);\n _programLayers.disableAll();\n if (parameters.fog) _programLayers.enable(0);\n if (parameters.useFog) _programLayers.enable(1);\n if (parameters.flatShading) _programLayers.enable(2);\n if (parameters.logarithmicDepthBuffer) _programLayers.enable(3);\n if (parameters.skinning) _programLayers.enable(4);\n if (parameters.morphTargets) _programLayers.enable(5);\n if (parameters.morphNormals) _programLayers.enable(6);\n if (parameters.morphColors) _programLayers.enable(7);\n if (parameters.premultipliedAlpha) _programLayers.enable(8);\n if (parameters.shadowMapEnabled) _programLayers.enable(9);\n if (parameters.useLegacyLights) _programLayers.enable(10);\n if (parameters.doubleSided) _programLayers.enable(11);\n if (parameters.flipSided) _programLayers.enable(12);\n if (parameters.useDepthPacking) _programLayers.enable(13);\n if (parameters.dithering) _programLayers.enable(14);\n if (parameters.transmission) _programLayers.enable(15);\n if (parameters.sheen) _programLayers.enable(16);\n if (parameters.opaque) _programLayers.enable(17);\n if (parameters.pointsUvs) _programLayers.enable(18);\n array.push(_programLayers.mask);\n }\n function getUniforms(material) {\n const shaderID = shaderIDs[material.type];\n let uniforms;\n if (shaderID) {\n const shader = $a315ee31802fb757$export$bee4a7d47f8f5014[shaderID];\n uniforms = $a315ee31802fb757$export$d8ecdf8615bfea69.clone(shader.uniforms);\n } else uniforms = material.uniforms;\n return uniforms;\n }\n function acquireProgram(parameters, cacheKey) {\n let program;\n // Check if code has been already compiled\n for(let p = 0, pl = programs.length; p < pl; p++){\n const preexistingProgram = programs[p];\n if (preexistingProgram.cacheKey === cacheKey) {\n program = preexistingProgram;\n ++program.usedTimes;\n break;\n }\n }\n if (program === undefined) {\n program = new $a315ee31802fb757$var$WebGLProgram(renderer, cacheKey, parameters, bindingStates);\n programs.push(program);\n }\n return program;\n }\n function releaseProgram(program) {\n if (--program.usedTimes === 0) {\n // Remove from unordered set\n const i = programs.indexOf(program);\n programs[i] = programs[programs.length - 1];\n programs.pop();\n // Free WebGL resources\n program.destroy();\n }\n }\n function releaseShaderCache(material) {\n _customShaders.remove(material);\n }\n function dispose() {\n _customShaders.dispose();\n }\n return {\n getParameters: getParameters,\n getProgramCacheKey: getProgramCacheKey,\n getUniforms: getUniforms,\n acquireProgram: acquireProgram,\n releaseProgram: releaseProgram,\n releaseShaderCache: releaseShaderCache,\n // Exposed for resource monitoring & error feedback via renderer.info:\n programs: programs,\n dispose: dispose\n };\n}\nfunction $a315ee31802fb757$var$WebGLProperties() {\n let properties = new WeakMap();\n function get(object) {\n let map = properties.get(object);\n if (map === undefined) {\n map = {};\n properties.set(object, map);\n }\n return map;\n }\n function remove(object) {\n properties.delete(object);\n }\n function update(object, key, value) {\n properties.get(object)[key] = value;\n }\n function dispose() {\n properties = new WeakMap();\n }\n return {\n get: get,\n remove: remove,\n update: update,\n dispose: dispose\n };\n}\nfunction $a315ee31802fb757$var$painterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) return a.groupOrder - b.groupOrder;\n else if (a.renderOrder !== b.renderOrder) return a.renderOrder - b.renderOrder;\n else if (a.material.id !== b.material.id) return a.material.id - b.material.id;\n else if (a.z !== b.z) return a.z - b.z;\n else return a.id - b.id;\n}\nfunction $a315ee31802fb757$var$reversePainterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) return a.groupOrder - b.groupOrder;\n else if (a.renderOrder !== b.renderOrder) return a.renderOrder - b.renderOrder;\n else if (a.z !== b.z) return b.z - a.z;\n else return a.id - b.id;\n}\nfunction $a315ee31802fb757$var$WebGLRenderList() {\n const renderItems = [];\n let renderItemsIndex = 0;\n const opaque = [];\n const transmissive = [];\n const transparent = [];\n function init() {\n renderItemsIndex = 0;\n opaque.length = 0;\n transmissive.length = 0;\n transparent.length = 0;\n }\n function getNextRenderItem(object, geometry, material, groupOrder, z, group) {\n let renderItem = renderItems[renderItemsIndex];\n if (renderItem === undefined) {\n renderItem = {\n id: object.id,\n object: object,\n geometry: geometry,\n material: material,\n groupOrder: groupOrder,\n renderOrder: object.renderOrder,\n z: z,\n group: group\n };\n renderItems[renderItemsIndex] = renderItem;\n } else {\n renderItem.id = object.id;\n renderItem.object = object;\n renderItem.geometry = geometry;\n renderItem.material = material;\n renderItem.groupOrder = groupOrder;\n renderItem.renderOrder = object.renderOrder;\n renderItem.z = z;\n renderItem.group = group;\n }\n renderItemsIndex++;\n return renderItem;\n }\n function push(object, geometry, material, groupOrder, z, group) {\n const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) transmissive.push(renderItem);\n else if (material.transparent === true) transparent.push(renderItem);\n else opaque.push(renderItem);\n }\n function unshift(object, geometry, material, groupOrder, z, group) {\n const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) transmissive.unshift(renderItem);\n else if (material.transparent === true) transparent.unshift(renderItem);\n else opaque.unshift(renderItem);\n }\n function sort(customOpaqueSort, customTransparentSort) {\n if (opaque.length > 1) opaque.sort(customOpaqueSort || $a315ee31802fb757$var$painterSortStable);\n if (transmissive.length > 1) transmissive.sort(customTransparentSort || $a315ee31802fb757$var$reversePainterSortStable);\n if (transparent.length > 1) transparent.sort(customTransparentSort || $a315ee31802fb757$var$reversePainterSortStable);\n }\n function finish() {\n // Clear references from inactive renderItems in the list\n for(let i = renderItemsIndex, il = renderItems.length; i < il; i++){\n const renderItem = renderItems[i];\n if (renderItem.id === null) break;\n renderItem.id = null;\n renderItem.object = null;\n renderItem.geometry = null;\n renderItem.material = null;\n renderItem.group = null;\n }\n }\n return {\n opaque: opaque,\n transmissive: transmissive,\n transparent: transparent,\n init: init,\n push: push,\n unshift: unshift,\n finish: finish,\n sort: sort\n };\n}\nfunction $a315ee31802fb757$var$WebGLRenderLists() {\n let lists = new WeakMap();\n function get(scene, renderCallDepth) {\n const listArray = lists.get(scene);\n let list;\n if (listArray === undefined) {\n list = new $a315ee31802fb757$var$WebGLRenderList();\n lists.set(scene, [\n list\n ]);\n } else if (renderCallDepth >= listArray.length) {\n list = new $a315ee31802fb757$var$WebGLRenderList();\n listArray.push(list);\n } else list = listArray[renderCallDepth];\n return list;\n }\n function dispose() {\n lists = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction $a315ee31802fb757$var$UniformsCache() {\n const lights = {};\n return {\n get: function(light) {\n if (lights[light.id] !== undefined) return lights[light.id];\n let uniforms;\n switch(light.type){\n case \"DirectionalLight\":\n uniforms = {\n direction: new $a315ee31802fb757$export$64b5c384219d3699(),\n color: new $a315ee31802fb757$export$892596cec99bc70e()\n };\n break;\n case \"SpotLight\":\n uniforms = {\n position: new $a315ee31802fb757$export$64b5c384219d3699(),\n direction: new $a315ee31802fb757$export$64b5c384219d3699(),\n color: new $a315ee31802fb757$export$892596cec99bc70e(),\n distance: 0,\n coneCos: 0,\n penumbraCos: 0,\n decay: 0\n };\n break;\n case \"PointLight\":\n uniforms = {\n position: new $a315ee31802fb757$export$64b5c384219d3699(),\n color: new $a315ee31802fb757$export$892596cec99bc70e(),\n distance: 0,\n decay: 0\n };\n break;\n case \"HemisphereLight\":\n uniforms = {\n direction: new $a315ee31802fb757$export$64b5c384219d3699(),\n skyColor: new $a315ee31802fb757$export$892596cec99bc70e(),\n groundColor: new $a315ee31802fb757$export$892596cec99bc70e()\n };\n break;\n case \"RectAreaLight\":\n uniforms = {\n color: new $a315ee31802fb757$export$892596cec99bc70e(),\n position: new $a315ee31802fb757$export$64b5c384219d3699(),\n halfWidth: new $a315ee31802fb757$export$64b5c384219d3699(),\n halfHeight: new $a315ee31802fb757$export$64b5c384219d3699()\n };\n break;\n }\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nfunction $a315ee31802fb757$var$ShadowUniformsCache() {\n const lights = {};\n return {\n get: function(light) {\n if (lights[light.id] !== undefined) return lights[light.id];\n let uniforms;\n switch(light.type){\n case \"DirectionalLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $a315ee31802fb757$export$c977b3e384af9ae1()\n };\n break;\n case \"SpotLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $a315ee31802fb757$export$c977b3e384af9ae1()\n };\n break;\n case \"PointLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $a315ee31802fb757$export$c977b3e384af9ae1(),\n shadowCameraNear: 1,\n shadowCameraFar: 1000\n };\n break;\n }\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nlet $a315ee31802fb757$var$nextVersion = 0;\nfunction $a315ee31802fb757$var$shadowCastingAndTexturingLightsFirst(lightA, lightB) {\n return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0);\n}\nfunction $a315ee31802fb757$var$WebGLLights(extensions, capabilities) {\n const cache = new $a315ee31802fb757$var$UniformsCache();\n const shadowCache = $a315ee31802fb757$var$ShadowUniformsCache();\n const state = {\n version: 0,\n hash: {\n directionalLength: -1,\n pointLength: -1,\n spotLength: -1,\n rectAreaLength: -1,\n hemiLength: -1,\n numDirectionalShadows: -1,\n numPointShadows: -1,\n numSpotShadows: -1,\n numSpotMaps: -1\n },\n ambient: [\n 0,\n 0,\n 0\n ],\n probe: [],\n directional: [],\n directionalShadow: [],\n directionalShadowMap: [],\n directionalShadowMatrix: [],\n spot: [],\n spotLightMap: [],\n spotShadow: [],\n spotShadowMap: [],\n spotLightMatrix: [],\n rectArea: [],\n rectAreaLTC1: null,\n rectAreaLTC2: null,\n point: [],\n pointShadow: [],\n pointShadowMap: [],\n pointShadowMatrix: [],\n hemi: [],\n numSpotLightShadowsWithMaps: 0\n };\n for(let i = 0; i < 9; i++)state.probe.push(new $a315ee31802fb757$export$64b5c384219d3699());\n const vector3 = new $a315ee31802fb757$export$64b5c384219d3699();\n const matrix4 = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n const matrix42 = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n function setup(lights, useLegacyLights) {\n let r = 0, g = 0, b = 0;\n for(let i = 0; i < 9; i++)state.probe[i].set(0, 0, 0);\n let directionalLength = 0;\n let pointLength = 0;\n let spotLength = 0;\n let rectAreaLength = 0;\n let hemiLength = 0;\n let numDirectionalShadows = 0;\n let numPointShadows = 0;\n let numSpotShadows = 0;\n let numSpotMaps = 0;\n let numSpotShadowsWithMaps = 0;\n // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n lights.sort($a315ee31802fb757$var$shadowCastingAndTexturingLightsFirst);\n // artist-friendly light intensity scaling factor\n const scaleFactor = useLegacyLights === true ? Math.PI : 1;\n for(let i = 0, l = lights.length; i < l; i++){\n const light = lights[i];\n const color = light.color;\n const intensity = light.intensity;\n const distance = light.distance;\n const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null;\n if (light.isAmbientLight) {\n r += color.r * intensity * scaleFactor;\n g += color.g * intensity * scaleFactor;\n b += color.b * intensity * scaleFactor;\n } else if (light.isLightProbe) for(let j = 0; j < 9; j++)state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);\n else if (light.isDirectionalLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n if (light.castShadow) {\n const shadow = light.shadow;\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n state.directionalShadow[directionalLength] = shadowUniforms;\n state.directionalShadowMap[directionalLength] = shadowMap;\n state.directionalShadowMatrix[directionalLength] = light.shadow.matrix;\n numDirectionalShadows++;\n }\n state.directional[directionalLength] = uniforms;\n directionalLength++;\n } else if (light.isSpotLight) {\n const uniforms = cache.get(light);\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor);\n uniforms.distance = distance;\n uniforms.coneCos = Math.cos(light.angle);\n uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));\n uniforms.decay = light.decay;\n state.spot[spotLength] = uniforms;\n const shadow = light.shadow;\n if (light.map) {\n state.spotLightMap[numSpotMaps] = light.map;\n numSpotMaps++;\n // make sure the lightMatrix is up to date\n // TODO : do it if required only\n shadow.updateMatrices(light);\n if (light.castShadow) numSpotShadowsWithMaps++;\n }\n state.spotLightMatrix[spotLength] = shadow.matrix;\n if (light.castShadow) {\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n state.spotShadow[spotLength] = shadowUniforms;\n state.spotShadowMap[spotLength] = shadowMap;\n numSpotShadows++;\n }\n spotLength++;\n } else if (light.isRectAreaLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(color).multiplyScalar(intensity);\n uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);\n state.rectArea[rectAreaLength] = uniforms;\n rectAreaLength++;\n } else if (light.isPointLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n uniforms.distance = light.distance;\n uniforms.decay = light.decay;\n if (light.castShadow) {\n const shadow = light.shadow;\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n shadowUniforms.shadowCameraNear = shadow.camera.near;\n shadowUniforms.shadowCameraFar = shadow.camera.far;\n state.pointShadow[pointLength] = shadowUniforms;\n state.pointShadowMap[pointLength] = shadowMap;\n state.pointShadowMatrix[pointLength] = light.shadow.matrix;\n numPointShadows++;\n }\n state.point[pointLength] = uniforms;\n pointLength++;\n } else if (light.isHemisphereLight) {\n const uniforms = cache.get(light);\n uniforms.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor);\n uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor);\n state.hemi[hemiLength] = uniforms;\n hemiLength++;\n }\n }\n if (rectAreaLength > 0) {\n if (capabilities.isWebGL2) {\n // WebGL 2\n state.rectAreaLTC1 = $a315ee31802fb757$export$6643083551874bf5.LTC_FLOAT_1;\n state.rectAreaLTC2 = $a315ee31802fb757$export$6643083551874bf5.LTC_FLOAT_2;\n } else {\n // WebGL 1\n if (extensions.has(\"OES_texture_float_linear\") === true) {\n state.rectAreaLTC1 = $a315ee31802fb757$export$6643083551874bf5.LTC_FLOAT_1;\n state.rectAreaLTC2 = $a315ee31802fb757$export$6643083551874bf5.LTC_FLOAT_2;\n } else if (extensions.has(\"OES_texture_half_float_linear\") === true) {\n state.rectAreaLTC1 = $a315ee31802fb757$export$6643083551874bf5.LTC_HALF_1;\n state.rectAreaLTC2 = $a315ee31802fb757$export$6643083551874bf5.LTC_HALF_2;\n } else console.error(\"THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.\");\n }\n }\n state.ambient[0] = r;\n state.ambient[1] = g;\n state.ambient[2] = b;\n const hash = state.hash;\n if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps) {\n state.directional.length = directionalLength;\n state.spot.length = spotLength;\n state.rectArea.length = rectAreaLength;\n state.point.length = pointLength;\n state.hemi.length = hemiLength;\n state.directionalShadow.length = numDirectionalShadows;\n state.directionalShadowMap.length = numDirectionalShadows;\n state.pointShadow.length = numPointShadows;\n state.pointShadowMap.length = numPointShadows;\n state.spotShadow.length = numSpotShadows;\n state.spotShadowMap.length = numSpotShadows;\n state.directionalShadowMatrix.length = numDirectionalShadows;\n state.pointShadowMatrix.length = numPointShadows;\n state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n state.spotLightMap.length = numSpotMaps;\n state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n hash.directionalLength = directionalLength;\n hash.pointLength = pointLength;\n hash.spotLength = spotLength;\n hash.rectAreaLength = rectAreaLength;\n hash.hemiLength = hemiLength;\n hash.numDirectionalShadows = numDirectionalShadows;\n hash.numPointShadows = numPointShadows;\n hash.numSpotShadows = numSpotShadows;\n hash.numSpotMaps = numSpotMaps;\n state.version = $a315ee31802fb757$var$nextVersion++;\n }\n }\n function setupView(lights, camera) {\n let directionalLength = 0;\n let pointLength = 0;\n let spotLength = 0;\n let rectAreaLength = 0;\n let hemiLength = 0;\n const viewMatrix = camera.matrixWorldInverse;\n for(let i = 0, l = lights.length; i < l; i++){\n const light = lights[i];\n if (light.isDirectionalLight) {\n const uniforms = state.directional[directionalLength];\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n uniforms.direction.sub(vector3);\n uniforms.direction.transformDirection(viewMatrix);\n directionalLength++;\n } else if (light.isSpotLight) {\n const uniforms = state.spot[spotLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n uniforms.direction.sub(vector3);\n uniforms.direction.transformDirection(viewMatrix);\n spotLength++;\n } else if (light.isRectAreaLight) {\n const uniforms = state.rectArea[rectAreaLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n // extract local rotation of light to derive width/height half vectors\n matrix42.identity();\n matrix4.copy(light.matrixWorld);\n matrix4.premultiply(viewMatrix);\n matrix42.extractRotation(matrix4);\n uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);\n uniforms.halfWidth.applyMatrix4(matrix42);\n uniforms.halfHeight.applyMatrix4(matrix42);\n rectAreaLength++;\n } else if (light.isPointLight) {\n const uniforms = state.point[pointLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n pointLength++;\n } else if (light.isHemisphereLight) {\n const uniforms = state.hemi[hemiLength];\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n uniforms.direction.transformDirection(viewMatrix);\n hemiLength++;\n }\n }\n }\n return {\n setup: setup,\n setupView: setupView,\n state: state\n };\n}\nfunction $a315ee31802fb757$var$WebGLRenderState(extensions, capabilities) {\n const lights = new $a315ee31802fb757$var$WebGLLights(extensions, capabilities);\n const lightsArray = [];\n const shadowsArray = [];\n function init() {\n lightsArray.length = 0;\n shadowsArray.length = 0;\n }\n function pushLight(light) {\n lightsArray.push(light);\n }\n function pushShadow(shadowLight) {\n shadowsArray.push(shadowLight);\n }\n function setupLights(useLegacyLights) {\n lights.setup(lightsArray, useLegacyLights);\n }\n function setupLightsView(camera) {\n lights.setupView(lightsArray, camera);\n }\n const state = {\n lightsArray: lightsArray,\n shadowsArray: shadowsArray,\n lights: lights\n };\n return {\n init: init,\n state: state,\n setupLights: setupLights,\n setupLightsView: setupLightsView,\n pushLight: pushLight,\n pushShadow: pushShadow\n };\n}\nfunction $a315ee31802fb757$var$WebGLRenderStates(extensions, capabilities) {\n let renderStates = new WeakMap();\n function get(scene, renderCallDepth = 0) {\n const renderStateArray = renderStates.get(scene);\n let renderState;\n if (renderStateArray === undefined) {\n renderState = new $a315ee31802fb757$var$WebGLRenderState(extensions, capabilities);\n renderStates.set(scene, [\n renderState\n ]);\n } else if (renderCallDepth >= renderStateArray.length) {\n renderState = new $a315ee31802fb757$var$WebGLRenderState(extensions, capabilities);\n renderStateArray.push(renderState);\n } else renderState = renderStateArray[renderCallDepth];\n return renderState;\n }\n function dispose() {\n renderStates = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nclass $a315ee31802fb757$export$2698c22ec13825db extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshDepthMaterial = true;\n this.type = \"MeshDepthMaterial\";\n this.depthPacking = $a315ee31802fb757$export$deeb383078690b50;\n this.map = null;\n this.alphaMap = null;\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.depthPacking = source.depthPacking;\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n return this;\n }\n}\nclass $a315ee31802fb757$export$33e187ed002f2a19 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshDistanceMaterial = true;\n this.type = \"MeshDistanceMaterial\";\n this.map = null;\n this.alphaMap = null;\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n return this;\n }\n}\nconst $a315ee31802fb757$var$vertex = \"void main() {\\n\tgl_Position = vec4( position, 1.0 );\\n}\";\nconst $a315ee31802fb757$var$fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\tconst float samples = float( VSM_SAMPLES );\\n\tfloat mean = 0.0;\\n\tfloat squared_mean = 0.0;\\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\t\tfloat uvOffset = uvStart + i * uvStride;\\n\t\t#ifdef HORIZONTAL_PASS\\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\t\t\tmean += distribution.x;\\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\t\t#else\\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\t\t\tmean += depth;\\n\t\t\tsquared_mean += depth * depth;\\n\t\t#endif\\n\t}\\n\tmean = mean / samples;\\n\tsquared_mean = squared_mean / samples;\\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\nfunction $a315ee31802fb757$var$WebGLShadowMap(_renderer, _objects, _capabilities) {\n let _frustum = new $a315ee31802fb757$export$35efe6f4c85463d2();\n const _shadowMapSize = new $a315ee31802fb757$export$c977b3e384af9ae1(), _viewportSize = new $a315ee31802fb757$export$c977b3e384af9ae1(), _viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3(), _depthMaterial = new $a315ee31802fb757$export$2698c22ec13825db({\n depthPacking: $a315ee31802fb757$export$8f910f4c4f73df11\n }), _distanceMaterial = new $a315ee31802fb757$export$33e187ed002f2a19(), _materialCache = {}, _maxTextureSize = _capabilities.maxTextureSize;\n const shadowSide = {\n [$a315ee31802fb757$export$2ede184fc2998901]: $a315ee31802fb757$export$d9f0486e75b5ace,\n [$a315ee31802fb757$export$d9f0486e75b5ace]: $a315ee31802fb757$export$2ede184fc2998901,\n [$a315ee31802fb757$export$3b296b6f144d5b03]: $a315ee31802fb757$export$3b296b6f144d5b03\n };\n const shadowMaterialVertical = new $a315ee31802fb757$export$83c7d75d550a8b0d({\n defines: {\n VSM_SAMPLES: 8\n },\n uniforms: {\n shadow_pass: {\n value: null\n },\n resolution: {\n value: new $a315ee31802fb757$export$c977b3e384af9ae1()\n },\n radius: {\n value: 4.0\n }\n },\n vertexShader: $a315ee31802fb757$var$vertex,\n fragmentShader: $a315ee31802fb757$var$fragment\n });\n const shadowMaterialHorizontal = shadowMaterialVertical.clone();\n shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n const fullScreenTri = new $a315ee31802fb757$export$b7be63a67df8959();\n fullScreenTri.setAttribute(\"position\", new $a315ee31802fb757$export$8dea267bd6bde117(new Float32Array([\n -1,\n -1,\n 0.5,\n 3,\n -1,\n 0.5,\n -1,\n 3,\n 0.5\n ]), 3));\n const fullScreenMesh = new $a315ee31802fb757$export$e176487c05830cc5(fullScreenTri, shadowMaterialVertical);\n const scope = this;\n this.enabled = false;\n this.autoUpdate = true;\n this.needsUpdate = false;\n this.type = $a315ee31802fb757$export$5813f879eee7cd88;\n let _previousType = this.type;\n this.render = function(lights, scene, camera) {\n if (scope.enabled === false) return;\n if (scope.autoUpdate === false && scope.needsUpdate === false) return;\n if (lights.length === 0) return;\n const currentRenderTarget = _renderer.getRenderTarget();\n const activeCubeFace = _renderer.getActiveCubeFace();\n const activeMipmapLevel = _renderer.getActiveMipmapLevel();\n const _state = _renderer.state;\n // Set GL state for depth map.\n _state.setBlending($a315ee31802fb757$export$63b8d6b580fc65ba);\n _state.buffers.color.setClear(1, 1, 1, 1);\n _state.buffers.depth.setTest(true);\n _state.setScissorTest(false);\n // check for shadow map type changes\n const toVSM = _previousType !== $a315ee31802fb757$export$896ae1ade6c829c4 && this.type === $a315ee31802fb757$export$896ae1ade6c829c4;\n const fromVSM = _previousType === $a315ee31802fb757$export$896ae1ade6c829c4 && this.type !== $a315ee31802fb757$export$896ae1ade6c829c4;\n // render depth map\n for(let i = 0, il = lights.length; i < il; i++){\n const light = lights[i];\n const shadow = light.shadow;\n if (shadow === undefined) {\n console.warn(\"THREE.WebGLShadowMap:\", light, \"has no shadow.\");\n continue;\n }\n if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue;\n _shadowMapSize.copy(shadow.mapSize);\n const shadowFrameExtents = shadow.getFrameExtents();\n _shadowMapSize.multiply(shadowFrameExtents);\n _viewportSize.copy(shadow.mapSize);\n if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) {\n if (_shadowMapSize.x > _maxTextureSize) {\n _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x);\n _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n shadow.mapSize.x = _viewportSize.x;\n }\n if (_shadowMapSize.y > _maxTextureSize) {\n _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y);\n _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n shadow.mapSize.y = _viewportSize.y;\n }\n }\n if (shadow.map === null || toVSM === true || fromVSM === true) {\n const pars = this.type !== $a315ee31802fb757$export$896ae1ade6c829c4 ? {\n minFilter: $a315ee31802fb757$export$727aa5ec3fe39bf0,\n magFilter: $a315ee31802fb757$export$727aa5ec3fe39bf0\n } : {};\n if (shadow.map !== null) shadow.map.dispose();\n shadow.map = new $a315ee31802fb757$export$3c052beb2e51e23f(_shadowMapSize.x, _shadowMapSize.y, pars);\n shadow.map.texture.name = light.name + \".shadowMap\";\n shadow.camera.updateProjectionMatrix();\n }\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n const viewportCount = shadow.getViewportCount();\n for(let vp = 0; vp < viewportCount; vp++){\n const viewport = shadow.getViewport(vp);\n _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w);\n _state.viewport(_viewport);\n shadow.updateMatrices(light, vp);\n _frustum = shadow.getFrustum();\n renderObject(scene, camera, shadow.camera, light, this.type);\n }\n // do blur pass for VSM\n if (shadow.isPointLightShadow !== true && this.type === $a315ee31802fb757$export$896ae1ade6c829c4) VSMPass(shadow, camera);\n shadow.needsUpdate = false;\n }\n _previousType = this.type;\n scope.needsUpdate = false;\n _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\n };\n function VSMPass(shadow, camera) {\n const geometry = _objects.update(fullScreenMesh);\n if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) {\n shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialVertical.needsUpdate = true;\n shadowMaterialHorizontal.needsUpdate = true;\n }\n if (shadow.mapPass === null) shadow.mapPass = new $a315ee31802fb757$export$3c052beb2e51e23f(_shadowMapSize.x, _shadowMapSize.y);\n // vertical pass\n shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialVertical.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.mapPass);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null);\n // horizontal pass\n shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);\n }\n function getDepthMaterial(object, material, light, type) {\n let result = null;\n const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;\n if (customMaterial !== undefined) result = customMaterial;\n else {\n result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;\n if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {\n // in this case we need a unique material instance reflecting the\n // appropriate state\n const keyA = result.uuid, keyB = material.uuid;\n let materialsForVariant = _materialCache[keyA];\n if (materialsForVariant === undefined) {\n materialsForVariant = {};\n _materialCache[keyA] = materialsForVariant;\n }\n let cachedMaterial = materialsForVariant[keyB];\n if (cachedMaterial === undefined) {\n cachedMaterial = result.clone();\n materialsForVariant[keyB] = cachedMaterial;\n }\n result = cachedMaterial;\n }\n }\n result.visible = material.visible;\n result.wireframe = material.wireframe;\n if (type === $a315ee31802fb757$export$896ae1ade6c829c4) result.side = material.shadowSide !== null ? material.shadowSide : material.side;\n else result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];\n result.alphaMap = material.alphaMap;\n result.alphaTest = material.alphaTest;\n result.map = material.map;\n result.clipShadows = material.clipShadows;\n result.clippingPlanes = material.clippingPlanes;\n result.clipIntersection = material.clipIntersection;\n result.displacementMap = material.displacementMap;\n result.displacementScale = material.displacementScale;\n result.displacementBias = material.displacementBias;\n result.wireframeLinewidth = material.wireframeLinewidth;\n result.linewidth = material.linewidth;\n if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {\n const materialProperties = _renderer.properties.get(result);\n materialProperties.light = light;\n }\n return result;\n }\n function renderObject(object, camera, shadowCamera, light, type) {\n if (object.visible === false) return;\n const visible = object.layers.test(camera.layers);\n if (visible && (object.isMesh || object.isLine || object.isPoints)) {\n if ((object.castShadow || object.receiveShadow && type === $a315ee31802fb757$export$896ae1ade6c829c4) && (!object.frustumCulled || _frustum.intersectsObject(object))) {\n object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);\n const geometry = _objects.update(object);\n const material = object.material;\n if (Array.isArray(material)) {\n const groups = geometry.groups;\n for(let k = 0, kl = groups.length; k < kl; k++){\n const group = groups[k];\n const groupMaterial = material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) {\n const depthMaterial = getDepthMaterial(object, groupMaterial, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group);\n }\n }\n } else if (material.visible) {\n const depthMaterial = getDepthMaterial(object, material, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)renderObject(children[i], camera, shadowCamera, light, type);\n }\n}\nfunction $a315ee31802fb757$var$WebGLState(gl, extensions, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n function ColorBuffer() {\n let locked = false;\n const color = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n let currentColorMask = null;\n const currentColorClear = new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, 0, 0);\n return {\n setMask: function(colorMask) {\n if (currentColorMask !== colorMask && !locked) {\n gl.colorMask(colorMask, colorMask, colorMask, colorMask);\n currentColorMask = colorMask;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(r, g, b, a, premultipliedAlpha) {\n if (premultipliedAlpha === true) {\n r *= a;\n g *= a;\n b *= a;\n }\n color.set(r, g, b, a);\n if (currentColorClear.equals(color) === false) {\n gl.clearColor(r, g, b, a);\n currentColorClear.copy(color);\n }\n },\n reset: function() {\n locked = false;\n currentColorMask = null;\n currentColorClear.set(-1, 0, 0, 0); // set to invalid state\n }\n };\n }\n function DepthBuffer() {\n let locked = false;\n let currentDepthMask = null;\n let currentDepthFunc = null;\n let currentDepthClear = null;\n return {\n setTest: function(depthTest) {\n if (depthTest) enable(gl.DEPTH_TEST);\n else disable(gl.DEPTH_TEST);\n },\n setMask: function(depthMask) {\n if (currentDepthMask !== depthMask && !locked) {\n gl.depthMask(depthMask);\n currentDepthMask = depthMask;\n }\n },\n setFunc: function(depthFunc) {\n if (currentDepthFunc !== depthFunc) {\n switch(depthFunc){\n case $a315ee31802fb757$export$69025ce147cee220:\n gl.depthFunc(gl.NEVER);\n break;\n case $a315ee31802fb757$export$7182eb52ea3b3f04:\n gl.depthFunc(gl.ALWAYS);\n break;\n case $a315ee31802fb757$export$eedccec66ab7ebe:\n gl.depthFunc(gl.LESS);\n break;\n case $a315ee31802fb757$export$296f78a0b892f81a:\n gl.depthFunc(gl.LEQUAL);\n break;\n case $a315ee31802fb757$export$a60d398fc7b7590e:\n gl.depthFunc(gl.EQUAL);\n break;\n case $a315ee31802fb757$export$7d7234c1240a1fc4:\n gl.depthFunc(gl.GEQUAL);\n break;\n case $a315ee31802fb757$export$c5e2c52991f30937:\n gl.depthFunc(gl.GREATER);\n break;\n case $a315ee31802fb757$export$2f843afa843d8916:\n gl.depthFunc(gl.NOTEQUAL);\n break;\n default:\n gl.depthFunc(gl.LEQUAL);\n }\n currentDepthFunc = depthFunc;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(depth) {\n if (currentDepthClear !== depth) {\n gl.clearDepth(depth);\n currentDepthClear = depth;\n }\n },\n reset: function() {\n locked = false;\n currentDepthMask = null;\n currentDepthFunc = null;\n currentDepthClear = null;\n }\n };\n }\n function StencilBuffer() {\n let locked = false;\n let currentStencilMask = null;\n let currentStencilFunc = null;\n let currentStencilRef = null;\n let currentStencilFuncMask = null;\n let currentStencilFail = null;\n let currentStencilZFail = null;\n let currentStencilZPass = null;\n let currentStencilClear = null;\n return {\n setTest: function(stencilTest) {\n if (!locked) {\n if (stencilTest) enable(gl.STENCIL_TEST);\n else disable(gl.STENCIL_TEST);\n }\n },\n setMask: function(stencilMask) {\n if (currentStencilMask !== stencilMask && !locked) {\n gl.stencilMask(stencilMask);\n currentStencilMask = stencilMask;\n }\n },\n setFunc: function(stencilFunc, stencilRef, stencilMask) {\n if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) {\n gl.stencilFunc(stencilFunc, stencilRef, stencilMask);\n currentStencilFunc = stencilFunc;\n currentStencilRef = stencilRef;\n currentStencilFuncMask = stencilMask;\n }\n },\n setOp: function(stencilFail, stencilZFail, stencilZPass) {\n if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) {\n gl.stencilOp(stencilFail, stencilZFail, stencilZPass);\n currentStencilFail = stencilFail;\n currentStencilZFail = stencilZFail;\n currentStencilZPass = stencilZPass;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(stencil) {\n if (currentStencilClear !== stencil) {\n gl.clearStencil(stencil);\n currentStencilClear = stencil;\n }\n },\n reset: function() {\n locked = false;\n currentStencilMask = null;\n currentStencilFunc = null;\n currentStencilRef = null;\n currentStencilFuncMask = null;\n currentStencilFail = null;\n currentStencilZFail = null;\n currentStencilZPass = null;\n currentStencilClear = null;\n }\n };\n }\n //\n const colorBuffer = new ColorBuffer();\n const depthBuffer = new DepthBuffer();\n const stencilBuffer = new StencilBuffer();\n const uboBindings = new WeakMap();\n const uboProgramMap = new WeakMap();\n let enabledCapabilities = {};\n let currentBoundFramebuffers = {};\n let currentDrawbuffers = new WeakMap();\n let defaultDrawbuffers = [];\n let currentProgram = null;\n let currentBlendingEnabled = false;\n let currentBlending = null;\n let currentBlendEquation = null;\n let currentBlendSrc = null;\n let currentBlendDst = null;\n let currentBlendEquationAlpha = null;\n let currentBlendSrcAlpha = null;\n let currentBlendDstAlpha = null;\n let currentPremultipledAlpha = false;\n let currentFlipSided = null;\n let currentCullFace = null;\n let currentLineWidth = null;\n let currentPolygonOffsetFactor = null;\n let currentPolygonOffsetUnits = null;\n const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\n let lineWidthAvailable = false;\n let version = 0;\n const glVersion = gl.getParameter(gl.VERSION);\n if (glVersion.indexOf(\"WebGL\") !== -1) {\n version = parseFloat(/^WebGL (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 1.0;\n } else if (glVersion.indexOf(\"OpenGL ES\") !== -1) {\n version = parseFloat(/^OpenGL ES (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 2.0;\n }\n let currentTextureSlot = null;\n let currentBoundTextures = {};\n const scissorParam = gl.getParameter(gl.SCISSOR_BOX);\n const viewportParam = gl.getParameter(gl.VIEWPORT);\n const currentScissor = new $a315ee31802fb757$export$fa7daccca11cdbe3().fromArray(scissorParam);\n const currentViewport = new $a315ee31802fb757$export$fa7daccca11cdbe3().fromArray(viewportParam);\n function createTexture(type, target, count, dimensions) {\n const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4.\n const texture = gl.createTexture();\n gl.bindTexture(type, texture);\n gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n for(let i = 0; i < count; i++)if (isWebGL2 && (type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY)) gl.texImage3D(target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n else gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n return texture;\n }\n const emptyTextures = {};\n emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1);\n emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6);\n if (isWebGL2) {\n emptyTextures[gl.TEXTURE_2D_ARRAY] = createTexture(gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1);\n emptyTextures[gl.TEXTURE_3D] = createTexture(gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1);\n }\n // init\n colorBuffer.setClear(0, 0, 0, 1);\n depthBuffer.setClear(1);\n stencilBuffer.setClear(0);\n enable(gl.DEPTH_TEST);\n depthBuffer.setFunc($a315ee31802fb757$export$296f78a0b892f81a);\n setFlipSided(false);\n setCullFace($a315ee31802fb757$export$b9a7b4fc5cb15f9b);\n enable(gl.CULL_FACE);\n setBlending($a315ee31802fb757$export$63b8d6b580fc65ba);\n //\n function enable(id) {\n if (enabledCapabilities[id] !== true) {\n gl.enable(id);\n enabledCapabilities[id] = true;\n }\n }\n function disable(id) {\n if (enabledCapabilities[id] !== false) {\n gl.disable(id);\n enabledCapabilities[id] = false;\n }\n }\n function bindFramebuffer(target, framebuffer) {\n if (currentBoundFramebuffers[target] !== framebuffer) {\n gl.bindFramebuffer(target, framebuffer);\n currentBoundFramebuffers[target] = framebuffer;\n if (isWebGL2) {\n // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n if (target === gl.DRAW_FRAMEBUFFER) currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer;\n if (target === gl.FRAMEBUFFER) currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer;\n }\n return true;\n }\n return false;\n }\n function drawBuffers(renderTarget, framebuffer) {\n let drawBuffers = defaultDrawbuffers;\n let needsUpdate = false;\n if (renderTarget) {\n drawBuffers = currentDrawbuffers.get(framebuffer);\n if (drawBuffers === undefined) {\n drawBuffers = [];\n currentDrawbuffers.set(framebuffer, drawBuffers);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) {\n const textures = renderTarget.texture;\n if (drawBuffers.length !== textures.length || drawBuffers[0] !== gl.COLOR_ATTACHMENT0) {\n for(let i = 0, il = textures.length; i < il; i++)drawBuffers[i] = gl.COLOR_ATTACHMENT0 + i;\n drawBuffers.length = textures.length;\n needsUpdate = true;\n }\n } else if (drawBuffers[0] !== gl.COLOR_ATTACHMENT0) {\n drawBuffers[0] = gl.COLOR_ATTACHMENT0;\n needsUpdate = true;\n }\n } else if (drawBuffers[0] !== gl.BACK) {\n drawBuffers[0] = gl.BACK;\n needsUpdate = true;\n }\n if (needsUpdate) {\n if (capabilities.isWebGL2) gl.drawBuffers(drawBuffers);\n else extensions.get(\"WEBGL_draw_buffers\").drawBuffersWEBGL(drawBuffers);\n }\n }\n function useProgram(program) {\n if (currentProgram !== program) {\n gl.useProgram(program);\n currentProgram = program;\n return true;\n }\n return false;\n }\n const equationToGL = {\n [$a315ee31802fb757$export$20183a0484ce21a0]: gl.FUNC_ADD,\n [$a315ee31802fb757$export$73e0df5177988548]: gl.FUNC_SUBTRACT,\n [$a315ee31802fb757$export$28e582859cbec660]: gl.FUNC_REVERSE_SUBTRACT\n };\n if (isWebGL2) {\n equationToGL[$a315ee31802fb757$export$c8c1508da8d0600c] = gl.MIN;\n equationToGL[$a315ee31802fb757$export$99948c02fb51055f] = gl.MAX;\n } else {\n const extension = extensions.get(\"EXT_blend_minmax\");\n if (extension !== null) {\n equationToGL[$a315ee31802fb757$export$c8c1508da8d0600c] = extension.MIN_EXT;\n equationToGL[$a315ee31802fb757$export$99948c02fb51055f] = extension.MAX_EXT;\n }\n }\n const factorToGL = {\n [$a315ee31802fb757$export$2110f05edf778d3d]: gl.ZERO,\n [$a315ee31802fb757$export$8805bad65e24940e]: gl.ONE,\n [$a315ee31802fb757$export$7fbe15b28d28cf52]: gl.SRC_COLOR,\n [$a315ee31802fb757$export$d5773124e86cf28c]: gl.SRC_ALPHA,\n [$a315ee31802fb757$export$c05e2a1fc8609506]: gl.SRC_ALPHA_SATURATE,\n [$a315ee31802fb757$export$ef5f2dd8ffac5574]: gl.DST_COLOR,\n [$a315ee31802fb757$export$a78aed1ca2a87192]: gl.DST_ALPHA,\n [$a315ee31802fb757$export$947829af9f2c17f6]: gl.ONE_MINUS_SRC_COLOR,\n [$a315ee31802fb757$export$11d468cc7f19e971]: gl.ONE_MINUS_SRC_ALPHA,\n [$a315ee31802fb757$export$56b85b2686ab16]: gl.ONE_MINUS_DST_COLOR,\n [$a315ee31802fb757$export$5d0fe17fd8773bac]: gl.ONE_MINUS_DST_ALPHA\n };\n function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {\n if (blending === $a315ee31802fb757$export$63b8d6b580fc65ba) {\n if (currentBlendingEnabled === true) {\n disable(gl.BLEND);\n currentBlendingEnabled = false;\n }\n return;\n }\n if (currentBlendingEnabled === false) {\n enable(gl.BLEND);\n currentBlendingEnabled = true;\n }\n if (blending !== $a315ee31802fb757$export$eda4864c68df1fa2) {\n if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) {\n if (currentBlendEquation !== $a315ee31802fb757$export$20183a0484ce21a0 || currentBlendEquationAlpha !== $a315ee31802fb757$export$20183a0484ce21a0) {\n gl.blendEquation(gl.FUNC_ADD);\n currentBlendEquation = $a315ee31802fb757$export$20183a0484ce21a0;\n currentBlendEquationAlpha = $a315ee31802fb757$export$20183a0484ce21a0;\n }\n if (premultipliedAlpha) switch(blending){\n case $a315ee31802fb757$export$5b29a26d96ee6af0:\n gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case $a315ee31802fb757$export$777d8f9551c2216b:\n gl.blendFunc(gl.ONE, gl.ONE);\n break;\n case $a315ee31802fb757$export$cdfa06f868e2e467:\n gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);\n break;\n case $a315ee31802fb757$export$4138e1c684b46a20:\n gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA);\n break;\n default:\n console.error(\"THREE.WebGLState: Invalid blending: \", blending);\n break;\n }\n else switch(blending){\n case $a315ee31802fb757$export$5b29a26d96ee6af0:\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case $a315ee31802fb757$export$777d8f9551c2216b:\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE);\n break;\n case $a315ee31802fb757$export$cdfa06f868e2e467:\n gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);\n break;\n case $a315ee31802fb757$export$4138e1c684b46a20:\n gl.blendFunc(gl.ZERO, gl.SRC_COLOR);\n break;\n default:\n console.error(\"THREE.WebGLState: Invalid blending: \", blending);\n break;\n }\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentBlending = blending;\n currentPremultipledAlpha = premultipliedAlpha;\n }\n return;\n }\n // custom blending\n blendEquationAlpha = blendEquationAlpha || blendEquation;\n blendSrcAlpha = blendSrcAlpha || blendSrc;\n blendDstAlpha = blendDstAlpha || blendDst;\n if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) {\n gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]);\n currentBlendEquation = blendEquation;\n currentBlendEquationAlpha = blendEquationAlpha;\n }\n if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) {\n gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]);\n currentBlendSrc = blendSrc;\n currentBlendDst = blendDst;\n currentBlendSrcAlpha = blendSrcAlpha;\n currentBlendDstAlpha = blendDstAlpha;\n }\n currentBlending = blending;\n currentPremultipledAlpha = false;\n }\n function setMaterial(material, frontFaceCW) {\n material.side === $a315ee31802fb757$export$3b296b6f144d5b03 ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE);\n let flipSided = material.side === $a315ee31802fb757$export$d9f0486e75b5ace;\n if (frontFaceCW) flipSided = !flipSided;\n setFlipSided(flipSided);\n material.blending === $a315ee31802fb757$export$5b29a26d96ee6af0 && material.transparent === false ? setBlending($a315ee31802fb757$export$63b8d6b580fc65ba) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);\n depthBuffer.setFunc(material.depthFunc);\n depthBuffer.setTest(material.depthTest);\n depthBuffer.setMask(material.depthWrite);\n colorBuffer.setMask(material.colorWrite);\n const stencilWrite = material.stencilWrite;\n stencilBuffer.setTest(stencilWrite);\n if (stencilWrite) {\n stencilBuffer.setMask(material.stencilWriteMask);\n stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);\n stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);\n }\n setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);\n material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE);\n }\n //\n function setFlipSided(flipSided) {\n if (currentFlipSided !== flipSided) {\n if (flipSided) gl.frontFace(gl.CW);\n else gl.frontFace(gl.CCW);\n currentFlipSided = flipSided;\n }\n }\n function setCullFace(cullFace) {\n if (cullFace !== $a315ee31802fb757$export$3237e1f2c1ea1f44) {\n enable(gl.CULL_FACE);\n if (cullFace !== currentCullFace) {\n if (cullFace === $a315ee31802fb757$export$b9a7b4fc5cb15f9b) gl.cullFace(gl.BACK);\n else if (cullFace === $a315ee31802fb757$export$b8058bcc7037d3f3) gl.cullFace(gl.FRONT);\n else gl.cullFace(gl.FRONT_AND_BACK);\n }\n } else disable(gl.CULL_FACE);\n currentCullFace = cullFace;\n }\n function setLineWidth(width) {\n if (width !== currentLineWidth) {\n if (lineWidthAvailable) gl.lineWidth(width);\n currentLineWidth = width;\n }\n }\n function setPolygonOffset(polygonOffset, factor, units) {\n if (polygonOffset) {\n enable(gl.POLYGON_OFFSET_FILL);\n if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) {\n gl.polygonOffset(factor, units);\n currentPolygonOffsetFactor = factor;\n currentPolygonOffsetUnits = units;\n }\n } else disable(gl.POLYGON_OFFSET_FILL);\n }\n function setScissorTest(scissorTest) {\n if (scissorTest) enable(gl.SCISSOR_TEST);\n else disable(gl.SCISSOR_TEST);\n }\n // texture\n function activeTexture(webglSlot) {\n if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n }\n function bindTexture(webglType, webglTexture, webglSlot) {\n if (webglSlot === undefined) {\n if (currentTextureSlot === null) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n else webglSlot = currentTextureSlot;\n }\n let boundTexture = currentBoundTextures[webglSlot];\n if (boundTexture === undefined) {\n boundTexture = {\n type: undefined,\n texture: undefined\n };\n currentBoundTextures[webglSlot] = boundTexture;\n }\n if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);\n boundTexture.type = webglType;\n boundTexture.texture = webglTexture;\n }\n }\n function unbindTexture() {\n const boundTexture = currentBoundTextures[currentTextureSlot];\n if (boundTexture !== undefined && boundTexture.type !== undefined) {\n gl.bindTexture(boundTexture.type, null);\n boundTexture.type = undefined;\n boundTexture.texture = undefined;\n }\n }\n function compressedTexImage2D() {\n try {\n gl.compressedTexImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexImage3D() {\n try {\n gl.compressedTexImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texSubImage2D() {\n try {\n gl.texSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texSubImage3D() {\n try {\n gl.texSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexSubImage2D() {\n try {\n gl.compressedTexSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexSubImage3D() {\n try {\n gl.compressedTexSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texStorage2D() {\n try {\n gl.texStorage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texStorage3D() {\n try {\n gl.texStorage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texImage2D() {\n try {\n gl.texImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texImage3D() {\n try {\n gl.texImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n //\n function scissor(scissor) {\n if (currentScissor.equals(scissor) === false) {\n gl.scissor(scissor.x, scissor.y, scissor.z, scissor.w);\n currentScissor.copy(scissor);\n }\n }\n function viewport(viewport) {\n if (currentViewport.equals(viewport) === false) {\n gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);\n currentViewport.copy(viewport);\n }\n }\n function updateUBOMapping(uniformsGroup, program) {\n let mapping = uboProgramMap.get(program);\n if (mapping === undefined) {\n mapping = new WeakMap();\n uboProgramMap.set(program, mapping);\n }\n let blockIndex = mapping.get(uniformsGroup);\n if (blockIndex === undefined) {\n blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name);\n mapping.set(uniformsGroup, blockIndex);\n }\n }\n function uniformBlockBinding(uniformsGroup, program) {\n const mapping = uboProgramMap.get(program);\n const blockIndex = mapping.get(uniformsGroup);\n if (uboBindings.get(program) !== blockIndex) {\n // bind shader specific block index to global block point\n gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex);\n uboBindings.set(program, blockIndex);\n }\n }\n //\n function reset() {\n // reset state\n gl.disable(gl.BLEND);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.POLYGON_OFFSET_FILL);\n gl.disable(gl.SCISSOR_TEST);\n gl.disable(gl.STENCIL_TEST);\n gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.ONE, gl.ZERO);\n gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO);\n gl.colorMask(true, true, true, true);\n gl.clearColor(0, 0, 0, 0);\n gl.depthMask(true);\n gl.depthFunc(gl.LESS);\n gl.clearDepth(1);\n gl.stencilMask(0xffffffff);\n gl.stencilFunc(gl.ALWAYS, 0, 0xffffffff);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n gl.clearStencil(0);\n gl.cullFace(gl.BACK);\n gl.frontFace(gl.CCW);\n gl.polygonOffset(0, 0);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n if (isWebGL2 === true) {\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);\n }\n gl.useProgram(null);\n gl.lineWidth(1);\n gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);\n gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\n // reset internals\n enabledCapabilities = {};\n currentTextureSlot = null;\n currentBoundTextures = {};\n currentBoundFramebuffers = {};\n currentDrawbuffers = new WeakMap();\n defaultDrawbuffers = [];\n currentProgram = null;\n currentBlendingEnabled = false;\n currentBlending = null;\n currentBlendEquation = null;\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendEquationAlpha = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentPremultipledAlpha = false;\n currentFlipSided = null;\n currentCullFace = null;\n currentLineWidth = null;\n currentPolygonOffsetFactor = null;\n currentPolygonOffsetUnits = null;\n currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height);\n currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height);\n colorBuffer.reset();\n depthBuffer.reset();\n stencilBuffer.reset();\n }\n return {\n buffers: {\n color: colorBuffer,\n depth: depthBuffer,\n stencil: stencilBuffer\n },\n enable: enable,\n disable: disable,\n bindFramebuffer: bindFramebuffer,\n drawBuffers: drawBuffers,\n useProgram: useProgram,\n setBlending: setBlending,\n setMaterial: setMaterial,\n setFlipSided: setFlipSided,\n setCullFace: setCullFace,\n setLineWidth: setLineWidth,\n setPolygonOffset: setPolygonOffset,\n setScissorTest: setScissorTest,\n activeTexture: activeTexture,\n bindTexture: bindTexture,\n unbindTexture: unbindTexture,\n compressedTexImage2D: compressedTexImage2D,\n compressedTexImage3D: compressedTexImage3D,\n texImage2D: texImage2D,\n texImage3D: texImage3D,\n updateUBOMapping: updateUBOMapping,\n uniformBlockBinding: uniformBlockBinding,\n texStorage2D: texStorage2D,\n texStorage3D: texStorage3D,\n texSubImage2D: texSubImage2D,\n texSubImage3D: texSubImage3D,\n compressedTexSubImage2D: compressedTexSubImage2D,\n compressedTexSubImage3D: compressedTexSubImage3D,\n scissor: scissor,\n viewport: viewport,\n reset: reset\n };\n}\nfunction $a315ee31802fb757$var$WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) {\n const isWebGL2 = capabilities.isWebGL2;\n const maxTextures = capabilities.maxTextures;\n const maxCubemapSize = capabilities.maxCubemapSize;\n const maxTextureSize = capabilities.maxTextureSize;\n const maxSamples = capabilities.maxSamples;\n const multisampledRTTExt = extensions.has(\"WEBGL_multisampled_render_to_texture\") ? extensions.get(\"WEBGL_multisampled_render_to_texture\") : null;\n const supportsInvalidateFramebuffer = typeof navigator === \"undefined\" ? false : /OculusBrowser/g.test(navigator.userAgent);\n const _videoTextures = new WeakMap();\n let _canvas;\n const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n // also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n let useOffscreenCanvas = false;\n try {\n useOffscreenCanvas = typeof OffscreenCanvas !== \"undefined\" && new OffscreenCanvas(1, 1).getContext(\"2d\") !== null;\n } catch (err) {\n // Ignore any errors\n }\n function createCanvas(width, height) {\n // Use OffscreenCanvas when available. Specially needed in web workers\n return useOffscreenCanvas ? // eslint-disable-next-line compat/compat\n new OffscreenCanvas(width, height) : $a315ee31802fb757$var$createElementNS(\"canvas\");\n }\n function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) {\n let scale = 1;\n // handle case if texture exceeds max size\n if (image.width > maxSize || image.height > maxSize) scale = maxSize / Math.max(image.width, image.height);\n // only perform resize if necessary\n if (scale < 1 || needsPowerOfTwo === true) {\n // only perform resize for certain image types\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) {\n const floor = needsPowerOfTwo ? $a315ee31802fb757$var$floorPowerOfTwo : Math.floor;\n const width = floor(scale * image.width);\n const height = floor(scale * image.height);\n if (_canvas === undefined) _canvas = createCanvas(width, height);\n // cube textures can't reuse the same canvas\n const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas;\n canvas.width = width;\n canvas.height = height;\n const context = canvas.getContext(\"2d\");\n context.drawImage(image, 0, 0, width, height);\n console.warn(\"THREE.WebGLRenderer: Texture has been resized from (\" + image.width + \"x\" + image.height + \") to (\" + width + \"x\" + height + \").\");\n return canvas;\n } else {\n if (\"data\" in image) console.warn(\"THREE.WebGLRenderer: Image in DataTexture is too big (\" + image.width + \"x\" + image.height + \").\");\n return image;\n }\n }\n return image;\n }\n function isPowerOfTwo$1(image) {\n return $a315ee31802fb757$var$isPowerOfTwo(image.width) && $a315ee31802fb757$var$isPowerOfTwo(image.height);\n }\n function textureNeedsPowerOfTwo(texture) {\n if (isWebGL2) return false;\n return texture.wrapS !== $a315ee31802fb757$export$9d9334239a5a5e06 || texture.wrapT !== $a315ee31802fb757$export$9d9334239a5a5e06 || texture.minFilter !== $a315ee31802fb757$export$727aa5ec3fe39bf0 && texture.minFilter !== $a315ee31802fb757$export$8a72f490b25c56c8;\n }\n function textureNeedsGenerateMipmaps(texture, supportsMips) {\n return texture.generateMipmaps && supportsMips && texture.minFilter !== $a315ee31802fb757$export$727aa5ec3fe39bf0 && texture.minFilter !== $a315ee31802fb757$export$8a72f490b25c56c8;\n }\n function generateMipmap(target) {\n _gl.generateMipmap(target);\n }\n function getInternalFormat(internalFormatName, glFormat, glType, colorSpace1, forceLinearTransfer = false) {\n if (isWebGL2 === false) return glFormat;\n if (internalFormatName !== null) {\n if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName];\n console.warn(\"THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '\" + internalFormatName + \"'\");\n }\n let internalFormat = glFormat;\n if (glFormat === _gl.RED) {\n if (glType === _gl.FLOAT) internalFormat = _gl.R32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;\n }\n if (glFormat === _gl.RED_INTEGER) {\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;\n if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.R16UI;\n if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.R32UI;\n if (glType === _gl.BYTE) internalFormat = _gl.R8I;\n if (glType === _gl.SHORT) internalFormat = _gl.R16I;\n if (glType === _gl.INT) internalFormat = _gl.R32I;\n }\n if (glFormat === _gl.RG) {\n if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;\n }\n if (glFormat === _gl.RGBA) {\n if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa && forceLinearTransfer === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;\n if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;\n }\n if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) extensions.get(\"EXT_color_buffer_float\");\n return internalFormat;\n }\n function getMipLevels(texture, image, supportsMips) {\n if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== $a315ee31802fb757$export$727aa5ec3fe39bf0 && texture.minFilter !== $a315ee31802fb757$export$8a72f490b25c56c8) return Math.log2(Math.max(image.width, image.height)) + 1;\n else if (texture.mipmaps !== undefined && texture.mipmaps.length > 0) // user-defined mipmaps\n return texture.mipmaps.length;\n else if (texture.isCompressedTexture && Array.isArray(texture.image)) return image.mipmaps.length;\n else // texture without mipmaps (only base level)\n return 1;\n }\n // Fallback filters for non-power-of-2 textures\n function filterFallback(f) {\n if (f === $a315ee31802fb757$export$727aa5ec3fe39bf0 || f === $a315ee31802fb757$export$d129e38cf6feaa8c || f === $a315ee31802fb757$export$d2327c1afe5bfdf2) return _gl.NEAREST;\n return _gl.LINEAR;\n }\n //\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n deallocateTexture(texture);\n if (texture.isVideoTexture) _videoTextures.delete(texture);\n }\n function onRenderTargetDispose(event) {\n const renderTarget = event.target;\n renderTarget.removeEventListener(\"dispose\", onRenderTargetDispose);\n deallocateRenderTarget(renderTarget);\n }\n //\n function deallocateTexture(texture) {\n const textureProperties = properties.get(texture);\n if (textureProperties.__webglInit === undefined) return;\n // check if it's necessary to remove the WebGLTexture object\n const source = texture.source;\n const webglTextures = _sources.get(source);\n if (webglTextures) {\n const webglTexture = webglTextures[textureProperties.__cacheKey];\n webglTexture.usedTimes--;\n // the WebGLTexture object is not used anymore, remove it\n if (webglTexture.usedTimes === 0) deleteTexture(texture);\n // remove the weak map entry if no WebGLTexture uses the source anymore\n if (Object.keys(webglTextures).length === 0) _sources.delete(source);\n }\n properties.remove(texture);\n }\n function deleteTexture(texture) {\n const textureProperties = properties.get(texture);\n _gl.deleteTexture(textureProperties.__webglTexture);\n const source = texture.source;\n const webglTextures = _sources.get(source);\n delete webglTextures[textureProperties.__cacheKey];\n info.memory.textures--;\n }\n function deallocateRenderTarget(renderTarget) {\n const texture = renderTarget.texture;\n const renderTargetProperties = properties.get(renderTarget);\n const textureProperties = properties.get(texture);\n if (textureProperties.__webglTexture !== undefined) {\n _gl.deleteTexture(textureProperties.__webglTexture);\n info.memory.textures--;\n }\n if (renderTarget.depthTexture) renderTarget.depthTexture.dispose();\n if (renderTarget.isWebGLCubeRenderTarget) for(let i = 0; i < 6; i++){\n if (Array.isArray(renderTargetProperties.__webglFramebuffer[i])) for(let level = 0; level < renderTargetProperties.__webglFramebuffer[i].length; level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i][level]);\n else _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);\n }\n else {\n if (Array.isArray(renderTargetProperties.__webglFramebuffer)) for(let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[level]);\n else _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);\n if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);\n if (renderTargetProperties.__webglColorRenderbuffer) {\n for(let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i++)if (renderTargetProperties.__webglColorRenderbuffer[i]) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i]);\n }\n if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) for(let i = 0, il = texture.length; i < il; i++){\n const attachmentProperties = properties.get(texture[i]);\n if (attachmentProperties.__webglTexture) {\n _gl.deleteTexture(attachmentProperties.__webglTexture);\n info.memory.textures--;\n }\n properties.remove(texture[i]);\n }\n properties.remove(texture);\n properties.remove(renderTarget);\n }\n //\n let textureUnits = 0;\n function resetTextureUnits() {\n textureUnits = 0;\n }\n function allocateTextureUnit() {\n const textureUnit = textureUnits;\n if (textureUnit >= maxTextures) console.warn(\"THREE.WebGLTextures: Trying to use \" + textureUnit + \" texture units while this GPU supports only \" + maxTextures);\n textureUnits += 1;\n return textureUnit;\n }\n function getTextureCacheKey(texture) {\n const array = [];\n array.push(texture.wrapS);\n array.push(texture.wrapT);\n array.push(texture.wrapR || 0);\n array.push(texture.magFilter);\n array.push(texture.minFilter);\n array.push(texture.anisotropy);\n array.push(texture.internalFormat);\n array.push(texture.format);\n array.push(texture.type);\n array.push(texture.generateMipmaps);\n array.push(texture.premultiplyAlpha);\n array.push(texture.flipY);\n array.push(texture.unpackAlignment);\n array.push(texture.colorSpace);\n return array.join();\n }\n //\n function setTexture2D(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.isVideoTexture) updateVideoTexture(texture);\n if (texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version) {\n const image = texture.image;\n if (image === null) console.warn(\"THREE.WebGLRenderer: Texture marked for update but no image data found.\");\n else if (image.complete === false) console.warn(\"THREE.WebGLRenderer: Texture marked for update but image is incomplete\");\n else {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n }\n state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTexture2DArray(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTexture3D(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTextureCube(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadCubeTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n const wrappingToGL = {\n [$a315ee31802fb757$export$533346c8e8dac0f5]: _gl.REPEAT,\n [$a315ee31802fb757$export$9d9334239a5a5e06]: _gl.CLAMP_TO_EDGE,\n [$a315ee31802fb757$export$c7e7c00b14f51a4f]: _gl.MIRRORED_REPEAT\n };\n const filterToGL = {\n [$a315ee31802fb757$export$727aa5ec3fe39bf0]: _gl.NEAREST,\n [$a315ee31802fb757$export$d129e38cf6feaa8c]: _gl.NEAREST_MIPMAP_NEAREST,\n [$a315ee31802fb757$export$d2327c1afe5bfdf2]: _gl.NEAREST_MIPMAP_LINEAR,\n [$a315ee31802fb757$export$8a72f490b25c56c8]: _gl.LINEAR,\n [$a315ee31802fb757$export$19a719f377145a13]: _gl.LINEAR_MIPMAP_NEAREST,\n [$a315ee31802fb757$export$5d8599b6a933fb1b]: _gl.LINEAR_MIPMAP_LINEAR\n };\n const compareToGL = {\n [$a315ee31802fb757$export$d9e2d19a747baaab]: _gl.NEVER,\n [$a315ee31802fb757$export$187b73a3e352c145]: _gl.ALWAYS,\n [$a315ee31802fb757$export$36bcf49c713b3eb7]: _gl.LESS,\n [$a315ee31802fb757$export$64eea11eb407ddf1]: _gl.LEQUAL,\n [$a315ee31802fb757$export$66f28d946fc6a0d5]: _gl.EQUAL,\n [$a315ee31802fb757$export$1cdcb70d53d65f61]: _gl.GEQUAL,\n [$a315ee31802fb757$export$155af022118f3a38]: _gl.GREATER,\n [$a315ee31802fb757$export$67ab95dde6bed156]: _gl.NOTEQUAL\n };\n function setTextureParameters(textureType, texture, supportsMips) {\n if (supportsMips) {\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]);\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]);\n if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]);\n _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]);\n _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]);\n } else {\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);\n if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE);\n if (texture.wrapS !== $a315ee31802fb757$export$9d9334239a5a5e06 || texture.wrapT !== $a315ee31802fb757$export$9d9334239a5a5e06) console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.\");\n _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter));\n _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter));\n if (texture.minFilter !== $a315ee31802fb757$export$727aa5ec3fe39bf0 && texture.minFilter !== $a315ee31802fb757$export$8a72f490b25c56c8) console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.\");\n }\n if (texture.compareFunction) {\n _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE);\n _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[texture.compareFunction]);\n }\n if (extensions.has(\"EXT_texture_filter_anisotropic\") === true) {\n const extension = extensions.get(\"EXT_texture_filter_anisotropic\");\n if (texture.magFilter === $a315ee31802fb757$export$727aa5ec3fe39bf0) return;\n if (texture.minFilter !== $a315ee31802fb757$export$d2327c1afe5bfdf2 && texture.minFilter !== $a315ee31802fb757$export$5d8599b6a933fb1b) return;\n if (texture.type === $a315ee31802fb757$export$f6d331659b644596 && extensions.has(\"OES_texture_float_linear\") === false) return; // verify extension for WebGL 1 and WebGL 2\n if (isWebGL2 === false && texture.type === $a315ee31802fb757$export$2697304443f382bc && extensions.has(\"OES_texture_half_float_linear\") === false) return; // verify extension for WebGL 1 only\n if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) {\n _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy()));\n properties.get(texture).__currentAnisotropy = texture.anisotropy;\n }\n }\n }\n function initTexture(textureProperties, texture) {\n let forceUpload = false;\n if (textureProperties.__webglInit === undefined) {\n textureProperties.__webglInit = true;\n texture.addEventListener(\"dispose\", onTextureDispose);\n }\n // create Source <-> WebGLTextures mapping if necessary\n const source = texture.source;\n let webglTextures = _sources.get(source);\n if (webglTextures === undefined) {\n webglTextures = {};\n _sources.set(source, webglTextures);\n }\n // check if there is already a WebGLTexture object for the given texture parameters\n const textureCacheKey = getTextureCacheKey(texture);\n if (textureCacheKey !== textureProperties.__cacheKey) {\n // if not, create a new instance of WebGLTexture\n if (webglTextures[textureCacheKey] === undefined) {\n // create new entry\n webglTextures[textureCacheKey] = {\n texture: _gl.createTexture(),\n usedTimes: 0\n };\n info.memory.textures++;\n // when a new instance of WebGLTexture was created, a texture upload is required\n // even if the image contents are identical\n forceUpload = true;\n }\n webglTextures[textureCacheKey].usedTimes++;\n // every time the texture cache key changes, it's necessary to check if an instance of\n // WebGLTexture can be deleted in order to avoid a memory leak.\n const webglTexture = webglTextures[textureProperties.__cacheKey];\n if (webglTexture !== undefined) {\n webglTextures[textureProperties.__cacheKey].usedTimes--;\n if (webglTexture.usedTimes === 0) deleteTexture(texture);\n }\n // store references to cache key and WebGLTexture object\n textureProperties.__cacheKey = textureCacheKey;\n textureProperties.__webglTexture = webglTextures[textureCacheKey].texture;\n }\n return forceUpload;\n }\n function uploadTexture(textureProperties, texture, slot) {\n let textureType = _gl.TEXTURE_2D;\n if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;\n if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;\n const forceUpload = initTexture(textureProperties, texture);\n const source = texture.source;\n state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n const sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(_gl.TEXTURE0 + slot);\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);\n _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);\n const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false;\n let image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);\n image = verifyColorSpace(texture, image);\n const supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace);\n let glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n setTextureParameters(textureType, texture, supportsMips);\n let mipmap;\n const mipmaps = texture.mipmaps;\n const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n const levels = getMipLevels(texture, image, supportsMips);\n if (texture.isDepthTexture) {\n // populate depth texture with dummy data\n glInternalFormat = _gl.DEPTH_COMPONENT;\n if (isWebGL2) {\n if (texture.type === $a315ee31802fb757$export$f6d331659b644596) glInternalFormat = _gl.DEPTH_COMPONENT32F;\n else if (texture.type === $a315ee31802fb757$export$c3c7fc4518ebba96) glInternalFormat = _gl.DEPTH_COMPONENT24;\n else if (texture.type === $a315ee31802fb757$export$6c8ea339bfab1301) glInternalFormat = _gl.DEPTH24_STENCIL8;\n else glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n } else if (texture.type === $a315ee31802fb757$export$f6d331659b644596) console.error(\"WebGLRenderer: Floating point depth texture requires WebGL2.\");\n // validation checks for WebGL 1\n if (texture.format === $a315ee31802fb757$export$c1b6b5136be58045 && glInternalFormat === _gl.DEPTH_COMPONENT) // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n {\n if (texture.type !== $a315ee31802fb757$export$c63dc51868b06a9d && texture.type !== $a315ee31802fb757$export$c3c7fc4518ebba96) {\n console.warn(\"THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.\");\n texture.type = $a315ee31802fb757$export$c3c7fc4518ebba96;\n glType = utils.convert(texture.type);\n }\n }\n if (texture.format === $a315ee31802fb757$export$1e113ac2d0905829 && glInternalFormat === _gl.DEPTH_COMPONENT) {\n // Depth stencil textures need the DEPTH_STENCIL internal format\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n glInternalFormat = _gl.DEPTH_STENCIL;\n // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n if (texture.type !== $a315ee31802fb757$export$6c8ea339bfab1301) {\n console.warn(\"THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.\");\n texture.type = $a315ee31802fb757$export$6c8ea339bfab1301;\n glType = utils.convert(texture.type);\n }\n }\n //\n if (allocateMemory) {\n if (useTexStorage) state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height);\n else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);\n }\n } else if (texture.isDataTexture) {\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n texture.generateMipmaps = false;\n } else if (useTexStorage) {\n if (allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data);\n } else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data);\n } else if (texture.isCompressedTexture) {\n if (texture.isCompressedArrayTexture) {\n if (useTexStorage && allocateMemory) state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (texture.format !== $a315ee31802fb757$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);\n else state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\");\n } else if (useTexStorage) state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);\n else state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);\n }\n } else {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (texture.format !== $a315ee31802fb757$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n else state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\");\n } else if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n } else if (texture.isDataArrayTexture) {\n if (useTexStorage) {\n if (allocateMemory) state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth);\n state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n } else if (texture.isData3DTexture) {\n if (useTexStorage) {\n if (allocateMemory) state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth);\n state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n } else if (texture.isFramebufferTexture) {\n if (allocateMemory) {\n if (useTexStorage) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n else {\n let width = image.width, height = image.height;\n for(let i = 0; i < levels; i++){\n state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null);\n width >>= 1;\n height >>= 1;\n }\n }\n }\n } else {\n // regular Texture (image, video, canvas)\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap);\n }\n texture.generateMipmaps = false;\n } else if (useTexStorage) {\n if (allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image);\n } else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image);\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(textureType);\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n function uploadCubeTexture(textureProperties, texture, slot) {\n if (texture.image.length !== 6) return;\n const forceUpload = initTexture(textureProperties, texture);\n const source = texture.source;\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n const sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(_gl.TEXTURE0 + slot);\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);\n _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);\n const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;\n const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;\n const cubeImage = [];\n for(let i = 0; i < 6; i++){\n if (!isCompressed && !isDataTexture) cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize);\n else cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];\n cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);\n }\n const image = cubeImage[0], supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n let levels = getMipLevels(texture, image, supportsMips);\n setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);\n let mipmaps;\n if (isCompressed) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height);\n for(let i = 0; i < 6; i++){\n mipmaps = cubeImage[i].mipmaps;\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n if (texture.format !== $a315ee31802fb757$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n else state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()\");\n } else if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n } else {\n mipmaps = texture.mipmaps;\n if (useTexStorage && allocateMemory) {\n // TODO: Uniformly handle mipmap definitions\n // Normal textures and compressed cube textures define base level + mips with their mipmap array\n // Uncompressed cube textures use their mipmap array only for mips (no base level)\n if (mipmaps.length > 0) levels++;\n state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height);\n }\n for(let i = 0; i < 6; i++)if (isDataTexture) {\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[i].width, cubeImage[i].height, glFormat, glType, cubeImage[i].data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data);\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n const mipmapImage = mipmap.image[i].image;\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data);\n }\n } else {\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[i]);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]);\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]);\n }\n }\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) // We assume images for cube map have the same size.\n generateMipmap(_gl.TEXTURE_CUBE_MAP);\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n // Render targets\n // Setup storage for target texture and bind it to correct framebuffer\n function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const renderTargetProperties = properties.get(renderTarget);\n if (!renderTargetProperties.__hasExternalTextures) {\n const width = Math.max(1, renderTarget.width >> level);\n const height = Math.max(1, renderTarget.height >> level);\n if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) state.texImage3D(textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null);\n else state.texImage2D(textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget));\n else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, level);\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n // Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) {\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer);\n if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) {\n let glInternalFormat = _gl.DEPTH_COMPONENT16;\n if (isMultisample || useMultisampledRTT(renderTarget)) {\n const depthTexture = renderTarget.depthTexture;\n if (depthTexture && depthTexture.isDepthTexture) {\n if (depthTexture.type === $a315ee31802fb757$export$f6d331659b644596) glInternalFormat = _gl.DEPTH_COMPONENT32F;\n else if (depthTexture.type === $a315ee31802fb757$export$c3c7fc4518ebba96) glInternalFormat = _gl.DEPTH_COMPONENT24;\n }\n const samples = getRenderTargetSamples(renderTarget);\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n } else _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);\n } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) {\n const samples = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);\n else if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);\n } else {\n const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [\n renderTarget.texture\n ];\n for(let i = 0; i < textures.length; i++){\n const texture = textures[i];\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const samples = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);\n }\n }\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);\n }\n // Setup resources for a Depth Texture for a FBO (needs an extension)\n function setupDepthTexture(framebuffer, renderTarget) {\n const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget;\n if (isCube) throw new Error(\"Depth Texture with cube render targets is not supported\");\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) throw new Error(\"renderTarget.depthTexture must be an instance of THREE.DepthTexture\");\n // upload an empty depth texture with framebuffer size\n if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) {\n renderTarget.depthTexture.image.width = renderTarget.width;\n renderTarget.depthTexture.image.height = renderTarget.height;\n renderTarget.depthTexture.needsUpdate = true;\n }\n setTexture2D(renderTarget.depthTexture, 0);\n const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture;\n const samples = getRenderTargetSamples(renderTarget);\n if (renderTarget.depthTexture.format === $a315ee31802fb757$export$c1b6b5136be58045) {\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples);\n else _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);\n } else if (renderTarget.depthTexture.format === $a315ee31802fb757$export$1e113ac2d0905829) {\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples);\n else _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);\n } else throw new Error(\"Unknown depthTexture format\");\n }\n // Setup GL resources for a non-texture depth buffer\n function setupDepthRenderbuffer(renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n const isCube = renderTarget.isWebGLCubeRenderTarget === true;\n if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) {\n if (isCube) throw new Error(\"target.depthTexture not supported in Cube render targets\");\n setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget);\n } else if (isCube) {\n renderTargetProperties.__webglDepthbuffer = [];\n for(let i = 0; i < 6; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]);\n renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false);\n }\n } else {\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n // rebind framebuffer with external textures\n function rebindTextures(renderTarget, colorTexture, depthTexture) {\n const renderTargetProperties = properties.get(renderTarget);\n if (colorTexture !== undefined) setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0);\n if (depthTexture !== undefined) setupDepthRenderbuffer(renderTarget);\n }\n // Set up GL resources for the render target\n function setupRenderTarget(renderTarget) {\n const texture = renderTarget.texture;\n const renderTargetProperties = properties.get(renderTarget);\n const textureProperties = properties.get(texture);\n renderTarget.addEventListener(\"dispose\", onRenderTargetDispose);\n if (renderTarget.isWebGLMultipleRenderTargets !== true) {\n if (textureProperties.__webglTexture === undefined) textureProperties.__webglTexture = _gl.createTexture();\n textureProperties.__version = texture.version;\n info.memory.textures++;\n }\n const isCube = renderTarget.isWebGLCubeRenderTarget === true;\n const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n // Setup framebuffer\n if (isCube) {\n renderTargetProperties.__webglFramebuffer = [];\n for(let i = 0; i < 6; i++)if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) {\n renderTargetProperties.__webglFramebuffer[i] = [];\n for(let level = 0; level < texture.mipmaps.length; level++)renderTargetProperties.__webglFramebuffer[i][level] = _gl.createFramebuffer();\n } else renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer();\n } else {\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) {\n renderTargetProperties.__webglFramebuffer = [];\n for(let level = 0; level < texture.mipmaps.length; level++)renderTargetProperties.__webglFramebuffer[level] = _gl.createFramebuffer();\n } else renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n if (isMultipleRenderTargets) {\n if (capabilities.drawBuffers) {\n const textures = renderTarget.texture;\n for(let i = 0, il = textures.length; i < il; i++){\n const attachmentProperties = properties.get(textures[i]);\n if (attachmentProperties.__webglTexture === undefined) {\n attachmentProperties.__webglTexture = _gl.createTexture();\n info.memory.textures++;\n }\n }\n } else console.warn(\"THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.\");\n }\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n const textures = isMultipleRenderTargets ? texture : [\n texture\n ];\n renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n renderTargetProperties.__webglColorRenderbuffer = [];\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n for(let i = 0; i < textures.length; i++){\n const texture = textures[i];\n renderTargetProperties.__webglColorRenderbuffer[i] = _gl.createRenderbuffer();\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true);\n const samples = getRenderTargetSamples(renderTarget);\n _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n }\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);\n if (renderTarget.depthBuffer) {\n renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n }\n // Setup color buffer\n if (isCube) {\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);\n setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);\n for(let i = 0; i < 6; i++){\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) for(let level = 0; level < texture.mipmaps.length; level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i][level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level);\n else setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0);\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(_gl.TEXTURE_CUBE_MAP);\n state.unbindTexture();\n } else if (isMultipleRenderTargets) {\n const textures = renderTarget.texture;\n for(let i = 0, il = textures.length; i < il; i++){\n const attachment = textures[i];\n const attachmentProperties = properties.get(attachment);\n state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture);\n setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips);\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0);\n if (textureNeedsGenerateMipmaps(attachment, supportsMips)) generateMipmap(_gl.TEXTURE_2D);\n }\n state.unbindTexture();\n } else {\n let glTextureType = _gl.TEXTURE_2D;\n if (renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget) {\n if (isWebGL2) glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n else console.error(\"THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.\");\n }\n state.bindTexture(glTextureType, textureProperties.__webglTexture);\n setTextureParameters(glTextureType, texture, supportsMips);\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) for(let level = 0; level < texture.mipmaps.length; level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level);\n else setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0);\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(glTextureType);\n state.unbindTexture();\n }\n // Setup depth and stencil buffers\n if (renderTarget.depthBuffer) setupDepthRenderbuffer(renderTarget);\n }\n function updateRenderTargetMipmap(renderTarget) {\n const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [\n renderTarget.texture\n ];\n for(let i = 0, il = textures.length; i < il; i++){\n const texture = textures[i];\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n const webglTexture = properties.get(texture).__webglTexture;\n state.bindTexture(target, webglTexture);\n generateMipmap(target);\n state.unbindTexture();\n }\n }\n }\n function updateMultisampleRenderTarget(renderTarget) {\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [\n renderTarget.texture\n ];\n const width = renderTarget.width;\n const height = renderTarget.height;\n let mask = _gl.COLOR_BUFFER_BIT;\n const invalidationArray = [];\n const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n const renderTargetProperties = properties.get(renderTarget);\n const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n // If MRT we need to remove FBO attachments\n if (isMultipleRenderTargets) for(let i = 0; i < textures.length; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null);\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0);\n }\n state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n for(let i = 0; i < textures.length; i++){\n invalidationArray.push(_gl.COLOR_ATTACHMENT0 + i);\n if (renderTarget.depthBuffer) invalidationArray.push(depthStyle);\n const ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== undefined ? renderTargetProperties.__ignoreDepthValues : false;\n if (ignoreDepthValues === false) {\n if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT;\n if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT;\n }\n if (isMultipleRenderTargets) _gl.framebufferRenderbuffer(_gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n if (ignoreDepthValues === true) {\n _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, [\n depthStyle\n ]);\n _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [\n depthStyle\n ]);\n }\n if (isMultipleRenderTargets) {\n const webglTexture = properties.get(textures[i]).__webglTexture;\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0);\n }\n _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST);\n if (supportsInvalidateFramebuffer) _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArray);\n }\n state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null);\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, null);\n // If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n if (isMultipleRenderTargets) for(let i = 0; i < textures.length; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n const webglTexture = properties.get(textures[i]).__webglTexture;\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0);\n }\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n }\n }\n function getRenderTargetSamples(renderTarget) {\n return Math.min(maxSamples, renderTarget.samples);\n }\n function useMultisampledRTT(renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n return isWebGL2 && renderTarget.samples > 0 && extensions.has(\"WEBGL_multisampled_render_to_texture\") === true && renderTargetProperties.__useRenderToTexture !== false;\n }\n function updateVideoTexture(texture) {\n const frame = info.render.frame;\n // Check the last frame we updated the VideoTexture\n if (_videoTextures.get(texture) !== frame) {\n _videoTextures.set(texture, frame);\n texture.update();\n }\n }\n function verifyColorSpace(texture, image) {\n const colorSpace1 = texture.colorSpace;\n const format = texture.format;\n const type = texture.type;\n if (texture.isCompressedTexture === true || texture.format === $a315ee31802fb757$export$ca1dce8b5e1de74d) return image;\n if (colorSpace1 !== $a315ee31802fb757$export$42429b3acfb233a4 && colorSpace1 !== $a315ee31802fb757$export$bfcb490c2dd3db51) {\n // sRGB\n if (colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa) {\n if (isWebGL2 === false) {\n // in WebGL 1, try to use EXT_sRGB extension and unsized formats\n if (extensions.has(\"EXT_sRGB\") === true && format === $a315ee31802fb757$export$3f8bb04b555a363c) {\n texture.format = $a315ee31802fb757$export$ca1dce8b5e1de74d;\n // it's not possible to generate mips in WebGL 1 with this extension\n texture.minFilter = $a315ee31802fb757$export$8a72f490b25c56c8;\n texture.generateMipmaps = false;\n } else // slow fallback (CPU decode)\n image = $a315ee31802fb757$export$698882cf06df44aa.sRGBToLinear(image);\n } else // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n if (format !== $a315ee31802fb757$export$3f8bb04b555a363c || type !== $a315ee31802fb757$export$2e8ce08d3f6f5e10) console.warn(\"THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.\");\n } else console.error(\"THREE.WebGLTextures: Unsupported texture color space:\", colorSpace1);\n }\n return image;\n }\n //\n this.allocateTextureUnit = allocateTextureUnit;\n this.resetTextureUnits = resetTextureUnits;\n this.setTexture2D = setTexture2D;\n this.setTexture2DArray = setTexture2DArray;\n this.setTexture3D = setTexture3D;\n this.setTextureCube = setTextureCube;\n this.rebindTextures = rebindTextures;\n this.setupRenderTarget = setupRenderTarget;\n this.updateRenderTargetMipmap = updateRenderTargetMipmap;\n this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n this.setupDepthRenderbuffer = setupDepthRenderbuffer;\n this.setupFrameBufferTexture = setupFrameBufferTexture;\n this.useMultisampledRTT = useMultisampledRTT;\n}\nfunction $a315ee31802fb757$export$ddaebcad857649a8(gl, extensions, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n function convert(p, colorSpace1 = $a315ee31802fb757$export$bfcb490c2dd3db51) {\n let extension;\n if (p === $a315ee31802fb757$export$2e8ce08d3f6f5e10) return gl.UNSIGNED_BYTE;\n if (p === $a315ee31802fb757$export$b3969b01faf587f2) return gl.UNSIGNED_SHORT_4_4_4_4;\n if (p === $a315ee31802fb757$export$18886f8ae33e90de) return gl.UNSIGNED_SHORT_5_5_5_1;\n if (p === $a315ee31802fb757$export$545fce0311a9796a) return gl.BYTE;\n if (p === $a315ee31802fb757$export$88572337f312435f) return gl.SHORT;\n if (p === $a315ee31802fb757$export$c63dc51868b06a9d) return gl.UNSIGNED_SHORT;\n if (p === $a315ee31802fb757$export$5c612977753abe2) return gl.INT;\n if (p === $a315ee31802fb757$export$c3c7fc4518ebba96) return gl.UNSIGNED_INT;\n if (p === $a315ee31802fb757$export$f6d331659b644596) return gl.FLOAT;\n if (p === $a315ee31802fb757$export$2697304443f382bc) {\n if (isWebGL2) return gl.HALF_FLOAT;\n extension = extensions.get(\"OES_texture_half_float\");\n if (extension !== null) return extension.HALF_FLOAT_OES;\n else return null;\n }\n if (p === $a315ee31802fb757$export$988473390501ed4b) return gl.ALPHA;\n if (p === $a315ee31802fb757$export$3f8bb04b555a363c) return gl.RGBA;\n if (p === $a315ee31802fb757$export$cc09ccbf6d1ed449) return gl.LUMINANCE;\n if (p === $a315ee31802fb757$export$9053a81c4a69c289) return gl.LUMINANCE_ALPHA;\n if (p === $a315ee31802fb757$export$c1b6b5136be58045) return gl.DEPTH_COMPONENT;\n if (p === $a315ee31802fb757$export$1e113ac2d0905829) return gl.DEPTH_STENCIL;\n // WebGL 1 sRGB fallback\n if (p === $a315ee31802fb757$export$ca1dce8b5e1de74d) {\n extension = extensions.get(\"EXT_sRGB\");\n if (extension !== null) return extension.SRGB_ALPHA_EXT;\n else return null;\n }\n // WebGL2 formats.\n if (p === $a315ee31802fb757$export$4e041a7967d15c4b) return gl.RED;\n if (p === $a315ee31802fb757$export$aa92e870a709d190) return gl.RED_INTEGER;\n if (p === $a315ee31802fb757$export$6cdf0b461c7ce8a0) return gl.RG;\n if (p === $a315ee31802fb757$export$1ba1c45f9f77d4d7) return gl.RG_INTEGER;\n if (p === $a315ee31802fb757$export$c200e7d26f592f21) return gl.RGBA_INTEGER;\n // S3TC\n if (p === $a315ee31802fb757$export$21d1799c6d552fc0 || p === $a315ee31802fb757$export$afa304c3e981b668 || p === $a315ee31802fb757$export$d2a1a68024a3e56c || p === $a315ee31802fb757$export$9a79c424327dacf9) {\n if (colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa) {\n extension = extensions.get(\"WEBGL_compressed_texture_s3tc_srgb\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$21d1799c6d552fc0) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n if (p === $a315ee31802fb757$export$afa304c3e981b668) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n if (p === $a315ee31802fb757$export$d2a1a68024a3e56c) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n if (p === $a315ee31802fb757$export$9a79c424327dacf9) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n } else return null;\n } else {\n extension = extensions.get(\"WEBGL_compressed_texture_s3tc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$21d1799c6d552fc0) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n if (p === $a315ee31802fb757$export$afa304c3e981b668) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n if (p === $a315ee31802fb757$export$d2a1a68024a3e56c) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n if (p === $a315ee31802fb757$export$9a79c424327dacf9) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n } else return null;\n }\n }\n // PVRTC\n if (p === $a315ee31802fb757$export$19ada9bbb1af3573 || p === $a315ee31802fb757$export$d0f0355bb3d948e4 || p === $a315ee31802fb757$export$b82296714358084c || p === $a315ee31802fb757$export$b71692456c47b6c3) {\n extension = extensions.get(\"WEBGL_compressed_texture_pvrtc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$19ada9bbb1af3573) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n if (p === $a315ee31802fb757$export$d0f0355bb3d948e4) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n if (p === $a315ee31802fb757$export$b82296714358084c) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n if (p === $a315ee31802fb757$export$b71692456c47b6c3) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n } else return null;\n }\n // ETC1\n if (p === $a315ee31802fb757$export$6ab91af2d757aee7) {\n extension = extensions.get(\"WEBGL_compressed_texture_etc1\");\n if (extension !== null) return extension.COMPRESSED_RGB_ETC1_WEBGL;\n else return null;\n }\n // ETC2\n if (p === $a315ee31802fb757$export$7800993ef8106a6a || p === $a315ee31802fb757$export$23ed8300a860e7d8) {\n extension = extensions.get(\"WEBGL_compressed_texture_etc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$7800993ef8106a6a) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n if (p === $a315ee31802fb757$export$23ed8300a860e7d8) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n } else return null;\n }\n // ASTC\n if (p === $a315ee31802fb757$export$dc5570b4a2b92d48 || p === $a315ee31802fb757$export$68880cd325f8b2fb || p === $a315ee31802fb757$export$7d2c0be323373d95 || p === $a315ee31802fb757$export$22b52da301fc3a3e || p === $a315ee31802fb757$export$c009e2cb4a66485e || p === $a315ee31802fb757$export$118fff5afa255b63 || p === $a315ee31802fb757$export$120713c829ae0667 || p === $a315ee31802fb757$export$c79eeabbf53313e9 || p === $a315ee31802fb757$export$443cf6567cdd6424 || p === $a315ee31802fb757$export$6573984fc9840780 || p === $a315ee31802fb757$export$e7aee563f30091de || p === $a315ee31802fb757$export$2eb8634622ddeab7 || p === $a315ee31802fb757$export$202b1ce7b5d25742 || p === $a315ee31802fb757$export$18ab77abd087e467) {\n extension = extensions.get(\"WEBGL_compressed_texture_astc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$dc5570b4a2b92d48) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n if (p === $a315ee31802fb757$export$68880cd325f8b2fb) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n if (p === $a315ee31802fb757$export$7d2c0be323373d95) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n if (p === $a315ee31802fb757$export$22b52da301fc3a3e) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n if (p === $a315ee31802fb757$export$c009e2cb4a66485e) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n if (p === $a315ee31802fb757$export$118fff5afa255b63) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n if (p === $a315ee31802fb757$export$120713c829ae0667) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n if (p === $a315ee31802fb757$export$c79eeabbf53313e9) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n if (p === $a315ee31802fb757$export$443cf6567cdd6424) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n if (p === $a315ee31802fb757$export$6573984fc9840780) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n if (p === $a315ee31802fb757$export$e7aee563f30091de) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n if (p === $a315ee31802fb757$export$2eb8634622ddeab7) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n if (p === $a315ee31802fb757$export$202b1ce7b5d25742) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n if (p === $a315ee31802fb757$export$18ab77abd087e467) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n } else return null;\n }\n // BPTC\n if (p === $a315ee31802fb757$export$ce40b115e188bc81) {\n extension = extensions.get(\"EXT_texture_compression_bptc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$ce40b115e188bc81) return colorSpace1 === $a315ee31802fb757$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n } else return null;\n }\n // RGTC\n if (p === $a315ee31802fb757$export$b1688df4c4c21670 || p === $a315ee31802fb757$export$fc15e5d8261eed58 || p === $a315ee31802fb757$export$d220f6ade8463a0f || p === $a315ee31802fb757$export$768646d09dc1b6ef) {\n extension = extensions.get(\"EXT_texture_compression_rgtc\");\n if (extension !== null) {\n if (p === $a315ee31802fb757$export$ce40b115e188bc81) return extension.COMPRESSED_RED_RGTC1_EXT;\n if (p === $a315ee31802fb757$export$fc15e5d8261eed58) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n if (p === $a315ee31802fb757$export$d220f6ade8463a0f) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n if (p === $a315ee31802fb757$export$768646d09dc1b6ef) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n } else return null;\n }\n //\n if (p === $a315ee31802fb757$export$6c8ea339bfab1301) {\n if (isWebGL2) return gl.UNSIGNED_INT_24_8;\n extension = extensions.get(\"WEBGL_depth_texture\");\n if (extension !== null) return extension.UNSIGNED_INT_24_8_WEBGL;\n else return null;\n }\n // if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n return gl[p] !== undefined ? gl[p] : null;\n }\n return {\n convert: convert\n };\n}\nclass $a315ee31802fb757$export$56b937d9e5581166 extends $a315ee31802fb757$export$74e4ae24825f68d7 {\n constructor(array = []){\n super();\n this.isArrayCamera = true;\n this.cameras = array;\n }\n}\nclass $a315ee31802fb757$export$eb2fcfdbd7ba97d4 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isGroup = true;\n this.type = \"Group\";\n }\n}\nconst $a315ee31802fb757$var$_moveEvent = {\n type: \"move\"\n};\nclass $a315ee31802fb757$var$WebXRController {\n constructor(){\n this._targetRay = null;\n this._grip = null;\n this._hand = null;\n }\n getHandSpace() {\n if (this._hand === null) {\n this._hand = new $a315ee31802fb757$export$eb2fcfdbd7ba97d4();\n this._hand.matrixAutoUpdate = false;\n this._hand.visible = false;\n this._hand.joints = {};\n this._hand.inputState = {\n pinching: false\n };\n }\n return this._hand;\n }\n getTargetRaySpace() {\n if (this._targetRay === null) {\n this._targetRay = new $a315ee31802fb757$export$eb2fcfdbd7ba97d4();\n this._targetRay.matrixAutoUpdate = false;\n this._targetRay.visible = false;\n this._targetRay.hasLinearVelocity = false;\n this._targetRay.linearVelocity = new $a315ee31802fb757$export$64b5c384219d3699();\n this._targetRay.hasAngularVelocity = false;\n this._targetRay.angularVelocity = new $a315ee31802fb757$export$64b5c384219d3699();\n }\n return this._targetRay;\n }\n getGripSpace() {\n if (this._grip === null) {\n this._grip = new $a315ee31802fb757$export$eb2fcfdbd7ba97d4();\n this._grip.matrixAutoUpdate = false;\n this._grip.visible = false;\n this._grip.hasLinearVelocity = false;\n this._grip.linearVelocity = new $a315ee31802fb757$export$64b5c384219d3699();\n this._grip.hasAngularVelocity = false;\n this._grip.angularVelocity = new $a315ee31802fb757$export$64b5c384219d3699();\n }\n return this._grip;\n }\n dispatchEvent(event) {\n if (this._targetRay !== null) this._targetRay.dispatchEvent(event);\n if (this._grip !== null) this._grip.dispatchEvent(event);\n if (this._hand !== null) this._hand.dispatchEvent(event);\n return this;\n }\n connect(inputSource) {\n if (inputSource && inputSource.hand) {\n const hand = this._hand;\n if (hand) for (const inputjoint of inputSource.hand.values())// Initialize hand with joints when connected\n this._getHandJoint(hand, inputjoint);\n }\n this.dispatchEvent({\n type: \"connected\",\n data: inputSource\n });\n return this;\n }\n disconnect(inputSource) {\n this.dispatchEvent({\n type: \"disconnected\",\n data: inputSource\n });\n if (this._targetRay !== null) this._targetRay.visible = false;\n if (this._grip !== null) this._grip.visible = false;\n if (this._hand !== null) this._hand.visible = false;\n return this;\n }\n update(inputSource, frame, referenceSpace) {\n let inputPose = null;\n let gripPose = null;\n let handPose = null;\n const targetRay = this._targetRay;\n const grip = this._grip;\n const hand = this._hand;\n if (inputSource && frame.session.visibilityState !== \"visible-blurred\") {\n if (hand && inputSource.hand) {\n handPose = true;\n for (const inputjoint of inputSource.hand.values()){\n // Update the joints groups with the XRJoint poses\n const jointPose = frame.getJointPose(inputjoint, referenceSpace);\n // The transform of this joint will be updated with the joint pose on each frame\n const joint = this._getHandJoint(hand, inputjoint);\n if (jointPose !== null) {\n joint.matrix.fromArray(jointPose.transform.matrix);\n joint.matrix.decompose(joint.position, joint.rotation, joint.scale);\n joint.matrixWorldNeedsUpdate = true;\n joint.jointRadius = jointPose.radius;\n }\n joint.visible = jointPose !== null;\n }\n // Custom events\n // Check pinchz\n const indexTip = hand.joints[\"index-finger-tip\"];\n const thumbTip = hand.joints[\"thumb-tip\"];\n const distance = indexTip.position.distanceTo(thumbTip.position);\n const distanceToPinch = 0.02;\n const threshold = 0.005;\n if (hand.inputState.pinching && distance > distanceToPinch + threshold) {\n hand.inputState.pinching = false;\n this.dispatchEvent({\n type: \"pinchend\",\n handedness: inputSource.handedness,\n target: this\n });\n } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) {\n hand.inputState.pinching = true;\n this.dispatchEvent({\n type: \"pinchstart\",\n handedness: inputSource.handedness,\n target: this\n });\n }\n } else if (grip !== null && inputSource.gripSpace) {\n gripPose = frame.getPose(inputSource.gripSpace, referenceSpace);\n if (gripPose !== null) {\n grip.matrix.fromArray(gripPose.transform.matrix);\n grip.matrix.decompose(grip.position, grip.rotation, grip.scale);\n grip.matrixWorldNeedsUpdate = true;\n if (gripPose.linearVelocity) {\n grip.hasLinearVelocity = true;\n grip.linearVelocity.copy(gripPose.linearVelocity);\n } else grip.hasLinearVelocity = false;\n if (gripPose.angularVelocity) {\n grip.hasAngularVelocity = true;\n grip.angularVelocity.copy(gripPose.angularVelocity);\n } else grip.hasAngularVelocity = false;\n }\n }\n if (targetRay !== null) {\n inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);\n // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n if (inputPose === null && gripPose !== null) inputPose = gripPose;\n if (inputPose !== null) {\n targetRay.matrix.fromArray(inputPose.transform.matrix);\n targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);\n targetRay.matrixWorldNeedsUpdate = true;\n if (inputPose.linearVelocity) {\n targetRay.hasLinearVelocity = true;\n targetRay.linearVelocity.copy(inputPose.linearVelocity);\n } else targetRay.hasLinearVelocity = false;\n if (inputPose.angularVelocity) {\n targetRay.hasAngularVelocity = true;\n targetRay.angularVelocity.copy(inputPose.angularVelocity);\n } else targetRay.hasAngularVelocity = false;\n this.dispatchEvent($a315ee31802fb757$var$_moveEvent);\n }\n }\n }\n if (targetRay !== null) targetRay.visible = inputPose !== null;\n if (grip !== null) grip.visible = gripPose !== null;\n if (hand !== null) hand.visible = handPose !== null;\n return this;\n }\n // private method\n _getHandJoint(hand, inputjoint) {\n if (hand.joints[inputjoint.jointName] === undefined) {\n const joint = new $a315ee31802fb757$export$eb2fcfdbd7ba97d4();\n joint.matrixAutoUpdate = false;\n joint.visible = false;\n hand.joints[inputjoint.jointName] = joint;\n hand.add(joint);\n }\n return hand.joints[inputjoint.jointName];\n }\n}\nclass $a315ee31802fb757$export$fc830aa069cc8c2f extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format){\n format = format !== undefined ? format : $a315ee31802fb757$export$c1b6b5136be58045;\n if (format !== $a315ee31802fb757$export$c1b6b5136be58045 && format !== $a315ee31802fb757$export$1e113ac2d0905829) throw new Error(\"DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat\");\n if (type === undefined && format === $a315ee31802fb757$export$c1b6b5136be58045) type = $a315ee31802fb757$export$c3c7fc4518ebba96;\n if (type === undefined && format === $a315ee31802fb757$export$1e113ac2d0905829) type = $a315ee31802fb757$export$6c8ea339bfab1301;\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isDepthTexture = true;\n this.image = {\n width: width,\n height: height\n };\n this.magFilter = magFilter !== undefined ? magFilter : $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.minFilter = minFilter !== undefined ? minFilter : $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.flipY = false;\n this.generateMipmaps = false;\n this.compareFunction = null;\n }\n copy(source) {\n super.copy(source);\n this.compareFunction = source.compareFunction;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.compareFunction !== null) data.compareFunction = this.compareFunction;\n return data;\n }\n}\nclass $a315ee31802fb757$var$WebXRManager extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(renderer, gl){\n super();\n const scope = this;\n let session = null;\n let framebufferScaleFactor = 1.0;\n let referenceSpace = null;\n let referenceSpaceType = \"local-floor\";\n // Set default foveation to maximum.\n let foveation = 1.0;\n let customReferenceSpace = null;\n let pose = null;\n let glBinding = null;\n let glProjLayer = null;\n let glBaseLayer = null;\n let xrFrame = null;\n const attributes = gl.getContextAttributes();\n let initialRenderTarget = null;\n let newRenderTarget = null;\n const controllers = [];\n const controllerInputSources = [];\n //\n const cameraL = new $a315ee31802fb757$export$74e4ae24825f68d7();\n cameraL.layers.enable(1);\n cameraL.viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n const cameraR = new $a315ee31802fb757$export$74e4ae24825f68d7();\n cameraR.layers.enable(2);\n cameraR.viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n const cameras = [\n cameraL,\n cameraR\n ];\n const cameraXR = new $a315ee31802fb757$export$56b937d9e5581166();\n cameraXR.layers.enable(1);\n cameraXR.layers.enable(2);\n let _currentDepthNear = null;\n let _currentDepthFar = null;\n //\n this.cameraAutoUpdate = true;\n this.enabled = false;\n this.isPresenting = false;\n this.getController = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $a315ee31802fb757$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getTargetRaySpace();\n };\n this.getControllerGrip = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $a315ee31802fb757$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getGripSpace();\n };\n this.getHand = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $a315ee31802fb757$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getHandSpace();\n };\n //\n function onSessionEvent(event) {\n const controllerIndex = controllerInputSources.indexOf(event.inputSource);\n if (controllerIndex === -1) return;\n const controller = controllers[controllerIndex];\n if (controller !== undefined) {\n controller.update(event.inputSource, event.frame, customReferenceSpace || referenceSpace);\n controller.dispatchEvent({\n type: event.type,\n data: event.inputSource\n });\n }\n }\n function onSessionEnd() {\n session.removeEventListener(\"select\", onSessionEvent);\n session.removeEventListener(\"selectstart\", onSessionEvent);\n session.removeEventListener(\"selectend\", onSessionEvent);\n session.removeEventListener(\"squeeze\", onSessionEvent);\n session.removeEventListener(\"squeezestart\", onSessionEvent);\n session.removeEventListener(\"squeezeend\", onSessionEvent);\n session.removeEventListener(\"end\", onSessionEnd);\n session.removeEventListener(\"inputsourceschange\", onInputSourcesChange);\n for(let i = 0; i < controllers.length; i++){\n const inputSource = controllerInputSources[i];\n if (inputSource === null) continue;\n controllerInputSources[i] = null;\n controllers[i].disconnect(inputSource);\n }\n _currentDepthNear = null;\n _currentDepthFar = null;\n // restore framebuffer/rendering state\n renderer.setRenderTarget(initialRenderTarget);\n glBaseLayer = null;\n glProjLayer = null;\n glBinding = null;\n session = null;\n newRenderTarget = null;\n //\n animation.stop();\n scope.isPresenting = false;\n scope.dispatchEvent({\n type: \"sessionend\"\n });\n }\n this.setFramebufferScaleFactor = function(value) {\n framebufferScaleFactor = value;\n if (scope.isPresenting === true) console.warn(\"THREE.WebXRManager: Cannot change framebuffer scale while presenting.\");\n };\n this.setReferenceSpaceType = function(value) {\n referenceSpaceType = value;\n if (scope.isPresenting === true) console.warn(\"THREE.WebXRManager: Cannot change reference space type while presenting.\");\n };\n this.getReferenceSpace = function() {\n return customReferenceSpace || referenceSpace;\n };\n this.setReferenceSpace = function(space) {\n customReferenceSpace = space;\n };\n this.getBaseLayer = function() {\n return glProjLayer !== null ? glProjLayer : glBaseLayer;\n };\n this.getBinding = function() {\n return glBinding;\n };\n this.getFrame = function() {\n return xrFrame;\n };\n this.getSession = function() {\n return session;\n };\n this.setSession = async function(value) {\n session = value;\n if (session !== null) {\n initialRenderTarget = renderer.getRenderTarget();\n session.addEventListener(\"select\", onSessionEvent);\n session.addEventListener(\"selectstart\", onSessionEvent);\n session.addEventListener(\"selectend\", onSessionEvent);\n session.addEventListener(\"squeeze\", onSessionEvent);\n session.addEventListener(\"squeezestart\", onSessionEvent);\n session.addEventListener(\"squeezeend\", onSessionEvent);\n session.addEventListener(\"end\", onSessionEnd);\n session.addEventListener(\"inputsourceschange\", onInputSourcesChange);\n if (attributes.xrCompatible !== true) await gl.makeXRCompatible();\n if (session.renderState.layers === undefined || renderer.capabilities.isWebGL2 === false) {\n const layerInit = {\n antialias: session.renderState.layers === undefined ? attributes.antialias : true,\n alpha: true,\n depth: attributes.depth,\n stencil: attributes.stencil,\n framebufferScaleFactor: framebufferScaleFactor\n };\n glBaseLayer = new XRWebGLLayer(session, gl, layerInit);\n session.updateRenderState({\n baseLayer: glBaseLayer\n });\n newRenderTarget = new $a315ee31802fb757$export$3c052beb2e51e23f(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, {\n format: $a315ee31802fb757$export$3f8bb04b555a363c,\n type: $a315ee31802fb757$export$2e8ce08d3f6f5e10,\n colorSpace: renderer.outputColorSpace,\n stencilBuffer: attributes.stencil\n });\n } else {\n let depthFormat = null;\n let depthType = null;\n let glDepthFormat = null;\n if (attributes.depth) {\n glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n depthFormat = attributes.stencil ? $a315ee31802fb757$export$1e113ac2d0905829 : $a315ee31802fb757$export$c1b6b5136be58045;\n depthType = attributes.stencil ? $a315ee31802fb757$export$6c8ea339bfab1301 : $a315ee31802fb757$export$c3c7fc4518ebba96;\n }\n const projectionlayerInit = {\n colorFormat: gl.RGBA8,\n depthFormat: glDepthFormat,\n scaleFactor: framebufferScaleFactor\n };\n glBinding = new XRWebGLBinding(session, gl);\n glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);\n session.updateRenderState({\n layers: [\n glProjLayer\n ]\n });\n newRenderTarget = new $a315ee31802fb757$export$3c052beb2e51e23f(glProjLayer.textureWidth, glProjLayer.textureHeight, {\n format: $a315ee31802fb757$export$3f8bb04b555a363c,\n type: $a315ee31802fb757$export$2e8ce08d3f6f5e10,\n depthTexture: new $a315ee31802fb757$export$fc830aa069cc8c2f(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat),\n stencilBuffer: attributes.stencil,\n colorSpace: renderer.outputColorSpace,\n samples: attributes.antialias ? 4 : 0\n });\n const renderTargetProperties = renderer.properties.get(newRenderTarget);\n renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n }\n newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n this.setFoveation(foveation);\n customReferenceSpace = null;\n referenceSpace = await session.requestReferenceSpace(referenceSpaceType);\n animation.setContext(session);\n animation.start();\n scope.isPresenting = true;\n scope.dispatchEvent({\n type: \"sessionstart\"\n });\n }\n };\n this.getEnvironmentBlendMode = function() {\n if (session !== null) return session.environmentBlendMode;\n };\n function onInputSourcesChange(event) {\n // Notify disconnected\n for(let i = 0; i < event.removed.length; i++){\n const inputSource = event.removed[i];\n const index = controllerInputSources.indexOf(inputSource);\n if (index >= 0) {\n controllerInputSources[index] = null;\n controllers[index].disconnect(inputSource);\n }\n }\n // Notify connected\n for(let i = 0; i < event.added.length; i++){\n const inputSource = event.added[i];\n let controllerIndex = controllerInputSources.indexOf(inputSource);\n if (controllerIndex === -1) {\n // Assign input source a controller that currently has no input source\n for(let i = 0; i < controllers.length; i++){\n if (i >= controllerInputSources.length) {\n controllerInputSources.push(inputSource);\n controllerIndex = i;\n break;\n } else if (controllerInputSources[i] === null) {\n controllerInputSources[i] = inputSource;\n controllerIndex = i;\n break;\n }\n }\n // If all controllers do currently receive input we ignore new ones\n if (controllerIndex === -1) break;\n }\n const controller = controllers[controllerIndex];\n if (controller) controller.connect(inputSource);\n }\n }\n //\n const cameraLPos = new $a315ee31802fb757$export$64b5c384219d3699();\n const cameraRPos = new $a315ee31802fb757$export$64b5c384219d3699();\n /**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */ function setProjectionFromUnion(camera, cameraL, cameraR) {\n cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);\n cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);\n const ipd = cameraLPos.distanceTo(cameraRPos);\n const projL = cameraL.projectionMatrix.elements;\n const projR = cameraR.projectionMatrix.elements;\n // VR systems will have identical far and near planes, and\n // most likely identical top and bottom frustum extents.\n // Use the left camera for these values.\n const near = projL[14] / (projL[10] - 1);\n const far = projL[14] / (projL[10] + 1);\n const topFov = (projL[9] + 1) / projL[5];\n const bottomFov = (projL[9] - 1) / projL[5];\n const leftFov = (projL[8] - 1) / projL[0];\n const rightFov = (projR[8] + 1) / projR[0];\n const left = near * leftFov;\n const right = near * rightFov;\n // Calculate the new camera's position offset from the\n // left camera. xOffset should be roughly half `ipd`.\n const zOffset = ipd / (-leftFov + rightFov);\n const xOffset = zOffset * -leftFov;\n // TODO: Better way to apply this offset?\n cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);\n camera.translateX(xOffset);\n camera.translateZ(zOffset);\n camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n // Find the union of the frustum values of the cameras and scale\n // the values so that the near plane's position does not change in world space,\n // although must now be relative to the new union camera.\n const near2 = near + zOffset;\n const far2 = far + zOffset;\n const left2 = left - xOffset;\n const right2 = right + (ipd - xOffset);\n const top2 = topFov * far / far2 * near2;\n const bottom2 = bottomFov * far / far2 * near2;\n camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n }\n function updateCamera(camera, parent) {\n if (parent === null) camera.matrixWorld.copy(camera.matrix);\n else camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix);\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n }\n this.updateCamera = function(camera) {\n if (session === null) return;\n cameraXR.near = cameraR.near = cameraL.near = camera.near;\n cameraXR.far = cameraR.far = cameraL.far = camera.far;\n if (_currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far) {\n // Note that the new renderState won't apply until the next frame. See #18320\n session.updateRenderState({\n depthNear: cameraXR.near,\n depthFar: cameraXR.far\n });\n _currentDepthNear = cameraXR.near;\n _currentDepthFar = cameraXR.far;\n }\n const parent = camera.parent;\n const cameras = cameraXR.cameras;\n updateCamera(cameraXR, parent);\n for(let i = 0; i < cameras.length; i++)updateCamera(cameras[i], parent);\n // update projection matrix for proper view frustum culling\n if (cameras.length === 2) setProjectionFromUnion(cameraXR, cameraL, cameraR);\n else // assume single camera setup (AR)\n cameraXR.projectionMatrix.copy(cameraL.projectionMatrix);\n // update user camera and its children\n updateUserCamera(camera, cameraXR, parent);\n };\n function updateUserCamera(camera, cameraXR, parent) {\n if (parent === null) camera.matrix.copy(cameraXR.matrixWorld);\n else {\n camera.matrix.copy(parent.matrixWorld);\n camera.matrix.invert();\n camera.matrix.multiply(cameraXR.matrixWorld);\n }\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.updateMatrixWorld(true);\n const children = camera.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].updateMatrixWorld(true);\n camera.projectionMatrix.copy(cameraXR.projectionMatrix);\n camera.projectionMatrixInverse.copy(cameraXR.projectionMatrixInverse);\n if (camera.isPerspectiveCamera) {\n camera.fov = $a315ee31802fb757$var$RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);\n camera.zoom = 1;\n }\n }\n this.getCamera = function() {\n return cameraXR;\n };\n this.getFoveation = function() {\n if (glProjLayer === null && glBaseLayer === null) return undefined;\n return foveation;\n };\n this.setFoveation = function(value) {\n // 0 = no foveation = full resolution\n // 1 = maximum foveation = the edges render at lower resolution\n foveation = value;\n if (glProjLayer !== null) glProjLayer.fixedFoveation = value;\n if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) glBaseLayer.fixedFoveation = value;\n };\n // Animation Loop\n let onAnimationFrameCallback = null;\n function onAnimationFrame(time, frame) {\n pose = frame.getViewerPose(customReferenceSpace || referenceSpace);\n xrFrame = frame;\n if (pose !== null) {\n const views = pose.views;\n if (glBaseLayer !== null) {\n renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer);\n renderer.setRenderTarget(newRenderTarget);\n }\n let cameraXRNeedsUpdate = false;\n // check if it's necessary to rebuild cameraXR's camera list\n if (views.length !== cameraXR.cameras.length) {\n cameraXR.cameras.length = 0;\n cameraXRNeedsUpdate = true;\n }\n for(let i = 0; i < views.length; i++){\n const view = views[i];\n let viewport = null;\n if (glBaseLayer !== null) viewport = glBaseLayer.getViewport(view);\n else {\n const glSubImage = glBinding.getViewSubImage(glProjLayer, view);\n viewport = glSubImage.viewport;\n // For side-by-side projection, we only produce a single texture for both eyes.\n if (i === 0) {\n renderer.setRenderTargetTextures(newRenderTarget, glSubImage.colorTexture, glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture);\n renderer.setRenderTarget(newRenderTarget);\n }\n }\n let camera = cameras[i];\n if (camera === undefined) {\n camera = new $a315ee31802fb757$export$74e4ae24825f68d7();\n camera.layers.enable(i);\n camera.viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n cameras[i] = camera;\n }\n camera.matrix.fromArray(view.transform.matrix);\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.projectionMatrix.fromArray(view.projectionMatrix);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);\n if (i === 0) {\n cameraXR.matrix.copy(camera.matrix);\n cameraXR.matrix.decompose(cameraXR.position, cameraXR.quaternion, cameraXR.scale);\n }\n if (cameraXRNeedsUpdate === true) cameraXR.cameras.push(camera);\n }\n }\n //\n for(let i = 0; i < controllers.length; i++){\n const inputSource = controllerInputSources[i];\n const controller = controllers[i];\n if (inputSource !== null && controller !== undefined) controller.update(inputSource, frame, customReferenceSpace || referenceSpace);\n }\n if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);\n if (frame.detectedPlanes) scope.dispatchEvent({\n type: \"planesdetected\",\n data: frame\n });\n xrFrame = null;\n }\n const animation = new $a315ee31802fb757$var$WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n this.setAnimationLoop = function(callback) {\n onAnimationFrameCallback = callback;\n };\n this.dispose = function() {};\n }\n}\nfunction $a315ee31802fb757$var$WebGLMaterials(renderer, properties) {\n function refreshTransformUniform(map, uniform) {\n if (map.matrixAutoUpdate === true) map.updateMatrix();\n uniform.value.copy(map.matrix);\n }\n function refreshFogUniforms(uniforms, fog) {\n fog.color.getRGB(uniforms.fogColor.value, $a315ee31802fb757$var$getUnlitUniformColorSpace(renderer));\n if (fog.isFog) {\n uniforms.fogNear.value = fog.near;\n uniforms.fogFar.value = fog.far;\n } else if (fog.isFogExp2) uniforms.fogDensity.value = fog.density;\n }\n function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {\n if (material.isMeshBasicMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshLambertMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshToonMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsToon(uniforms, material);\n } else if (material.isMeshPhongMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsPhong(uniforms, material);\n } else if (material.isMeshStandardMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsStandard(uniforms, material);\n if (material.isMeshPhysicalMaterial) refreshUniformsPhysical(uniforms, material, transmissionRenderTarget);\n } else if (material.isMeshMatcapMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsMatcap(uniforms, material);\n } else if (material.isMeshDepthMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshDistanceMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsDistance(uniforms, material);\n } else if (material.isMeshNormalMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isLineBasicMaterial) {\n refreshUniformsLine(uniforms, material);\n if (material.isLineDashedMaterial) refreshUniformsDash(uniforms, material);\n } else if (material.isPointsMaterial) refreshUniformsPoints(uniforms, material, pixelRatio, height);\n else if (material.isSpriteMaterial) refreshUniformsSprites(uniforms, material);\n else if (material.isShadowMaterial) {\n uniforms.color.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n } else if (material.isShaderMaterial) material.uniformsNeedUpdate = false; // #15581\n }\n function refreshUniformsCommon(uniforms, material) {\n uniforms.opacity.value = material.opacity;\n if (material.color) uniforms.diffuse.value.copy(material.color);\n if (material.emissive) uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.bumpMap) {\n uniforms.bumpMap.value = material.bumpMap;\n refreshTransformUniform(material.bumpMap, uniforms.bumpMapTransform);\n uniforms.bumpScale.value = material.bumpScale;\n if (material.side === $a315ee31802fb757$export$d9f0486e75b5ace) uniforms.bumpScale.value *= -1;\n }\n if (material.normalMap) {\n uniforms.normalMap.value = material.normalMap;\n refreshTransformUniform(material.normalMap, uniforms.normalMapTransform);\n uniforms.normalScale.value.copy(material.normalScale);\n if (material.side === $a315ee31802fb757$export$d9f0486e75b5ace) uniforms.normalScale.value.negate();\n }\n if (material.displacementMap) {\n uniforms.displacementMap.value = material.displacementMap;\n refreshTransformUniform(material.displacementMap, uniforms.displacementMapTransform);\n uniforms.displacementScale.value = material.displacementScale;\n uniforms.displacementBias.value = material.displacementBias;\n }\n if (material.emissiveMap) {\n uniforms.emissiveMap.value = material.emissiveMap;\n refreshTransformUniform(material.emissiveMap, uniforms.emissiveMapTransform);\n }\n if (material.specularMap) {\n uniforms.specularMap.value = material.specularMap;\n refreshTransformUniform(material.specularMap, uniforms.specularMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n const envMap = properties.get(material).envMap;\n if (envMap) {\n uniforms.envMap.value = envMap;\n uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n uniforms.reflectivity.value = material.reflectivity;\n uniforms.ior.value = material.ior;\n uniforms.refractionRatio.value = material.refractionRatio;\n }\n if (material.lightMap) {\n uniforms.lightMap.value = material.lightMap;\n // artist-friendly light intensity scaling factor\n const scaleFactor = renderer._useLegacyLights === true ? Math.PI : 1;\n uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n refreshTransformUniform(material.lightMap, uniforms.lightMapTransform);\n }\n if (material.aoMap) {\n uniforms.aoMap.value = material.aoMap;\n uniforms.aoMapIntensity.value = material.aoMapIntensity;\n refreshTransformUniform(material.aoMap, uniforms.aoMapTransform);\n }\n }\n function refreshUniformsLine(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n }\n function refreshUniformsDash(uniforms, material) {\n uniforms.dashSize.value = material.dashSize;\n uniforms.totalSize.value = material.dashSize + material.gapSize;\n uniforms.scale.value = material.scale;\n }\n function refreshUniformsPoints(uniforms, material, pixelRatio, height) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.size.value = material.size * pixelRatio;\n uniforms.scale.value = height * 0.5;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.uvTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n }\n function refreshUniformsSprites(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.rotation.value = material.rotation;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n }\n function refreshUniformsPhong(uniforms, material) {\n uniforms.specular.value.copy(material.specular);\n uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 )\n }\n function refreshUniformsToon(uniforms, material) {\n if (material.gradientMap) uniforms.gradientMap.value = material.gradientMap;\n }\n function refreshUniformsStandard(uniforms, material) {\n uniforms.metalness.value = material.metalness;\n if (material.metalnessMap) {\n uniforms.metalnessMap.value = material.metalnessMap;\n refreshTransformUniform(material.metalnessMap, uniforms.metalnessMapTransform);\n }\n uniforms.roughness.value = material.roughness;\n if (material.roughnessMap) {\n uniforms.roughnessMap.value = material.roughnessMap;\n refreshTransformUniform(material.roughnessMap, uniforms.roughnessMapTransform);\n }\n const envMap = properties.get(material).envMap;\n if (envMap) //uniforms.envMap.value = material.envMap; // part of uniforms common\n uniforms.envMapIntensity.value = material.envMapIntensity;\n }\n function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) {\n uniforms.ior.value = material.ior; // also part of uniforms common\n if (material.sheen > 0) {\n uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen);\n uniforms.sheenRoughness.value = material.sheenRoughness;\n if (material.sheenColorMap) {\n uniforms.sheenColorMap.value = material.sheenColorMap;\n refreshTransformUniform(material.sheenColorMap, uniforms.sheenColorMapTransform);\n }\n if (material.sheenRoughnessMap) {\n uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n refreshTransformUniform(material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform);\n }\n }\n if (material.clearcoat > 0) {\n uniforms.clearcoat.value = material.clearcoat;\n uniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n if (material.clearcoatMap) {\n uniforms.clearcoatMap.value = material.clearcoatMap;\n refreshTransformUniform(material.clearcoatMap, uniforms.clearcoatMapTransform);\n }\n if (material.clearcoatRoughnessMap) {\n uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n refreshTransformUniform(material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform);\n }\n if (material.clearcoatNormalMap) {\n uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n refreshTransformUniform(material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform);\n uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);\n if (material.side === $a315ee31802fb757$export$d9f0486e75b5ace) uniforms.clearcoatNormalScale.value.negate();\n }\n }\n if (material.iridescence > 0) {\n uniforms.iridescence.value = material.iridescence;\n uniforms.iridescenceIOR.value = material.iridescenceIOR;\n uniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[0];\n uniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[1];\n if (material.iridescenceMap) {\n uniforms.iridescenceMap.value = material.iridescenceMap;\n refreshTransformUniform(material.iridescenceMap, uniforms.iridescenceMapTransform);\n }\n if (material.iridescenceThicknessMap) {\n uniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n refreshTransformUniform(material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform);\n }\n }\n if (material.transmission > 0) {\n uniforms.transmission.value = material.transmission;\n uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height);\n if (material.transmissionMap) {\n uniforms.transmissionMap.value = material.transmissionMap;\n refreshTransformUniform(material.transmissionMap, uniforms.transmissionMapTransform);\n }\n uniforms.thickness.value = material.thickness;\n if (material.thicknessMap) {\n uniforms.thicknessMap.value = material.thicknessMap;\n refreshTransformUniform(material.thicknessMap, uniforms.thicknessMapTransform);\n }\n uniforms.attenuationDistance.value = material.attenuationDistance;\n uniforms.attenuationColor.value.copy(material.attenuationColor);\n }\n if (material.anisotropy > 0) {\n uniforms.anisotropyVector.value.set(material.anisotropy * Math.cos(material.anisotropyRotation), material.anisotropy * Math.sin(material.anisotropyRotation));\n if (material.anisotropyMap) {\n uniforms.anisotropyMap.value = material.anisotropyMap;\n refreshTransformUniform(material.anisotropyMap, uniforms.anisotropyMapTransform);\n }\n }\n uniforms.specularIntensity.value = material.specularIntensity;\n uniforms.specularColor.value.copy(material.specularColor);\n if (material.specularColorMap) {\n uniforms.specularColorMap.value = material.specularColorMap;\n refreshTransformUniform(material.specularColorMap, uniforms.specularColorMapTransform);\n }\n if (material.specularIntensityMap) {\n uniforms.specularIntensityMap.value = material.specularIntensityMap;\n refreshTransformUniform(material.specularIntensityMap, uniforms.specularIntensityMapTransform);\n }\n }\n function refreshUniformsMatcap(uniforms, material) {\n if (material.matcap) uniforms.matcap.value = material.matcap;\n }\n function refreshUniformsDistance(uniforms, material) {\n const light = properties.get(material).light;\n uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld);\n uniforms.nearDistance.value = light.shadow.camera.near;\n uniforms.farDistance.value = light.shadow.camera.far;\n }\n return {\n refreshFogUniforms: refreshFogUniforms,\n refreshMaterialUniforms: refreshMaterialUniforms\n };\n}\nfunction $a315ee31802fb757$var$WebGLUniformsGroups(gl, info, capabilities, state) {\n let buffers = {};\n let updateList = {};\n let allocatedBindingPoints = [];\n const maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0; // binding points are global whereas block indices are per shader program\n function bind(uniformsGroup, program) {\n const webglProgram = program.program;\n state.uniformBlockBinding(uniformsGroup, webglProgram);\n }\n function update(uniformsGroup, program) {\n let buffer = buffers[uniformsGroup.id];\n if (buffer === undefined) {\n prepareUniformsGroup(uniformsGroup);\n buffer = createBuffer(uniformsGroup);\n buffers[uniformsGroup.id] = buffer;\n uniformsGroup.addEventListener(\"dispose\", onUniformsGroupsDispose);\n }\n // ensure to update the binding points/block indices mapping for this program\n const webglProgram = program.program;\n state.updateUBOMapping(uniformsGroup, webglProgram);\n // update UBO once per frame\n const frame = info.render.frame;\n if (updateList[uniformsGroup.id] !== frame) {\n updateBufferData(uniformsGroup);\n updateList[uniformsGroup.id] = frame;\n }\n }\n function createBuffer(uniformsGroup) {\n // the setup of an UBO is independent of a particular shader program but global\n const bindingPointIndex = allocateBindingPointIndex();\n uniformsGroup.__bindingPointIndex = bindingPointIndex;\n const buffer = gl.createBuffer();\n const size = uniformsGroup.__size;\n const usage = uniformsGroup.usage;\n gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);\n gl.bufferData(gl.UNIFORM_BUFFER, size, usage);\n gl.bindBuffer(gl.UNIFORM_BUFFER, null);\n gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer);\n return buffer;\n }\n function allocateBindingPointIndex() {\n for(let i = 0; i < maxBindingPoints; i++)if (allocatedBindingPoints.indexOf(i) === -1) {\n allocatedBindingPoints.push(i);\n return i;\n }\n console.error(\"THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.\");\n return 0;\n }\n function updateBufferData(uniformsGroup) {\n const buffer = buffers[uniformsGroup.id];\n const uniforms = uniformsGroup.uniforms;\n const cache = uniformsGroup.__cache;\n gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);\n for(let i = 0, il = uniforms.length; i < il; i++){\n const uniform = uniforms[i];\n // partly update the buffer if necessary\n if (hasUniformChanged(uniform, i, cache) === true) {\n const offset = uniform.__offset;\n const values = Array.isArray(uniform.value) ? uniform.value : [\n uniform.value\n ];\n let arrayOffset = 0;\n for(let i = 0; i < values.length; i++){\n const value = values[i];\n const info = getUniformSize(value);\n if (typeof value === \"number\") {\n uniform.__data[0] = value;\n gl.bufferSubData(gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data);\n } else if (value.isMatrix3) {\n // manually converting 3x3 to 3x4\n uniform.__data[0] = value.elements[0];\n uniform.__data[1] = value.elements[1];\n uniform.__data[2] = value.elements[2];\n uniform.__data[3] = value.elements[0];\n uniform.__data[4] = value.elements[3];\n uniform.__data[5] = value.elements[4];\n uniform.__data[6] = value.elements[5];\n uniform.__data[7] = value.elements[0];\n uniform.__data[8] = value.elements[6];\n uniform.__data[9] = value.elements[7];\n uniform.__data[10] = value.elements[8];\n uniform.__data[11] = value.elements[0];\n } else {\n value.toArray(uniform.__data, arrayOffset);\n arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n }\n }\n gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);\n }\n }\n gl.bindBuffer(gl.UNIFORM_BUFFER, null);\n }\n function hasUniformChanged(uniform, index, cache) {\n const value = uniform.value;\n if (cache[index] === undefined) {\n // cache entry does not exist so far\n if (typeof value === \"number\") cache[index] = value;\n else {\n const values = Array.isArray(value) ? value : [\n value\n ];\n const tempValues = [];\n for(let i = 0; i < values.length; i++)tempValues.push(values[i].clone());\n cache[index] = tempValues;\n }\n return true;\n } else {\n // compare current value with cached entry\n if (typeof value === \"number\") {\n if (cache[index] !== value) {\n cache[index] = value;\n return true;\n }\n } else {\n const cachedObjects = Array.isArray(cache[index]) ? cache[index] : [\n cache[index]\n ];\n const values = Array.isArray(value) ? value : [\n value\n ];\n for(let i = 0; i < cachedObjects.length; i++){\n const cachedObject = cachedObjects[i];\n if (cachedObject.equals(values[i]) === false) {\n cachedObject.copy(values[i]);\n return true;\n }\n }\n }\n }\n return false;\n }\n function prepareUniformsGroup(uniformsGroup) {\n // determine total buffer size according to the STD140 layout\n // Hint: STD140 is the only supported layout in WebGL 2\n const uniforms = uniformsGroup.uniforms;\n let offset = 0; // global buffer offset in bytes\n const chunkSize = 16; // size of a chunk in bytes\n let chunkOffset = 0; // offset within a single chunk in bytes\n for(let i = 0, l = uniforms.length; i < l; i++){\n const uniform = uniforms[i];\n const infos = {\n boundary: 0,\n storage: 0 // bytes\n };\n const values = Array.isArray(uniform.value) ? uniform.value : [\n uniform.value\n ];\n for(let j = 0, jl = values.length; j < jl; j++){\n const value = values[j];\n const info = getUniformSize(value);\n infos.boundary += info.boundary;\n infos.storage += info.storage;\n }\n // the following two properties will be used for partial buffer updates\n uniform.__data = new Float32Array(infos.storage / Float32Array.BYTES_PER_ELEMENT);\n uniform.__offset = offset;\n //\n if (i > 0) {\n chunkOffset = offset % chunkSize;\n const remainingSizeInChunk = chunkSize - chunkOffset;\n // check for chunk overflow\n if (chunkOffset !== 0 && remainingSizeInChunk - infos.boundary < 0) {\n // add padding and adjust offset\n offset += chunkSize - chunkOffset;\n uniform.__offset = offset;\n }\n }\n offset += infos.storage;\n }\n // ensure correct final padding\n chunkOffset = offset % chunkSize;\n if (chunkOffset > 0) offset += chunkSize - chunkOffset;\n //\n uniformsGroup.__size = offset;\n uniformsGroup.__cache = {};\n return this;\n }\n function getUniformSize(value) {\n const info = {\n boundary: 0,\n storage: 0 // bytes\n };\n // determine sizes according to STD140\n if (typeof value === \"number\") {\n // float/int\n info.boundary = 4;\n info.storage = 4;\n } else if (value.isVector2) {\n // vec2\n info.boundary = 8;\n info.storage = 8;\n } else if (value.isVector3 || value.isColor) {\n // vec3\n info.boundary = 16;\n info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n } else if (value.isVector4) {\n // vec4\n info.boundary = 16;\n info.storage = 16;\n } else if (value.isMatrix3) {\n // mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n info.boundary = 48;\n info.storage = 48;\n } else if (value.isMatrix4) {\n // mat4\n info.boundary = 64;\n info.storage = 64;\n } else if (value.isTexture) console.warn(\"THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.\");\n else console.warn(\"THREE.WebGLRenderer: Unsupported uniform value type.\", value);\n return info;\n }\n function onUniformsGroupsDispose(event) {\n const uniformsGroup = event.target;\n uniformsGroup.removeEventListener(\"dispose\", onUniformsGroupsDispose);\n const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);\n allocatedBindingPoints.splice(index, 1);\n gl.deleteBuffer(buffers[uniformsGroup.id]);\n delete buffers[uniformsGroup.id];\n delete updateList[uniformsGroup.id];\n }\n function dispose() {\n for(const id in buffers)gl.deleteBuffer(buffers[id]);\n allocatedBindingPoints = [];\n buffers = {};\n updateList = {};\n }\n return {\n bind: bind,\n update: update,\n dispose: dispose\n };\n}\nfunction $a315ee31802fb757$var$createCanvasElement() {\n const canvas = $a315ee31802fb757$var$createElementNS(\"canvas\");\n canvas.style.display = \"block\";\n return canvas;\n}\nclass $a315ee31802fb757$export$f6cc00ef28d7cf97 {\n constructor(parameters = {}){\n const { canvas: canvas = $a315ee31802fb757$var$createCanvasElement(), context: context = null, depth: depth = true, stencil: stencil = true, alpha: alpha = false, antialias: antialias = false, premultipliedAlpha: premultipliedAlpha = true, preserveDrawingBuffer: preserveDrawingBuffer = false, powerPreference: powerPreference = \"default\", failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat = false } = parameters;\n this.isWebGLRenderer = true;\n let _alpha;\n if (context !== null) _alpha = context.getContextAttributes().alpha;\n else _alpha = alpha;\n const uintClearColor = new Uint32Array(4);\n const intClearColor = new Int32Array(4);\n let currentRenderList = null;\n let currentRenderState = null;\n // render() can be called from within a callback triggered by another render.\n // We track this so that the nested render call gets its list and state isolated from the parent render call.\n const renderListStack = [];\n const renderStateStack = [];\n // public properties\n this.domElement = canvas;\n // Debug configuration container\n this.debug = {\n /**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */ checkShaderErrors: true,\n /**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */ onShaderError: null\n };\n // clearing\n this.autoClear = true;\n this.autoClearColor = true;\n this.autoClearDepth = true;\n this.autoClearStencil = true;\n // scene graph\n this.sortObjects = true;\n // user-defined clipping\n this.clippingPlanes = [];\n this.localClippingEnabled = false;\n // physically based shading\n this.outputColorSpace = $a315ee31802fb757$export$561f394b24edfcaa;\n // physical lights\n this._useLegacyLights = false;\n // tone mapping\n this.toneMapping = $a315ee31802fb757$export$9fcb6b4294603b2;\n this.toneMappingExposure = 1.0;\n // internal properties\n const _this = this;\n let _isContextLost = false;\n // internal state cache\n let _currentActiveCubeFace = 0;\n let _currentActiveMipmapLevel = 0;\n let _currentRenderTarget = null;\n let _currentMaterialId = -1;\n let _currentCamera = null;\n const _currentViewport = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n const _currentScissor = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n let _currentScissorTest = null;\n const _currentClearColor = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n let _currentClearAlpha = 0;\n //\n let _width = canvas.width;\n let _height = canvas.height;\n let _pixelRatio = 1;\n let _opaqueSort = null;\n let _transparentSort = null;\n const _viewport = new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, _width, _height);\n const _scissor = new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, _width, _height);\n let _scissorTest = false;\n // frustum\n const _frustum = new $a315ee31802fb757$export$35efe6f4c85463d2();\n // clipping\n let _clippingEnabled = false;\n let _localClippingEnabled = false;\n // transmission\n let _transmissionRenderTarget = null;\n // camera matrices cache\n const _projScreenMatrix = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n const _vector2 = new $a315ee31802fb757$export$c977b3e384af9ae1();\n const _vector3 = new $a315ee31802fb757$export$64b5c384219d3699();\n const _emptyScene = {\n background: null,\n fog: null,\n environment: null,\n overrideMaterial: null,\n isScene: true\n };\n function getTargetPixelRatio() {\n return _currentRenderTarget === null ? _pixelRatio : 1;\n }\n // initialize\n let _gl = context;\n function getContext(contextNames, contextAttributes) {\n for(let i = 0; i < contextNames.length; i++){\n const contextName = contextNames[i];\n const context = canvas.getContext(contextName, contextAttributes);\n if (context !== null) return context;\n }\n return null;\n }\n try {\n const contextAttributes = {\n alpha: true,\n depth: depth,\n stencil: stencil,\n antialias: antialias,\n premultipliedAlpha: premultipliedAlpha,\n preserveDrawingBuffer: preserveDrawingBuffer,\n powerPreference: powerPreference,\n failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat\n };\n // OffscreenCanvas does not have setAttribute, see #22811\n if (\"setAttribute\" in canvas) canvas.setAttribute(\"data-engine\", `three.js r${$a315ee31802fb757$export$3545e07a80636437}`);\n // event listeners must be registered before WebGL context is created, see #12753\n canvas.addEventListener(\"webglcontextlost\", onContextLost, false);\n canvas.addEventListener(\"webglcontextrestored\", onContextRestore, false);\n canvas.addEventListener(\"webglcontextcreationerror\", onContextCreationError, false);\n if (_gl === null) {\n const contextNames = [\n \"webgl2\",\n \"webgl\",\n \"experimental-webgl\"\n ];\n if (_this.isWebGL1Renderer === true) contextNames.shift();\n _gl = getContext(contextNames, contextAttributes);\n if (_gl === null) {\n if (getContext(contextNames)) throw new Error(\"Error creating WebGL context with your selected attributes.\");\n else throw new Error(\"Error creating WebGL context.\");\n }\n }\n if (typeof WebGLRenderingContext !== \"undefined\" && _gl instanceof WebGLRenderingContext) console.warn(\"THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.\");\n // Some experimental-webgl implementations do not have getShaderPrecisionFormat\n if (_gl.getShaderPrecisionFormat === undefined) _gl.getShaderPrecisionFormat = function() {\n return {\n \"rangeMin\": 1,\n \"rangeMax\": 1,\n \"precision\": 1\n };\n };\n } catch (error) {\n console.error(\"THREE.WebGLRenderer: \" + error.message);\n throw error;\n }\n let extensions, capabilities, state, info;\n let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n let programCache, materials, renderLists, renderStates, clipping, shadowMap;\n let background, morphtargets, bufferRenderer, indexedBufferRenderer;\n let utils, bindingStates, uniformsGroups;\n function initGLContext() {\n extensions = new $a315ee31802fb757$var$WebGLExtensions(_gl);\n capabilities = new $a315ee31802fb757$var$WebGLCapabilities(_gl, extensions, parameters);\n extensions.init(capabilities);\n utils = new $a315ee31802fb757$export$ddaebcad857649a8(_gl, extensions, capabilities);\n state = new $a315ee31802fb757$var$WebGLState(_gl, extensions, capabilities);\n info = new $a315ee31802fb757$var$WebGLInfo(_gl);\n properties = new $a315ee31802fb757$var$WebGLProperties();\n textures = new $a315ee31802fb757$var$WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);\n cubemaps = new $a315ee31802fb757$var$WebGLCubeMaps(_this);\n cubeuvmaps = new $a315ee31802fb757$var$WebGLCubeUVMaps(_this);\n attributes = new $a315ee31802fb757$var$WebGLAttributes(_gl, capabilities);\n bindingStates = new $a315ee31802fb757$var$WebGLBindingStates(_gl, extensions, attributes, capabilities);\n geometries = new $a315ee31802fb757$var$WebGLGeometries(_gl, attributes, info, bindingStates);\n objects = new $a315ee31802fb757$var$WebGLObjects(_gl, geometries, attributes, info);\n morphtargets = new $a315ee31802fb757$var$WebGLMorphtargets(_gl, capabilities, textures);\n clipping = new $a315ee31802fb757$var$WebGLClipping(properties);\n programCache = new $a315ee31802fb757$var$WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);\n materials = new $a315ee31802fb757$var$WebGLMaterials(_this, properties);\n renderLists = new $a315ee31802fb757$var$WebGLRenderLists();\n renderStates = new $a315ee31802fb757$var$WebGLRenderStates(extensions, capabilities);\n background = new $a315ee31802fb757$var$WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha);\n shadowMap = new $a315ee31802fb757$var$WebGLShadowMap(_this, objects, capabilities);\n uniformsGroups = new $a315ee31802fb757$var$WebGLUniformsGroups(_gl, info, capabilities, state);\n bufferRenderer = new $a315ee31802fb757$var$WebGLBufferRenderer(_gl, extensions, info, capabilities);\n indexedBufferRenderer = new $a315ee31802fb757$var$WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);\n info.programs = programCache.programs;\n _this.capabilities = capabilities;\n _this.extensions = extensions;\n _this.properties = properties;\n _this.renderLists = renderLists;\n _this.shadowMap = shadowMap;\n _this.state = state;\n _this.info = info;\n }\n initGLContext();\n // xr\n const xr = new $a315ee31802fb757$var$WebXRManager(_this, _gl);\n this.xr = xr;\n // API\n this.getContext = function() {\n return _gl;\n };\n this.getContextAttributes = function() {\n return _gl.getContextAttributes();\n };\n this.forceContextLoss = function() {\n const extension = extensions.get(\"WEBGL_lose_context\");\n if (extension) extension.loseContext();\n };\n this.forceContextRestore = function() {\n const extension = extensions.get(\"WEBGL_lose_context\");\n if (extension) extension.restoreContext();\n };\n this.getPixelRatio = function() {\n return _pixelRatio;\n };\n this.setPixelRatio = function(value) {\n if (value === undefined) return;\n _pixelRatio = value;\n this.setSize(_width, _height, false);\n };\n this.getSize = function(target) {\n return target.set(_width, _height);\n };\n this.setSize = function(width, height, updateStyle = true) {\n if (xr.isPresenting) {\n console.warn(\"THREE.WebGLRenderer: Can't change size while VR device is presenting.\");\n return;\n }\n _width = width;\n _height = height;\n canvas.width = Math.floor(width * _pixelRatio);\n canvas.height = Math.floor(height * _pixelRatio);\n if (updateStyle === true) {\n canvas.style.width = width + \"px\";\n canvas.style.height = height + \"px\";\n }\n this.setViewport(0, 0, width, height);\n };\n this.getDrawingBufferSize = function(target) {\n return target.set(_width * _pixelRatio, _height * _pixelRatio).floor();\n };\n this.setDrawingBufferSize = function(width, height, pixelRatio) {\n _width = width;\n _height = height;\n _pixelRatio = pixelRatio;\n canvas.width = Math.floor(width * pixelRatio);\n canvas.height = Math.floor(height * pixelRatio);\n this.setViewport(0, 0, width, height);\n };\n this.getCurrentViewport = function(target) {\n return target.copy(_currentViewport);\n };\n this.getViewport = function(target) {\n return target.copy(_viewport);\n };\n this.setViewport = function(x, y, width, height) {\n if (x.isVector4) _viewport.set(x.x, x.y, x.z, x.w);\n else _viewport.set(x, y, width, height);\n state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissor = function(target) {\n return target.copy(_scissor);\n };\n this.setScissor = function(x, y, width, height) {\n if (x.isVector4) _scissor.set(x.x, x.y, x.z, x.w);\n else _scissor.set(x, y, width, height);\n state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissorTest = function() {\n return _scissorTest;\n };\n this.setScissorTest = function(boolean) {\n state.setScissorTest(_scissorTest = boolean);\n };\n this.setOpaqueSort = function(method) {\n _opaqueSort = method;\n };\n this.setTransparentSort = function(method) {\n _transparentSort = method;\n };\n // Clearing\n this.getClearColor = function(target) {\n return target.copy(background.getClearColor());\n };\n this.setClearColor = function() {\n background.setClearColor.apply(background, arguments);\n };\n this.getClearAlpha = function() {\n return background.getClearAlpha();\n };\n this.setClearAlpha = function() {\n background.setClearAlpha.apply(background, arguments);\n };\n this.clear = function(color = true, depth = true, stencil = true) {\n let bits = 0;\n if (color) {\n // check if we're trying to clear an integer target\n let isIntegerFormat = false;\n if (_currentRenderTarget !== null) {\n const targetFormat = _currentRenderTarget.texture.format;\n isIntegerFormat = targetFormat === $a315ee31802fb757$export$c200e7d26f592f21 || targetFormat === $a315ee31802fb757$export$1ba1c45f9f77d4d7 || targetFormat === $a315ee31802fb757$export$aa92e870a709d190;\n }\n // use the appropriate clear functions to clear the target if it's a signed\n // or unsigned integer target\n if (isIntegerFormat) {\n const targetType = _currentRenderTarget.texture.type;\n const isUnsignedType = targetType === $a315ee31802fb757$export$2e8ce08d3f6f5e10 || targetType === $a315ee31802fb757$export$c3c7fc4518ebba96 || targetType === $a315ee31802fb757$export$c63dc51868b06a9d || targetType === $a315ee31802fb757$export$6c8ea339bfab1301 || targetType === $a315ee31802fb757$export$b3969b01faf587f2 || targetType === $a315ee31802fb757$export$18886f8ae33e90de;\n const clearColor = background.getClearColor();\n const a = background.getClearAlpha();\n const r = clearColor.r;\n const g = clearColor.g;\n const b = clearColor.b;\n if (isUnsignedType) {\n uintClearColor[0] = r;\n uintClearColor[1] = g;\n uintClearColor[2] = b;\n uintClearColor[3] = a;\n _gl.clearBufferuiv(_gl.COLOR, 0, uintClearColor);\n } else {\n intClearColor[0] = r;\n intClearColor[1] = g;\n intClearColor[2] = b;\n intClearColor[3] = a;\n _gl.clearBufferiv(_gl.COLOR, 0, intClearColor);\n }\n } else bits |= _gl.COLOR_BUFFER_BIT;\n }\n if (depth) bits |= _gl.DEPTH_BUFFER_BIT;\n if (stencil) bits |= _gl.STENCIL_BUFFER_BIT;\n _gl.clear(bits);\n };\n this.clearColor = function() {\n this.clear(true, false, false);\n };\n this.clearDepth = function() {\n this.clear(false, true, false);\n };\n this.clearStencil = function() {\n this.clear(false, false, true);\n };\n //\n this.dispose = function() {\n canvas.removeEventListener(\"webglcontextlost\", onContextLost, false);\n canvas.removeEventListener(\"webglcontextrestored\", onContextRestore, false);\n canvas.removeEventListener(\"webglcontextcreationerror\", onContextCreationError, false);\n renderLists.dispose();\n renderStates.dispose();\n properties.dispose();\n cubemaps.dispose();\n cubeuvmaps.dispose();\n objects.dispose();\n bindingStates.dispose();\n uniformsGroups.dispose();\n programCache.dispose();\n xr.dispose();\n xr.removeEventListener(\"sessionstart\", onXRSessionStart);\n xr.removeEventListener(\"sessionend\", onXRSessionEnd);\n if (_transmissionRenderTarget) {\n _transmissionRenderTarget.dispose();\n _transmissionRenderTarget = null;\n }\n animation.stop();\n };\n // Events\n function onContextLost(event) {\n event.preventDefault();\n console.log(\"THREE.WebGLRenderer: Context Lost.\");\n _isContextLost = true;\n }\n function onContextRestore() {\n console.log(\"THREE.WebGLRenderer: Context Restored.\");\n _isContextLost = false;\n const infoAutoReset = info.autoReset;\n const shadowMapEnabled = shadowMap.enabled;\n const shadowMapAutoUpdate = shadowMap.autoUpdate;\n const shadowMapNeedsUpdate = shadowMap.needsUpdate;\n const shadowMapType = shadowMap.type;\n initGLContext();\n info.autoReset = infoAutoReset;\n shadowMap.enabled = shadowMapEnabled;\n shadowMap.autoUpdate = shadowMapAutoUpdate;\n shadowMap.needsUpdate = shadowMapNeedsUpdate;\n shadowMap.type = shadowMapType;\n }\n function onContextCreationError(event) {\n console.error(\"THREE.WebGLRenderer: A WebGL context could not be created. Reason: \", event.statusMessage);\n }\n function onMaterialDispose(event) {\n const material = event.target;\n material.removeEventListener(\"dispose\", onMaterialDispose);\n deallocateMaterial(material);\n }\n // Buffer deallocation\n function deallocateMaterial(material) {\n releaseMaterialProgramReferences(material);\n properties.remove(material);\n }\n function releaseMaterialProgramReferences(material) {\n const programs = properties.get(material).programs;\n if (programs !== undefined) {\n programs.forEach(function(program) {\n programCache.releaseProgram(program);\n });\n if (material.isShaderMaterial) programCache.releaseShaderCache(material);\n }\n }\n // Buffer rendering\n this.renderBufferDirect = function(camera, scene, geometry, material, object, group) {\n if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;\n const program = setProgram(camera, scene, geometry, material, object);\n state.setMaterial(material, frontFaceCW);\n //\n let index = geometry.index;\n let rangeFactor = 1;\n if (material.wireframe === true) {\n index = geometries.getWireframeAttribute(geometry);\n if (index === undefined) return;\n rangeFactor = 2;\n }\n //\n const drawRange = geometry.drawRange;\n const position = geometry.attributes.position;\n let drawStart = drawRange.start * rangeFactor;\n let drawEnd = (drawRange.start + drawRange.count) * rangeFactor;\n if (group !== null) {\n drawStart = Math.max(drawStart, group.start * rangeFactor);\n drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor);\n }\n if (index !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, index.count);\n } else if (position !== undefined && position !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, position.count);\n }\n const drawCount = drawEnd - drawStart;\n if (drawCount < 0 || drawCount === Infinity) return;\n //\n bindingStates.setup(object, material, program, geometry, index);\n let attribute;\n let renderer = bufferRenderer;\n if (index !== null) {\n attribute = attributes.get(index);\n renderer = indexedBufferRenderer;\n renderer.setIndex(attribute);\n }\n //\n if (object.isMesh) {\n if (material.wireframe === true) {\n state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());\n renderer.setMode(_gl.LINES);\n } else renderer.setMode(_gl.TRIANGLES);\n } else if (object.isLine) {\n let lineWidth = material.linewidth;\n if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material\n state.setLineWidth(lineWidth * getTargetPixelRatio());\n if (object.isLineSegments) renderer.setMode(_gl.LINES);\n else if (object.isLineLoop) renderer.setMode(_gl.LINE_LOOP);\n else renderer.setMode(_gl.LINE_STRIP);\n } else if (object.isPoints) renderer.setMode(_gl.POINTS);\n else if (object.isSprite) renderer.setMode(_gl.TRIANGLES);\n if (object.isInstancedMesh) renderer.renderInstances(drawStart, drawCount, object.count);\n else if (geometry.isInstancedBufferGeometry) {\n const maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount);\n renderer.renderInstances(drawStart, drawCount, instanceCount);\n } else renderer.render(drawStart, drawCount);\n };\n // Compile\n this.compile = function(scene, camera) {\n function prepare(material, scene, object) {\n if (material.transparent === true && material.side === $a315ee31802fb757$export$3b296b6f144d5b03 && material.forceSinglePass === false) {\n material.side = $a315ee31802fb757$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = $a315ee31802fb757$export$2ede184fc2998901;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = $a315ee31802fb757$export$3b296b6f144d5b03;\n } else getProgram(material, scene, object);\n }\n currentRenderState = renderStates.get(scene);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n scene.traverseVisible(function(object) {\n if (object.isLight && object.layers.test(camera.layers)) {\n currentRenderState.pushLight(object);\n if (object.castShadow) currentRenderState.pushShadow(object);\n }\n });\n currentRenderState.setupLights(_this._useLegacyLights);\n scene.traverse(function(object) {\n const material = object.material;\n if (material) {\n if (Array.isArray(material)) for(let i = 0; i < material.length; i++){\n const material2 = material[i];\n prepare(material2, scene, object);\n }\n else prepare(material, scene, object);\n }\n });\n renderStateStack.pop();\n currentRenderState = null;\n };\n // Animation Loop\n let onAnimationFrameCallback = null;\n function onAnimationFrame(time) {\n if (onAnimationFrameCallback) onAnimationFrameCallback(time);\n }\n function onXRSessionStart() {\n animation.stop();\n }\n function onXRSessionEnd() {\n animation.start();\n }\n const animation = new $a315ee31802fb757$var$WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n if (typeof self !== \"undefined\") animation.setContext(self);\n this.setAnimationLoop = function(callback) {\n onAnimationFrameCallback = callback;\n xr.setAnimationLoop(callback);\n callback === null ? animation.stop() : animation.start();\n };\n xr.addEventListener(\"sessionstart\", onXRSessionStart);\n xr.addEventListener(\"sessionend\", onXRSessionEnd);\n // Rendering\n this.render = function(scene, camera) {\n if (camera !== undefined && camera.isCamera !== true) {\n console.error(\"THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.\");\n return;\n }\n if (_isContextLost === true) return;\n // update scene graph\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();\n // update camera matrices and frustum\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();\n if (xr.enabled === true && xr.isPresenting === true) {\n if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);\n camera = xr.getCamera(); // use XR camera for rendering\n }\n //\n if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);\n currentRenderState = renderStates.get(scene, renderStateStack.length);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n _frustum.setFromProjectionMatrix(_projScreenMatrix);\n _localClippingEnabled = this.localClippingEnabled;\n _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled);\n currentRenderList = renderLists.get(scene, renderListStack.length);\n currentRenderList.init();\n renderListStack.push(currentRenderList);\n projectObject(scene, camera, 0, _this.sortObjects);\n currentRenderList.finish();\n if (_this.sortObjects === true) currentRenderList.sort(_opaqueSort, _transparentSort);\n //\n this.info.render.frame++;\n if (_clippingEnabled === true) clipping.beginShadows();\n const shadowsArray = currentRenderState.state.shadowsArray;\n shadowMap.render(shadowsArray, scene, camera);\n if (_clippingEnabled === true) clipping.endShadows();\n //\n if (this.info.autoReset === true) this.info.reset();\n //\n background.render(currentRenderList, scene);\n // render scene\n currentRenderState.setupLights(_this._useLegacyLights);\n if (camera.isArrayCamera) {\n const cameras = camera.cameras;\n for(let i = 0, l = cameras.length; i < l; i++){\n const camera2 = cameras[i];\n renderScene(currentRenderList, scene, camera2, camera2.viewport);\n }\n } else renderScene(currentRenderList, scene, camera);\n //\n if (_currentRenderTarget !== null) {\n // resolve multisample renderbuffers to a single-sample texture if necessary\n textures.updateMultisampleRenderTarget(_currentRenderTarget);\n // Generate mipmap if we're using any kind of mipmap filtering\n textures.updateRenderTargetMipmap(_currentRenderTarget);\n }\n //\n if (scene.isScene === true) scene.onAfterRender(_this, scene, camera);\n // _gl.finish();\n bindingStates.resetDefaultState();\n _currentMaterialId = -1;\n _currentCamera = null;\n renderStateStack.pop();\n if (renderStateStack.length > 0) currentRenderState = renderStateStack[renderStateStack.length - 1];\n else currentRenderState = null;\n renderListStack.pop();\n if (renderListStack.length > 0) currentRenderList = renderListStack[renderListStack.length - 1];\n else currentRenderList = null;\n };\n function projectObject(object, camera, groupOrder, sortObjects) {\n if (object.visible === false) return;\n const visible = object.layers.test(camera.layers);\n if (visible) {\n if (object.isGroup) groupOrder = object.renderOrder;\n else if (object.isLOD) {\n if (object.autoUpdate === true) object.update(camera);\n } else if (object.isLight) {\n currentRenderState.pushLight(object);\n if (object.castShadow) currentRenderState.pushShadow(object);\n } else if (object.isSprite) {\n if (!object.frustumCulled || _frustum.intersectsSprite(object)) {\n if (sortObjects) _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n const geometry = objects.update(object);\n const material = object.material;\n if (material.visible) currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);\n }\n } else if (object.isMesh || object.isLine || object.isPoints) {\n if (!object.frustumCulled || _frustum.intersectsObject(object)) {\n const geometry = objects.update(object);\n const material = object.material;\n if (sortObjects) {\n if (object.boundingSphere !== undefined) {\n if (object.boundingSphere === null) object.computeBoundingSphere();\n _vector3.copy(object.boundingSphere.center);\n } else {\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _vector3.copy(geometry.boundingSphere.center);\n }\n _vector3.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n }\n if (Array.isArray(material)) {\n const groups = geometry.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group);\n }\n } else if (material.visible) currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)projectObject(children[i], camera, groupOrder, sortObjects);\n }\n function renderScene(currentRenderList, scene, camera, viewport) {\n const opaqueObjects = currentRenderList.opaque;\n const transmissiveObjects = currentRenderList.transmissive;\n const transparentObjects = currentRenderList.transparent;\n currentRenderState.setupLightsView(camera);\n if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, camera);\n if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera);\n if (viewport) state.viewport(_currentViewport.copy(viewport));\n if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);\n if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera);\n if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera);\n // Ensure depth buffer writing is enabled so it can be cleared on next render\n state.buffers.depth.setTest(true);\n state.buffers.depth.setMask(true);\n state.buffers.color.setMask(true);\n state.setPolygonOffset(false);\n }\n function renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera) {\n const isWebGL2 = capabilities.isWebGL2;\n if (_transmissionRenderTarget === null) _transmissionRenderTarget = new $a315ee31802fb757$export$3c052beb2e51e23f(1, 1, {\n generateMipmaps: true,\n type: extensions.has(\"EXT_color_buffer_half_float\") ? $a315ee31802fb757$export$2697304443f382bc : $a315ee31802fb757$export$2e8ce08d3f6f5e10,\n minFilter: $a315ee31802fb757$export$5d8599b6a933fb1b,\n samples: isWebGL2 ? 4 : 0\n });\n _this.getDrawingBufferSize(_vector2);\n if (isWebGL2) _transmissionRenderTarget.setSize(_vector2.x, _vector2.y);\n else _transmissionRenderTarget.setSize($a315ee31802fb757$var$floorPowerOfTwo(_vector2.x), $a315ee31802fb757$var$floorPowerOfTwo(_vector2.y));\n //\n const currentRenderTarget = _this.getRenderTarget();\n _this.setRenderTarget(_transmissionRenderTarget);\n _this.getClearColor(_currentClearColor);\n _currentClearAlpha = _this.getClearAlpha();\n if (_currentClearAlpha < 1) _this.setClearColor(0xffffff, 0.5);\n _this.clear();\n // Turn off the features which can affect the frag color for opaque objects pass.\n // Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n const currentToneMapping = _this.toneMapping;\n _this.toneMapping = $a315ee31802fb757$export$9fcb6b4294603b2;\n renderObjects(opaqueObjects, scene, camera);\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n let renderTargetNeedsUpdate = false;\n for(let i = 0, l = transmissiveObjects.length; i < l; i++){\n const renderItem = transmissiveObjects[i];\n const object = renderItem.object;\n const geometry = renderItem.geometry;\n const material = renderItem.material;\n const group = renderItem.group;\n if (material.side === $a315ee31802fb757$export$3b296b6f144d5b03 && object.layers.test(camera.layers)) {\n const currentSide = material.side;\n material.side = $a315ee31802fb757$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n renderObject(object, scene, camera, geometry, material, group);\n material.side = currentSide;\n material.needsUpdate = true;\n renderTargetNeedsUpdate = true;\n }\n }\n if (renderTargetNeedsUpdate === true) {\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n }\n _this.setRenderTarget(currentRenderTarget);\n _this.setClearColor(_currentClearColor, _currentClearAlpha);\n _this.toneMapping = currentToneMapping;\n }\n function renderObjects(renderList, scene, camera) {\n const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n for(let i = 0, l = renderList.length; i < l; i++){\n const renderItem = renderList[i];\n const object = renderItem.object;\n const geometry = renderItem.geometry;\n const material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n const group = renderItem.group;\n if (object.layers.test(camera.layers)) renderObject(object, scene, camera, geometry, material, group);\n }\n }\n function renderObject(object, scene, camera, geometry, material, group) {\n object.onBeforeRender(_this, scene, camera, geometry, material, group);\n object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);\n object.normalMatrix.getNormalMatrix(object.modelViewMatrix);\n material.onBeforeRender(_this, scene, camera, geometry, object, group);\n if (material.transparent === true && material.side === $a315ee31802fb757$export$3b296b6f144d5b03 && material.forceSinglePass === false) {\n material.side = $a315ee31802fb757$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = $a315ee31802fb757$export$2ede184fc2998901;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = $a315ee31802fb757$export$3b296b6f144d5b03;\n } else _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n object.onAfterRender(_this, scene, camera, geometry, material, group);\n }\n function getProgram(material, scene, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n const materialProperties = properties.get(material);\n const lights = currentRenderState.state.lights;\n const shadowsArray = currentRenderState.state.shadowsArray;\n const lightsStateVersion = lights.state.version;\n const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object);\n const programCacheKey = programCache.getProgramCacheKey(parameters);\n let programs = materialProperties.programs;\n // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n materialProperties.fog = scene.fog;\n materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment);\n if (programs === undefined) {\n // new material\n material.addEventListener(\"dispose\", onMaterialDispose);\n programs = new Map();\n materialProperties.programs = programs;\n }\n let program = programs.get(programCacheKey);\n if (program !== undefined) // early out if program and light state is identical\n {\n if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) {\n updateCommonMaterialProperties(material, parameters);\n return program;\n }\n } else {\n parameters.uniforms = programCache.getUniforms(material);\n material.onBuild(object, parameters, _this);\n material.onBeforeCompile(parameters, _this);\n program = programCache.acquireProgram(parameters, programCacheKey);\n programs.set(programCacheKey, program);\n materialProperties.uniforms = parameters.uniforms;\n }\n const uniforms = materialProperties.uniforms;\n if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) uniforms.clippingPlanes = clipping.uniform;\n updateCommonMaterialProperties(material, parameters);\n // store the light setup it was created for\n materialProperties.needsLights = materialNeedsLights(material);\n materialProperties.lightsStateVersion = lightsStateVersion;\n if (materialProperties.needsLights) {\n // wire up the material to this renderer's lighting state\n uniforms.ambientLightColor.value = lights.state.ambient;\n uniforms.lightProbe.value = lights.state.probe;\n uniforms.directionalLights.value = lights.state.directional;\n uniforms.directionalLightShadows.value = lights.state.directionalShadow;\n uniforms.spotLights.value = lights.state.spot;\n uniforms.spotLightShadows.value = lights.state.spotShadow;\n uniforms.rectAreaLights.value = lights.state.rectArea;\n uniforms.ltc_1.value = lights.state.rectAreaLTC1;\n uniforms.ltc_2.value = lights.state.rectAreaLTC2;\n uniforms.pointLights.value = lights.state.point;\n uniforms.pointLightShadows.value = lights.state.pointShadow;\n uniforms.hemisphereLights.value = lights.state.hemi;\n uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n uniforms.spotShadowMap.value = lights.state.spotShadowMap;\n uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n uniforms.spotLightMap.value = lights.state.spotLightMap;\n uniforms.pointShadowMap.value = lights.state.pointShadowMap;\n uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n // TODO (abelnation): add area lights shadow info to uniforms\n }\n const progUniforms = program.getUniforms();\n const uniformsList = $a315ee31802fb757$var$WebGLUniforms.seqWithValue(progUniforms.seq, uniforms);\n materialProperties.currentProgram = program;\n materialProperties.uniformsList = uniformsList;\n return program;\n }\n function updateCommonMaterialProperties(material, parameters) {\n const materialProperties = properties.get(material);\n materialProperties.outputColorSpace = parameters.outputColorSpace;\n materialProperties.instancing = parameters.instancing;\n materialProperties.instancingColor = parameters.instancingColor;\n materialProperties.skinning = parameters.skinning;\n materialProperties.morphTargets = parameters.morphTargets;\n materialProperties.morphNormals = parameters.morphNormals;\n materialProperties.morphColors = parameters.morphColors;\n materialProperties.morphTargetsCount = parameters.morphTargetsCount;\n materialProperties.numClippingPlanes = parameters.numClippingPlanes;\n materialProperties.numIntersection = parameters.numClipIntersection;\n materialProperties.vertexAlphas = parameters.vertexAlphas;\n materialProperties.vertexTangents = parameters.vertexTangents;\n materialProperties.toneMapping = parameters.toneMapping;\n }\n function setProgram(camera, scene, geometry, material, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n textures.resetTextureUnits();\n const fog = scene.fog;\n const environment = material.isMeshStandardMaterial ? scene.environment : null;\n const colorSpace1 = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : $a315ee31802fb757$export$42429b3acfb233a4;\n const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n const vertexTangents = !!geometry.attributes.tangent && (!!material.normalMap || material.anisotropy > 0);\n const morphTargets = !!geometry.morphAttributes.position;\n const morphNormals = !!geometry.morphAttributes.normal;\n const morphColors = !!geometry.morphAttributes.color;\n let toneMapping = $a315ee31802fb757$export$9fcb6b4294603b2;\n if (material.toneMapped) {\n if (_currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true) toneMapping = _this.toneMapping;\n }\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n const materialProperties = properties.get(material);\n const lights = currentRenderState.state.lights;\n if (_clippingEnabled === true) {\n if (_localClippingEnabled === true || camera !== _currentCamera) {\n const useCache = camera === _currentCamera && material.id === _currentMaterialId;\n // we might want to call this function with some ClippingGroup\n // object instead of the material, once it becomes feasible\n // (#8465, #8379)\n clipping.setState(material, camera, useCache);\n }\n }\n //\n let needsProgramChange = false;\n if (material.version === materialProperties.__version) {\n if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) needsProgramChange = true;\n else if (materialProperties.outputColorSpace !== colorSpace1) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancing === false) needsProgramChange = true;\n else if (!object.isInstancedMesh && materialProperties.instancing === true) needsProgramChange = true;\n else if (object.isSkinnedMesh && materialProperties.skinning === false) needsProgramChange = true;\n else if (!object.isSkinnedMesh && materialProperties.skinning === true) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null) needsProgramChange = true;\n else if (materialProperties.envMap !== envMap) needsProgramChange = true;\n else if (material.fog === true && materialProperties.fog !== fog) needsProgramChange = true;\n else if (materialProperties.numClippingPlanes !== undefined && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) needsProgramChange = true;\n else if (materialProperties.vertexAlphas !== vertexAlphas) needsProgramChange = true;\n else if (materialProperties.vertexTangents !== vertexTangents) needsProgramChange = true;\n else if (materialProperties.morphTargets !== morphTargets) needsProgramChange = true;\n else if (materialProperties.morphNormals !== morphNormals) needsProgramChange = true;\n else if (materialProperties.morphColors !== morphColors) needsProgramChange = true;\n else if (materialProperties.toneMapping !== toneMapping) needsProgramChange = true;\n else if (capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount) needsProgramChange = true;\n } else {\n needsProgramChange = true;\n materialProperties.__version = material.version;\n }\n //\n let program = materialProperties.currentProgram;\n if (needsProgramChange === true) program = getProgram(material, scene, object);\n let refreshProgram = false;\n let refreshMaterial = false;\n let refreshLights = false;\n const p_uniforms = program.getUniforms(), m_uniforms = materialProperties.uniforms;\n if (state.useProgram(program.program)) {\n refreshProgram = true;\n refreshMaterial = true;\n refreshLights = true;\n }\n if (material.id !== _currentMaterialId) {\n _currentMaterialId = material.id;\n refreshMaterial = true;\n }\n if (refreshProgram || _currentCamera !== camera) {\n p_uniforms.setValue(_gl, \"projectionMatrix\", camera.projectionMatrix);\n if (capabilities.logarithmicDepthBuffer) p_uniforms.setValue(_gl, \"logDepthBufFC\", 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));\n if (_currentCamera !== camera) {\n _currentCamera = camera;\n // lighting uniforms depend on the camera so enforce an update\n // now, in case this material supports lights - or later, when\n // the next material that does gets activated:\n refreshMaterial = true; // set to true on material change\n refreshLights = true; // remains set until update done\n }\n // load material specific uniforms\n // (shader material also gets them for the sake of genericity)\n if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) {\n const uCamPos = p_uniforms.map.cameraPosition;\n if (uCamPos !== undefined) uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));\n }\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) p_uniforms.setValue(_gl, \"isOrthographic\", camera.isOrthographicCamera === true);\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) p_uniforms.setValue(_gl, \"viewMatrix\", camera.matrixWorldInverse);\n }\n // skinning and morph target uniforms must be set even if material didn't change\n // auto-setting of texture unit for bone and morph texture must go before other textures\n // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n if (object.isSkinnedMesh) {\n p_uniforms.setOptional(_gl, object, \"bindMatrix\");\n p_uniforms.setOptional(_gl, object, \"bindMatrixInverse\");\n const skeleton = object.skeleton;\n if (skeleton) {\n if (capabilities.floatVertexTextures) {\n if (skeleton.boneTexture === null) skeleton.computeBoneTexture();\n p_uniforms.setValue(_gl, \"boneTexture\", skeleton.boneTexture, textures);\n p_uniforms.setValue(_gl, \"boneTextureSize\", skeleton.boneTextureSize);\n } else console.warn(\"THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.\");\n }\n }\n const morphAttributes = geometry.morphAttributes;\n if (morphAttributes.position !== undefined || morphAttributes.normal !== undefined || morphAttributes.color !== undefined && capabilities.isWebGL2 === true) morphtargets.update(object, geometry, program);\n if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {\n materialProperties.receiveShadow = object.receiveShadow;\n p_uniforms.setValue(_gl, \"receiveShadow\", object.receiveShadow);\n }\n // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n if (material.isMeshGouraudMaterial && material.envMap !== null) {\n m_uniforms.envMap.value = envMap;\n m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n }\n if (refreshMaterial) {\n p_uniforms.setValue(_gl, \"toneMappingExposure\", _this.toneMappingExposure);\n if (materialProperties.needsLights) // the current material requires lighting info\n // note: all lighting uniforms are always set correctly\n // they simply reference the renderer's state for their\n // values\n //\n // use the current material's .needsUpdate flags to set\n // the GL state when required\n markUniformsLightsNeedsUpdate(m_uniforms, refreshLights);\n // refresh uniforms common to several materials\n if (fog && material.fog === true) materials.refreshFogUniforms(m_uniforms, fog);\n materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget);\n $a315ee31802fb757$var$WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n }\n if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {\n $a315ee31802fb757$var$WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n material.uniformsNeedUpdate = false;\n }\n if (material.isSpriteMaterial) p_uniforms.setValue(_gl, \"center\", object.center);\n // common matrices\n p_uniforms.setValue(_gl, \"modelViewMatrix\", object.modelViewMatrix);\n p_uniforms.setValue(_gl, \"normalMatrix\", object.normalMatrix);\n p_uniforms.setValue(_gl, \"modelMatrix\", object.matrixWorld);\n // UBOs\n if (material.isShaderMaterial || material.isRawShaderMaterial) {\n const groups = material.uniformsGroups;\n for(let i = 0, l = groups.length; i < l; i++)if (capabilities.isWebGL2) {\n const group = groups[i];\n uniformsGroups.update(group, program);\n uniformsGroups.bind(group, program);\n } else console.warn(\"THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.\");\n }\n return program;\n }\n // If uniforms are marked as clean, they don't need to be loaded to the GPU.\n function markUniformsLightsNeedsUpdate(uniforms, value) {\n uniforms.ambientLightColor.needsUpdate = value;\n uniforms.lightProbe.needsUpdate = value;\n uniforms.directionalLights.needsUpdate = value;\n uniforms.directionalLightShadows.needsUpdate = value;\n uniforms.pointLights.needsUpdate = value;\n uniforms.pointLightShadows.needsUpdate = value;\n uniforms.spotLights.needsUpdate = value;\n uniforms.spotLightShadows.needsUpdate = value;\n uniforms.rectAreaLights.needsUpdate = value;\n uniforms.hemisphereLights.needsUpdate = value;\n }\n function materialNeedsLights(material) {\n return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true;\n }\n this.getActiveCubeFace = function() {\n return _currentActiveCubeFace;\n };\n this.getActiveMipmapLevel = function() {\n return _currentActiveMipmapLevel;\n };\n this.getRenderTarget = function() {\n return _currentRenderTarget;\n };\n this.setRenderTargetTextures = function(renderTarget, colorTexture, depthTexture) {\n properties.get(renderTarget.texture).__webglTexture = colorTexture;\n properties.get(renderTarget.depthTexture).__webglTexture = depthTexture;\n const renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__hasExternalTextures = true;\n if (renderTargetProperties.__hasExternalTextures) {\n renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n if (!renderTargetProperties.__autoAllocateDepthBuffer) // The multisample_render_to_texture extension doesn't work properly if there\n // are midframe flushes and an external depth buffer. Disable use of the extension.\n {\n if (extensions.has(\"WEBGL_multisampled_render_to_texture\") === true) {\n console.warn(\"THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided\");\n renderTargetProperties.__useRenderToTexture = false;\n }\n }\n }\n };\n this.setRenderTargetFramebuffer = function(renderTarget, defaultFramebuffer) {\n const renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n };\n this.setRenderTarget = function(renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) {\n _currentRenderTarget = renderTarget;\n _currentActiveCubeFace = activeCubeFace;\n _currentActiveMipmapLevel = activeMipmapLevel;\n let useDefaultFramebuffer = true;\n let framebuffer = null;\n let isCube = false;\n let isRenderTarget3D = false;\n if (renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n if (renderTargetProperties.__useDefaultFramebuffer !== undefined) {\n // We need to make sure to rebind the framebuffer.\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n useDefaultFramebuffer = false;\n } else if (renderTargetProperties.__webglFramebuffer === undefined) textures.setupRenderTarget(renderTarget);\n else if (renderTargetProperties.__hasExternalTextures) // Color and depth texture must be rebound in order for the swapchain to update.\n textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture);\n const texture = renderTarget.texture;\n if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) isRenderTarget3D = true;\n const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget) {\n if (Array.isArray(__webglFramebuffer[activeCubeFace])) framebuffer = __webglFramebuffer[activeCubeFace][activeMipmapLevel];\n else framebuffer = __webglFramebuffer[activeCubeFace];\n isCube = true;\n } else if (capabilities.isWebGL2 && renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer;\n else if (Array.isArray(__webglFramebuffer)) framebuffer = __webglFramebuffer[activeMipmapLevel];\n else framebuffer = __webglFramebuffer;\n _currentViewport.copy(renderTarget.viewport);\n _currentScissor.copy(renderTarget.scissor);\n _currentScissorTest = renderTarget.scissorTest;\n } else {\n _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();\n _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();\n _currentScissorTest = _scissorTest;\n }\n const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) state.drawBuffers(renderTarget, framebuffer);\n state.viewport(_currentViewport);\n state.scissor(_currentScissor);\n state.setScissorTest(_currentScissorTest);\n if (isCube) {\n const textureProperties = properties.get(renderTarget.texture);\n _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel);\n } else if (isRenderTarget3D) {\n const textureProperties = properties.get(renderTarget.texture);\n const layer = activeCubeFace || 0;\n _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer);\n }\n _currentMaterialId = -1; // reset current material to ensure correct uniform bindings\n };\n this.readRenderTargetPixels = function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) {\n if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\");\n return;\n }\n let framebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) framebuffer = framebuffer[activeCubeFaceIndex];\n if (framebuffer) {\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n try {\n const texture = renderTarget.texture;\n const textureFormat = texture.format;\n const textureType = texture.type;\n if (textureFormat !== $a315ee31802fb757$export$3f8bb04b555a363c && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.\");\n return;\n }\n const halfFloatSupportedByExt = textureType === $a315ee31802fb757$export$2697304443f382bc && (extensions.has(\"EXT_color_buffer_half_float\") || capabilities.isWebGL2 && extensions.has(\"EXT_color_buffer_float\"));\n if (textureType !== $a315ee31802fb757$export$2e8ce08d3f6f5e10 && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)\n !(textureType === $a315ee31802fb757$export$f6d331659b644596 && (capabilities.isWebGL2 || extensions.has(\"OES_texture_float\") || extensions.has(\"WEBGL_color_buffer_float\"))) && // Chrome Mac >= 52 and Firefox\n !halfFloatSupportedByExt) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.\");\n return;\n }\n // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer);\n } finally{\n // restore framebuffer of current render target if necessary\n const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n }\n }\n };\n this.copyFramebufferToTexture = function(position, texture, level = 0) {\n const levelScale = Math.pow(2, -level);\n const width = Math.floor(texture.image.width * levelScale);\n const height = Math.floor(texture.image.height * levelScale);\n textures.setTexture2D(texture, 0);\n _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height);\n state.unbindTexture();\n };\n this.copyTextureToTexture = function(position, srcTexture, dstTexture, level = 0) {\n const width = srcTexture.image.width;\n const height = srcTexture.image.height;\n const glFormat = utils.convert(dstTexture.format);\n const glType = utils.convert(dstTexture.type);\n textures.setTexture2D(dstTexture, 0);\n // As another texture upload may have changed pixelStorei\n // parameters, make sure they are correct for the dstTexture\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);\n if (srcTexture.isDataTexture) _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data);\n else if (srcTexture.isCompressedTexture) _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data);\n else _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image);\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D);\n state.unbindTexture();\n };\n this.copyTextureToTexture3D = function(sourceBox, position, srcTexture, dstTexture, level = 0) {\n if (_this.isWebGL1Renderer) {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.\");\n return;\n }\n const width = sourceBox.max.x - sourceBox.min.x + 1;\n const height = sourceBox.max.y - sourceBox.min.y + 1;\n const depth = sourceBox.max.z - sourceBox.min.z + 1;\n const glFormat = utils.convert(dstTexture.format);\n const glType = utils.convert(dstTexture.type);\n let glTarget;\n if (dstTexture.isData3DTexture) {\n textures.setTexture3D(dstTexture, 0);\n glTarget = _gl.TEXTURE_3D;\n } else if (dstTexture.isDataArrayTexture) {\n textures.setTexture2DArray(dstTexture, 0);\n glTarget = _gl.TEXTURE_2D_ARRAY;\n } else {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.\");\n return;\n }\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);\n const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);\n const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);\n const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);\n const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);\n const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);\n const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image;\n _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);\n _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);\n _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x);\n _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y);\n _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z);\n if (srcTexture.isDataTexture || srcTexture.isData3DTexture) _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);\n else if (srcTexture.isCompressedArrayTexture) {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.\");\n _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);\n } else _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image);\n _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen);\n _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight);\n _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels);\n _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows);\n _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages);\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget);\n state.unbindTexture();\n };\n this.initTexture = function(texture) {\n if (texture.isCubeTexture) textures.setTextureCube(texture, 0);\n else if (texture.isData3DTexture) textures.setTexture3D(texture, 0);\n else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textures.setTexture2DArray(texture, 0);\n else textures.setTexture2D(texture, 0);\n state.unbindTexture();\n };\n this.resetState = function() {\n _currentActiveCubeFace = 0;\n _currentActiveMipmapLevel = 0;\n _currentRenderTarget = null;\n state.reset();\n bindingStates.reset();\n };\n if (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\", {\n detail: this\n }));\n }\n get coordinateSystem() {\n return $a315ee31802fb757$export$5a0e9190d10875d3;\n }\n get physicallyCorrectLights() {\n console.warn(\"THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.\");\n return !this.useLegacyLights;\n }\n set physicallyCorrectLights(value) {\n console.warn(\"THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.\");\n this.useLegacyLights = !value;\n }\n get outputEncoding() {\n console.warn(\"THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.\");\n return this.outputColorSpace === $a315ee31802fb757$export$561f394b24edfcaa ? $a315ee31802fb757$export$f32388edbb32674 : $a315ee31802fb757$export$7207336e4151a112;\n }\n set outputEncoding(encoding) {\n console.warn(\"THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.\");\n this.outputColorSpace = encoding === $a315ee31802fb757$export$f32388edbb32674 ? $a315ee31802fb757$export$561f394b24edfcaa : $a315ee31802fb757$export$42429b3acfb233a4;\n }\n get useLegacyLights() {\n console.warn(\"THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.\");\n return this._useLegacyLights;\n }\n set useLegacyLights(value) {\n console.warn(\"THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.\");\n this._useLegacyLights = value;\n }\n}\nclass $a315ee31802fb757$export$a2f65229194348f9 extends $a315ee31802fb757$export$f6cc00ef28d7cf97 {\n}\n$a315ee31802fb757$export$a2f65229194348f9.prototype.isWebGL1Renderer = true;\nclass $a315ee31802fb757$export$6f1519f023b8d0f6 {\n constructor(color, density = 0.00025){\n this.isFogExp2 = true;\n this.name = \"\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(color);\n this.density = density;\n }\n clone() {\n return new $a315ee31802fb757$export$6f1519f023b8d0f6(this.color, this.density);\n }\n toJSON() {\n return {\n type: \"FogExp2\",\n color: this.color.getHex(),\n density: this.density\n };\n }\n}\nclass $a315ee31802fb757$export$3c890837b09508d4 {\n constructor(color, near = 1, far = 1000){\n this.isFog = true;\n this.name = \"\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(color);\n this.near = near;\n this.far = far;\n }\n clone() {\n return new $a315ee31802fb757$export$3c890837b09508d4(this.color, this.near, this.far);\n }\n toJSON() {\n return {\n type: \"Fog\",\n color: this.color.getHex(),\n near: this.near,\n far: this.far\n };\n }\n}\nclass $a315ee31802fb757$export$38af1803e3442a7f extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isScene = true;\n this.type = \"Scene\";\n this.background = null;\n this.environment = null;\n this.fog = null;\n this.backgroundBlurriness = 0;\n this.backgroundIntensity = 1;\n this.overrideMaterial = null;\n if (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\", {\n detail: this\n }));\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.background !== null) this.background = source.background.clone();\n if (source.environment !== null) this.environment = source.environment.clone();\n if (source.fog !== null) this.fog = source.fog.clone();\n this.backgroundBlurriness = source.backgroundBlurriness;\n this.backgroundIntensity = source.backgroundIntensity;\n if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.fog !== null) data.object.fog = this.fog.toJSON();\n if (this.backgroundBlurriness > 0) data.object.backgroundBlurriness = this.backgroundBlurriness;\n if (this.backgroundIntensity !== 1) data.object.backgroundIntensity = this.backgroundIntensity;\n return data;\n }\n}\nclass $a315ee31802fb757$export$3d5cd879f108f53f {\n constructor(array, stride){\n this.isInterleavedBuffer = true;\n this.array = array;\n this.stride = stride;\n this.count = array !== undefined ? array.length / stride : 0;\n this.usage = $a315ee31802fb757$export$763e8360f4d7f77d;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.version = 0;\n this.uuid = $a315ee31802fb757$var$generateUUID();\n }\n onUploadCallback() {}\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n copy(source) {\n this.array = new source.array.constructor(source.array);\n this.count = source.count;\n this.stride = source.stride;\n this.usage = source.usage;\n return this;\n }\n copyAt(index1, attribute, index2) {\n index1 *= this.stride;\n index2 *= attribute.stride;\n for(let i = 0, l = this.stride; i < l; i++)this.array[index1 + i] = attribute.array[index2 + i];\n return this;\n }\n set(value, offset = 0) {\n this.array.set(value, offset);\n return this;\n }\n clone(data) {\n if (data.arrayBuffers === undefined) data.arrayBuffers = {};\n if (this.array.buffer._uuid === undefined) this.array.buffer._uuid = $a315ee31802fb757$var$generateUUID();\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;\n const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);\n const ib = new this.constructor(array, this.stride);\n ib.setUsage(this.usage);\n return ib;\n }\n onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n toJSON(data) {\n if (data.arrayBuffers === undefined) data.arrayBuffers = {};\n // generate UUID for array buffer if necessary\n if (this.array.buffer._uuid === undefined) this.array.buffer._uuid = $a315ee31802fb757$var$generateUUID();\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));\n //\n return {\n uuid: this.uuid,\n buffer: this.array.buffer._uuid,\n type: this.array.constructor.name,\n stride: this.stride\n };\n }\n}\nconst $a315ee31802fb757$var$_vector$5 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$920b6d07334599c7 {\n constructor(interleavedBuffer, itemSize, offset, normalized = false){\n this.isInterleavedBufferAttribute = true;\n this.name = \"\";\n this.data = interleavedBuffer;\n this.itemSize = itemSize;\n this.offset = offset;\n this.normalized = normalized;\n }\n get count() {\n return this.data.count;\n }\n get array() {\n return this.data.array;\n }\n set needsUpdate(value) {\n this.data.needsUpdate = value;\n }\n applyMatrix4(m) {\n for(let i = 0, l = this.data.count; i < l; i++){\n $a315ee31802fb757$var$_vector$5.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$5.applyMatrix4(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$5.x, $a315ee31802fb757$var$_vector$5.y, $a315ee31802fb757$var$_vector$5.z);\n }\n return this;\n }\n applyNormalMatrix(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$5.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$5.applyNormalMatrix(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$5.x, $a315ee31802fb757$var$_vector$5.y, $a315ee31802fb757$var$_vector$5.z);\n }\n return this;\n }\n transformDirection(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $a315ee31802fb757$var$_vector$5.fromBufferAttribute(this, i);\n $a315ee31802fb757$var$_vector$5.transformDirection(m);\n this.setXYZ(i, $a315ee31802fb757$var$_vector$5.x, $a315ee31802fb757$var$_vector$5.y, $a315ee31802fb757$var$_vector$5.z);\n }\n return this;\n }\n setX(index, x) {\n if (this.normalized) x = $a315ee31802fb757$var$normalize(x, this.array);\n this.data.array[index * this.data.stride + this.offset] = x;\n return this;\n }\n setY(index, y) {\n if (this.normalized) y = $a315ee31802fb757$var$normalize(y, this.array);\n this.data.array[index * this.data.stride + this.offset + 1] = y;\n return this;\n }\n setZ(index, z) {\n if (this.normalized) z = $a315ee31802fb757$var$normalize(z, this.array);\n this.data.array[index * this.data.stride + this.offset + 2] = z;\n return this;\n }\n setW(index, w) {\n if (this.normalized) w = $a315ee31802fb757$var$normalize(w, this.array);\n this.data.array[index * this.data.stride + this.offset + 3] = w;\n return this;\n }\n getX(index) {\n let x = this.data.array[index * this.data.stride + this.offset];\n if (this.normalized) x = $a315ee31802fb757$var$denormalize(x, this.array);\n return x;\n }\n getY(index) {\n let y = this.data.array[index * this.data.stride + this.offset + 1];\n if (this.normalized) y = $a315ee31802fb757$var$denormalize(y, this.array);\n return y;\n }\n getZ(index) {\n let z = this.data.array[index * this.data.stride + this.offset + 2];\n if (this.normalized) z = $a315ee31802fb757$var$denormalize(z, this.array);\n return z;\n }\n getW(index) {\n let w = this.data.array[index * this.data.stride + this.offset + 3];\n if (this.normalized) w = $a315ee31802fb757$var$denormalize(w, this.array);\n return w;\n }\n setXY(index, x, y) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n return this;\n }\n setXYZ(index, x, y, z) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $a315ee31802fb757$var$normalize(x, this.array);\n y = $a315ee31802fb757$var$normalize(y, this.array);\n z = $a315ee31802fb757$var$normalize(z, this.array);\n w = $a315ee31802fb757$var$normalize(w, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n this.data.array[index + 3] = w;\n return this;\n }\n clone(data) {\n if (data === undefined) {\n console.log(\"THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.\");\n const array = [];\n for(let i = 0; i < this.count; i++){\n const index = i * this.data.stride + this.offset;\n for(let j = 0; j < this.itemSize; j++)array.push(this.data.array[index + j]);\n }\n return new $a315ee31802fb757$export$8dea267bd6bde117(new this.array.constructor(array), this.itemSize, this.normalized);\n } else {\n if (data.interleavedBuffers === undefined) data.interleavedBuffers = {};\n if (data.interleavedBuffers[this.data.uuid] === undefined) data.interleavedBuffers[this.data.uuid] = this.data.clone(data);\n return new $a315ee31802fb757$export$920b6d07334599c7(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);\n }\n }\n toJSON(data) {\n if (data === undefined) {\n console.log(\"THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.\");\n const array = [];\n for(let i = 0; i < this.count; i++){\n const index = i * this.data.stride + this.offset;\n for(let j = 0; j < this.itemSize; j++)array.push(this.data.array[index + j]);\n }\n // de-interleave data and save it as an ordinary buffer attribute for now\n return {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: array,\n normalized: this.normalized\n };\n } else {\n // save as true interleaved attribute\n if (data.interleavedBuffers === undefined) data.interleavedBuffers = {};\n if (data.interleavedBuffers[this.data.uuid] === undefined) data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);\n return {\n isInterleavedBufferAttribute: true,\n itemSize: this.itemSize,\n data: this.data.uuid,\n offset: this.offset,\n normalized: this.normalized\n };\n }\n }\n}\nclass $a315ee31802fb757$export$5ec7dd1c6994bf8e extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isSpriteMaterial = true;\n this.type = \"SpriteMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.alphaMap = null;\n this.rotation = 0;\n this.sizeAttenuation = true;\n this.transparent = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.rotation = source.rotation;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n}\nlet $a315ee31802fb757$var$_geometry;\nconst $a315ee31802fb757$var$_intersectPoint = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_worldScale = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_mvPosition = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_alignedPosition = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_rotatedPosition = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_viewWorldMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_vA = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vB = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_vC = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_uvA = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_uvB = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nconst $a315ee31802fb757$var$_uvC = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nclass $a315ee31802fb757$export$3075603db8e6204c extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(material){\n super();\n this.isSprite = true;\n this.type = \"Sprite\";\n if ($a315ee31802fb757$var$_geometry === undefined) {\n $a315ee31802fb757$var$_geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n const float32Array = new Float32Array([\n -0.5,\n -0.5,\n 0,\n 0,\n 0,\n 0.5,\n -0.5,\n 0,\n 1,\n 0,\n 0.5,\n 0.5,\n 0,\n 1,\n 1,\n -0.5,\n 0.5,\n 0,\n 0,\n 1\n ]);\n const interleavedBuffer = new $a315ee31802fb757$export$3d5cd879f108f53f(float32Array, 5);\n $a315ee31802fb757$var$_geometry.setIndex([\n 0,\n 1,\n 2,\n 0,\n 2,\n 3\n ]);\n $a315ee31802fb757$var$_geometry.setAttribute(\"position\", new $a315ee31802fb757$export$920b6d07334599c7(interleavedBuffer, 3, 0, false));\n $a315ee31802fb757$var$_geometry.setAttribute(\"uv\", new $a315ee31802fb757$export$920b6d07334599c7(interleavedBuffer, 2, 3, false));\n }\n this.geometry = $a315ee31802fb757$var$_geometry;\n this.material = material !== undefined ? material : new $a315ee31802fb757$export$5ec7dd1c6994bf8e();\n this.center = new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, 0.5);\n }\n raycast(raycaster, intersects) {\n if (raycaster.camera === null) console.error('THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.');\n $a315ee31802fb757$var$_worldScale.setFromMatrixScale(this.matrixWorld);\n $a315ee31802fb757$var$_viewWorldMatrix.copy(raycaster.camera.matrixWorld);\n this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld);\n $a315ee31802fb757$var$_mvPosition.setFromMatrixPosition(this.modelViewMatrix);\n if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) $a315ee31802fb757$var$_worldScale.multiplyScalar(-$a315ee31802fb757$var$_mvPosition.z);\n const rotation = this.material.rotation;\n let sin, cos;\n if (rotation !== 0) {\n cos = Math.cos(rotation);\n sin = Math.sin(rotation);\n }\n const center = this.center;\n $a315ee31802fb757$var$transformVertex($a315ee31802fb757$var$_vA.set(-0.5, -0.5, 0), $a315ee31802fb757$var$_mvPosition, center, $a315ee31802fb757$var$_worldScale, sin, cos);\n $a315ee31802fb757$var$transformVertex($a315ee31802fb757$var$_vB.set(0.5, -0.5, 0), $a315ee31802fb757$var$_mvPosition, center, $a315ee31802fb757$var$_worldScale, sin, cos);\n $a315ee31802fb757$var$transformVertex($a315ee31802fb757$var$_vC.set(0.5, 0.5, 0), $a315ee31802fb757$var$_mvPosition, center, $a315ee31802fb757$var$_worldScale, sin, cos);\n $a315ee31802fb757$var$_uvA.set(0, 0);\n $a315ee31802fb757$var$_uvB.set(1, 0);\n $a315ee31802fb757$var$_uvC.set(1, 1);\n // check first triangle\n let intersect = raycaster.ray.intersectTriangle($a315ee31802fb757$var$_vA, $a315ee31802fb757$var$_vB, $a315ee31802fb757$var$_vC, false, $a315ee31802fb757$var$_intersectPoint);\n if (intersect === null) {\n // check second triangle\n $a315ee31802fb757$var$transformVertex($a315ee31802fb757$var$_vB.set(-0.5, 0.5, 0), $a315ee31802fb757$var$_mvPosition, center, $a315ee31802fb757$var$_worldScale, sin, cos);\n $a315ee31802fb757$var$_uvB.set(0, 1);\n intersect = raycaster.ray.intersectTriangle($a315ee31802fb757$var$_vA, $a315ee31802fb757$var$_vC, $a315ee31802fb757$var$_vB, false, $a315ee31802fb757$var$_intersectPoint);\n if (intersect === null) return;\n }\n const distance = raycaster.ray.origin.distanceTo($a315ee31802fb757$var$_intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n point: $a315ee31802fb757$var$_intersectPoint.clone(),\n uv: $a315ee31802fb757$export$5a465592bfe74b48.getInterpolation($a315ee31802fb757$var$_intersectPoint, $a315ee31802fb757$var$_vA, $a315ee31802fb757$var$_vB, $a315ee31802fb757$var$_vC, $a315ee31802fb757$var$_uvA, $a315ee31802fb757$var$_uvB, $a315ee31802fb757$var$_uvC, new $a315ee31802fb757$export$c977b3e384af9ae1()),\n face: null,\n object: this\n });\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.center !== undefined) this.center.copy(source.center);\n this.material = source.material;\n return this;\n }\n}\nfunction $a315ee31802fb757$var$transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {\n // compute position in camera space\n $a315ee31802fb757$var$_alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale);\n // to check if rotation is not zero\n if (sin !== undefined) {\n $a315ee31802fb757$var$_rotatedPosition.x = cos * $a315ee31802fb757$var$_alignedPosition.x - sin * $a315ee31802fb757$var$_alignedPosition.y;\n $a315ee31802fb757$var$_rotatedPosition.y = sin * $a315ee31802fb757$var$_alignedPosition.x + cos * $a315ee31802fb757$var$_alignedPosition.y;\n } else $a315ee31802fb757$var$_rotatedPosition.copy($a315ee31802fb757$var$_alignedPosition);\n vertexPosition.copy(mvPosition);\n vertexPosition.x += $a315ee31802fb757$var$_rotatedPosition.x;\n vertexPosition.y += $a315ee31802fb757$var$_rotatedPosition.y;\n // transform to world space\n vertexPosition.applyMatrix4($a315ee31802fb757$var$_viewWorldMatrix);\n}\nconst $a315ee31802fb757$var$_v1$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v2$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$112e7237be0c5f30 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this._currentLevel = 0;\n this.type = \"LOD\";\n Object.defineProperties(this, {\n levels: {\n enumerable: true,\n value: []\n },\n isLOD: {\n value: true\n }\n });\n this.autoUpdate = true;\n }\n copy(source) {\n super.copy(source, false);\n const levels = source.levels;\n for(let i = 0, l = levels.length; i < l; i++){\n const level = levels[i];\n this.addLevel(level.object.clone(), level.distance, level.hysteresis);\n }\n this.autoUpdate = source.autoUpdate;\n return this;\n }\n addLevel(object, distance = 0, hysteresis = 0) {\n distance = Math.abs(distance);\n const levels = this.levels;\n let l;\n for(l = 0; l < levels.length; l++){\n if (distance < levels[l].distance) break;\n }\n levels.splice(l, 0, {\n distance: distance,\n hysteresis: hysteresis,\n object: object\n });\n this.add(object);\n return this;\n }\n getCurrentLevel() {\n return this._currentLevel;\n }\n getObjectForDistance(distance) {\n const levels = this.levels;\n if (levels.length > 0) {\n let i, l;\n for(i = 1, l = levels.length; i < l; i++){\n let levelDistance = levels[i].distance;\n if (levels[i].object.visible) levelDistance -= levelDistance * levels[i].hysteresis;\n if (distance < levelDistance) break;\n }\n return levels[i - 1].object;\n }\n return null;\n }\n raycast(raycaster, intersects) {\n const levels = this.levels;\n if (levels.length > 0) {\n $a315ee31802fb757$var$_v1$2.setFromMatrixPosition(this.matrixWorld);\n const distance = raycaster.ray.origin.distanceTo($a315ee31802fb757$var$_v1$2);\n this.getObjectForDistance(distance).raycast(raycaster, intersects);\n }\n }\n update(camera) {\n const levels = this.levels;\n if (levels.length > 1) {\n $a315ee31802fb757$var$_v1$2.setFromMatrixPosition(camera.matrixWorld);\n $a315ee31802fb757$var$_v2$1.setFromMatrixPosition(this.matrixWorld);\n const distance = $a315ee31802fb757$var$_v1$2.distanceTo($a315ee31802fb757$var$_v2$1) / camera.zoom;\n levels[0].object.visible = true;\n let i, l;\n for(i = 1, l = levels.length; i < l; i++){\n let levelDistance = levels[i].distance;\n if (levels[i].object.visible) levelDistance -= levelDistance * levels[i].hysteresis;\n if (distance >= levelDistance) {\n levels[i - 1].object.visible = false;\n levels[i].object.visible = true;\n } else break;\n }\n this._currentLevel = i - 1;\n for(; i < l; i++)levels[i].object.visible = false;\n }\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.autoUpdate === false) data.object.autoUpdate = false;\n data.object.levels = [];\n const levels = this.levels;\n for(let i = 0, l = levels.length; i < l; i++){\n const level = levels[i];\n data.object.levels.push({\n object: level.object.uuid,\n distance: level.distance,\n hysteresis: level.hysteresis\n });\n }\n return data;\n }\n}\nconst $a315ee31802fb757$var$_basePosition = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_skinIndex = /*@__PURE__*/ new $a315ee31802fb757$export$fa7daccca11cdbe3();\nconst $a315ee31802fb757$var$_skinWeight = /*@__PURE__*/ new $a315ee31802fb757$export$fa7daccca11cdbe3();\nconst $a315ee31802fb757$var$_vector3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_matrix4 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_vertex = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_sphere$3 = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nconst $a315ee31802fb757$var$_inverseMatrix$2 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_ray$2 = /*@__PURE__*/ new $a315ee31802fb757$export$a186db52eed6d40e();\nclass $a315ee31802fb757$export$b303577035157ecf extends $a315ee31802fb757$export$e176487c05830cc5 {\n constructor(geometry, material){\n super(geometry, material);\n this.isSkinnedMesh = true;\n this.type = \"SkinnedMesh\";\n this.bindMode = \"attached\";\n this.bindMatrix = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.bindMatrixInverse = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.boundingBox = null;\n this.boundingSphere = null;\n }\n computeBoundingBox() {\n const geometry = this.geometry;\n if (this.boundingBox === null) this.boundingBox = new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\n this.boundingBox.makeEmpty();\n const positionAttribute = geometry.getAttribute(\"position\");\n for(let i = 0; i < positionAttribute.count; i++){\n $a315ee31802fb757$var$_vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, $a315ee31802fb757$var$_vertex);\n this.boundingBox.expandByPoint($a315ee31802fb757$var$_vertex);\n }\n }\n computeBoundingSphere() {\n const geometry = this.geometry;\n if (this.boundingSphere === null) this.boundingSphere = new $a315ee31802fb757$export$805e8b72413ccaba();\n this.boundingSphere.makeEmpty();\n const positionAttribute = geometry.getAttribute(\"position\");\n for(let i = 0; i < positionAttribute.count; i++){\n $a315ee31802fb757$var$_vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, $a315ee31802fb757$var$_vertex);\n this.boundingSphere.expandByPoint($a315ee31802fb757$var$_vertex);\n }\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.bindMode = source.bindMode;\n this.bindMatrix.copy(source.bindMatrix);\n this.bindMatrixInverse.copy(source.bindMatrixInverse);\n this.skeleton = source.skeleton;\n if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();\n if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();\n return this;\n }\n raycast(raycaster, intersects) {\n const material = this.material;\n const matrixWorld = this.matrixWorld;\n if (material === undefined) return;\n // test with bounding sphere in world space\n if (this.boundingSphere === null) this.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$3.copy(this.boundingSphere);\n $a315ee31802fb757$var$_sphere$3.applyMatrix4(matrixWorld);\n if (raycaster.ray.intersectsSphere($a315ee31802fb757$var$_sphere$3) === false) return;\n // convert ray to local space of skinned mesh\n $a315ee31802fb757$var$_inverseMatrix$2.copy(matrixWorld).invert();\n $a315ee31802fb757$var$_ray$2.copy(raycaster.ray).applyMatrix4($a315ee31802fb757$var$_inverseMatrix$2);\n // test with bounding box in local space\n if (this.boundingBox !== null) {\n if ($a315ee31802fb757$var$_ray$2.intersectsBox(this.boundingBox) === false) return;\n }\n // test for intersections with geometry\n this._computeIntersections(raycaster, intersects, $a315ee31802fb757$var$_ray$2);\n }\n getVertexPosition(index, target) {\n super.getVertexPosition(index, target);\n this.applyBoneTransform(index, target);\n return target;\n }\n bind(skeleton, bindMatrix) {\n this.skeleton = skeleton;\n if (bindMatrix === undefined) {\n this.updateMatrixWorld(true);\n this.skeleton.calculateInverses();\n bindMatrix = this.matrixWorld;\n }\n this.bindMatrix.copy(bindMatrix);\n this.bindMatrixInverse.copy(bindMatrix).invert();\n }\n pose() {\n this.skeleton.pose();\n }\n normalizeSkinWeights() {\n const vector = new $a315ee31802fb757$export$fa7daccca11cdbe3();\n const skinWeight = this.geometry.attributes.skinWeight;\n for(let i = 0, l = skinWeight.count; i < l; i++){\n vector.fromBufferAttribute(skinWeight, i);\n const scale = 1.0 / vector.manhattanLength();\n if (scale !== Infinity) vector.multiplyScalar(scale);\n else vector.set(1, 0, 0, 0); // do something reasonable\n skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w);\n }\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.bindMode === \"attached\") this.bindMatrixInverse.copy(this.matrixWorld).invert();\n else if (this.bindMode === \"detached\") this.bindMatrixInverse.copy(this.bindMatrix).invert();\n else console.warn(\"THREE.SkinnedMesh: Unrecognized bindMode: \" + this.bindMode);\n }\n applyBoneTransform(index, vector) {\n const skeleton = this.skeleton;\n const geometry = this.geometry;\n $a315ee31802fb757$var$_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);\n $a315ee31802fb757$var$_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);\n $a315ee31802fb757$var$_basePosition.copy(vector).applyMatrix4(this.bindMatrix);\n vector.set(0, 0, 0);\n for(let i = 0; i < 4; i++){\n const weight = $a315ee31802fb757$var$_skinWeight.getComponent(i);\n if (weight !== 0) {\n const boneIndex = $a315ee31802fb757$var$_skinIndex.getComponent(i);\n $a315ee31802fb757$var$_matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);\n vector.addScaledVector($a315ee31802fb757$var$_vector3.copy($a315ee31802fb757$var$_basePosition).applyMatrix4($a315ee31802fb757$var$_matrix4), weight);\n }\n }\n return vector.applyMatrix4(this.bindMatrixInverse);\n }\n boneTransform(index, vector) {\n console.warn(\"THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.\");\n return this.applyBoneTransform(index, vector);\n }\n}\nclass $a315ee31802fb757$export$b127726e56765aa4 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isBone = true;\n this.type = \"Bone\";\n }\n}\nclass $a315ee31802fb757$export$b691f601014eabe1 extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0, minFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0, anisotropy, colorSpace1){\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isDataTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height\n };\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nconst $a315ee31802fb757$var$_offsetMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_identityMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nclass $a315ee31802fb757$export$8f31e4c4a37b8e9c {\n constructor(bones = [], boneInverses = []){\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.bones = bones.slice(0);\n this.boneInverses = boneInverses;\n this.boneMatrices = null;\n this.boneTexture = null;\n this.boneTextureSize = 0;\n this.init();\n }\n init() {\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n this.boneMatrices = new Float32Array(bones.length * 16);\n // calculate inverse bone matrices if necessary\n if (boneInverses.length === 0) this.calculateInverses();\n else // handle special case\n if (bones.length !== boneInverses.length) {\n console.warn(\"THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.\");\n this.boneInverses = [];\n for(let i = 0, il = this.bones.length; i < il; i++)this.boneInverses.push(new $a315ee31802fb757$export$2ae72fc923e5eb5());\n }\n }\n calculateInverses() {\n this.boneInverses.length = 0;\n for(let i = 0, il = this.bones.length; i < il; i++){\n const inverse = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n if (this.bones[i]) inverse.copy(this.bones[i].matrixWorld).invert();\n this.boneInverses.push(inverse);\n }\n }\n pose() {\n // recover the bind-time world matrices\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone) bone.matrixWorld.copy(this.boneInverses[i]).invert();\n }\n // compute the local matrices, positions, rotations and scales\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone) {\n if (bone.parent && bone.parent.isBone) {\n bone.matrix.copy(bone.parent.matrixWorld).invert();\n bone.matrix.multiply(bone.matrixWorld);\n } else bone.matrix.copy(bone.matrixWorld);\n bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);\n }\n }\n }\n update() {\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n const boneMatrices = this.boneMatrices;\n const boneTexture = this.boneTexture;\n // flatten bone matrices to array\n for(let i = 0, il = bones.length; i < il; i++){\n // compute the offset between the current and the original transform\n const matrix = bones[i] ? bones[i].matrixWorld : $a315ee31802fb757$var$_identityMatrix;\n $a315ee31802fb757$var$_offsetMatrix.multiplyMatrices(matrix, boneInverses[i]);\n $a315ee31802fb757$var$_offsetMatrix.toArray(boneMatrices, i * 16);\n }\n if (boneTexture !== null) boneTexture.needsUpdate = true;\n }\n clone() {\n return new $a315ee31802fb757$export$8f31e4c4a37b8e9c(this.bones, this.boneInverses);\n }\n computeBoneTexture() {\n // layout (1 matrix = 4 pixels)\n // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix\n size = $a315ee31802fb757$var$ceilPowerOfTwo(size);\n size = Math.max(size, 4);\n const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel\n boneMatrices.set(this.boneMatrices); // copy current values\n const boneTexture = new $a315ee31802fb757$export$b691f601014eabe1(boneMatrices, size, size, $a315ee31802fb757$export$3f8bb04b555a363c, $a315ee31802fb757$export$f6d331659b644596);\n boneTexture.needsUpdate = true;\n this.boneMatrices = boneMatrices;\n this.boneTexture = boneTexture;\n this.boneTextureSize = size;\n return this;\n }\n getBoneByName(name) {\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone.name === name) return bone;\n }\n return undefined;\n }\n dispose() {\n if (this.boneTexture !== null) {\n this.boneTexture.dispose();\n this.boneTexture = null;\n }\n }\n fromJSON(json, bones) {\n this.uuid = json.uuid;\n for(let i = 0, l = json.bones.length; i < l; i++){\n const uuid = json.bones[i];\n let bone = bones[uuid];\n if (bone === undefined) {\n console.warn(\"THREE.Skeleton: No bone found with UUID:\", uuid);\n bone = new $a315ee31802fb757$export$b127726e56765aa4();\n }\n this.bones.push(bone);\n this.boneInverses.push(new $a315ee31802fb757$export$2ae72fc923e5eb5().fromArray(json.boneInverses[i]));\n }\n this.init();\n return this;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"Skeleton\",\n generator: \"Skeleton.toJSON\"\n },\n bones: [],\n boneInverses: []\n };\n data.uuid = this.uuid;\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n for(let i = 0, l = bones.length; i < l; i++){\n const bone = bones[i];\n data.bones.push(bone.uuid);\n const boneInverse = boneInverses[i];\n data.boneInverses.push(boneInverse.toArray());\n }\n return data;\n }\n}\nclass $a315ee31802fb757$export$32ea87a8b54d744a extends $a315ee31802fb757$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized, meshPerAttribute = 1){\n super(array, itemSize, normalized);\n this.isInstancedBufferAttribute = true;\n this.meshPerAttribute = meshPerAttribute;\n }\n copy(source) {\n super.copy(source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.meshPerAttribute = this.meshPerAttribute;\n data.isInstancedBufferAttribute = true;\n return data;\n }\n}\nconst $a315ee31802fb757$var$_instanceLocalMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_instanceWorldMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_instanceIntersects = [];\nconst $a315ee31802fb757$var$_box3 = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\nconst $a315ee31802fb757$var$_identity = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_mesh = /*@__PURE__*/ new $a315ee31802fb757$export$e176487c05830cc5();\nconst $a315ee31802fb757$var$_sphere$2 = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nclass $a315ee31802fb757$export$f3c979c331175ad7 extends $a315ee31802fb757$export$e176487c05830cc5 {\n constructor(geometry, material, count){\n super(geometry, material);\n this.isInstancedMesh = true;\n this.instanceMatrix = new $a315ee31802fb757$export$32ea87a8b54d744a(new Float32Array(count * 16), 16);\n this.instanceColor = null;\n this.count = count;\n this.boundingBox = null;\n this.boundingSphere = null;\n for(let i = 0; i < count; i++)this.setMatrixAt(i, $a315ee31802fb757$var$_identity);\n }\n computeBoundingBox() {\n const geometry = this.geometry;\n const count = this.count;\n if (this.boundingBox === null) this.boundingBox = new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\n if (geometry.boundingBox === null) geometry.computeBoundingBox();\n this.boundingBox.makeEmpty();\n for(let i = 0; i < count; i++){\n this.getMatrixAt(i, $a315ee31802fb757$var$_instanceLocalMatrix);\n $a315ee31802fb757$var$_box3.copy(geometry.boundingBox).applyMatrix4($a315ee31802fb757$var$_instanceLocalMatrix);\n this.boundingBox.union($a315ee31802fb757$var$_box3);\n }\n }\n computeBoundingSphere() {\n const geometry = this.geometry;\n const count = this.count;\n if (this.boundingSphere === null) this.boundingSphere = new $a315ee31802fb757$export$805e8b72413ccaba();\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n this.boundingSphere.makeEmpty();\n for(let i = 0; i < count; i++){\n this.getMatrixAt(i, $a315ee31802fb757$var$_instanceLocalMatrix);\n $a315ee31802fb757$var$_sphere$2.copy(geometry.boundingSphere).applyMatrix4($a315ee31802fb757$var$_instanceLocalMatrix);\n this.boundingSphere.union($a315ee31802fb757$var$_sphere$2);\n }\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.instanceMatrix.copy(source.instanceMatrix);\n if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();\n this.count = source.count;\n if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();\n if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();\n return this;\n }\n getColorAt(index, color) {\n color.fromArray(this.instanceColor.array, index * 3);\n }\n getMatrixAt(index, matrix) {\n matrix.fromArray(this.instanceMatrix.array, index * 16);\n }\n raycast(raycaster, intersects) {\n const matrixWorld = this.matrixWorld;\n const raycastTimes = this.count;\n $a315ee31802fb757$var$_mesh.geometry = this.geometry;\n $a315ee31802fb757$var$_mesh.material = this.material;\n if ($a315ee31802fb757$var$_mesh.material === undefined) return;\n // test with bounding sphere first\n if (this.boundingSphere === null) this.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$2.copy(this.boundingSphere);\n $a315ee31802fb757$var$_sphere$2.applyMatrix4(matrixWorld);\n if (raycaster.ray.intersectsSphere($a315ee31802fb757$var$_sphere$2) === false) return;\n // now test each instance\n for(let instanceId = 0; instanceId < raycastTimes; instanceId++){\n // calculate the world matrix for each instance\n this.getMatrixAt(instanceId, $a315ee31802fb757$var$_instanceLocalMatrix);\n $a315ee31802fb757$var$_instanceWorldMatrix.multiplyMatrices(matrixWorld, $a315ee31802fb757$var$_instanceLocalMatrix);\n // the mesh represents this single instance\n $a315ee31802fb757$var$_mesh.matrixWorld = $a315ee31802fb757$var$_instanceWorldMatrix;\n $a315ee31802fb757$var$_mesh.raycast(raycaster, $a315ee31802fb757$var$_instanceIntersects);\n // process the result of raycast\n for(let i = 0, l = $a315ee31802fb757$var$_instanceIntersects.length; i < l; i++){\n const intersect = $a315ee31802fb757$var$_instanceIntersects[i];\n intersect.instanceId = instanceId;\n intersect.object = this;\n intersects.push(intersect);\n }\n $a315ee31802fb757$var$_instanceIntersects.length = 0;\n }\n }\n setColorAt(index, color) {\n if (this.instanceColor === null) this.instanceColor = new $a315ee31802fb757$export$32ea87a8b54d744a(new Float32Array(this.instanceMatrix.count * 3), 3);\n color.toArray(this.instanceColor.array, index * 3);\n }\n setMatrixAt(index, matrix) {\n matrix.toArray(this.instanceMatrix.array, index * 16);\n }\n updateMorphTargets() {}\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nclass $a315ee31802fb757$export$fbaaa33907730a0c extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isLineBasicMaterial = true;\n this.type = \"LineBasicMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.linewidth = 1;\n this.linecap = \"round\";\n this.linejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.linewidth = source.linewidth;\n this.linecap = source.linecap;\n this.linejoin = source.linejoin;\n this.fog = source.fog;\n return this;\n }\n}\nconst $a315ee31802fb757$var$_start$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_end$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_inverseMatrix$1 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_ray$1 = /*@__PURE__*/ new $a315ee31802fb757$export$a186db52eed6d40e();\nconst $a315ee31802fb757$var$_sphere$1 = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nclass $a315ee31802fb757$export$17d680238e50603e extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(geometry = new $a315ee31802fb757$export$b7be63a67df8959(), material = new $a315ee31802fb757$export$fbaaa33907730a0c()){\n super();\n this.isLine = true;\n this.type = \"Line\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n computeLineDistances() {\n const geometry = this.geometry;\n // we assume non-indexed geometry\n if (geometry.index === null) {\n const positionAttribute = geometry.attributes.position;\n const lineDistances = [\n 0\n ];\n for(let i = 1, l = positionAttribute.count; i < l; i++){\n $a315ee31802fb757$var$_start$1.fromBufferAttribute(positionAttribute, i - 1);\n $a315ee31802fb757$var$_end$1.fromBufferAttribute(positionAttribute, i);\n lineDistances[i] = lineDistances[i - 1];\n lineDistances[i] += $a315ee31802fb757$var$_start$1.distanceTo($a315ee31802fb757$var$_end$1);\n }\n geometry.setAttribute(\"lineDistance\", new $a315ee31802fb757$export$cbe7a62641830ebd(lineDistances, 1));\n } else console.warn(\"THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const matrixWorld = this.matrixWorld;\n const threshold = raycaster.params.Line.threshold;\n const drawRange = geometry.drawRange;\n // Checking boundingSphere distance to ray\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere$1.copy(geometry.boundingSphere);\n $a315ee31802fb757$var$_sphere$1.applyMatrix4(matrixWorld);\n $a315ee31802fb757$var$_sphere$1.radius += threshold;\n if (raycaster.ray.intersectsSphere($a315ee31802fb757$var$_sphere$1) === false) return;\n //\n $a315ee31802fb757$var$_inverseMatrix$1.copy(matrixWorld).invert();\n $a315ee31802fb757$var$_ray$1.copy(raycaster.ray).applyMatrix4($a315ee31802fb757$var$_inverseMatrix$1);\n const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n const localThresholdSq = localThreshold * localThreshold;\n const vStart = new $a315ee31802fb757$export$64b5c384219d3699();\n const vEnd = new $a315ee31802fb757$export$64b5c384219d3699();\n const interSegment = new $a315ee31802fb757$export$64b5c384219d3699();\n const interRay = new $a315ee31802fb757$export$64b5c384219d3699();\n const step = this.isLineSegments ? 2 : 1;\n const index = geometry.index;\n const attributes = geometry.attributes;\n const positionAttribute = attributes.position;\n if (index !== null) {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, l = end - 1; i < l; i += step){\n const a = index.getX(i);\n const b = index.getX(i + 1);\n vStart.fromBufferAttribute(positionAttribute, a);\n vEnd.fromBufferAttribute(positionAttribute, b);\n const distSq = $a315ee31802fb757$var$_ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n const distance = raycaster.ray.origin.distanceTo(interRay);\n if (distance < raycaster.near || distance > raycaster.far) continue;\n intersects.push({\n distance: distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: i,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n } else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for(let i = start, l = end - 1; i < l; i += step){\n vStart.fromBufferAttribute(positionAttribute, i);\n vEnd.fromBufferAttribute(positionAttribute, i + 1);\n const distSq = $a315ee31802fb757$var$_ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n const distance = raycaster.ray.origin.distanceTo(interRay);\n if (distance < raycaster.near || distance > raycaster.far) continue;\n intersects.push({\n distance: distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: i,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n }\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n}\nconst $a315ee31802fb757$var$_start = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_end = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$ff1ed10fedfdd604 extends $a315ee31802fb757$export$17d680238e50603e {\n constructor(geometry, material){\n super(geometry, material);\n this.isLineSegments = true;\n this.type = \"LineSegments\";\n }\n computeLineDistances() {\n const geometry = this.geometry;\n // we assume non-indexed geometry\n if (geometry.index === null) {\n const positionAttribute = geometry.attributes.position;\n const lineDistances = [];\n for(let i = 0, l = positionAttribute.count; i < l; i += 2){\n $a315ee31802fb757$var$_start.fromBufferAttribute(positionAttribute, i);\n $a315ee31802fb757$var$_end.fromBufferAttribute(positionAttribute, i + 1);\n lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1];\n lineDistances[i + 1] = lineDistances[i] + $a315ee31802fb757$var$_start.distanceTo($a315ee31802fb757$var$_end);\n }\n geometry.setAttribute(\"lineDistance\", new $a315ee31802fb757$export$cbe7a62641830ebd(lineDistances, 1));\n } else console.warn(\"THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n}\nclass $a315ee31802fb757$export$f85a24d745e4f17d extends $a315ee31802fb757$export$17d680238e50603e {\n constructor(geometry, material){\n super(geometry, material);\n this.isLineLoop = true;\n this.type = \"LineLoop\";\n }\n}\nclass $a315ee31802fb757$export$a178c45366ce5d6b extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isPointsMaterial = true;\n this.type = \"PointsMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.alphaMap = null;\n this.size = 1;\n this.sizeAttenuation = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.size = source.size;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n}\nconst $a315ee31802fb757$var$_inverseMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_ray = /*@__PURE__*/ new $a315ee31802fb757$export$a186db52eed6d40e();\nconst $a315ee31802fb757$var$_sphere = /*@__PURE__*/ new $a315ee31802fb757$export$805e8b72413ccaba();\nconst $a315ee31802fb757$var$_position$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$1c787534cb11aa3e extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(geometry = new $a315ee31802fb757$export$b7be63a67df8959(), material = new $a315ee31802fb757$export$a178c45366ce5d6b()){\n super();\n this.isPoints = true;\n this.type = \"Points\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const matrixWorld = this.matrixWorld;\n const threshold = raycaster.params.Points.threshold;\n const drawRange = geometry.drawRange;\n // Checking boundingSphere distance to ray\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $a315ee31802fb757$var$_sphere.copy(geometry.boundingSphere);\n $a315ee31802fb757$var$_sphere.applyMatrix4(matrixWorld);\n $a315ee31802fb757$var$_sphere.radius += threshold;\n if (raycaster.ray.intersectsSphere($a315ee31802fb757$var$_sphere) === false) return;\n //\n $a315ee31802fb757$var$_inverseMatrix.copy(matrixWorld).invert();\n $a315ee31802fb757$var$_ray.copy(raycaster.ray).applyMatrix4($a315ee31802fb757$var$_inverseMatrix);\n const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n const localThresholdSq = localThreshold * localThreshold;\n const index = geometry.index;\n const attributes = geometry.attributes;\n const positionAttribute = attributes.position;\n if (index !== null) {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i++){\n const a = index.getX(i);\n $a315ee31802fb757$var$_position$2.fromBufferAttribute(positionAttribute, a);\n $a315ee31802fb757$var$testPoint($a315ee31802fb757$var$_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n } else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for(let i = start, l = end; i < l; i++){\n $a315ee31802fb757$var$_position$2.fromBufferAttribute(positionAttribute, i);\n $a315ee31802fb757$var$testPoint($a315ee31802fb757$var$_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n }\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n}\nfunction $a315ee31802fb757$var$testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) {\n const rayPointDistanceSq = $a315ee31802fb757$var$_ray.distanceSqToPoint(point);\n if (rayPointDistanceSq < localThresholdSq) {\n const intersectPoint = new $a315ee31802fb757$export$64b5c384219d3699();\n $a315ee31802fb757$var$_ray.closestPointToPoint(point, intersectPoint);\n intersectPoint.applyMatrix4(matrixWorld);\n const distance = raycaster.ray.origin.distanceTo(intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n distanceToRay: Math.sqrt(rayPointDistanceSq),\n point: intersectPoint,\n index: index,\n face: null,\n object: object\n });\n }\n}\nclass $a315ee31802fb757$export$6e09d1edf8d5a25c extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy){\n super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isVideoTexture = true;\n this.minFilter = minFilter !== undefined ? minFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n this.magFilter = magFilter !== undefined ? magFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n this.generateMipmaps = false;\n const scope = this;\n function updateVideo() {\n scope.needsUpdate = true;\n video.requestVideoFrameCallback(updateVideo);\n }\n if (\"requestVideoFrameCallback\" in video) video.requestVideoFrameCallback(updateVideo);\n }\n clone() {\n return new this.constructor(this.image).copy(this);\n }\n update() {\n const video = this.image;\n const hasVideoFrameCallback = \"requestVideoFrameCallback\" in video;\n if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) this.needsUpdate = true;\n }\n}\nclass $a315ee31802fb757$export$9270d786f73ce6fe extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(width, height){\n super({\n width: width,\n height: height\n });\n this.isFramebufferTexture = true;\n this.magFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.minFilter = $a315ee31802fb757$export$727aa5ec3fe39bf0;\n this.generateMipmaps = false;\n this.needsUpdate = true;\n }\n}\nclass $a315ee31802fb757$export$3466bac9141a5cc4 extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace1){\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isCompressedTexture = true;\n this.image = {\n width: width,\n height: height\n };\n this.mipmaps = mipmaps;\n // no flipping for cube textures\n // (also flipping doesn't work for compressed textures )\n this.flipY = false;\n // can't generate mipmaps for compressed textures\n // mips must be embedded in DDS files\n this.generateMipmaps = false;\n }\n}\nclass $a315ee31802fb757$export$5fe6b8e34b274fcb extends $a315ee31802fb757$export$3466bac9141a5cc4 {\n constructor(mipmaps, width, height, depth, format, type){\n super(mipmaps, width, height, format, type);\n this.isCompressedArrayTexture = true;\n this.image.depth = depth;\n this.wrapR = $a315ee31802fb757$export$9d9334239a5a5e06;\n }\n}\nclass $a315ee31802fb757$export$d80173634de65bff extends $a315ee31802fb757$export$3466bac9141a5cc4 {\n constructor(images, format, type){\n super(undefined, images[0].width, images[0].height, format, type, $a315ee31802fb757$export$8759762a6477f2c4);\n this.isCompressedCubeTexture = true;\n this.isCubeTexture = true;\n this.image = images;\n }\n}\nclass $a315ee31802fb757$export$f7189e49152d1c13 extends $a315ee31802fb757$export$5431306cf43de24a {\n constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy){\n super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isCanvasTexture = true;\n this.needsUpdate = true;\n }\n}\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/ class $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(){\n this.type = \"Curve\";\n this.arcLengthDivisions = 200;\n }\n // Virtual base class method to overwrite and implement in subclasses\n //\t- t [0 .. 1]\n getPoint() {\n console.warn(\"THREE.Curve: .getPoint() not implemented.\");\n return null;\n }\n // Get point at relative position in curve according to arc length\n // - u [0 .. 1]\n getPointAt(u, optionalTarget) {\n const t = this.getUtoTmapping(u);\n return this.getPoint(t, optionalTarget);\n }\n // Get sequence of points using getPoint( t )\n getPoints(divisions = 5) {\n const points = [];\n for(let d = 0; d <= divisions; d++)points.push(this.getPoint(d / divisions));\n return points;\n }\n // Get sequence of points using getPointAt( u )\n getSpacedPoints(divisions = 5) {\n const points = [];\n for(let d = 0; d <= divisions; d++)points.push(this.getPointAt(d / divisions));\n return points;\n }\n // Get total curve arc length\n getLength() {\n const lengths = this.getLengths();\n return lengths[lengths.length - 1];\n }\n // Get list of cumulative segment lengths\n getLengths(divisions = this.arcLengthDivisions) {\n if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) return this.cacheArcLengths;\n this.needsUpdate = false;\n const cache = [];\n let current, last = this.getPoint(0);\n let sum = 0;\n cache.push(0);\n for(let p = 1; p <= divisions; p++){\n current = this.getPoint(p / divisions);\n sum += current.distanceTo(last);\n cache.push(sum);\n last = current;\n }\n this.cacheArcLengths = cache;\n return cache; // { sums: cache, sum: sum }; Sum is in the last element.\n }\n updateArcLengths() {\n this.needsUpdate = true;\n this.getLengths();\n }\n // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n getUtoTmapping(u, distance) {\n const arcLengths = this.getLengths();\n let i = 0;\n const il = arcLengths.length;\n let targetArcLength; // The targeted u distance value to get\n if (distance) targetArcLength = distance;\n else targetArcLength = u * arcLengths[il - 1];\n // binary search for the index with largest value smaller than target u distance\n let low = 0, high = il - 1, comparison;\n while(low <= high){\n i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n comparison = arcLengths[i] - targetArcLength;\n if (comparison < 0) low = i + 1;\n else if (comparison > 0) high = i - 1;\n else {\n high = i;\n break;\n // DONE\n }\n }\n i = high;\n if (arcLengths[i] === targetArcLength) return i / (il - 1);\n // we could get finer grain at lengths, or use simple interpolation between two points\n const lengthBefore = arcLengths[i];\n const lengthAfter = arcLengths[i + 1];\n const segmentLength = lengthAfter - lengthBefore;\n // determine where we are between the 'before' and 'after' points\n const segmentFraction = (targetArcLength - lengthBefore) / segmentLength;\n // add that fractional amount to t\n const t = (i + segmentFraction) / (il - 1);\n return t;\n }\n // Returns a unit vector tangent at t\n // In case any sub curve does not implement its tangent derivation,\n // 2 points a small delta apart will be used to find its gradient\n // which seems to give a reasonable approximation\n getTangent(t, optionalTarget) {\n const delta = 0.0001;\n let t1 = t - delta;\n let t2 = t + delta;\n // Capping in case of danger\n if (t1 < 0) t1 = 0;\n if (t2 > 1) t2 = 1;\n const pt1 = this.getPoint(t1);\n const pt2 = this.getPoint(t2);\n const tangent = optionalTarget || (pt1.isVector2 ? new $a315ee31802fb757$export$c977b3e384af9ae1() : new $a315ee31802fb757$export$64b5c384219d3699());\n tangent.copy(pt2).sub(pt1).normalize();\n return tangent;\n }\n getTangentAt(u, optionalTarget) {\n const t = this.getUtoTmapping(u);\n return this.getTangent(t, optionalTarget);\n }\n computeFrenetFrames(segments, closed) {\n // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n const tangents = [];\n const normals = [];\n const binormals = [];\n const vec = new $a315ee31802fb757$export$64b5c384219d3699();\n const mat = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n // compute the tangent vectors for each segment on the curve\n for(let i = 0; i <= segments; i++){\n const u = i / segments;\n tangents[i] = this.getTangentAt(u, new $a315ee31802fb757$export$64b5c384219d3699());\n }\n // select an initial normal vector perpendicular to the first tangent vector,\n // and in the direction of the minimum tangent xyz component\n normals[0] = new $a315ee31802fb757$export$64b5c384219d3699();\n binormals[0] = new $a315ee31802fb757$export$64b5c384219d3699();\n let min = Number.MAX_VALUE;\n const tx = Math.abs(tangents[0].x);\n const ty = Math.abs(tangents[0].y);\n const tz = Math.abs(tangents[0].z);\n if (tx <= min) {\n min = tx;\n normal.set(1, 0, 0);\n }\n if (ty <= min) {\n min = ty;\n normal.set(0, 1, 0);\n }\n if (tz <= min) normal.set(0, 0, 1);\n vec.crossVectors(tangents[0], normal).normalize();\n normals[0].crossVectors(tangents[0], vec);\n binormals[0].crossVectors(tangents[0], normals[0]);\n // compute the slowly-varying normal and binormal vectors for each segment on the curve\n for(let i = 1; i <= segments; i++){\n normals[i] = normals[i - 1].clone();\n binormals[i] = binormals[i - 1].clone();\n vec.crossVectors(tangents[i - 1], tangents[i]);\n if (vec.length() > Number.EPSILON) {\n vec.normalize();\n const theta = Math.acos($a315ee31802fb757$var$clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors\n normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta));\n }\n binormals[i].crossVectors(tangents[i], normals[i]);\n }\n // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n if (closed === true) {\n let theta = Math.acos($a315ee31802fb757$var$clamp(normals[0].dot(normals[segments]), -1, 1));\n theta /= segments;\n if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) theta = -theta;\n for(let i = 1; i <= segments; i++){\n // twist a little...\n normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i));\n binormals[i].crossVectors(tangents[i], normals[i]);\n }\n }\n return {\n tangents: tangents,\n normals: normals,\n binormals: binormals\n };\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.arcLengthDivisions = source.arcLengthDivisions;\n return this;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"Curve\",\n generator: \"Curve.toJSON\"\n }\n };\n data.arcLengthDivisions = this.arcLengthDivisions;\n data.type = this.type;\n return data;\n }\n fromJSON(json) {\n this.arcLengthDivisions = json.arcLengthDivisions;\n return this;\n }\n}\nclass $a315ee31802fb757$export$3f87a931616cde04 extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0){\n super();\n this.isEllipseCurve = true;\n this.type = \"EllipseCurve\";\n this.aX = aX;\n this.aY = aY;\n this.xRadius = xRadius;\n this.yRadius = yRadius;\n this.aStartAngle = aStartAngle;\n this.aEndAngle = aEndAngle;\n this.aClockwise = aClockwise;\n this.aRotation = aRotation;\n }\n getPoint(t, optionalTarget) {\n const point = optionalTarget || new $a315ee31802fb757$export$c977b3e384af9ae1();\n const twoPi = Math.PI * 2;\n let deltaAngle = this.aEndAngle - this.aStartAngle;\n const samePoints = Math.abs(deltaAngle) < Number.EPSILON;\n // ensures that deltaAngle is 0 .. 2 PI\n while(deltaAngle < 0)deltaAngle += twoPi;\n while(deltaAngle > twoPi)deltaAngle -= twoPi;\n if (deltaAngle < Number.EPSILON) {\n if (samePoints) deltaAngle = 0;\n else deltaAngle = twoPi;\n }\n if (this.aClockwise === true && !samePoints) {\n if (deltaAngle === twoPi) deltaAngle = -twoPi;\n else deltaAngle = deltaAngle - twoPi;\n }\n const angle = this.aStartAngle + t * deltaAngle;\n let x = this.aX + this.xRadius * Math.cos(angle);\n let y = this.aY + this.yRadius * Math.sin(angle);\n if (this.aRotation !== 0) {\n const cos = Math.cos(this.aRotation);\n const sin = Math.sin(this.aRotation);\n const tx = x - this.aX;\n const ty = y - this.aY;\n // Rotate the point about the center of the ellipse.\n x = tx * cos - ty * sin + this.aX;\n y = tx * sin + ty * cos + this.aY;\n }\n return point.set(x, y);\n }\n copy(source) {\n super.copy(source);\n this.aX = source.aX;\n this.aY = source.aY;\n this.xRadius = source.xRadius;\n this.yRadius = source.yRadius;\n this.aStartAngle = source.aStartAngle;\n this.aEndAngle = source.aEndAngle;\n this.aClockwise = source.aClockwise;\n this.aRotation = source.aRotation;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.aX = this.aX;\n data.aY = this.aY;\n data.xRadius = this.xRadius;\n data.yRadius = this.yRadius;\n data.aStartAngle = this.aStartAngle;\n data.aEndAngle = this.aEndAngle;\n data.aClockwise = this.aClockwise;\n data.aRotation = this.aRotation;\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.aX = json.aX;\n this.aY = json.aY;\n this.xRadius = json.xRadius;\n this.yRadius = json.yRadius;\n this.aStartAngle = json.aStartAngle;\n this.aEndAngle = json.aEndAngle;\n this.aClockwise = json.aClockwise;\n this.aRotation = json.aRotation;\n return this;\n }\n}\nclass $a315ee31802fb757$export$b1eedc9aab6300e8 extends $a315ee31802fb757$export$3f87a931616cde04 {\n constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise){\n super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n this.isArcCurve = true;\n this.type = \"ArcCurve\";\n }\n}\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */ /*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/ function $a315ee31802fb757$var$CubicPoly() {\n let c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n /*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */ function init(x0, x1, t0, t1) {\n c0 = x0;\n c1 = t0;\n c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;\n c3 = 2 * x0 - 2 * x1 + t0 + t1;\n }\n return {\n initCatmullRom: function(x0, x1, x2, x3, tension) {\n init(x1, x2, tension * (x2 - x0), tension * (x3 - x1));\n },\n initNonuniformCatmullRom: function(x0, x1, x2, x3, dt0, dt1, dt2) {\n // compute tangents when parameterized in [t1,t2]\n let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;\n let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2;\n // rescale tangents for parametrization in [0,1]\n t1 *= dt1;\n t2 *= dt1;\n init(x1, x2, t1, t2);\n },\n calc: function(t) {\n const t2 = t * t;\n const t3 = t2 * t;\n return c0 + c1 * t + c2 * t2 + c3 * t3;\n }\n };\n}\n//\nconst $a315ee31802fb757$var$tmp = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$px = /*@__PURE__*/ new $a315ee31802fb757$var$CubicPoly();\nconst $a315ee31802fb757$var$py = /*@__PURE__*/ new $a315ee31802fb757$var$CubicPoly();\nconst $a315ee31802fb757$var$pz = /*@__PURE__*/ new $a315ee31802fb757$var$CubicPoly();\nclass $a315ee31802fb757$export$b9146b27c24b744c extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(points = [], closed = false, curveType = \"centripetal\", tension = 0.5){\n super();\n this.isCatmullRomCurve3 = true;\n this.type = \"CatmullRomCurve3\";\n this.points = points;\n this.closed = closed;\n this.curveType = curveType;\n this.tension = tension;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const points = this.points;\n const l = points.length;\n const p = (l - (this.closed ? 0 : 1)) * t;\n let intPoint = Math.floor(p);\n let weight = p - intPoint;\n if (this.closed) intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l;\n else if (weight === 0 && intPoint === l - 1) {\n intPoint = l - 2;\n weight = 1;\n }\n let p0, p3; // 4 points (p1 & p2 defined below)\n if (this.closed || intPoint > 0) p0 = points[(intPoint - 1) % l];\n else {\n // extrapolate first point\n $a315ee31802fb757$var$tmp.subVectors(points[0], points[1]).add(points[0]);\n p0 = $a315ee31802fb757$var$tmp;\n }\n const p1 = points[intPoint % l];\n const p2 = points[(intPoint + 1) % l];\n if (this.closed || intPoint + 2 < l) p3 = points[(intPoint + 2) % l];\n else {\n // extrapolate last point\n $a315ee31802fb757$var$tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]);\n p3 = $a315ee31802fb757$var$tmp;\n }\n if (this.curveType === \"centripetal\" || this.curveType === \"chordal\") {\n // init Centripetal / Chordal Catmull-Rom\n const pow = this.curveType === \"chordal\" ? 0.5 : 0.25;\n let dt0 = Math.pow(p0.distanceToSquared(p1), pow);\n let dt1 = Math.pow(p1.distanceToSquared(p2), pow);\n let dt2 = Math.pow(p2.distanceToSquared(p3), pow);\n // safety check for repeated points\n if (dt1 < 1e-4) dt1 = 1.0;\n if (dt0 < 1e-4) dt0 = dt1;\n if (dt2 < 1e-4) dt2 = dt1;\n $a315ee31802fb757$var$px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2);\n $a315ee31802fb757$var$py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2);\n $a315ee31802fb757$var$pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2);\n } else if (this.curveType === \"catmullrom\") {\n $a315ee31802fb757$var$px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension);\n $a315ee31802fb757$var$py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension);\n $a315ee31802fb757$var$pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension);\n }\n point.set($a315ee31802fb757$var$px.calc(weight), $a315ee31802fb757$var$py.calc(weight), $a315ee31802fb757$var$pz.calc(weight));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.points = [];\n for(let i = 0, l = source.points.length; i < l; i++){\n const point = source.points[i];\n this.points.push(point.clone());\n }\n this.closed = source.closed;\n this.curveType = source.curveType;\n this.tension = source.tension;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.points = [];\n for(let i = 0, l = this.points.length; i < l; i++){\n const point = this.points[i];\n data.points.push(point.toArray());\n }\n data.closed = this.closed;\n data.curveType = this.curveType;\n data.tension = this.tension;\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.points = [];\n for(let i = 0, l = json.points.length; i < l; i++){\n const point = json.points[i];\n this.points.push(new $a315ee31802fb757$export$64b5c384219d3699().fromArray(point));\n }\n this.closed = json.closed;\n this.curveType = json.curveType;\n this.tension = json.tension;\n return this;\n }\n}\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */ function $a315ee31802fb757$var$CatmullRom(t, p0, p1, p2, p3) {\n const v0 = (p2 - p0) * 0.5;\n const v1 = (p3 - p1) * 0.5;\n const t2 = t * t;\n const t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n}\n//\nfunction $a315ee31802fb757$var$QuadraticBezierP0(t, p) {\n const k = 1 - t;\n return k * k * p;\n}\nfunction $a315ee31802fb757$var$QuadraticBezierP1(t, p) {\n return 2 * (1 - t) * t * p;\n}\nfunction $a315ee31802fb757$var$QuadraticBezierP2(t, p) {\n return t * t * p;\n}\nfunction $a315ee31802fb757$var$QuadraticBezier(t, p0, p1, p2) {\n return $a315ee31802fb757$var$QuadraticBezierP0(t, p0) + $a315ee31802fb757$var$QuadraticBezierP1(t, p1) + $a315ee31802fb757$var$QuadraticBezierP2(t, p2);\n}\n//\nfunction $a315ee31802fb757$var$CubicBezierP0(t, p) {\n const k = 1 - t;\n return k * k * k * p;\n}\nfunction $a315ee31802fb757$var$CubicBezierP1(t, p) {\n const k = 1 - t;\n return 3 * k * k * t * p;\n}\nfunction $a315ee31802fb757$var$CubicBezierP2(t, p) {\n return 3 * (1 - t) * t * t * p;\n}\nfunction $a315ee31802fb757$var$CubicBezierP3(t, p) {\n return t * t * t * p;\n}\nfunction $a315ee31802fb757$var$CubicBezier(t, p0, p1, p2, p3) {\n return $a315ee31802fb757$var$CubicBezierP0(t, p0) + $a315ee31802fb757$var$CubicBezierP1(t, p1) + $a315ee31802fb757$var$CubicBezierP2(t, p2) + $a315ee31802fb757$var$CubicBezierP3(t, p3);\n}\nclass $a315ee31802fb757$export$e36650d36468bb39 extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v1 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v2 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v3 = new $a315ee31802fb757$export$c977b3e384af9ae1()){\n super();\n this.isCubicBezierCurve = true;\n this.type = \"CubicBezierCurve\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n this.v3 = v3;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n point.set($a315ee31802fb757$var$CubicBezier(t, v0.x, v1.x, v2.x, v3.x), $a315ee31802fb757$var$CubicBezier(t, v0.y, v1.y, v2.y, v3.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n}\nclass $a315ee31802fb757$export$13d5f1c9525f246c extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $a315ee31802fb757$export$64b5c384219d3699(), v1 = new $a315ee31802fb757$export$64b5c384219d3699(), v2 = new $a315ee31802fb757$export$64b5c384219d3699(), v3 = new $a315ee31802fb757$export$64b5c384219d3699()){\n super();\n this.isCubicBezierCurve3 = true;\n this.type = \"CubicBezierCurve3\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n this.v3 = v3;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n point.set($a315ee31802fb757$var$CubicBezier(t, v0.x, v1.x, v2.x, v3.x), $a315ee31802fb757$var$CubicBezier(t, v0.y, v1.y, v2.y, v3.y), $a315ee31802fb757$var$CubicBezier(t, v0.z, v1.z, v2.z, v3.z));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n}\nclass $a315ee31802fb757$export$ab2e07e76531a47e extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v1 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v2 = new $a315ee31802fb757$export$c977b3e384af9ae1()){\n super();\n this.isLineCurve = true;\n this.type = \"LineCurve\";\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n if (t === 1) point.copy(this.v2);\n else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n // Line curve is linear, so we can overwrite default getPointAt\n getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n getTangent(t, optionalTarget = new $a315ee31802fb757$export$c977b3e384af9ae1()) {\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n copy(source) {\n super.copy(source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $a315ee31802fb757$export$1fdfd9d9cf487600 extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v1 = new $a315ee31802fb757$export$64b5c384219d3699(), v2 = new $a315ee31802fb757$export$64b5c384219d3699()){\n super();\n this.isLineCurve3 = true;\n this.type = \"LineCurve3\";\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$64b5c384219d3699()) {\n const point = optionalTarget;\n if (t === 1) point.copy(this.v2);\n else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n // Line curve is linear, so we can overwrite default getPointAt\n getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n getTangent(t, optionalTarget = new $a315ee31802fb757$export$64b5c384219d3699()) {\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n copy(source) {\n super.copy(source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $a315ee31802fb757$export$5938c4ee491a43ad extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v1 = new $a315ee31802fb757$export$c977b3e384af9ae1(), v2 = new $a315ee31802fb757$export$c977b3e384af9ae1()){\n super();\n this.isQuadraticBezierCurve = true;\n this.type = \"QuadraticBezierCurve\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2;\n point.set($a315ee31802fb757$var$QuadraticBezier(t, v0.x, v1.x, v2.x), $a315ee31802fb757$var$QuadraticBezier(t, v0.y, v1.y, v2.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $a315ee31802fb757$export$bf3f4c7e459f90fc extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $a315ee31802fb757$export$64b5c384219d3699(), v1 = new $a315ee31802fb757$export$64b5c384219d3699(), v2 = new $a315ee31802fb757$export$64b5c384219d3699()){\n super();\n this.isQuadraticBezierCurve3 = true;\n this.type = \"QuadraticBezierCurve3\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2;\n point.set($a315ee31802fb757$var$QuadraticBezier(t, v0.x, v1.x, v2.x), $a315ee31802fb757$var$QuadraticBezier(t, v0.y, v1.y, v2.y), $a315ee31802fb757$var$QuadraticBezier(t, v0.z, v1.z, v2.z));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $a315ee31802fb757$export$d3bdd77da77afc1b extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(points = []){\n super();\n this.isSplineCurve = true;\n this.type = \"SplineCurve\";\n this.points = points;\n }\n getPoint(t, optionalTarget = new $a315ee31802fb757$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const points = this.points;\n const p = (points.length - 1) * t;\n const intPoint = Math.floor(p);\n const weight = p - intPoint;\n const p0 = points[intPoint === 0 ? intPoint : intPoint - 1];\n const p1 = points[intPoint];\n const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];\n const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];\n point.set($a315ee31802fb757$var$CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), $a315ee31802fb757$var$CatmullRom(weight, p0.y, p1.y, p2.y, p3.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.points = [];\n for(let i = 0, l = source.points.length; i < l; i++){\n const point = source.points[i];\n this.points.push(point.clone());\n }\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.points = [];\n for(let i = 0, l = this.points.length; i < l; i++){\n const point = this.points[i];\n data.points.push(point.toArray());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.points = [];\n for(let i = 0, l = json.points.length; i < l; i++){\n const point = json.points[i];\n this.points.push(new $a315ee31802fb757$export$c977b3e384af9ae1().fromArray(point));\n }\n return this;\n }\n}\nvar $a315ee31802fb757$var$Curves = /*#__PURE__*/ Object.freeze({\n __proto__: null,\n ArcCurve: $a315ee31802fb757$export$b1eedc9aab6300e8,\n CatmullRomCurve3: $a315ee31802fb757$export$b9146b27c24b744c,\n CubicBezierCurve: $a315ee31802fb757$export$e36650d36468bb39,\n CubicBezierCurve3: $a315ee31802fb757$export$13d5f1c9525f246c,\n EllipseCurve: $a315ee31802fb757$export$3f87a931616cde04,\n LineCurve: $a315ee31802fb757$export$ab2e07e76531a47e,\n LineCurve3: $a315ee31802fb757$export$1fdfd9d9cf487600,\n QuadraticBezierCurve: $a315ee31802fb757$export$5938c4ee491a43ad,\n QuadraticBezierCurve3: $a315ee31802fb757$export$bf3f4c7e459f90fc,\n SplineCurve: $a315ee31802fb757$export$d3bdd77da77afc1b\n});\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/ class $a315ee31802fb757$export$4aaf9b66af1bbf2c extends $a315ee31802fb757$export$b0e83c3ef8d2db1 {\n constructor(){\n super();\n this.type = \"CurvePath\";\n this.curves = [];\n this.autoClose = false; // Automatically closes the path\n }\n add(curve) {\n this.curves.push(curve);\n }\n closePath() {\n // Add a line curve if start and end of lines are not connected\n const startPoint = this.curves[0].getPoint(0);\n const endPoint = this.curves[this.curves.length - 1].getPoint(1);\n if (!startPoint.equals(endPoint)) this.curves.push(new $a315ee31802fb757$export$ab2e07e76531a47e(endPoint, startPoint));\n }\n // To get accurate point with reference to\n // entire path distance at time t,\n // following has to be done:\n // 1. Length of each sub path have to be known\n // 2. Locate and identify type of curve\n // 3. Get t for the curve\n // 4. Return curve.getPointAt(t')\n getPoint(t, optionalTarget) {\n const d = t * this.getLength();\n const curveLengths = this.getCurveLengths();\n let i = 0;\n // To think about boundaries points.\n while(i < curveLengths.length){\n if (curveLengths[i] >= d) {\n const diff = curveLengths[i] - d;\n const curve = this.curves[i];\n const segmentLength = curve.getLength();\n const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n return curve.getPointAt(u, optionalTarget);\n }\n i++;\n }\n return null;\n // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) points.push(points[0]);\n return points;\n }\n copy(source) {\n super.copy(source);\n this.curves = [];\n for(let i = 0, l = source.curves.length; i < l; i++){\n const curve = source.curves[i];\n this.curves.push(curve.clone());\n }\n this.autoClose = source.autoClose;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.autoClose = this.autoClose;\n data.curves = [];\n for(let i = 0, l = this.curves.length; i < l; i++){\n const curve = this.curves[i];\n data.curves.push(curve.toJSON());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.autoClose = json.autoClose;\n this.curves = [];\n for(let i = 0, l = json.curves.length; i < l; i++){\n const curve = json.curves[i];\n this.curves.push(new $a315ee31802fb757$var$Curves[curve.type]().fromJSON(curve));\n }\n return this;\n }\n}\nclass $a315ee31802fb757$export$4b2950bdac9b6ee9 extends $a315ee31802fb757$export$4aaf9b66af1bbf2c {\n constructor(points){\n super();\n this.type = \"Path\";\n this.currentPoint = new $a315ee31802fb757$export$c977b3e384af9ae1();\n if (points) this.setFromPoints(points);\n }\n setFromPoints(points) {\n this.moveTo(points[0].x, points[0].y);\n for(let i = 1, l = points.length; i < l; i++)this.lineTo(points[i].x, points[i].y);\n return this;\n }\n moveTo(x, y) {\n this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying?\n return this;\n }\n lineTo(x, y) {\n const curve = new $a315ee31802fb757$export$ab2e07e76531a47e(this.currentPoint.clone(), new $a315ee31802fb757$export$c977b3e384af9ae1(x, y));\n this.curves.push(curve);\n this.currentPoint.set(x, y);\n return this;\n }\n quadraticCurveTo(aCPx, aCPy, aX, aY) {\n const curve = new $a315ee31802fb757$export$5938c4ee491a43ad(this.currentPoint.clone(), new $a315ee31802fb757$export$c977b3e384af9ae1(aCPx, aCPy), new $a315ee31802fb757$export$c977b3e384af9ae1(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n const curve = new $a315ee31802fb757$export$e36650d36468bb39(this.currentPoint.clone(), new $a315ee31802fb757$export$c977b3e384af9ae1(aCP1x, aCP1y), new $a315ee31802fb757$export$c977b3e384af9ae1(aCP2x, aCP2y), new $a315ee31802fb757$export$c977b3e384af9ae1(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n splineThru(pts /*Array of Vector*/ ) {\n const npts = [\n this.currentPoint.clone()\n ].concat(pts);\n const curve = new $a315ee31802fb757$export$d3bdd77da77afc1b(npts);\n this.curves.push(curve);\n this.currentPoint.copy(pts[pts.length - 1]);\n return this;\n }\n arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n const x0 = this.currentPoint.x;\n const y0 = this.currentPoint.y;\n this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n const x0 = this.currentPoint.x;\n const y0 = this.currentPoint.y;\n this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n return this;\n }\n absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n const curve = new $a315ee31802fb757$export$3f87a931616cde04(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n if (this.curves.length > 0) {\n // if a previous curve is present, attempt to join\n const firstPoint = curve.getPoint(0);\n if (!firstPoint.equals(this.currentPoint)) this.lineTo(firstPoint.x, firstPoint.y);\n }\n this.curves.push(curve);\n const lastPoint = curve.getPoint(1);\n this.currentPoint.copy(lastPoint);\n return this;\n }\n copy(source) {\n super.copy(source);\n this.currentPoint.copy(source.currentPoint);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.currentPoint = this.currentPoint.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.currentPoint.fromArray(json.currentPoint);\n return this;\n }\n}\nclass $a315ee31802fb757$export$6d839803fcd1882c extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(points = [\n new $a315ee31802fb757$export$c977b3e384af9ae1(0, -0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, 0),\n new $a315ee31802fb757$export$c977b3e384af9ae1(0, 0.5)\n ], segments = 12, phiStart = 0, phiLength = Math.PI * 2){\n super();\n this.type = \"LatheGeometry\";\n this.parameters = {\n points: points,\n segments: segments,\n phiStart: phiStart,\n phiLength: phiLength\n };\n segments = Math.floor(segments);\n // clamp phiLength so it's in range of [ 0, 2PI ]\n phiLength = $a315ee31802fb757$var$clamp(phiLength, 0, Math.PI * 2);\n // buffers\n const indices = [];\n const vertices = [];\n const uvs = [];\n const initNormals = [];\n const normals = [];\n // helper variables\n const inverseSegments = 1.0 / segments;\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const uv = new $a315ee31802fb757$export$c977b3e384af9ae1();\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n const curNormal = new $a315ee31802fb757$export$64b5c384219d3699();\n const prevNormal = new $a315ee31802fb757$export$64b5c384219d3699();\n let dx = 0;\n let dy = 0;\n // pre-compute normals for initial \"meridian\"\n for(let j = 0; j <= points.length - 1; j++)switch(j){\n case 0:\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n prevNormal.copy(normal);\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n break;\n case points.length - 1:\n initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z);\n break;\n default:\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n curNormal.copy(normal);\n normal.x += prevNormal.x;\n normal.y += prevNormal.y;\n normal.z += prevNormal.z;\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n prevNormal.copy(curNormal);\n }\n // generate vertices, uvs and normals\n for(let i = 0; i <= segments; i++){\n const phi = phiStart + i * inverseSegments * phiLength;\n const sin = Math.sin(phi);\n const cos = Math.cos(phi);\n for(let j = 0; j <= points.length - 1; j++){\n // vertex\n vertex.x = points[j].x * sin;\n vertex.y = points[j].y;\n vertex.z = points[j].x * cos;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // uv\n uv.x = i / segments;\n uv.y = j / (points.length - 1);\n uvs.push(uv.x, uv.y);\n // normal\n const x = initNormals[3 * j + 0] * sin;\n const y = initNormals[3 * j + 1];\n const z = initNormals[3 * j + 0] * cos;\n normals.push(x, y, z);\n }\n }\n // indices\n for(let i = 0; i < segments; i++)for(let j = 0; j < points.length - 1; j++){\n const base = j + i * points.length;\n const a = base;\n const b = base + points.length;\n const c = base + points.length + 1;\n const d = base + 1;\n // faces\n indices.push(a, b, d);\n indices.push(c, d, b);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$6d839803fcd1882c(data.points, data.segments, data.phiStart, data.phiLength);\n }\n}\nclass $a315ee31802fb757$export$41680e8551036033 extends $a315ee31802fb757$export$6d839803fcd1882c {\n constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8){\n const path = new $a315ee31802fb757$export$4b2950bdac9b6ee9();\n path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);\n path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);\n super(path.getPoints(capSegments), radialSegments);\n this.type = \"CapsuleGeometry\";\n this.parameters = {\n radius: radius,\n length: length,\n capSegments: capSegments,\n radialSegments: radialSegments\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$41680e8551036033(data.radius, data.length, data.capSegments, data.radialSegments);\n }\n}\nclass $a315ee31802fb757$export$d5c0e8d607467193 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"CircleGeometry\";\n this.parameters = {\n radius: radius,\n segments: segments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n segments = Math.max(3, segments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const uv = new $a315ee31802fb757$export$c977b3e384af9ae1();\n // center point\n vertices.push(0, 0, 0);\n normals.push(0, 0, 1);\n uvs.push(0.5, 0.5);\n for(let s = 0, i = 3; s <= segments; s++, i += 3){\n const segment = thetaStart + s / segments * thetaLength;\n // vertex\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, 0, 1);\n // uvs\n uv.x = (vertices[i] / radius + 1) / 2;\n uv.y = (vertices[i + 1] / radius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n // indices\n for(let i = 1; i <= segments; i++)indices.push(i, i + 1, 0);\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$d5c0e8d607467193(data.radius, data.segments, data.thetaStart, data.thetaLength);\n }\n}\nclass $a315ee31802fb757$export$68f745719dbe5198 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"CylinderGeometry\";\n this.parameters = {\n radiusTop: radiusTop,\n radiusBottom: radiusBottom,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n const scope = this;\n radialSegments = Math.floor(radialSegments);\n heightSegments = Math.floor(heightSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let index = 0;\n const indexArray = [];\n const halfHeight = height / 2;\n let groupStart = 0;\n // generate geometry\n generateTorso();\n if (openEnded === false) {\n if (radiusTop > 0) generateCap(true);\n if (radiusBottom > 0) generateCap(false);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n function generateTorso() {\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n let groupCount = 0;\n // this will be used to calculate the normal\n const slope = (radiusBottom - radiusTop) / height;\n // generate vertices, normals and uvs\n for(let y = 0; y <= heightSegments; y++){\n const indexRow = [];\n const v = y / heightSegments;\n // calculate the radius of the current row\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\n for(let x = 0; x <= radialSegments; x++){\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n // vertex\n vertex.x = radius * sinTheta;\n vertex.y = -v * height + halfHeight;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.set(sinTheta, slope, cosTheta).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u, 1 - v);\n // save index of vertex in respective row\n indexRow.push(index++);\n }\n // now save vertices of the row in our index array\n indexArray.push(indexRow);\n }\n // generate indices\n for(let x = 0; x < radialSegments; x++)for(let y = 0; y < heightSegments; y++){\n // we use the index array to access the correct indices\n const a = indexArray[y][x];\n const b = indexArray[y + 1][x];\n const c = indexArray[y + 1][x + 1];\n const d = indexArray[y][x + 1];\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n // update group counter\n groupCount += 6;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, 0);\n // calculate new start value for groups\n groupStart += groupCount;\n }\n function generateCap(top) {\n // save the index of the first center vertex\n const centerIndexStart = index;\n const uv = new $a315ee31802fb757$export$c977b3e384af9ae1();\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n let groupCount = 0;\n const radius = top === true ? radiusTop : radiusBottom;\n const sign = top === true ? 1 : -1;\n // first we generate the center vertex data of the cap.\n // because the geometry needs one set of uvs per face,\n // we must generate a center vertex per face/segment\n for(let x = 1; x <= radialSegments; x++){\n // vertex\n vertices.push(0, halfHeight * sign, 0);\n // normal\n normals.push(0, sign, 0);\n // uv\n uvs.push(0.5, 0.5);\n // increase index\n index++;\n }\n // save the index of the last center vertex\n const centerIndexEnd = index;\n // now we generate the surrounding vertices, normals and uvs\n for(let x = 0; x <= radialSegments; x++){\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n // vertex\n vertex.x = radius * sinTheta;\n vertex.y = halfHeight * sign;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, sign, 0);\n // uv\n uv.x = cosTheta * 0.5 + 0.5;\n uv.y = sinTheta * 0.5 * sign + 0.5;\n uvs.push(uv.x, uv.y);\n // increase index\n index++;\n }\n // generate indices\n for(let x = 0; x < radialSegments; x++){\n const c = centerIndexStart + x;\n const i = centerIndexEnd + x;\n if (top === true) // face top\n indices.push(i, i + 1, c);\n else // face bottom\n indices.push(i + 1, i, c);\n groupCount += 3;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, top === true ? 1 : 2);\n // calculate new start value for groups\n groupStart += groupCount;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$68f745719dbe5198(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n}\nclass $a315ee31802fb757$export$a7a48974f285c9b3 extends $a315ee31802fb757$export$68f745719dbe5198 {\n constructor(radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2){\n super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);\n this.type = \"ConeGeometry\";\n this.parameters = {\n radius: radius,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$a7a48974f285c9b3(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n}\nclass $a315ee31802fb757$export$60e57a7d3f20ff65 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(vertices = [], indices = [], radius = 1, detail = 0){\n super();\n this.type = \"PolyhedronGeometry\";\n this.parameters = {\n vertices: vertices,\n indices: indices,\n radius: radius,\n detail: detail\n };\n // default buffer data\n const vertexBuffer = [];\n const uvBuffer = [];\n // the subdivision creates the vertex buffer data\n subdivide(detail);\n // all vertices should lie on a conceptual sphere with a given radius\n applyRadius(radius);\n // finally, create the uv data\n generateUVs();\n // build non-indexed geometry\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertexBuffer, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertexBuffer.slice(), 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvBuffer, 2));\n if (detail === 0) this.computeVertexNormals(); // flat normals\n else this.normalizeNormals(); // smooth normals\n // helper functions\n function subdivide(detail) {\n const a = new $a315ee31802fb757$export$64b5c384219d3699();\n const b = new $a315ee31802fb757$export$64b5c384219d3699();\n const c = new $a315ee31802fb757$export$64b5c384219d3699();\n // iterate over all faces and apply a subdivision with the given detail value\n for(let i = 0; i < indices.length; i += 3){\n // get the vertices of the face\n getVertexByIndex(indices[i + 0], a);\n getVertexByIndex(indices[i + 1], b);\n getVertexByIndex(indices[i + 2], c);\n // perform subdivision\n subdivideFace(a, b, c, detail);\n }\n }\n function subdivideFace(a, b, c, detail) {\n const cols = detail + 1;\n // we use this multidimensional array as a data structure for creating the subdivision\n const v = [];\n // construct all of the vertices for this subdivision\n for(let i = 0; i <= cols; i++){\n v[i] = [];\n const aj = a.clone().lerp(c, i / cols);\n const bj = b.clone().lerp(c, i / cols);\n const rows = cols - i;\n for(let j = 0; j <= rows; j++)if (j === 0 && i === cols) v[i][j] = aj;\n else v[i][j] = aj.clone().lerp(bj, j / rows);\n }\n // construct all of the faces\n for(let i = 0; i < cols; i++)for(let j = 0; j < 2 * (cols - i) - 1; j++){\n const k = Math.floor(j / 2);\n if (j % 2 === 0) {\n pushVertex(v[i][k + 1]);\n pushVertex(v[i + 1][k]);\n pushVertex(v[i][k]);\n } else {\n pushVertex(v[i][k + 1]);\n pushVertex(v[i + 1][k + 1]);\n pushVertex(v[i + 1][k]);\n }\n }\n }\n function applyRadius(radius) {\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n // iterate over the entire buffer and apply the radius to each vertex\n for(let i = 0; i < vertexBuffer.length; i += 3){\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n vertex.normalize().multiplyScalar(radius);\n vertexBuffer[i + 0] = vertex.x;\n vertexBuffer[i + 1] = vertex.y;\n vertexBuffer[i + 2] = vertex.z;\n }\n }\n function generateUVs() {\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n for(let i = 0; i < vertexBuffer.length; i += 3){\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n const u = azimuth(vertex) / 2 / Math.PI + 0.5;\n const v = inclination(vertex) / Math.PI + 0.5;\n uvBuffer.push(u, 1 - v);\n }\n correctUVs();\n correctSeam();\n }\n function correctSeam() {\n // handle case when face straddles the seam, see #3269\n for(let i = 0; i < uvBuffer.length; i += 6){\n // uv data of a single face\n const x0 = uvBuffer[i + 0];\n const x1 = uvBuffer[i + 2];\n const x2 = uvBuffer[i + 4];\n const max = Math.max(x0, x1, x2);\n const min = Math.min(x0, x1, x2);\n // 0.9 is somewhat arbitrary\n if (max > 0.9 && min < 0.1) {\n if (x0 < 0.2) uvBuffer[i + 0] += 1;\n if (x1 < 0.2) uvBuffer[i + 2] += 1;\n if (x2 < 0.2) uvBuffer[i + 4] += 1;\n }\n }\n }\n function pushVertex(vertex) {\n vertexBuffer.push(vertex.x, vertex.y, vertex.z);\n }\n function getVertexByIndex(index, vertex) {\n const stride = index * 3;\n vertex.x = vertices[stride + 0];\n vertex.y = vertices[stride + 1];\n vertex.z = vertices[stride + 2];\n }\n function correctUVs() {\n const a = new $a315ee31802fb757$export$64b5c384219d3699();\n const b = new $a315ee31802fb757$export$64b5c384219d3699();\n const c = new $a315ee31802fb757$export$64b5c384219d3699();\n const centroid = new $a315ee31802fb757$export$64b5c384219d3699();\n const uvA = new $a315ee31802fb757$export$c977b3e384af9ae1();\n const uvB = new $a315ee31802fb757$export$c977b3e384af9ae1();\n const uvC = new $a315ee31802fb757$export$c977b3e384af9ae1();\n for(let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6){\n a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]);\n b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]);\n c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]);\n uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]);\n uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]);\n uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]);\n centroid.copy(a).add(b).add(c).divideScalar(3);\n const azi = azimuth(centroid);\n correctUV(uvA, j + 0, a, azi);\n correctUV(uvB, j + 2, b, azi);\n correctUV(uvC, j + 4, c, azi);\n }\n }\n function correctUV(uv, stride, vector, azimuth) {\n if (azimuth < 0 && uv.x === 1) uvBuffer[stride] = uv.x - 1;\n if (vector.x === 0 && vector.z === 0) uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5;\n }\n // Angle around the Y axis, counter-clockwise when looking from above.\n function azimuth(vector) {\n return Math.atan2(vector.z, -vector.x);\n }\n // Angle above the XZ plane.\n function inclination(vector) {\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$60e57a7d3f20ff65(data.vertices, data.indices, data.radius, data.details);\n }\n}\nclass $a315ee31802fb757$export$c0babfeb8708fc9c extends $a315ee31802fb757$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const t = (1 + Math.sqrt(5)) / 2;\n const r = 1 / t;\n const vertices = [\n // (±1, ±1, ±1)\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n -1,\n 1,\n -1,\n -1,\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n 1,\n 1,\n 1,\n -1,\n 1,\n 1,\n 1,\n // (0, ±1/φ, ±φ)\n 0,\n -r,\n -t,\n 0,\n -r,\n t,\n 0,\n r,\n -t,\n 0,\n r,\n t,\n // (±1/φ, ±φ, 0)\n -r,\n -t,\n 0,\n -r,\n t,\n 0,\n r,\n -t,\n 0,\n r,\n t,\n 0,\n // (±φ, 0, ±1/φ)\n -t,\n 0,\n -r,\n t,\n 0,\n -r,\n -t,\n 0,\n r,\n t,\n 0,\n r\n ];\n const indices = [\n 3,\n 11,\n 7,\n 3,\n 7,\n 15,\n 3,\n 15,\n 13,\n 7,\n 19,\n 17,\n 7,\n 17,\n 6,\n 7,\n 6,\n 15,\n 17,\n 4,\n 8,\n 17,\n 8,\n 10,\n 17,\n 10,\n 6,\n 8,\n 0,\n 16,\n 8,\n 16,\n 2,\n 8,\n 2,\n 10,\n 0,\n 12,\n 1,\n 0,\n 1,\n 18,\n 0,\n 18,\n 16,\n 6,\n 10,\n 2,\n 6,\n 2,\n 13,\n 6,\n 13,\n 15,\n 2,\n 16,\n 18,\n 2,\n 18,\n 3,\n 2,\n 3,\n 13,\n 18,\n 1,\n 9,\n 18,\n 9,\n 11,\n 18,\n 11,\n 3,\n 4,\n 14,\n 12,\n 4,\n 12,\n 0,\n 4,\n 0,\n 8,\n 11,\n 9,\n 5,\n 11,\n 5,\n 19,\n 11,\n 19,\n 7,\n 19,\n 5,\n 14,\n 19,\n 14,\n 4,\n 19,\n 4,\n 17,\n 1,\n 12,\n 14,\n 1,\n 14,\n 5,\n 1,\n 5,\n 9\n ];\n super(vertices, indices, radius, detail);\n this.type = \"DodecahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$c0babfeb8708fc9c(data.radius, data.detail);\n }\n}\nconst $a315ee31802fb757$var$_v0 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v1$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_normal = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_triangle = /*@__PURE__*/ new $a315ee31802fb757$export$5a465592bfe74b48();\nclass $a315ee31802fb757$export$4730b1542707547f extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(geometry = null, thresholdAngle = 1){\n super();\n this.type = \"EdgesGeometry\";\n this.parameters = {\n geometry: geometry,\n thresholdAngle: thresholdAngle\n };\n if (geometry !== null) {\n const precisionPoints = 4;\n const precision = Math.pow(10, precisionPoints);\n const thresholdDot = Math.cos($a315ee31802fb757$var$DEG2RAD * thresholdAngle);\n const indexAttr = geometry.getIndex();\n const positionAttr = geometry.getAttribute(\"position\");\n const indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n const indexArr = [\n 0,\n 0,\n 0\n ];\n const vertKeys = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const hashes = new Array(3);\n const edgeData = {};\n const vertices = [];\n for(let i = 0; i < indexCount; i += 3){\n if (indexAttr) {\n indexArr[0] = indexAttr.getX(i);\n indexArr[1] = indexAttr.getX(i + 1);\n indexArr[2] = indexAttr.getX(i + 2);\n } else {\n indexArr[0] = i;\n indexArr[1] = i + 1;\n indexArr[2] = i + 2;\n }\n const { a: a, b: b, c: c } = $a315ee31802fb757$var$_triangle;\n a.fromBufferAttribute(positionAttr, indexArr[0]);\n b.fromBufferAttribute(positionAttr, indexArr[1]);\n c.fromBufferAttribute(positionAttr, indexArr[2]);\n $a315ee31802fb757$var$_triangle.getNormal($a315ee31802fb757$var$_normal);\n // create hashes for the edge from the vertices\n hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;\n hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;\n hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`;\n // skip degenerate triangles\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) continue;\n // iterate over every edge\n for(let j = 0; j < 3; j++){\n // get the first and next vertex making up the edge\n const jNext = (j + 1) % 3;\n const vecHash0 = hashes[j];\n const vecHash1 = hashes[jNext];\n const v0 = $a315ee31802fb757$var$_triangle[vertKeys[j]];\n const v1 = $a315ee31802fb757$var$_triangle[vertKeys[jNext]];\n const hash = `${vecHash0}_${vecHash1}`;\n const reverseHash = `${vecHash1}_${vecHash0}`;\n if (reverseHash in edgeData && edgeData[reverseHash]) {\n // if we found a sibling edge add it into the vertex array if\n // it meets the angle threshold and delete the edge from the map.\n if ($a315ee31802fb757$var$_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) {\n vertices.push(v0.x, v0.y, v0.z);\n vertices.push(v1.x, v1.y, v1.z);\n }\n edgeData[reverseHash] = null;\n } else if (!(hash in edgeData)) // if we've already got an edge here then skip adding a new one\n edgeData[hash] = {\n index0: indexArr[j],\n index1: indexArr[jNext],\n normal: $a315ee31802fb757$var$_normal.clone()\n };\n }\n }\n // iterate over all remaining, unmatched edges and add them to the vertex array\n for(const key in edgeData)if (edgeData[key]) {\n const { index0: index0, index1: index1 } = edgeData[key];\n $a315ee31802fb757$var$_v0.fromBufferAttribute(positionAttr, index0);\n $a315ee31802fb757$var$_v1$1.fromBufferAttribute(positionAttr, index1);\n vertices.push($a315ee31802fb757$var$_v0.x, $a315ee31802fb757$var$_v0.y, $a315ee31802fb757$var$_v0.z);\n vertices.push($a315ee31802fb757$var$_v1$1.x, $a315ee31802fb757$var$_v1$1.y, $a315ee31802fb757$var$_v1$1.z);\n }\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n}\nclass $a315ee31802fb757$export$6428a7f2611ef1fa extends $a315ee31802fb757$export$4b2950bdac9b6ee9 {\n constructor(points){\n super(points);\n this.uuid = $a315ee31802fb757$var$generateUUID();\n this.type = \"Shape\";\n this.holes = [];\n }\n getPointsHoles(divisions) {\n const holesPts = [];\n for(let i = 0, l = this.holes.length; i < l; i++)holesPts[i] = this.holes[i].getPoints(divisions);\n return holesPts;\n }\n // get points of shape and holes (keypoints based on segments parameter)\n extractPoints(divisions) {\n return {\n shape: this.getPoints(divisions),\n holes: this.getPointsHoles(divisions)\n };\n }\n copy(source) {\n super.copy(source);\n this.holes = [];\n for(let i = 0, l = source.holes.length; i < l; i++){\n const hole = source.holes[i];\n this.holes.push(hole.clone());\n }\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.uuid = this.uuid;\n data.holes = [];\n for(let i = 0, l = this.holes.length; i < l; i++){\n const hole = this.holes[i];\n data.holes.push(hole.toJSON());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.uuid = json.uuid;\n this.holes = [];\n for(let i = 0, l = json.holes.length; i < l; i++){\n const hole = json.holes[i];\n this.holes.push(new $a315ee31802fb757$export$4b2950bdac9b6ee9().fromJSON(hole));\n }\n return this;\n }\n}\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */ const $a315ee31802fb757$var$Earcut = {\n triangulate: function(data, holeIndices, dim = 2) {\n const hasHoles = holeIndices && holeIndices.length;\n const outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n let outerNode = $a315ee31802fb757$var$linkedList(data, 0, outerLen, dim, true);\n const triangles = [];\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n let minX, minY, maxX, maxY, x, y, invSize;\n if (hasHoles) outerNode = $a315ee31802fb757$var$eliminateHoles(data, holeIndices, outerNode, dim);\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n for(let i = dim; i < outerLen; i += dim){\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n $a315ee31802fb757$var$earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n return triangles;\n }\n};\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction $a315ee31802fb757$var$linkedList(data, start, end, dim, clockwise) {\n let i, last;\n if (clockwise === $a315ee31802fb757$var$signedArea(data, start, end, dim) > 0) for(i = start; i < end; i += dim)last = $a315ee31802fb757$var$insertNode(i, data[i], data[i + 1], last);\n else for(i = end - dim; i >= start; i -= dim)last = $a315ee31802fb757$var$insertNode(i, data[i], data[i + 1], last);\n if (last && $a315ee31802fb757$var$equals(last, last.next)) {\n $a315ee31802fb757$var$removeNode(last);\n last = last.next;\n }\n return last;\n}\n// eliminate colinear or duplicate points\nfunction $a315ee31802fb757$var$filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n let p = start, again;\n do {\n again = false;\n if (!p.steiner && ($a315ee31802fb757$var$equals(p, p.next) || $a315ee31802fb757$var$area(p.prev, p, p.next) === 0)) {\n $a315ee31802fb757$var$removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n } else p = p.next;\n }while (again || p !== end);\n return end;\n}\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction $a315ee31802fb757$var$earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n // interlink polygon nodes in z-order\n if (!pass && invSize) $a315ee31802fb757$var$indexCurve(ear, minX, minY, invSize);\n let stop = ear, prev, next;\n // iterate through ears, slicing them one by one\n while(ear.prev !== ear.next){\n prev = ear.prev;\n next = ear.next;\n if (invSize ? $a315ee31802fb757$var$isEarHashed(ear, minX, minY, invSize) : $a315ee31802fb757$var$isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n $a315ee31802fb757$var$removeNode(ear);\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n continue;\n }\n ear = next;\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) $a315ee31802fb757$var$earcutLinked($a315ee31802fb757$var$filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n else if (pass === 1) {\n ear = $a315ee31802fb757$var$cureLocalIntersections($a315ee31802fb757$var$filterPoints(ear), triangles, dim);\n $a315ee31802fb757$var$earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) $a315ee31802fb757$var$splitEarcut(ear, triangles, dim, minX, minY, invSize);\n break;\n }\n }\n}\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction $a315ee31802fb757$var$isEar(ear) {\n const a = ear.prev, b = ear, c = ear.next;\n if ($a315ee31802fb757$var$area(a, b, c) >= 0) return false; // reflex, can't be an ear\n // now make sure we don't have other points inside the potential ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n // triangle bbox; min & max are calculated like this for speed\n const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n let p = c.next;\n while(p !== a){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $a315ee31802fb757$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n return true;\n}\nfunction $a315ee31802fb757$var$isEarHashed(ear, minX, minY, invSize) {\n const a = ear.prev, b = ear, c = ear.next;\n if ($a315ee31802fb757$var$area(a, b, c) >= 0) return false; // reflex, can't be an ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n // triangle bbox; min & max are calculated like this for speed\n const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n // z-order range for the current triangle bbox;\n const minZ = $a315ee31802fb757$var$zOrder(x0, y0, minX, minY, invSize), maxZ = $a315ee31802fb757$var$zOrder(x1, y1, minX, minY, invSize);\n let p = ear.prevZ, n = ear.nextZ;\n // look for points inside the triangle in both directions\n while(p && p.z >= minZ && n && n.z <= maxZ){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $a315ee31802fb757$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && $a315ee31802fb757$var$area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n // look for remaining points in decreasing z-order\n while(p && p.z >= minZ){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $a315ee31802fb757$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n // look for remaining points in increasing z-order\n while(n && n.z <= maxZ){\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && $a315ee31802fb757$var$area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n return true;\n}\n// go through all polygon nodes and cure small local self-intersections\nfunction $a315ee31802fb757$var$cureLocalIntersections(start, triangles, dim) {\n let p = start;\n do {\n const a = p.prev, b = p.next.next;\n if (!$a315ee31802fb757$var$equals(a, b) && $a315ee31802fb757$var$intersects(a, p, p.next, b) && $a315ee31802fb757$var$locallyInside(a, b) && $a315ee31802fb757$var$locallyInside(b, a)) {\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n // remove two nodes involved\n $a315ee31802fb757$var$removeNode(p);\n $a315ee31802fb757$var$removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n }while (p !== start);\n return $a315ee31802fb757$var$filterPoints(p);\n}\n// try splitting polygon into two and triangulate them independently\nfunction $a315ee31802fb757$var$splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n let a = start;\n do {\n let b = a.next.next;\n while(b !== a.prev){\n if (a.i !== b.i && $a315ee31802fb757$var$isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n let c = $a315ee31802fb757$var$splitPolygon(a, b);\n // filter colinear points around the cuts\n a = $a315ee31802fb757$var$filterPoints(a, a.next);\n c = $a315ee31802fb757$var$filterPoints(c, c.next);\n // run earcut on each half\n $a315ee31802fb757$var$earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n $a315ee31802fb757$var$earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n }while (a !== start);\n}\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction $a315ee31802fb757$var$eliminateHoles(data, holeIndices, outerNode, dim) {\n const queue = [];\n let i, len, start, end, list;\n for(i = 0, len = holeIndices.length; i < len; i++){\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = $a315ee31802fb757$var$linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push($a315ee31802fb757$var$getLeftmost(list));\n }\n queue.sort($a315ee31802fb757$var$compareX);\n // process holes from left to right\n for(i = 0; i < queue.length; i++)outerNode = $a315ee31802fb757$var$eliminateHole(queue[i], outerNode);\n return outerNode;\n}\nfunction $a315ee31802fb757$var$compareX(a, b) {\n return a.x - b.x;\n}\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction $a315ee31802fb757$var$eliminateHole(hole, outerNode) {\n const bridge = $a315ee31802fb757$var$findHoleBridge(hole, outerNode);\n if (!bridge) return outerNode;\n const bridgeReverse = $a315ee31802fb757$var$splitPolygon(bridge, hole);\n // filter collinear points around the cuts\n $a315ee31802fb757$var$filterPoints(bridgeReverse, bridgeReverse.next);\n return $a315ee31802fb757$var$filterPoints(bridge, bridge.next);\n}\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction $a315ee31802fb757$var$findHoleBridge(hole, outerNode) {\n let p = outerNode, qx = -Infinity, m;\n const hx = hole.x, hy = hole.y;\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n }while (p !== outerNode);\n if (!m) return null;\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n const stop = m, mx = m.x, my = m.y;\n let tanMin = Infinity, tan;\n p = m;\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x && $a315ee31802fb757$var$pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n if ($a315ee31802fb757$var$locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && $a315ee31802fb757$var$sectorContainsSector(m, p)))) {\n m = p;\n tanMin = tan;\n }\n }\n p = p.next;\n }while (p !== stop);\n return m;\n}\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction $a315ee31802fb757$var$sectorContainsSector(m, p) {\n return $a315ee31802fb757$var$area(m.prev, m, p.prev) < 0 && $a315ee31802fb757$var$area(p.next, m, m.next) < 0;\n}\n// interlink polygon nodes in z-order\nfunction $a315ee31802fb757$var$indexCurve(start, minX, minY, invSize) {\n let p = start;\n do {\n if (p.z === 0) p.z = $a315ee31802fb757$var$zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n }while (p !== start);\n p.prevZ.nextZ = null;\n p.prevZ = null;\n $a315ee31802fb757$var$sortLinked(p);\n}\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction $a315ee31802fb757$var$sortLinked(list) {\n let i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n while(p){\n numMerges++;\n q = p;\n pSize = 0;\n for(i = 0; i < inSize; i++){\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n while(pSize > 0 || qSize > 0 && q){\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n if (tail) tail.nextZ = e;\n else list = e;\n e.prevZ = tail;\n tail = e;\n }\n p = q;\n }\n tail.nextZ = null;\n inSize *= 2;\n }while (numMerges > 1);\n return list;\n}\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction $a315ee31802fb757$var$zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n y = (y | y << 2) & 0x33333333;\n y = (y | y << 1) & 0x55555555;\n return x | y << 1;\n}\n// find the leftmost node of a polygon ring\nfunction $a315ee31802fb757$var$getLeftmost(start) {\n let p = start, leftmost = start;\n do {\n if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;\n p = p.next;\n }while (p !== start);\n return leftmost;\n}\n// check if a point lies within a convex triangle\nfunction $a315ee31802fb757$var$pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction $a315ee31802fb757$var$isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !$a315ee31802fb757$var$intersectsPolygon(a, b) && // dones't intersect other edges\n ($a315ee31802fb757$var$locallyInside(a, b) && $a315ee31802fb757$var$locallyInside(b, a) && $a315ee31802fb757$var$middleInside(a, b) && // locally visible\n ($a315ee31802fb757$var$area(a.prev, a, b.prev) || $a315ee31802fb757$var$area(a, b.prev, b)) || // does not create opposite-facing sectors\n $a315ee31802fb757$var$equals(a, b) && $a315ee31802fb757$var$area(a.prev, a, a.next) > 0 && $a315ee31802fb757$var$area(b.prev, b, b.next) > 0); // special zero-length case\n}\n// signed area of a triangle\nfunction $a315ee31802fb757$var$area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n// check if two points are equal\nfunction $a315ee31802fb757$var$equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n// check if two segments intersect\nfunction $a315ee31802fb757$var$intersects(p1, q1, p2, q2) {\n const o1 = $a315ee31802fb757$var$sign($a315ee31802fb757$var$area(p1, q1, p2));\n const o2 = $a315ee31802fb757$var$sign($a315ee31802fb757$var$area(p1, q1, q2));\n const o3 = $a315ee31802fb757$var$sign($a315ee31802fb757$var$area(p2, q2, p1));\n const o4 = $a315ee31802fb757$var$sign($a315ee31802fb757$var$area(p2, q2, q1));\n if (o1 !== o2 && o3 !== o4) return true; // general case\n if (o1 === 0 && $a315ee31802fb757$var$onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && $a315ee31802fb757$var$onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && $a315ee31802fb757$var$onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && $a315ee31802fb757$var$onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n return false;\n}\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction $a315ee31802fb757$var$onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\nfunction $a315ee31802fb757$var$sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n// check if a polygon diagonal intersects any polygon segments\nfunction $a315ee31802fb757$var$intersectsPolygon(a, b) {\n let p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && $a315ee31802fb757$var$intersects(p, p.next, a, b)) return true;\n p = p.next;\n }while (p !== a);\n return false;\n}\n// check if a polygon diagonal is locally inside the polygon\nfunction $a315ee31802fb757$var$locallyInside(a, b) {\n return $a315ee31802fb757$var$area(a.prev, a, a.next) < 0 ? $a315ee31802fb757$var$area(a, b, a.next) >= 0 && $a315ee31802fb757$var$area(a, a.prev, b) >= 0 : $a315ee31802fb757$var$area(a, b, a.prev) < 0 || $a315ee31802fb757$var$area(a, a.next, b) < 0;\n}\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction $a315ee31802fb757$var$middleInside(a, b) {\n let p = a, inside = false;\n const px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;\n p = p.next;\n }while (p !== a);\n return inside;\n}\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction $a315ee31802fb757$var$splitPolygon(a, b) {\n const a2 = new $a315ee31802fb757$var$Node(a.i, a.x, a.y), b2 = new $a315ee31802fb757$var$Node(b.i, b.x, b.y), an = a.next, bp = b.prev;\n a.next = b;\n b.prev = a;\n a2.next = an;\n an.prev = a2;\n b2.next = a2;\n a2.prev = b2;\n bp.next = b2;\n b2.prev = bp;\n return b2;\n}\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction $a315ee31802fb757$var$insertNode(i, x, y, last) {\n const p = new $a315ee31802fb757$var$Node(i, x, y);\n if (!last) {\n p.prev = p;\n p.next = p;\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\nfunction $a315ee31802fb757$var$removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\nfunction $a315ee31802fb757$var$Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n // vertex coordinates\n this.x = x;\n this.y = y;\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n // z-order curve value\n this.z = 0;\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n // indicates whether this is a steiner point\n this.steiner = false;\n}\nfunction $a315ee31802fb757$var$signedArea(data, start, end, dim) {\n let sum = 0;\n for(let i = start, j = end - dim; i < end; i += dim){\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\nclass $a315ee31802fb757$export$96bdf6d9c66d7ba8 {\n // calculate area of the contour polygon\n static area(contour) {\n const n = contour.length;\n let a = 0.0;\n for(let p = n - 1, q = 0; q < n; p = q++)a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;\n return a * 0.5;\n }\n static isClockWise(pts) {\n return $a315ee31802fb757$export$96bdf6d9c66d7ba8.area(pts) < 0;\n }\n static triangulateShape(contour, holes) {\n const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n const holeIndices = []; // array of hole indices\n const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n $a315ee31802fb757$var$removeDupEndPts(contour);\n $a315ee31802fb757$var$addContour(vertices, contour);\n //\n let holeIndex = contour.length;\n holes.forEach($a315ee31802fb757$var$removeDupEndPts);\n for(let i = 0; i < holes.length; i++){\n holeIndices.push(holeIndex);\n holeIndex += holes[i].length;\n $a315ee31802fb757$var$addContour(vertices, holes[i]);\n }\n //\n const triangles = $a315ee31802fb757$var$Earcut.triangulate(vertices, holeIndices);\n //\n for(let i = 0; i < triangles.length; i += 3)faces.push(triangles.slice(i, i + 3));\n return faces;\n }\n}\nfunction $a315ee31802fb757$var$removeDupEndPts(points) {\n const l = points.length;\n if (l > 2 && points[l - 1].equals(points[0])) points.pop();\n}\nfunction $a315ee31802fb757$var$addContour(vertices, contour) {\n for(let i = 0; i < contour.length; i++){\n vertices.push(contour[i].x);\n vertices.push(contour[i].y);\n }\n}\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */ class $a315ee31802fb757$export$598697a1efa63ca7 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(shapes = new $a315ee31802fb757$export$6428a7f2611ef1fa([\n new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, 0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(-0.5, 0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(-0.5, -0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, -0.5)\n ]), options = {}){\n super();\n this.type = \"ExtrudeGeometry\";\n this.parameters = {\n shapes: shapes,\n options: options\n };\n shapes = Array.isArray(shapes) ? shapes : [\n shapes\n ];\n const scope = this;\n const verticesArray = [];\n const uvArray = [];\n for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n addShape(shape);\n }\n // build geometry\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(verticesArray, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvArray, 2));\n this.computeVertexNormals();\n // functions\n function addShape(shape) {\n const placeholder = [];\n // options\n const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n const steps = options.steps !== undefined ? options.steps : 1;\n const depth = options.depth !== undefined ? options.depth : 1;\n let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n const extrudePath = options.extrudePath;\n const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : $a315ee31802fb757$var$WorldUVGenerator;\n //\n let extrudePts, extrudeByPath = false;\n let splineTube, binormal, normal, position2;\n if (extrudePath) {\n extrudePts = extrudePath.getSpacedPoints(steps);\n extrudeByPath = true;\n bevelEnabled = false; // bevels not supported for path extrusion\n // SETUP TNB variables\n // TODO1 - have a .isClosed in spline?\n splineTube = extrudePath.computeFrenetFrames(steps, false);\n // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n binormal = new $a315ee31802fb757$export$64b5c384219d3699();\n normal = new $a315ee31802fb757$export$64b5c384219d3699();\n position2 = new $a315ee31802fb757$export$64b5c384219d3699();\n }\n // Safeguards if bevels are not enabled\n if (!bevelEnabled) {\n bevelSegments = 0;\n bevelThickness = 0;\n bevelSize = 0;\n bevelOffset = 0;\n }\n // Variables initialization\n const shapePoints = shape.extractPoints(curveSegments);\n let vertices = shapePoints.shape;\n const holes = shapePoints.holes;\n const reverse = !$a315ee31802fb757$export$96bdf6d9c66d7ba8.isClockWise(vertices);\n if (reverse) {\n vertices = vertices.reverse();\n // Maybe we should also check if holes are in the opposite direction, just to be safe ...\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n if ($a315ee31802fb757$export$96bdf6d9c66d7ba8.isClockWise(ahole)) holes[h] = ahole.reverse();\n }\n }\n const faces = $a315ee31802fb757$export$96bdf6d9c66d7ba8.triangulateShape(vertices, holes);\n /* Vertices */ const contour = vertices; // vertices has all points but contour has only points of circumference\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n vertices = vertices.concat(ahole);\n }\n function scalePt2(pt, vec, size) {\n if (!vec) console.error(\"THREE.ExtrudeGeometry: vec does not exist\");\n return pt.clone().addScaledVector(vec, size);\n }\n const vlen = vertices.length, flen = faces.length;\n // Find directions for point movement\n function getBevelVec(inPt, inPrev, inNext) {\n // computes for inPt the corresponding point inPt' on a new contour\n // shifted by 1 unit (length of normalized vector) to the left\n // if we walk along contour clockwise, this new contour is outside the old one\n //\n // inPt' is the intersection of the two lines parallel to the two\n // adjacent edges of inPt at a distance of 1 unit on the left side.\n let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n // good reading for geometry algorithms (here: line-line intersection)\n // http://geomalgorithms.com/a05-_intersect-1.html\n const v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y;\n const v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y;\n const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y;\n // check for collinear edges\n const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x;\n if (Math.abs(collinear0) > Number.EPSILON) {\n // not collinear\n // length of vectors for normalizing\n const v_prev_len = Math.sqrt(v_prev_lensq);\n const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y);\n // shift adjacent points by unit vectors to the left\n const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len;\n const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len;\n const ptNextShift_x = inNext.x - v_next_y / v_next_len;\n const ptNextShift_y = inNext.y + v_next_x / v_next_len;\n // scaling factor for v_prev to intersection point\n const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x);\n // vector from inPt to intersection point\n v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x;\n v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y;\n // Don't normalize!, otherwise sharp corners become ugly\n // but prevent crazy spikes\n const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y;\n if (v_trans_lensq <= 2) return new $a315ee31802fb757$export$c977b3e384af9ae1(v_trans_x, v_trans_y);\n else shrink_by = Math.sqrt(v_trans_lensq / 2);\n } else {\n // handle special case of collinear edges\n let direction_eq = false; // assumes: opposite\n if (v_prev_x > Number.EPSILON) {\n if (v_next_x > Number.EPSILON) direction_eq = true;\n } else {\n if (v_prev_x < -Number.EPSILON) {\n if (v_next_x < -Number.EPSILON) direction_eq = true;\n } else if (Math.sign(v_prev_y) === Math.sign(v_next_y)) direction_eq = true;\n }\n if (direction_eq) {\n // console.log(\"Warning: lines are a straight sequence\");\n v_trans_x = -v_prev_y;\n v_trans_y = v_prev_x;\n shrink_by = Math.sqrt(v_prev_lensq);\n } else {\n // console.log(\"Warning: lines are a straight spike\");\n v_trans_x = v_prev_x;\n v_trans_y = v_prev_y;\n shrink_by = Math.sqrt(v_prev_lensq / 2);\n }\n }\n return new $a315ee31802fb757$export$c977b3e384af9ae1(v_trans_x / shrink_by, v_trans_y / shrink_by);\n }\n const contourMovements = [];\n for(let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++){\n if (j === il) j = 0;\n if (k === il) k = 0;\n // (j)---(i)---(k)\n // console.log('i,j,k', i, j , k)\n contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]);\n }\n const holesMovements = [];\n let oneHoleMovements, verticesMovements = contourMovements.concat();\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = [];\n for(let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++){\n if (j === il) j = 0;\n if (k === il) k = 0;\n // (j)---(i)---(k)\n oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]);\n }\n holesMovements.push(oneHoleMovements);\n verticesMovements = verticesMovements.concat(oneHoleMovements);\n }\n // Loop bevelSegments, 1 for the front, 1 for the back\n for(let b = 0; b < bevelSegments; b++){\n //for ( b = bevelSegments; b > 0; b -- ) {\n const t = b / bevelSegments;\n const z = bevelThickness * Math.cos(t * Math.PI / 2);\n const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset;\n // contract shape\n for(let i = 0, il = contour.length; i < il; i++){\n const vert = scalePt2(contour[i], contourMovements[i], bs);\n v(vert.x, vert.y, -z);\n }\n // expand holes\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = holesMovements[h];\n for(let i = 0, il = ahole.length; i < il; i++){\n const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);\n v(vert.x, vert.y, -z);\n }\n }\n }\n const bs = bevelSize + bevelOffset;\n // Back facing vertices\n for(let i = 0; i < vlen; i++){\n const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];\n if (!extrudeByPath) v(vert.x, vert.y, 0);\n else {\n // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n normal.copy(splineTube.normals[0]).multiplyScalar(vert.x);\n binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y);\n position2.copy(extrudePts[0]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n // Add stepped vertices...\n // Including front facing vertices\n for(let s = 1; s <= steps; s++)for(let i = 0; i < vlen; i++){\n const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];\n if (!extrudeByPath) v(vert.x, vert.y, depth / steps * s);\n else {\n // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n normal.copy(splineTube.normals[s]).multiplyScalar(vert.x);\n binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y);\n position2.copy(extrudePts[s]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n // Add bevel segments planes\n //for ( b = 1; b <= bevelSegments; b ++ ) {\n for(let b = bevelSegments - 1; b >= 0; b--){\n const t = b / bevelSegments;\n const z = bevelThickness * Math.cos(t * Math.PI / 2);\n const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset;\n // contract shape\n for(let i = 0, il = contour.length; i < il; i++){\n const vert = scalePt2(contour[i], contourMovements[i], bs);\n v(vert.x, vert.y, depth + z);\n }\n // expand holes\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = holesMovements[h];\n for(let i = 0, il = ahole.length; i < il; i++){\n const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);\n if (!extrudeByPath) v(vert.x, vert.y, depth + z);\n else v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z);\n }\n }\n }\n /* Faces */ // Top and bottom faces\n buildLidFaces();\n // Sides faces\n buildSideFaces();\n ///// Internal functions\n function buildLidFaces() {\n const start = verticesArray.length / 3;\n if (bevelEnabled) {\n let layer = 0; // steps + 1\n let offset = vlen * layer;\n // Bottom faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[2] + offset, face[1] + offset, face[0] + offset);\n }\n layer = steps + bevelSegments * 2;\n offset = vlen * layer;\n // Top faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[0] + offset, face[1] + offset, face[2] + offset);\n }\n } else {\n // Bottom faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[2], face[1], face[0]);\n }\n // Top faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps);\n }\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 0);\n }\n // Create faces for the z-sides of the shape\n function buildSideFaces() {\n const start = verticesArray.length / 3;\n let layeroffset = 0;\n sidewalls(contour, layeroffset);\n layeroffset += contour.length;\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n sidewalls(ahole, layeroffset);\n //, true\n layeroffset += ahole.length;\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 1);\n }\n function sidewalls(contour, layeroffset) {\n let i = contour.length;\n while(--i >= 0){\n const j = i;\n let k = i - 1;\n if (k < 0) k = contour.length - 1;\n //console.log('b', i,j, i-1, k,vertices.length);\n for(let s = 0, sl = steps + bevelSegments * 2; s < sl; s++){\n const slen1 = vlen * s;\n const slen2 = vlen * (s + 1);\n const a = layeroffset + j + slen1, b = layeroffset + k + slen1, c = layeroffset + k + slen2, d = layeroffset + j + slen2;\n f4(a, b, c, d);\n }\n }\n }\n function v(x, y, z) {\n placeholder.push(x);\n placeholder.push(y);\n placeholder.push(z);\n }\n function f3(a, b, c) {\n addVertex(a);\n addVertex(b);\n addVertex(c);\n const nextIndex = verticesArray.length / 3;\n const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n }\n function f4(a, b, c, d) {\n addVertex(a);\n addVertex(b);\n addVertex(d);\n addVertex(b);\n addVertex(c);\n addVertex(d);\n const nextIndex = verticesArray.length / 3;\n const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[3]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n addUV(uvs[3]);\n }\n function addVertex(index) {\n verticesArray.push(placeholder[index * 3 + 0]);\n verticesArray.push(placeholder[index * 3 + 1]);\n verticesArray.push(placeholder[index * 3 + 2]);\n }\n function addUV(vector2) {\n uvArray.push(vector2.x);\n uvArray.push(vector2.y);\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n const shapes = this.parameters.shapes;\n const options = this.parameters.options;\n return $a315ee31802fb757$var$toJSON$1(shapes, options, data);\n }\n static fromJSON(data, shapes) {\n const geometryShapes = [];\n for(let j = 0, jl = data.shapes.length; j < jl; j++){\n const shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n const extrudePath = data.options.extrudePath;\n if (extrudePath !== undefined) data.options.extrudePath = new $a315ee31802fb757$var$Curves[extrudePath.type]().fromJSON(extrudePath);\n return new $a315ee31802fb757$export$598697a1efa63ca7(geometryShapes, data.options);\n }\n}\nconst $a315ee31802fb757$var$WorldUVGenerator = {\n generateTopUV: function(geometry, vertices, indexA, indexB, indexC) {\n const a_x = vertices[indexA * 3];\n const a_y = vertices[indexA * 3 + 1];\n const b_x = vertices[indexB * 3];\n const b_y = vertices[indexB * 3 + 1];\n const c_x = vertices[indexC * 3];\n const c_y = vertices[indexC * 3 + 1];\n return [\n new $a315ee31802fb757$export$c977b3e384af9ae1(a_x, a_y),\n new $a315ee31802fb757$export$c977b3e384af9ae1(b_x, b_y),\n new $a315ee31802fb757$export$c977b3e384af9ae1(c_x, c_y)\n ];\n },\n generateSideWallUV: function(geometry, vertices, indexA, indexB, indexC, indexD) {\n const a_x = vertices[indexA * 3];\n const a_y = vertices[indexA * 3 + 1];\n const a_z = vertices[indexA * 3 + 2];\n const b_x = vertices[indexB * 3];\n const b_y = vertices[indexB * 3 + 1];\n const b_z = vertices[indexB * 3 + 2];\n const c_x = vertices[indexC * 3];\n const c_y = vertices[indexC * 3 + 1];\n const c_z = vertices[indexC * 3 + 2];\n const d_x = vertices[indexD * 3];\n const d_y = vertices[indexD * 3 + 1];\n const d_z = vertices[indexD * 3 + 2];\n if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) return [\n new $a315ee31802fb757$export$c977b3e384af9ae1(a_x, 1 - a_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(b_x, 1 - b_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(c_x, 1 - c_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(d_x, 1 - d_z)\n ];\n else return [\n new $a315ee31802fb757$export$c977b3e384af9ae1(a_y, 1 - a_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(b_y, 1 - b_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(c_y, 1 - c_z),\n new $a315ee31802fb757$export$c977b3e384af9ae1(d_y, 1 - d_z)\n ];\n }\n};\nfunction $a315ee31802fb757$var$toJSON$1(shapes, options, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n else data.shapes.push(shapes.uuid);\n data.options = Object.assign({}, options);\n if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON();\n return data;\n}\nclass $a315ee31802fb757$export$9567cc828c9535da extends $a315ee31802fb757$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const t = (1 + Math.sqrt(5)) / 2;\n const vertices = [\n -1,\n t,\n 0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n 0,\n 0,\n -1,\n t,\n 0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n t,\n 0,\n -1,\n t,\n 0,\n 1,\n -t,\n 0,\n -1,\n -t,\n 0,\n 1\n ];\n const indices = [\n 0,\n 11,\n 5,\n 0,\n 5,\n 1,\n 0,\n 1,\n 7,\n 0,\n 7,\n 10,\n 0,\n 10,\n 11,\n 1,\n 5,\n 9,\n 5,\n 11,\n 4,\n 11,\n 10,\n 2,\n 10,\n 7,\n 6,\n 7,\n 1,\n 8,\n 3,\n 9,\n 4,\n 3,\n 4,\n 2,\n 3,\n 2,\n 6,\n 3,\n 6,\n 8,\n 3,\n 8,\n 9,\n 4,\n 9,\n 5,\n 2,\n 4,\n 11,\n 6,\n 2,\n 10,\n 8,\n 6,\n 7,\n 9,\n 8,\n 1\n ];\n super(vertices, indices, radius, detail);\n this.type = \"IcosahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$9567cc828c9535da(data.radius, data.detail);\n }\n}\nclass $a315ee31802fb757$export$1954e2b809fe361e extends $a315ee31802fb757$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const vertices = [\n 1,\n 0,\n 0,\n -1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -1\n ];\n const indices = [\n 0,\n 2,\n 4,\n 0,\n 4,\n 3,\n 0,\n 3,\n 5,\n 0,\n 5,\n 2,\n 1,\n 2,\n 5,\n 1,\n 5,\n 3,\n 1,\n 3,\n 4,\n 1,\n 4,\n 2\n ];\n super(vertices, indices, radius, detail);\n this.type = \"OctahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$1954e2b809fe361e(data.radius, data.detail);\n }\n}\nclass $a315ee31802fb757$export$68cb731f50f614af extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"RingGeometry\";\n this.parameters = {\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n thetaSegments: thetaSegments,\n phiSegments: phiSegments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n thetaSegments = Math.max(3, thetaSegments);\n phiSegments = Math.max(1, phiSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // some helper variables\n let radius = innerRadius;\n const radiusStep = (outerRadius - innerRadius) / phiSegments;\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const uv = new $a315ee31802fb757$export$c977b3e384af9ae1();\n // generate vertices, normals and uvs\n for(let j = 0; j <= phiSegments; j++){\n for(let i = 0; i <= thetaSegments; i++){\n // values are generate from the inside of the ring to the outside\n const segment = thetaStart + i / thetaSegments * thetaLength;\n // vertex\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, 0, 1);\n // uv\n uv.x = (vertex.x / outerRadius + 1) / 2;\n uv.y = (vertex.y / outerRadius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n // increase the radius for next row of vertices\n radius += radiusStep;\n }\n // indices\n for(let j = 0; j < phiSegments; j++){\n const thetaSegmentLevel = j * (thetaSegments + 1);\n for(let i = 0; i < thetaSegments; i++){\n const segment = i + thetaSegmentLevel;\n const a = segment;\n const b = segment + thetaSegments + 1;\n const c = segment + thetaSegments + 2;\n const d = segment + 1;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$68cb731f50f614af(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength);\n }\n}\nclass $a315ee31802fb757$export$57a29a1c803e9065 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(shapes = new $a315ee31802fb757$export$6428a7f2611ef1fa([\n new $a315ee31802fb757$export$c977b3e384af9ae1(0, 0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(-0.5, -0.5),\n new $a315ee31802fb757$export$c977b3e384af9ae1(0.5, -0.5)\n ]), curveSegments = 12){\n super();\n this.type = \"ShapeGeometry\";\n this.parameters = {\n shapes: shapes,\n curveSegments: curveSegments\n };\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let groupStart = 0;\n let groupCount = 0;\n // allow single and array values for \"shapes\" parameter\n if (Array.isArray(shapes) === false) addShape(shapes);\n else for(let i = 0; i < shapes.length; i++){\n addShape(shapes[i]);\n this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support\n groupStart += groupCount;\n groupCount = 0;\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n // helper functions\n function addShape(shape) {\n const indexOffset = vertices.length / 3;\n const points = shape.extractPoints(curveSegments);\n let shapeVertices = points.shape;\n const shapeHoles = points.holes;\n // check direction of vertices\n if ($a315ee31802fb757$export$96bdf6d9c66d7ba8.isClockWise(shapeVertices) === false) shapeVertices = shapeVertices.reverse();\n for(let i = 0, l = shapeHoles.length; i < l; i++){\n const shapeHole = shapeHoles[i];\n if ($a315ee31802fb757$export$96bdf6d9c66d7ba8.isClockWise(shapeHole) === true) shapeHoles[i] = shapeHole.reverse();\n }\n const faces = $a315ee31802fb757$export$96bdf6d9c66d7ba8.triangulateShape(shapeVertices, shapeHoles);\n // join vertices of inner and outer paths to a single array\n for(let i = 0, l = shapeHoles.length; i < l; i++){\n const shapeHole = shapeHoles[i];\n shapeVertices = shapeVertices.concat(shapeHole);\n }\n // vertices, normals, uvs\n for(let i = 0, l = shapeVertices.length; i < l; i++){\n const vertex = shapeVertices[i];\n vertices.push(vertex.x, vertex.y, 0);\n normals.push(0, 0, 1);\n uvs.push(vertex.x, vertex.y); // world uvs\n }\n // indices\n for(let i = 0, l = faces.length; i < l; i++){\n const face = faces[i];\n const a = face[0] + indexOffset;\n const b = face[1] + indexOffset;\n const c = face[2] + indexOffset;\n indices.push(a, b, c);\n groupCount += 3;\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n const shapes = this.parameters.shapes;\n return $a315ee31802fb757$var$toJSON(shapes, data);\n }\n static fromJSON(data, shapes) {\n const geometryShapes = [];\n for(let j = 0, jl = data.shapes.length; j < jl; j++){\n const shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n return new $a315ee31802fb757$export$57a29a1c803e9065(geometryShapes, data.curveSegments);\n }\n}\nfunction $a315ee31802fb757$var$toJSON(shapes, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n else data.shapes.push(shapes.uuid);\n return data;\n}\nclass $a315ee31802fb757$export$1b417fc3b307a251 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI){\n super();\n this.type = \"SphereGeometry\";\n this.parameters = {\n radius: radius,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n phiStart: phiStart,\n phiLength: phiLength,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n widthSegments = Math.max(3, Math.floor(widthSegments));\n heightSegments = Math.max(2, Math.floor(heightSegments));\n const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);\n let index = 0;\n const grid = [];\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // generate vertices, normals and uvs\n for(let iy = 0; iy <= heightSegments; iy++){\n const verticesRow = [];\n const v = iy / heightSegments;\n // special case for the poles\n let uOffset = 0;\n if (iy === 0 && thetaStart === 0) uOffset = 0.5 / widthSegments;\n else if (iy === heightSegments && thetaEnd === Math.PI) uOffset = -0.5 / widthSegments;\n for(let ix = 0; ix <= widthSegments; ix++){\n const u = ix / widthSegments;\n // vertex\n vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertex.y = radius * Math.cos(thetaStart + v * thetaLength);\n vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.copy(vertex).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u + uOffset, 1 - v);\n verticesRow.push(index++);\n }\n grid.push(verticesRow);\n }\n // indices\n for(let iy = 0; iy < heightSegments; iy++)for(let ix = 0; ix < widthSegments; ix++){\n const a = grid[iy][ix + 1];\n const b = grid[iy][ix];\n const c = grid[iy + 1][ix];\n const d = grid[iy + 1][ix + 1];\n if (iy !== 0 || thetaStart > 0) indices.push(a, b, d);\n if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$1b417fc3b307a251(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);\n }\n}\nclass $a315ee31802fb757$export$fb3f7adc68bd6e02 extends $a315ee31802fb757$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const vertices = [\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n 1,\n -1,\n 1,\n -1,\n -1\n ];\n const indices = [\n 2,\n 1,\n 0,\n 0,\n 3,\n 2,\n 1,\n 3,\n 0,\n 2,\n 3,\n 1\n ];\n super(vertices, indices, radius, detail);\n this.type = \"TetrahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$fb3f7adc68bd6e02(data.radius, data.detail);\n }\n}\nclass $a315ee31802fb757$export$a2312a2a1fa56495 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2){\n super();\n this.type = \"TorusGeometry\";\n this.parameters = {\n radius: radius,\n tube: tube,\n radialSegments: radialSegments,\n tubularSegments: tubularSegments,\n arc: arc\n };\n radialSegments = Math.floor(radialSegments);\n tubularSegments = Math.floor(tubularSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const center = new $a315ee31802fb757$export$64b5c384219d3699();\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let j = 0; j <= radialSegments; j++)for(let i = 0; i <= tubularSegments; i++){\n const u = i / tubularSegments * arc;\n const v = j / radialSegments * Math.PI * 2;\n // vertex\n vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u);\n vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u);\n vertex.z = tube * Math.sin(v);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n center.x = radius * Math.cos(u);\n center.y = radius * Math.sin(u);\n normal.subVectors(vertex, center).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n // generate indices\n for(let j = 1; j <= radialSegments; j++)for(let i = 1; i <= tubularSegments; i++){\n // indices\n const a = (tubularSegments + 1) * j + i - 1;\n const b = (tubularSegments + 1) * (j - 1) + i - 1;\n const c = (tubularSegments + 1) * (j - 1) + i;\n const d = (tubularSegments + 1) * j + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$a2312a2a1fa56495(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);\n }\n}\nclass $a315ee31802fb757$export$77e9bfadfb9ab8c8 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3){\n super();\n this.type = \"TorusKnotGeometry\";\n this.parameters = {\n radius: radius,\n tube: tube,\n tubularSegments: tubularSegments,\n radialSegments: radialSegments,\n p: p,\n q: q\n };\n tubularSegments = Math.floor(tubularSegments);\n radialSegments = Math.floor(radialSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n const P1 = new $a315ee31802fb757$export$64b5c384219d3699();\n const P2 = new $a315ee31802fb757$export$64b5c384219d3699();\n const B = new $a315ee31802fb757$export$64b5c384219d3699();\n const T = new $a315ee31802fb757$export$64b5c384219d3699();\n const N = new $a315ee31802fb757$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let i = 0; i <= tubularSegments; ++i){\n // the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n const u = i / tubularSegments * p * Math.PI * 2;\n // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n // these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n calculatePositionOnCurve(u, p, q, radius, P1);\n calculatePositionOnCurve(u + 0.01, p, q, radius, P2);\n // calculate orthonormal basis\n T.subVectors(P2, P1);\n N.addVectors(P2, P1);\n B.crossVectors(T, N);\n N.crossVectors(B, T);\n // normalize B, N. T can be ignored, we don't use it\n B.normalize();\n N.normalize();\n for(let j = 0; j <= radialSegments; ++j){\n // now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n // because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n const v = j / radialSegments * Math.PI * 2;\n const cx = -tube * Math.cos(v);\n const cy = tube * Math.sin(v);\n // now calculate the final vertex position.\n // first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n vertex.x = P1.x + (cx * N.x + cy * B.x);\n vertex.y = P1.y + (cx * N.y + cy * B.y);\n vertex.z = P1.z + (cx * N.z + cy * B.z);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n normal.subVectors(vertex, P1).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n }\n // generate indices\n for(let j = 1; j <= tubularSegments; j++)for(let i = 1; i <= radialSegments; i++){\n // indices\n const a = (radialSegments + 1) * (j - 1) + (i - 1);\n const b = (radialSegments + 1) * j + (i - 1);\n const c = (radialSegments + 1) * j + i;\n const d = (radialSegments + 1) * (j - 1) + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n // this function calculates the current position on the torus curve\n function calculatePositionOnCurve(u, p, q, radius, position) {\n const cu = Math.cos(u);\n const su = Math.sin(u);\n const quOverP = q / p * u;\n const cs = Math.cos(quOverP);\n position.x = radius * (2 + cs) * 0.5 * cu;\n position.y = radius * (2 + cs) * su * 0.5;\n position.z = radius * Math.sin(quOverP) * 0.5;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $a315ee31802fb757$export$77e9bfadfb9ab8c8(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q);\n }\n}\nclass $a315ee31802fb757$export$7897d9d48904490c extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(path = new $a315ee31802fb757$export$bf3f4c7e459f90fc(new $a315ee31802fb757$export$64b5c384219d3699(-1, -1, 0), new $a315ee31802fb757$export$64b5c384219d3699(-1, 1, 0), new $a315ee31802fb757$export$64b5c384219d3699(1, 1, 0)), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false){\n super();\n this.type = \"TubeGeometry\";\n this.parameters = {\n path: path,\n tubularSegments: tubularSegments,\n radius: radius,\n radialSegments: radialSegments,\n closed: closed\n };\n const frames = path.computeFrenetFrames(tubularSegments, closed);\n // expose internals\n this.tangents = frames.tangents;\n this.normals = frames.normals;\n this.binormals = frames.binormals;\n // helper variables\n const vertex = new $a315ee31802fb757$export$64b5c384219d3699();\n const normal = new $a315ee31802fb757$export$64b5c384219d3699();\n const uv = new $a315ee31802fb757$export$c977b3e384af9ae1();\n let P = new $a315ee31802fb757$export$64b5c384219d3699();\n // buffer\n const vertices = [];\n const normals = [];\n const uvs = [];\n const indices = [];\n // create buffer data\n generateBufferData();\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $a315ee31802fb757$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $a315ee31802fb757$export$cbe7a62641830ebd(uvs, 2));\n // functions\n function generateBufferData() {\n for(let i = 0; i < tubularSegments; i++)generateSegment(i);\n // if the geometry is not closed, generate the last row of vertices and normals\n // at the regular position on the given path\n //\n // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n generateSegment(closed === false ? tubularSegments : 0);\n // uvs are generated in a separate function.\n // this makes it easy compute correct values for closed geometries\n generateUVs();\n // finally create faces\n generateIndices();\n }\n function generateSegment(i) {\n // we use getPointAt to sample evenly distributed points from the given path\n P = path.getPointAt(i / tubularSegments, P);\n // retrieve corresponding normal and binormal\n const N = frames.normals[i];\n const B = frames.binormals[i];\n // generate normals and vertices for the current segment\n for(let j = 0; j <= radialSegments; j++){\n const v = j / radialSegments * Math.PI * 2;\n const sin = Math.sin(v);\n const cos = -Math.cos(v);\n // normal\n normal.x = cos * N.x + sin * B.x;\n normal.y = cos * N.y + sin * B.y;\n normal.z = cos * N.z + sin * B.z;\n normal.normalize();\n normals.push(normal.x, normal.y, normal.z);\n // vertex\n vertex.x = P.x + radius * normal.x;\n vertex.y = P.y + radius * normal.y;\n vertex.z = P.z + radius * normal.z;\n vertices.push(vertex.x, vertex.y, vertex.z);\n }\n }\n function generateIndices() {\n for(let j = 1; j <= tubularSegments; j++)for(let i = 1; i <= radialSegments; i++){\n const a = (radialSegments + 1) * (j - 1) + (i - 1);\n const b = (radialSegments + 1) * j + (i - 1);\n const c = (radialSegments + 1) * j + i;\n const d = (radialSegments + 1) * (j - 1) + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n function generateUVs() {\n for(let i = 0; i <= tubularSegments; i++)for(let j = 0; j <= radialSegments; j++){\n uv.x = i / tubularSegments;\n uv.y = j / radialSegments;\n uvs.push(uv.x, uv.y);\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.path = this.parameters.path.toJSON();\n return data;\n }\n static fromJSON(data) {\n // This only works for built-in curves (e.g. CatmullRomCurve3).\n // User defined curves or instances of CurvePath will not be deserialized.\n return new $a315ee31802fb757$export$7897d9d48904490c(new $a315ee31802fb757$var$Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed);\n }\n}\nclass $a315ee31802fb757$export$4b739da06d24892b extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(geometry = null){\n super();\n this.type = \"WireframeGeometry\";\n this.parameters = {\n geometry: geometry\n };\n if (geometry !== null) {\n // buffer\n const vertices = [];\n const edges = new Set();\n // helper variables\n const start = new $a315ee31802fb757$export$64b5c384219d3699();\n const end = new $a315ee31802fb757$export$64b5c384219d3699();\n if (geometry.index !== null) {\n // indexed BufferGeometry\n const position = geometry.attributes.position;\n const indices = geometry.index;\n let groups = geometry.groups;\n if (groups.length === 0) groups = [\n {\n start: 0,\n count: indices.count,\n materialIndex: 0\n }\n ];\n // create a data structure that contains all edges without duplicates\n for(let o = 0, ol = groups.length; o < ol; ++o){\n const group = groups[o];\n const groupStart = group.start;\n const groupCount = group.count;\n for(let i = groupStart, l = groupStart + groupCount; i < l; i += 3)for(let j = 0; j < 3; j++){\n const index1 = indices.getX(i + j);\n const index2 = indices.getX(i + (j + 1) % 3);\n start.fromBufferAttribute(position, index1);\n end.fromBufferAttribute(position, index2);\n if ($a315ee31802fb757$var$isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n } else {\n // non-indexed BufferGeometry\n const position = geometry.attributes.position;\n for(let i = 0, l = position.count / 3; i < l; i++)for(let j = 0; j < 3; j++){\n // three edges per triangle, an edge is represented as (index1, index2)\n // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n const index1 = 3 * i + j;\n const index2 = 3 * i + (j + 1) % 3;\n start.fromBufferAttribute(position, index1);\n end.fromBufferAttribute(position, index2);\n if ($a315ee31802fb757$var$isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n // build geometry\n this.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n}\nfunction $a315ee31802fb757$var$isUniqueEdge(start, end, edges) {\n const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n if (edges.has(hash1) === true || edges.has(hash2) === true) return false;\n else {\n edges.add(hash1);\n edges.add(hash2);\n return true;\n }\n}\nvar $a315ee31802fb757$var$Geometries = /*#__PURE__*/ Object.freeze({\n __proto__: null,\n BoxGeometry: $a315ee31802fb757$export$33e43285f7406bd5,\n CapsuleGeometry: $a315ee31802fb757$export$41680e8551036033,\n CircleGeometry: $a315ee31802fb757$export$d5c0e8d607467193,\n ConeGeometry: $a315ee31802fb757$export$a7a48974f285c9b3,\n CylinderGeometry: $a315ee31802fb757$export$68f745719dbe5198,\n DodecahedronGeometry: $a315ee31802fb757$export$c0babfeb8708fc9c,\n EdgesGeometry: $a315ee31802fb757$export$4730b1542707547f,\n ExtrudeGeometry: $a315ee31802fb757$export$598697a1efa63ca7,\n IcosahedronGeometry: $a315ee31802fb757$export$9567cc828c9535da,\n LatheGeometry: $a315ee31802fb757$export$6d839803fcd1882c,\n OctahedronGeometry: $a315ee31802fb757$export$1954e2b809fe361e,\n PlaneGeometry: $a315ee31802fb757$export$967d831af31f69ce,\n PolyhedronGeometry: $a315ee31802fb757$export$60e57a7d3f20ff65,\n RingGeometry: $a315ee31802fb757$export$68cb731f50f614af,\n ShapeGeometry: $a315ee31802fb757$export$57a29a1c803e9065,\n SphereGeometry: $a315ee31802fb757$export$1b417fc3b307a251,\n TetrahedronGeometry: $a315ee31802fb757$export$fb3f7adc68bd6e02,\n TorusGeometry: $a315ee31802fb757$export$a2312a2a1fa56495,\n TorusKnotGeometry: $a315ee31802fb757$export$77e9bfadfb9ab8c8,\n TubeGeometry: $a315ee31802fb757$export$7897d9d48904490c,\n WireframeGeometry: $a315ee31802fb757$export$4b739da06d24892b\n});\nclass $a315ee31802fb757$export$e8564da406055a3 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isShadowMaterial = true;\n this.type = \"ShadowMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.transparent = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$21c421a2e1df9d22 extends $a315ee31802fb757$export$83c7d75d550a8b0d {\n constructor(parameters){\n super(parameters);\n this.isRawShaderMaterial = true;\n this.type = \"RawShaderMaterial\";\n }\n}\nclass $a315ee31802fb757$export$f2980790215acccd extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshStandardMaterial = true;\n this.defines = {\n \"STANDARD\": \"\"\n };\n this.type = \"MeshStandardMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff); // diffuse\n this.roughness = 1.0;\n this.metalness = 0.0;\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.roughnessMap = null;\n this.metalnessMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.envMapIntensity = 1.0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"STANDARD\": \"\"\n };\n this.color.copy(source.color);\n this.roughness = source.roughness;\n this.metalness = source.metalness;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.roughnessMap = source.roughnessMap;\n this.metalnessMap = source.metalnessMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.envMapIntensity = source.envMapIntensity;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$28d04986c4269c9f extends $a315ee31802fb757$export$f2980790215acccd {\n constructor(parameters){\n super();\n this.isMeshPhysicalMaterial = true;\n this.defines = {\n \"STANDARD\": \"\",\n \"PHYSICAL\": \"\"\n };\n this.type = \"MeshPhysicalMaterial\";\n this.anisotropyRotation = 0;\n this.anisotropyMap = null;\n this.clearcoatMap = null;\n this.clearcoatRoughness = 0.0;\n this.clearcoatRoughnessMap = null;\n this.clearcoatNormalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.clearcoatNormalMap = null;\n this.ior = 1.5;\n Object.defineProperty(this, \"reflectivity\", {\n get: function() {\n return $a315ee31802fb757$var$clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);\n },\n set: function(reflectivity) {\n this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity);\n }\n });\n this.iridescenceMap = null;\n this.iridescenceIOR = 1.3;\n this.iridescenceThicknessRange = [\n 100,\n 400\n ];\n this.iridescenceThicknessMap = null;\n this.sheenColor = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.sheenColorMap = null;\n this.sheenRoughness = 1.0;\n this.sheenRoughnessMap = null;\n this.transmissionMap = null;\n this.thickness = 0;\n this.thicknessMap = null;\n this.attenuationDistance = Infinity;\n this.attenuationColor = new $a315ee31802fb757$export$892596cec99bc70e(1, 1, 1);\n this.specularIntensity = 1.0;\n this.specularIntensityMap = null;\n this.specularColor = new $a315ee31802fb757$export$892596cec99bc70e(1, 1, 1);\n this.specularColorMap = null;\n this._anisotropy = 0;\n this._clearcoat = 0;\n this._iridescence = 0;\n this._sheen = 0.0;\n this._transmission = 0;\n this.setValues(parameters);\n }\n get anisotropy() {\n return this._anisotropy;\n }\n set anisotropy(value) {\n if (this._anisotropy > 0 !== value > 0) this.version++;\n this._anisotropy = value;\n }\n get clearcoat() {\n return this._clearcoat;\n }\n set clearcoat(value) {\n if (this._clearcoat > 0 !== value > 0) this.version++;\n this._clearcoat = value;\n }\n get iridescence() {\n return this._iridescence;\n }\n set iridescence(value) {\n if (this._iridescence > 0 !== value > 0) this.version++;\n this._iridescence = value;\n }\n get sheen() {\n return this._sheen;\n }\n set sheen(value) {\n if (this._sheen > 0 !== value > 0) this.version++;\n this._sheen = value;\n }\n get transmission() {\n return this._transmission;\n }\n set transmission(value) {\n if (this._transmission > 0 !== value > 0) this.version++;\n this._transmission = value;\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"STANDARD\": \"\",\n \"PHYSICAL\": \"\"\n };\n this.anisotropy = source.anisotropy;\n this.anisotropyRotation = source.anisotropyRotation;\n this.anisotropyMap = source.anisotropyMap;\n this.clearcoat = source.clearcoat;\n this.clearcoatMap = source.clearcoatMap;\n this.clearcoatRoughness = source.clearcoatRoughness;\n this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n this.clearcoatNormalMap = source.clearcoatNormalMap;\n this.clearcoatNormalScale.copy(source.clearcoatNormalScale);\n this.ior = source.ior;\n this.iridescence = source.iridescence;\n this.iridescenceMap = source.iridescenceMap;\n this.iridescenceIOR = source.iridescenceIOR;\n this.iridescenceThicknessRange = [\n ...source.iridescenceThicknessRange\n ];\n this.iridescenceThicknessMap = source.iridescenceThicknessMap;\n this.sheen = source.sheen;\n this.sheenColor.copy(source.sheenColor);\n this.sheenColorMap = source.sheenColorMap;\n this.sheenRoughness = source.sheenRoughness;\n this.sheenRoughnessMap = source.sheenRoughnessMap;\n this.transmission = source.transmission;\n this.transmissionMap = source.transmissionMap;\n this.thickness = source.thickness;\n this.thicknessMap = source.thicknessMap;\n this.attenuationDistance = source.attenuationDistance;\n this.attenuationColor.copy(source.attenuationColor);\n this.specularIntensity = source.specularIntensity;\n this.specularIntensityMap = source.specularIntensityMap;\n this.specularColor.copy(source.specularColor);\n this.specularColorMap = source.specularColorMap;\n return this;\n }\n}\nclass $a315ee31802fb757$export$24c72f71cbaf0678 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshPhongMaterial = true;\n this.type = \"MeshPhongMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff); // diffuse\n this.specular = new $a315ee31802fb757$export$892596cec99bc70e(0x111111);\n this.shininess = 30;\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $a315ee31802fb757$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.specular.copy(source.specular);\n this.shininess = source.shininess;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$df893cf97e765622 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshToonMaterial = true;\n this.defines = {\n \"TOON\": \"\"\n };\n this.type = \"MeshToonMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.gradientMap = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.alphaMap = null;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.gradientMap = source.gradientMap;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$bfe8c0a091f41ae7 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshNormalMaterial = true;\n this.type = \"MeshNormalMaterial\";\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.flatShading = false;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.flatShading = source.flatShading;\n return this;\n }\n}\nclass $a315ee31802fb757$export$5023a9a8114806b8 extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshLambertMaterial = true;\n this.type = \"MeshLambertMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff); // diffuse\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $a315ee31802fb757$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $a315ee31802fb757$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$6f5fef6235ec12ee extends $a315ee31802fb757$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshMatcapMaterial = true;\n this.defines = {\n \"MATCAP\": \"\"\n };\n this.type = \"MeshMatcapMaterial\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff); // diffuse\n this.matcap = null;\n this.map = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $a315ee31802fb757$export$2852a58ebdac27b8;\n this.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.alphaMap = null;\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"MATCAP\": \"\"\n };\n this.color.copy(source.color);\n this.matcap = source.matcap;\n this.map = source.map;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $a315ee31802fb757$export$327886a3efaeaebe extends $a315ee31802fb757$export$fbaaa33907730a0c {\n constructor(parameters){\n super();\n this.isLineDashedMaterial = true;\n this.type = \"LineDashedMaterial\";\n this.scale = 1;\n this.dashSize = 3;\n this.gapSize = 1;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.scale = source.scale;\n this.dashSize = source.dashSize;\n this.gapSize = source.gapSize;\n return this;\n }\n}\n// same as Array.prototype.slice, but also works on typed arrays\nfunction $a315ee31802fb757$var$arraySlice(array, from, to) {\n if ($a315ee31802fb757$var$isTypedArray(array)) // in ios9 array.subarray(from, undefined) will return empty array\n // but array.subarray(from) or array.subarray(from, len) is correct\n return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));\n return array.slice(from, to);\n}\n// converts an array to a specific type\nfunction $a315ee31802fb757$var$convertArray(array, type, forceClone) {\n if (!array || // let 'undefined' and 'null' pass\n !forceClone && array.constructor === type) return array;\n if (typeof type.BYTES_PER_ELEMENT === \"number\") return new type(array); // create typed array\n return Array.prototype.slice.call(array); // create Array\n}\nfunction $a315ee31802fb757$var$isTypedArray(object) {\n return ArrayBuffer.isView(object) && !(object instanceof DataView);\n}\n// returns an array by which times and values can be sorted\nfunction $a315ee31802fb757$var$getKeyframeOrder(times) {\n function compareTime(i, j) {\n return times[i] - times[j];\n }\n const n = times.length;\n const result = new Array(n);\n for(let i = 0; i !== n; ++i)result[i] = i;\n result.sort(compareTime);\n return result;\n}\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction $a315ee31802fb757$var$sortedArray(values, stride, order) {\n const nValues = values.length;\n const result = new values.constructor(nValues);\n for(let i = 0, dstOffset = 0; dstOffset !== nValues; ++i){\n const srcOffset = order[i] * stride;\n for(let j = 0; j !== stride; ++j)result[dstOffset++] = values[srcOffset + j];\n }\n return result;\n}\n// function for parsing AOS keyframe formats\nfunction $a315ee31802fb757$var$flattenJSON(jsonKeys, times, values, valuePropertyName) {\n let i = 1, key = jsonKeys[0];\n while(key !== undefined && key[valuePropertyName] === undefined)key = jsonKeys[i++];\n if (key === undefined) return; // no data\n let value = key[valuePropertyName];\n if (value === undefined) return; // no data\n if (Array.isArray(value)) do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push.apply(values, value); // push all elements\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n else if (value.toArray !== undefined) // ...assume THREE.Math-ish\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n value.toArray(values, values.length);\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n else // otherwise push as-is\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push(value);\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n}\nfunction $a315ee31802fb757$var$subclip(sourceClip, name, startFrame, endFrame, fps = 30) {\n const clip = sourceClip.clone();\n clip.name = name;\n const tracks = [];\n for(let i = 0; i < clip.tracks.length; ++i){\n const track = clip.tracks[i];\n const valueSize = track.getValueSize();\n const times = [];\n const values = [];\n for(let j = 0; j < track.times.length; ++j){\n const frame = track.times[j] * fps;\n if (frame < startFrame || frame >= endFrame) continue;\n times.push(track.times[j]);\n for(let k = 0; k < valueSize; ++k)values.push(track.values[j * valueSize + k]);\n }\n if (times.length === 0) continue;\n track.times = $a315ee31802fb757$var$convertArray(times, track.times.constructor);\n track.values = $a315ee31802fb757$var$convertArray(values, track.values.constructor);\n tracks.push(track);\n }\n clip.tracks = tracks;\n // find minimum .times value across all tracks in the trimmed clip\n let minStartTime = Infinity;\n for(let i = 0; i < clip.tracks.length; ++i)if (minStartTime > clip.tracks[i].times[0]) minStartTime = clip.tracks[i].times[0];\n // shift all tracks such that clip begins at t=0\n for(let i = 0; i < clip.tracks.length; ++i)clip.tracks[i].shift(-1 * minStartTime);\n clip.resetDuration();\n return clip;\n}\nfunction $a315ee31802fb757$var$makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {\n if (fps <= 0) fps = 30;\n const numTracks = referenceClip.tracks.length;\n const referenceTime = referenceFrame / fps;\n // Make each track's values relative to the values at the reference frame\n for(let i = 0; i < numTracks; ++i){\n const referenceTrack = referenceClip.tracks[i];\n const referenceTrackType = referenceTrack.ValueTypeName;\n // Skip this track if it's non-numeric\n if (referenceTrackType === \"bool\" || referenceTrackType === \"string\") continue;\n // Find the track in the target clip whose name and type matches the reference track\n const targetTrack = targetClip.tracks.find(function(track) {\n return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;\n });\n if (targetTrack === undefined) continue;\n let referenceOffset = 0;\n const referenceValueSize = referenceTrack.getValueSize();\n if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) referenceOffset = referenceValueSize / 3;\n let targetOffset = 0;\n const targetValueSize = targetTrack.getValueSize();\n if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) targetOffset = targetValueSize / 3;\n const lastIndex = referenceTrack.times.length - 1;\n let referenceValue;\n // Find the value to subtract out of the track\n if (referenceTime <= referenceTrack.times[0]) {\n // Reference frame is earlier than the first keyframe, so just use the first keyframe\n const startIndex = referenceOffset;\n const endIndex = referenceValueSize - referenceOffset;\n referenceValue = $a315ee31802fb757$var$arraySlice(referenceTrack.values, startIndex, endIndex);\n } else if (referenceTime >= referenceTrack.times[lastIndex]) {\n // Reference frame is after the last keyframe, so just use the last keyframe\n const startIndex = lastIndex * referenceValueSize + referenceOffset;\n const endIndex = startIndex + referenceValueSize - referenceOffset;\n referenceValue = $a315ee31802fb757$var$arraySlice(referenceTrack.values, startIndex, endIndex);\n } else {\n // Interpolate to the reference value\n const interpolant = referenceTrack.createInterpolant();\n const startIndex = referenceOffset;\n const endIndex = referenceValueSize - referenceOffset;\n interpolant.evaluate(referenceTime);\n referenceValue = $a315ee31802fb757$var$arraySlice(interpolant.resultBuffer, startIndex, endIndex);\n }\n // Conjugate the quaternion\n if (referenceTrackType === \"quaternion\") {\n const referenceQuat = new $a315ee31802fb757$export$23d6a54f0bbc85a3().fromArray(referenceValue).normalize().conjugate();\n referenceQuat.toArray(referenceValue);\n }\n // Subtract the reference value from all of the track values\n const numTimes = targetTrack.times.length;\n for(let j = 0; j < numTimes; ++j){\n const valueStart = j * targetValueSize + targetOffset;\n if (referenceTrackType === \"quaternion\") // Multiply the conjugate for quaternion track types\n $a315ee31802fb757$export$23d6a54f0bbc85a3.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);\n else {\n const valueEnd = targetValueSize - targetOffset * 2;\n // Subtract each value for all other numeric track types\n for(let k = 0; k < valueEnd; ++k)targetTrack.values[valueStart + k] -= referenceValue[k];\n }\n }\n }\n targetClip.blendMode = $a315ee31802fb757$export$d875e029ef558d3;\n return targetClip;\n}\nconst $a315ee31802fb757$export$7ee8caa573e71ad1 = {\n arraySlice: $a315ee31802fb757$var$arraySlice,\n convertArray: $a315ee31802fb757$var$convertArray,\n isTypedArray: $a315ee31802fb757$var$isTypedArray,\n getKeyframeOrder: $a315ee31802fb757$var$getKeyframeOrder,\n sortedArray: $a315ee31802fb757$var$sortedArray,\n flattenJSON: $a315ee31802fb757$var$flattenJSON,\n subclip: $a315ee31802fb757$var$subclip,\n makeClipAdditive: $a315ee31802fb757$var$makeClipAdditive\n};\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */ class $a315ee31802fb757$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n this.parameterPositions = parameterPositions;\n this._cachedIndex = 0;\n this.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor(sampleSize);\n this.sampleValues = sampleValues;\n this.valueSize = sampleSize;\n this.settings = null;\n this.DefaultSettings_ = {};\n }\n evaluate(t) {\n const pp = this.parameterPositions;\n let i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1];\n validate_interval: {\n seek: {\n let right;\n linear_scan: {\n //- See http://jsperf.com/comparison-to-undefined/3\n //- slower code:\n //-\n //- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n forward_scan: if (!(t < t1)) {\n for(let giveUpAt = i1 + 2;;){\n if (t1 === undefined) {\n if (t < t0) break forward_scan;\n // after end\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n if (i1 === giveUpAt) break; // this loop\n t0 = t1;\n t1 = pp[++i1];\n if (t < t1) break seek;\n }\n // prepare binary search on the right side of the index\n right = pp.length;\n break linear_scan;\n }\n //- slower code:\n //-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n if (!(t >= t0)) {\n // looping?\n const t1global = pp[1];\n if (t < t1global) {\n i1 = 2; // + 1, using the scan for the details\n t0 = t1global;\n }\n // linear reverse scan\n for(let giveUpAt = i1 - 2;;){\n if (t0 === undefined) {\n // before start\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (i1 === giveUpAt) break; // this loop\n t1 = t0;\n t0 = pp[--i1 - 1];\n if (t >= t0) break seek;\n }\n // prepare binary search on the left side of the index\n right = i1;\n i1 = 0;\n break linear_scan;\n }\n break validate_interval;\n } // linear scan\n // binary search\n while(i1 < right){\n const mid = i1 + right >>> 1;\n if (t < pp[mid]) right = mid;\n else i1 = mid + 1;\n }\n t1 = pp[i1];\n t0 = pp[i1 - 1];\n // check boundary cases, again\n if (t0 === undefined) {\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (t1 === undefined) {\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n } // seek\n this._cachedIndex = i1;\n this.intervalChanged_(i1, t0, t1);\n } // validate_interval\n return this.interpolate_(i1, t0, t, t1);\n }\n getSettings_() {\n return this.settings || this.DefaultSettings_;\n }\n copySampleValue_(index) {\n // copies a sample value to the result buffer\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride;\n for(let i = 0; i !== stride; ++i)result[i] = values[offset + i];\n return result;\n }\n // Template methods for derived classes:\n interpolate_() {\n throw new Error(\"call to abstract method\");\n // implementations shall return this.resultBuffer\n }\n intervalChanged_() {\n // empty\n }\n}\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */ class $a315ee31802fb757$export$3646682e7a3959 extends $a315ee31802fb757$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n this._weightPrev = -0;\n this._offsetPrev = -0;\n this._weightNext = -0;\n this._offsetNext = -0;\n this.DefaultSettings_ = {\n endingStart: $a315ee31802fb757$export$7f795934b84ab523,\n endingEnd: $a315ee31802fb757$export$7f795934b84ab523\n };\n }\n intervalChanged_(i1, t0, t1) {\n const pp = this.parameterPositions;\n let iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext];\n if (tPrev === undefined) switch(this.getSettings_().endingStart){\n case $a315ee31802fb757$export$24a4ccb5099273b5:\n // f'(t0) = 0\n iPrev = i1;\n tPrev = 2 * t0 - t1;\n break;\n case $a315ee31802fb757$export$8e8c3ecdcd8e1fee:\n // use the other end of the curve\n iPrev = pp.length - 2;\n tPrev = t0 + pp[iPrev] - pp[iPrev + 1];\n break;\n default:\n // f''(t0) = 0 a.k.a. Natural Spline\n iPrev = i1;\n tPrev = t1;\n }\n if (tNext === undefined) switch(this.getSettings_().endingEnd){\n case $a315ee31802fb757$export$24a4ccb5099273b5:\n // f'(tN) = 0\n iNext = i1;\n tNext = 2 * t1 - t0;\n break;\n case $a315ee31802fb757$export$8e8c3ecdcd8e1fee:\n // use the other end of the curve\n iNext = 1;\n tNext = t1 + pp[1] - pp[0];\n break;\n default:\n // f''(tN) = 0, a.k.a. Natural Spline\n iNext = i1 - 1;\n tNext = t0;\n }\n const halfDt = (t1 - t0) * 0.5, stride = this.valueSize;\n this._weightPrev = halfDt / (t0 - tPrev);\n this._weightNext = halfDt / (tNext - t1);\n this._offsetPrev = iPrev * stride;\n this._offsetNext = iNext * stride;\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p = (t - t0) / (t1 - t0), pp = p * p, ppp = pp * p;\n // evaluate polynomials\n const sP = -wP * ppp + 2 * wP * pp - wP * p;\n const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1;\n const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p;\n const sN = wN * ppp - wN * pp;\n // combine data linearly\n for(let i = 0; i !== stride; ++i)result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];\n return result;\n }\n}\nclass $a315ee31802fb757$export$a8e6009059f51e1a extends $a315ee31802fb757$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t - t0) / (t1 - t0), weight0 = 1 - weight1;\n for(let i = 0; i !== stride; ++i)result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;\n return result;\n }\n}\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */ class $a315ee31802fb757$export$fb9758ef7ef8d5cc extends $a315ee31802fb757$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1 /*, t0, t, t1 */ ) {\n return this.copySampleValue_(i1 - 1);\n }\n}\nclass $a315ee31802fb757$export$b0e479f45b7006d6 {\n constructor(name, times, values, interpolation){\n if (name === undefined) throw new Error(\"THREE.KeyframeTrack: track name is undefined\");\n if (times === undefined || times.length === 0) throw new Error(\"THREE.KeyframeTrack: no keyframes in track named \" + name);\n this.name = name;\n this.times = $a315ee31802fb757$var$convertArray(times, this.TimeBufferType);\n this.values = $a315ee31802fb757$var$convertArray(values, this.ValueBufferType);\n this.setInterpolation(interpolation || this.DefaultInterpolation);\n }\n // Serialization (in static context, because of constructor invocation\n // and automatic invocation of .toJSON):\n static toJSON(track) {\n const trackType = track.constructor;\n let json;\n // derived classes can define a static toJSON method\n if (trackType.toJSON !== this.toJSON) json = trackType.toJSON(track);\n else {\n // by default, we assume the data can be serialized as-is\n json = {\n \"name\": track.name,\n \"times\": $a315ee31802fb757$var$convertArray(track.times, Array),\n \"values\": $a315ee31802fb757$var$convertArray(track.values, Array)\n };\n const interpolation = track.getInterpolation();\n if (interpolation !== track.DefaultInterpolation) json.interpolation = interpolation;\n }\n json.type = track.ValueTypeName; // mandatory\n return json;\n }\n InterpolantFactoryMethodDiscrete(result) {\n return new $a315ee31802fb757$export$fb9758ef7ef8d5cc(this.times, this.values, this.getValueSize(), result);\n }\n InterpolantFactoryMethodLinear(result) {\n return new $a315ee31802fb757$export$a8e6009059f51e1a(this.times, this.values, this.getValueSize(), result);\n }\n InterpolantFactoryMethodSmooth(result) {\n return new $a315ee31802fb757$export$3646682e7a3959(this.times, this.values, this.getValueSize(), result);\n }\n setInterpolation(interpolation) {\n let factoryMethod;\n switch(interpolation){\n case $a315ee31802fb757$export$995b32462a65e855:\n factoryMethod = this.InterpolantFactoryMethodDiscrete;\n break;\n case $a315ee31802fb757$export$30fac1aace31cf4d:\n factoryMethod = this.InterpolantFactoryMethodLinear;\n break;\n case $a315ee31802fb757$export$198b11ff4c72bb30:\n factoryMethod = this.InterpolantFactoryMethodSmooth;\n break;\n }\n if (factoryMethod === undefined) {\n const message = \"unsupported interpolation for \" + this.ValueTypeName + \" keyframe track named \" + this.name;\n if (this.createInterpolant === undefined) {\n // fall back to default, unless the default itself is messed up\n if (interpolation !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation);\n else throw new Error(message); // fatal, in this case\n }\n console.warn(\"THREE.KeyframeTrack:\", message);\n return this;\n }\n this.createInterpolant = factoryMethod;\n return this;\n }\n getInterpolation() {\n switch(this.createInterpolant){\n case this.InterpolantFactoryMethodDiscrete:\n return $a315ee31802fb757$export$995b32462a65e855;\n case this.InterpolantFactoryMethodLinear:\n return $a315ee31802fb757$export$30fac1aace31cf4d;\n case this.InterpolantFactoryMethodSmooth:\n return $a315ee31802fb757$export$198b11ff4c72bb30;\n }\n }\n getValueSize() {\n return this.values.length / this.times.length;\n }\n // move all keyframes either forwards or backwards in time\n shift(timeOffset) {\n if (timeOffset !== 0.0) {\n const times = this.times;\n for(let i = 0, n = times.length; i !== n; ++i)times[i] += timeOffset;\n }\n return this;\n }\n // scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n scale(timeScale) {\n if (timeScale !== 1.0) {\n const times = this.times;\n for(let i = 0, n = times.length; i !== n; ++i)times[i] *= timeScale;\n }\n return this;\n }\n // removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n trim(startTime, endTime) {\n const times = this.times, nKeys = times.length;\n let from = 0, to = nKeys - 1;\n while(from !== nKeys && times[from] < startTime)++from;\n while(to !== -1 && times[to] > endTime)--to;\n ++to; // inclusive -> exclusive bound\n if (from !== 0 || to !== nKeys) {\n // empty tracks are forbidden, so keep at least one keyframe\n if (from >= to) {\n to = Math.max(to, 1);\n from = to - 1;\n }\n const stride = this.getValueSize();\n this.times = $a315ee31802fb757$var$arraySlice(times, from, to);\n this.values = $a315ee31802fb757$var$arraySlice(this.values, from * stride, to * stride);\n }\n return this;\n }\n // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n validate() {\n let valid = true;\n const valueSize = this.getValueSize();\n if (valueSize - Math.floor(valueSize) !== 0) {\n console.error(\"THREE.KeyframeTrack: Invalid value size in track.\", this);\n valid = false;\n }\n const times = this.times, values = this.values, nKeys = times.length;\n if (nKeys === 0) {\n console.error(\"THREE.KeyframeTrack: Track is empty.\", this);\n valid = false;\n }\n let prevTime = null;\n for(let i = 0; i !== nKeys; i++){\n const currTime = times[i];\n if (typeof currTime === \"number\" && isNaN(currTime)) {\n console.error(\"THREE.KeyframeTrack: Time is not a valid number.\", this, i, currTime);\n valid = false;\n break;\n }\n if (prevTime !== null && prevTime > currTime) {\n console.error(\"THREE.KeyframeTrack: Out of order keys.\", this, i, currTime, prevTime);\n valid = false;\n break;\n }\n prevTime = currTime;\n }\n if (values !== undefined) {\n if ($a315ee31802fb757$var$isTypedArray(values)) for(let i = 0, n = values.length; i !== n; ++i){\n const value = values[i];\n if (isNaN(value)) {\n console.error(\"THREE.KeyframeTrack: Value is not a valid number.\", this, i, value);\n valid = false;\n break;\n }\n }\n }\n return valid;\n }\n // removes equivalent sequential keys as common in morph target sequences\n // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n optimize() {\n // times or values may be shared with other tracks, so overwriting is unsafe\n const times = $a315ee31802fb757$var$arraySlice(this.times), values = $a315ee31802fb757$var$arraySlice(this.values), stride = this.getValueSize(), smoothInterpolation = this.getInterpolation() === $a315ee31802fb757$export$198b11ff4c72bb30, lastIndex = times.length - 1;\n let writeIndex = 1;\n for(let i = 1; i < lastIndex; ++i){\n let keep = false;\n const time = times[i];\n const timeNext = times[i + 1];\n // remove adjacent keyframes scheduled at the same time\n if (time !== timeNext && (i !== 1 || time !== times[0])) {\n if (!smoothInterpolation) {\n // remove unnecessary keyframes same as their neighbors\n const offset = i * stride, offsetP = offset - stride, offsetN = offset + stride;\n for(let j = 0; j !== stride; ++j){\n const value = values[offset + j];\n if (value !== values[offsetP + j] || value !== values[offsetN + j]) {\n keep = true;\n break;\n }\n }\n } else keep = true;\n }\n // in-place compaction\n if (keep) {\n if (i !== writeIndex) {\n times[writeIndex] = times[i];\n const readOffset = i * stride, writeOffset = writeIndex * stride;\n for(let j = 0; j !== stride; ++j)values[writeOffset + j] = values[readOffset + j];\n }\n ++writeIndex;\n }\n }\n // flush last keyframe (compaction looks ahead)\n if (lastIndex > 0) {\n times[writeIndex] = times[lastIndex];\n for(let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j)values[writeOffset + j] = values[readOffset + j];\n ++writeIndex;\n }\n if (writeIndex !== times.length) {\n this.times = $a315ee31802fb757$var$arraySlice(times, 0, writeIndex);\n this.values = $a315ee31802fb757$var$arraySlice(values, 0, writeIndex * stride);\n } else {\n this.times = times;\n this.values = values;\n }\n return this;\n }\n clone() {\n const times = $a315ee31802fb757$var$arraySlice(this.times, 0);\n const values = $a315ee31802fb757$var$arraySlice(this.values, 0);\n const TypedKeyframeTrack = this.constructor;\n const track = new TypedKeyframeTrack(this.name, times, values);\n // Interpolant argument to constructor is not saved, so copy the factory method directly.\n track.createInterpolant = this.createInterpolant;\n return track;\n }\n}\n$a315ee31802fb757$export$b0e479f45b7006d6.prototype.TimeBufferType = Float32Array;\n$a315ee31802fb757$export$b0e479f45b7006d6.prototype.ValueBufferType = Float32Array;\n$a315ee31802fb757$export$b0e479f45b7006d6.prototype.DefaultInterpolation = $a315ee31802fb757$export$30fac1aace31cf4d;\n/**\n * A Track of Boolean keyframe values.\n */ class $a315ee31802fb757$export$d3a344b98cf0b775 extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n}\n$a315ee31802fb757$export$d3a344b98cf0b775.prototype.ValueTypeName = \"bool\";\n$a315ee31802fb757$export$d3a344b98cf0b775.prototype.ValueBufferType = Array;\n$a315ee31802fb757$export$d3a344b98cf0b775.prototype.DefaultInterpolation = $a315ee31802fb757$export$995b32462a65e855;\n$a315ee31802fb757$export$d3a344b98cf0b775.prototype.InterpolantFactoryMethodLinear = undefined;\n$a315ee31802fb757$export$d3a344b98cf0b775.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track of keyframe values that represent color.\n */ class $a315ee31802fb757$export$83444c5d885347d8 extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n}\n$a315ee31802fb757$export$83444c5d885347d8.prototype.ValueTypeName = \"color\";\n/**\n * A Track of numeric keyframe values.\n */ class $a315ee31802fb757$export$d45f0d1a4d9a9314 extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n}\n$a315ee31802fb757$export$d45f0d1a4d9a9314.prototype.ValueTypeName = \"number\";\n/**\n * Spherical linear unit quaternion interpolant.\n */ class $a315ee31802fb757$export$2db1cfb7923d931e extends $a315ee31802fb757$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t - t0) / (t1 - t0);\n let offset = i1 * stride;\n for(let end = offset + stride; offset !== end; offset += 4)$a315ee31802fb757$export$23d6a54f0bbc85a3.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);\n return result;\n }\n}\n/**\n * A Track of quaternion keyframe values.\n */ class $a315ee31802fb757$export$b8043f12b5aafbd7 extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n InterpolantFactoryMethodLinear(result) {\n return new $a315ee31802fb757$export$2db1cfb7923d931e(this.times, this.values, this.getValueSize(), result);\n }\n}\n$a315ee31802fb757$export$b8043f12b5aafbd7.prototype.ValueTypeName = \"quaternion\";\n// ValueBufferType is inherited\n$a315ee31802fb757$export$b8043f12b5aafbd7.prototype.DefaultInterpolation = $a315ee31802fb757$export$30fac1aace31cf4d;\n$a315ee31802fb757$export$b8043f12b5aafbd7.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track that interpolates Strings\n */ class $a315ee31802fb757$export$6ce41d4f3a8df9cd extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n}\n$a315ee31802fb757$export$6ce41d4f3a8df9cd.prototype.ValueTypeName = \"string\";\n$a315ee31802fb757$export$6ce41d4f3a8df9cd.prototype.ValueBufferType = Array;\n$a315ee31802fb757$export$6ce41d4f3a8df9cd.prototype.DefaultInterpolation = $a315ee31802fb757$export$995b32462a65e855;\n$a315ee31802fb757$export$6ce41d4f3a8df9cd.prototype.InterpolantFactoryMethodLinear = undefined;\n$a315ee31802fb757$export$6ce41d4f3a8df9cd.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track of vectored keyframe values.\n */ class $a315ee31802fb757$export$5ce2dcb4cc9f2bff extends $a315ee31802fb757$export$b0e479f45b7006d6 {\n}\n$a315ee31802fb757$export$5ce2dcb4cc9f2bff.prototype.ValueTypeName = \"vector\";\nclass $a315ee31802fb757$export$d942c706bf23829c {\n constructor(name, duration = -1, tracks, blendMode = $a315ee31802fb757$export$bcfbbdcf8de7f8cd){\n this.name = name;\n this.tracks = tracks;\n this.duration = duration;\n this.blendMode = blendMode;\n this.uuid = $a315ee31802fb757$var$generateUUID();\n // this means it should figure out its duration by scanning the tracks\n if (this.duration < 0) this.resetDuration();\n }\n static parse(json) {\n const tracks = [], jsonTracks = json.tracks, frameTime = 1.0 / (json.fps || 1.0);\n for(let i = 0, n = jsonTracks.length; i !== n; ++i)tracks.push($a315ee31802fb757$var$parseKeyframeTrack(jsonTracks[i]).scale(frameTime));\n const clip = new this(json.name, json.duration, tracks, json.blendMode);\n clip.uuid = json.uuid;\n return clip;\n }\n static toJSON(clip) {\n const tracks = [], clipTracks = clip.tracks;\n const json = {\n \"name\": clip.name,\n \"duration\": clip.duration,\n \"tracks\": tracks,\n \"uuid\": clip.uuid,\n \"blendMode\": clip.blendMode\n };\n for(let i = 0, n = clipTracks.length; i !== n; ++i)tracks.push($a315ee31802fb757$export$b0e479f45b7006d6.toJSON(clipTracks[i]));\n return json;\n }\n static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) {\n const numMorphTargets = morphTargetSequence.length;\n const tracks = [];\n for(let i = 0; i < numMorphTargets; i++){\n let times = [];\n let values = [];\n times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);\n values.push(0, 1, 0);\n const order = $a315ee31802fb757$var$getKeyframeOrder(times);\n times = $a315ee31802fb757$var$sortedArray(times, 1, order);\n values = $a315ee31802fb757$var$sortedArray(values, 1, order);\n // if there is a key at the first frame, duplicate it as the\n // last frame as well for perfect loop.\n if (!noLoop && times[0] === 0) {\n times.push(numMorphTargets);\n values.push(values[0]);\n }\n tracks.push(new $a315ee31802fb757$export$d45f0d1a4d9a9314(\".morphTargetInfluences[\" + morphTargetSequence[i].name + \"]\", times, values).scale(1.0 / fps));\n }\n return new this(name, -1, tracks);\n }\n static findByName(objectOrClipArray, name) {\n let clipArray = objectOrClipArray;\n if (!Array.isArray(objectOrClipArray)) {\n const o = objectOrClipArray;\n clipArray = o.geometry && o.geometry.animations || o.animations;\n }\n for(let i = 0; i < clipArray.length; i++){\n if (clipArray[i].name === name) return clipArray[i];\n }\n return null;\n }\n static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) {\n const animationToMorphTargets = {};\n // tested with https://regex101.com/ on trick sequences\n // such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n const pattern = /^([\\w-]*?)([\\d]+)$/;\n // sort morph target names into animation groups based\n // patterns like Walk_001, Walk_002, Run_001, Run_002\n for(let i = 0, il = morphTargets.length; i < il; i++){\n const morphTarget = morphTargets[i];\n const parts = morphTarget.name.match(pattern);\n if (parts && parts.length > 1) {\n const name = parts[1];\n let animationMorphTargets = animationToMorphTargets[name];\n if (!animationMorphTargets) animationToMorphTargets[name] = animationMorphTargets = [];\n animationMorphTargets.push(morphTarget);\n }\n }\n const clips = [];\n for(const name in animationToMorphTargets)clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop));\n return clips;\n }\n // parse the animation.hierarchy format\n static parseAnimation(animation, bones) {\n if (!animation) {\n console.error(\"THREE.AnimationClip: No animation in JSONLoader data.\");\n return null;\n }\n const addNonemptyTrack = function(trackType, trackName, animationKeys, propertyName, destTracks) {\n // only return track if there are actually keys.\n if (animationKeys.length !== 0) {\n const times = [];\n const values = [];\n $a315ee31802fb757$var$flattenJSON(animationKeys, times, values, propertyName);\n // empty keys are filtered out, so check again\n if (times.length !== 0) destTracks.push(new trackType(trackName, times, values));\n }\n };\n const tracks = [];\n const clipName = animation.name || \"default\";\n const fps = animation.fps || 30;\n const blendMode = animation.blendMode;\n // automatic length determination in AnimationClip.\n let duration = animation.length || -1;\n const hierarchyTracks = animation.hierarchy || [];\n for(let h = 0; h < hierarchyTracks.length; h++){\n const animationKeys = hierarchyTracks[h].keys;\n // skip empty tracks\n if (!animationKeys || animationKeys.length === 0) continue;\n // process morph targets\n if (animationKeys[0].morphTargets) {\n // figure out all morph targets used in this track\n const morphTargetNames = {};\n let k;\n for(k = 0; k < animationKeys.length; k++){\n if (animationKeys[k].morphTargets) for(let m = 0; m < animationKeys[k].morphTargets.length; m++)morphTargetNames[animationKeys[k].morphTargets[m]] = -1;\n }\n // create a track for each morph target with all zero\n // morphTargetInfluences except for the keys in which\n // the morphTarget is named.\n for(const morphTargetName in morphTargetNames){\n const times = [];\n const values = [];\n for(let m = 0; m !== animationKeys[k].morphTargets.length; ++m){\n const animationKey = animationKeys[k];\n times.push(animationKey.time);\n values.push(animationKey.morphTarget === morphTargetName ? 1 : 0);\n }\n tracks.push(new $a315ee31802fb757$export$d45f0d1a4d9a9314(\".morphTargetInfluence[\" + morphTargetName + \"]\", times, values));\n }\n duration = morphTargetNames.length * fps;\n } else {\n // ...assume skeletal animation\n const boneName = \".bones[\" + bones[h].name + \"]\";\n addNonemptyTrack($a315ee31802fb757$export$5ce2dcb4cc9f2bff, boneName + \".position\", animationKeys, \"pos\", tracks);\n addNonemptyTrack($a315ee31802fb757$export$b8043f12b5aafbd7, boneName + \".quaternion\", animationKeys, \"rot\", tracks);\n addNonemptyTrack($a315ee31802fb757$export$5ce2dcb4cc9f2bff, boneName + \".scale\", animationKeys, \"scl\", tracks);\n }\n }\n if (tracks.length === 0) return null;\n const clip = new this(clipName, duration, tracks, blendMode);\n return clip;\n }\n resetDuration() {\n const tracks = this.tracks;\n let duration = 0;\n for(let i = 0, n = tracks.length; i !== n; ++i){\n const track = this.tracks[i];\n duration = Math.max(duration, track.times[track.times.length - 1]);\n }\n this.duration = duration;\n return this;\n }\n trim() {\n for(let i = 0; i < this.tracks.length; i++)this.tracks[i].trim(0, this.duration);\n return this;\n }\n validate() {\n let valid = true;\n for(let i = 0; i < this.tracks.length; i++)valid = valid && this.tracks[i].validate();\n return valid;\n }\n optimize() {\n for(let i = 0; i < this.tracks.length; i++)this.tracks[i].optimize();\n return this;\n }\n clone() {\n const tracks = [];\n for(let i = 0; i < this.tracks.length; i++)tracks.push(this.tracks[i].clone());\n return new this.constructor(this.name, this.duration, tracks, this.blendMode);\n }\n toJSON() {\n return this.constructor.toJSON(this);\n }\n}\nfunction $a315ee31802fb757$var$getTrackTypeForValueTypeName(typeName) {\n switch(typeName.toLowerCase()){\n case \"scalar\":\n case \"double\":\n case \"float\":\n case \"number\":\n case \"integer\":\n return $a315ee31802fb757$export$d45f0d1a4d9a9314;\n case \"vector\":\n case \"vector2\":\n case \"vector3\":\n case \"vector4\":\n return $a315ee31802fb757$export$5ce2dcb4cc9f2bff;\n case \"color\":\n return $a315ee31802fb757$export$83444c5d885347d8;\n case \"quaternion\":\n return $a315ee31802fb757$export$b8043f12b5aafbd7;\n case \"bool\":\n case \"boolean\":\n return $a315ee31802fb757$export$d3a344b98cf0b775;\n case \"string\":\n return $a315ee31802fb757$export$6ce41d4f3a8df9cd;\n }\n throw new Error(\"THREE.KeyframeTrack: Unsupported typeName: \" + typeName);\n}\nfunction $a315ee31802fb757$var$parseKeyframeTrack(json) {\n if (json.type === undefined) throw new Error(\"THREE.KeyframeTrack: track type undefined, can not parse\");\n const trackType = $a315ee31802fb757$var$getTrackTypeForValueTypeName(json.type);\n if (json.times === undefined) {\n const times = [], values = [];\n $a315ee31802fb757$var$flattenJSON(json.keys, times, values, \"value\");\n json.times = times;\n json.values = values;\n }\n // derived classes can define a static parse method\n if (trackType.parse !== undefined) return trackType.parse(json);\n else // by default, we assume a constructor compatible with the base\n return new trackType(json.name, json.times, json.values, json.interpolation);\n}\nconst $a315ee31802fb757$export$94affb487e701bf2 = {\n enabled: false,\n files: {},\n add: function(key, file) {\n if (this.enabled === false) return;\n // console.log( 'THREE.Cache', 'Adding key:', key );\n this.files[key] = file;\n },\n get: function(key) {\n if (this.enabled === false) return;\n // console.log( 'THREE.Cache', 'Checking key:', key );\n return this.files[key];\n },\n remove: function(key) {\n delete this.files[key];\n },\n clear: function() {\n this.files = {};\n }\n};\nclass $a315ee31802fb757$export$99cc795e99919eed {\n constructor(onLoad, onProgress, onError){\n const scope = this;\n let isLoading = false;\n let itemsLoaded = 0;\n let itemsTotal = 0;\n let urlModifier = undefined;\n const handlers = [];\n // Refer to #5689 for the reason why we don't set .onStart\n // in the constructor\n this.onStart = undefined;\n this.onLoad = onLoad;\n this.onProgress = onProgress;\n this.onError = onError;\n this.itemStart = function(url) {\n itemsTotal++;\n if (isLoading === false) {\n if (scope.onStart !== undefined) scope.onStart(url, itemsLoaded, itemsTotal);\n }\n isLoading = true;\n };\n this.itemEnd = function(url) {\n itemsLoaded++;\n if (scope.onProgress !== undefined) scope.onProgress(url, itemsLoaded, itemsTotal);\n if (itemsLoaded === itemsTotal) {\n isLoading = false;\n if (scope.onLoad !== undefined) scope.onLoad();\n }\n };\n this.itemError = function(url) {\n if (scope.onError !== undefined) scope.onError(url);\n };\n this.resolveURL = function(url) {\n if (urlModifier) return urlModifier(url);\n return url;\n };\n this.setURLModifier = function(transform) {\n urlModifier = transform;\n return this;\n };\n this.addHandler = function(regex, loader) {\n handlers.push(regex, loader);\n return this;\n };\n this.removeHandler = function(regex) {\n const index = handlers.indexOf(regex);\n if (index !== -1) handlers.splice(index, 2);\n return this;\n };\n this.getHandler = function(file) {\n for(let i = 0, l = handlers.length; i < l; i += 2){\n const regex = handlers[i];\n const loader = handlers[i + 1];\n if (regex.global) regex.lastIndex = 0; // see #17920\n if (regex.test(file)) return loader;\n }\n return null;\n };\n }\n}\nconst $a315ee31802fb757$export$b033c3f9a95c6a16 = /*@__PURE__*/ new $a315ee31802fb757$export$99cc795e99919eed();\nclass $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n this.manager = manager !== undefined ? manager : $a315ee31802fb757$export$b033c3f9a95c6a16;\n this.crossOrigin = \"anonymous\";\n this.withCredentials = false;\n this.path = \"\";\n this.resourcePath = \"\";\n this.requestHeader = {};\n }\n load() {}\n loadAsync(url, onProgress) {\n const scope = this;\n return new Promise(function(resolve, reject) {\n scope.load(url, resolve, onProgress, reject);\n });\n }\n parse() {}\n setCrossOrigin(crossOrigin) {\n this.crossOrigin = crossOrigin;\n return this;\n }\n setWithCredentials(value) {\n this.withCredentials = value;\n return this;\n }\n setPath(path) {\n this.path = path;\n return this;\n }\n setResourcePath(resourcePath) {\n this.resourcePath = resourcePath;\n return this;\n }\n setRequestHeader(requestHeader) {\n this.requestHeader = requestHeader;\n return this;\n }\n}\n$a315ee31802fb757$export$3b0d6d7590275603.DEFAULT_MATERIAL_NAME = \"__DEFAULT\";\nconst $a315ee31802fb757$var$loading = {};\nclass $a315ee31802fb757$var$HttpError extends Error {\n constructor(message, response){\n super(message);\n this.response = response;\n }\n}\nclass $a315ee31802fb757$export$98435a25b5cf7b2b extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n if (url === undefined) url = \"\";\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const cached = $a315ee31802fb757$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n this.manager.itemStart(url);\n setTimeout(()=>{\n if (onLoad) onLoad(cached);\n this.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n // Check if request is duplicate\n if ($a315ee31802fb757$var$loading[url] !== undefined) {\n $a315ee31802fb757$var$loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n return;\n }\n // Initialise array for duplicate requests\n $a315ee31802fb757$var$loading[url] = [];\n $a315ee31802fb757$var$loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n // create request\n const req = new Request(url, {\n headers: new Headers(this.requestHeader),\n credentials: this.withCredentials ? \"include\" : \"same-origin\"\n });\n // record states ( avoid data race )\n const mimeType = this.mimeType;\n const responseType = this.responseType;\n // start the fetch\n fetch(req).then((response)=>{\n if (response.status === 200 || response.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n if (response.status === 0) console.warn(\"THREE.FileLoader: HTTP Status 0 received.\");\n // Workaround: Checking if response.body === undefined for Alipay browser #23548\n if (typeof ReadableStream === \"undefined\" || response.body === undefined || response.body.getReader === undefined) return response;\n const callbacks = $a315ee31802fb757$var$loading[url];\n const reader = response.body.getReader();\n // Nginx needs X-File-Size check\n // https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n const contentLength = response.headers.get(\"Content-Length\") || response.headers.get(\"X-File-Size\");\n const total = contentLength ? parseInt(contentLength) : 0;\n const lengthComputable = total !== 0;\n let loaded = 0;\n // periodically read data into the new stream tracking while download progress\n const stream = new ReadableStream({\n start (controller) {\n readData();\n function readData() {\n reader.read().then(({ done: done, value: value })=>{\n if (done) controller.close();\n else {\n loaded += value.byteLength;\n const event = new ProgressEvent(\"progress\", {\n lengthComputable: lengthComputable,\n loaded: loaded,\n total: total\n });\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onProgress) callback.onProgress(event);\n }\n controller.enqueue(value);\n readData();\n }\n });\n }\n }\n });\n return new Response(stream);\n } else throw new $a315ee31802fb757$var$HttpError(`fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response);\n }).then((response)=>{\n switch(responseType){\n case \"arraybuffer\":\n return response.arrayBuffer();\n case \"blob\":\n return response.blob();\n case \"document\":\n return response.text().then((text)=>{\n const parser = new DOMParser();\n return parser.parseFromString(text, mimeType);\n });\n case \"json\":\n return response.json();\n default:\n if (mimeType === undefined) return response.text();\n else {\n // sniff encoding\n const re = /charset=\"?([^;\"\\s]*)\"?/i;\n const exec = re.exec(mimeType);\n const label = exec && exec[1] ? exec[1].toLowerCase() : undefined;\n const decoder = new TextDecoder(label);\n return response.arrayBuffer().then((ab)=>decoder.decode(ab));\n }\n }\n }).then((data)=>{\n // Add to cache only on HTTP success, so that we do not cache\n // error response bodies as proper responses to requests.\n $a315ee31802fb757$export$94affb487e701bf2.add(url, data);\n const callbacks = $a315ee31802fb757$var$loading[url];\n delete $a315ee31802fb757$var$loading[url];\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onLoad) callback.onLoad(data);\n }\n }).catch((err)=>{\n // Abort errors and other errors are handled the same\n const callbacks = $a315ee31802fb757$var$loading[url];\n if (callbacks === undefined) {\n // When onLoad was called and url was deleted in `loading`\n this.manager.itemError(url);\n throw err;\n }\n delete $a315ee31802fb757$var$loading[url];\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onError) callback.onError(err);\n }\n this.manager.itemError(url);\n }).finally(()=>{\n this.manager.itemEnd(url);\n });\n this.manager.itemStart(url);\n }\n setResponseType(value) {\n this.responseType = value;\n return this;\n }\n setMimeType(value) {\n this.mimeType = value;\n return this;\n }\n}\nclass $a315ee31802fb757$export$29711c7e14f61db extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const animations = [];\n for(let i = 0; i < json.length; i++){\n const clip = $a315ee31802fb757$export$d942c706bf23829c.parse(json[i]);\n animations.push(clip);\n }\n return animations;\n }\n}\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */ class $a315ee31802fb757$export$bd73ce947a280350 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const images = [];\n const texture = new $a315ee31802fb757$export$3466bac9141a5cc4();\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n let loaded = 0;\n function loadTexture(i) {\n loader.load(url[i], function(buffer) {\n const texDatas = scope.parse(buffer, true);\n images[i] = {\n width: texDatas.width,\n height: texDatas.height,\n format: texDatas.format,\n mipmaps: texDatas.mipmaps\n };\n loaded += 1;\n if (loaded === 6) {\n if (texDatas.mipmapCount === 1) texture.minFilter = $a315ee31802fb757$export$8a72f490b25c56c8;\n texture.image = images;\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, onProgress, onError);\n }\n if (Array.isArray(url)) for(let i = 0, il = url.length; i < il; ++i)loadTexture(i);\n else // compressed cubemap texture stored in a single DDS file\n loader.load(url, function(buffer) {\n const texDatas = scope.parse(buffer, true);\n if (texDatas.isCubemap) {\n const faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n for(let f = 0; f < faces; f++){\n images[f] = {\n mipmaps: []\n };\n for(let i = 0; i < texDatas.mipmapCount; i++){\n images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]);\n images[f].format = texDatas.format;\n images[f].width = texDatas.width;\n images[f].height = texDatas.height;\n }\n }\n texture.image = images;\n } else {\n texture.image.width = texDatas.width;\n texture.image.height = texDatas.height;\n texture.mipmaps = texDatas.mipmaps;\n }\n if (texDatas.mipmapCount === 1) texture.minFilter = $a315ee31802fb757$export$8a72f490b25c56c8;\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $a315ee31802fb757$export$8905ce1c7a2464a1 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const scope = this;\n const cached = $a315ee31802fb757$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function() {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n const image = $a315ee31802fb757$var$createElementNS(\"img\");\n function onImageLoad() {\n removeEventListeners();\n $a315ee31802fb757$export$94affb487e701bf2.add(url, this);\n if (onLoad) onLoad(this);\n scope.manager.itemEnd(url);\n }\n function onImageError(event) {\n removeEventListeners();\n if (onError) onError(event);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n }\n function removeEventListeners() {\n image.removeEventListener(\"load\", onImageLoad, false);\n image.removeEventListener(\"error\", onImageError, false);\n }\n image.addEventListener(\"load\", onImageLoad, false);\n image.addEventListener(\"error\", onImageError, false);\n if (url.slice(0, 5) !== \"data:\") {\n if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin;\n }\n scope.manager.itemStart(url);\n image.src = url;\n return image;\n }\n}\nclass $a315ee31802fb757$export$2ec114afc2cf6308 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(urls, onLoad, onProgress, onError) {\n const texture = new $a315ee31802fb757$export$ee2e5a18258a4049();\n texture.colorSpace = $a315ee31802fb757$export$561f394b24edfcaa;\n const loader = new $a315ee31802fb757$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n let loaded = 0;\n function loadTexture(i) {\n loader.load(urls[i], function(image) {\n texture.images[i] = image;\n loaded++;\n if (loaded === 6) {\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, undefined, onError);\n }\n for(let i = 0; i < urls.length; ++i)loadTexture(i);\n return texture;\n }\n}\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */ class $a315ee31802fb757$export$792d8a18f2c55855 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const texture = new $a315ee31802fb757$export$b691f601014eabe1();\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setPath(this.path);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(buffer) {\n let texData;\n try {\n texData = scope.parse(buffer);\n } catch (error) {\n if (onError !== undefined) onError(error);\n else {\n console.error(error);\n return;\n }\n }\n if (!texData) return onError(); // TODO: Remove this when all loaders properly throw errors\n if (texData.image !== undefined) texture.image = texData.image;\n else if (texData.data !== undefined) {\n texture.image.width = texData.width;\n texture.image.height = texData.height;\n texture.image.data = texData.data;\n }\n texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : $a315ee31802fb757$export$9d9334239a5a5e06;\n texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : $a315ee31802fb757$export$9d9334239a5a5e06;\n texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : $a315ee31802fb757$export$8a72f490b25c56c8;\n texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n if (texData.colorSpace !== undefined) texture.colorSpace = texData.colorSpace;\n else if (texData.encoding !== undefined) texture.encoding = texData.encoding;\n if (texData.flipY !== undefined) texture.flipY = texData.flipY;\n if (texData.format !== undefined) texture.format = texData.format;\n if (texData.type !== undefined) texture.type = texData.type;\n if (texData.mipmaps !== undefined) {\n texture.mipmaps = texData.mipmaps;\n texture.minFilter = $a315ee31802fb757$export$5d8599b6a933fb1b; // presumably...\n }\n if (texData.mipmapCount === 1) texture.minFilter = $a315ee31802fb757$export$8a72f490b25c56c8;\n if (texData.generateMipmaps !== undefined) texture.generateMipmaps = texData.generateMipmaps;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture, texData);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $a315ee31802fb757$export$fd1bfc71f64c538c extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const texture = new $a315ee31802fb757$export$5431306cf43de24a();\n const loader = new $a315ee31802fb757$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n loader.load(url, function(image) {\n texture.image = image;\n texture.needsUpdate = true;\n if (onLoad !== undefined) onLoad(texture);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $a315ee31802fb757$export$6ecadb6ed240d696 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(color, intensity = 1){\n super();\n this.isLight = true;\n this.type = \"Light\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e(color);\n this.intensity = intensity;\n }\n dispose() {\n // Empty here in base class; some subclasses override.\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.color.copy(source.color);\n this.intensity = source.intensity;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.color = this.color.getHex();\n data.object.intensity = this.intensity;\n if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex();\n if (this.distance !== undefined) data.object.distance = this.distance;\n if (this.angle !== undefined) data.object.angle = this.angle;\n if (this.decay !== undefined) data.object.decay = this.decay;\n if (this.penumbra !== undefined) data.object.penumbra = this.penumbra;\n if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON();\n return data;\n }\n}\nclass $a315ee31802fb757$export$8d474f55edbb9624 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(skyColor, groundColor, intensity){\n super(skyColor, intensity);\n this.isHemisphereLight = true;\n this.type = \"HemisphereLight\";\n this.position.copy($a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.groundColor = new $a315ee31802fb757$export$892596cec99bc70e(groundColor);\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.groundColor.copy(source.groundColor);\n return this;\n }\n}\nconst $a315ee31802fb757$var$_projScreenMatrix$1 = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_lightPositionWorld$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_lookTarget$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$var$LightShadow {\n constructor(camera){\n this.camera = camera;\n this.bias = 0;\n this.normalBias = 0;\n this.radius = 1;\n this.blurSamples = 8;\n this.mapSize = new $a315ee31802fb757$export$c977b3e384af9ae1(512, 512);\n this.map = null;\n this.mapPass = null;\n this.matrix = new $a315ee31802fb757$export$2ae72fc923e5eb5();\n this.autoUpdate = true;\n this.needsUpdate = false;\n this._frustum = new $a315ee31802fb757$export$35efe6f4c85463d2();\n this._frameExtents = new $a315ee31802fb757$export$c977b3e384af9ae1(1, 1);\n this._viewportCount = 1;\n this._viewports = [\n new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 0, 1, 1)\n ];\n }\n getViewportCount() {\n return this._viewportCount;\n }\n getFrustum() {\n return this._frustum;\n }\n updateMatrices(light) {\n const shadowCamera = this.camera;\n const shadowMatrix = this.matrix;\n $a315ee31802fb757$var$_lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);\n shadowCamera.position.copy($a315ee31802fb757$var$_lightPositionWorld$1);\n $a315ee31802fb757$var$_lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);\n shadowCamera.lookAt($a315ee31802fb757$var$_lookTarget$1);\n shadowCamera.updateMatrixWorld();\n $a315ee31802fb757$var$_projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix($a315ee31802fb757$var$_projScreenMatrix$1);\n shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);\n shadowMatrix.multiply($a315ee31802fb757$var$_projScreenMatrix$1);\n }\n getViewport(viewportIndex) {\n return this._viewports[viewportIndex];\n }\n getFrameExtents() {\n return this._frameExtents;\n }\n dispose() {\n if (this.map) this.map.dispose();\n if (this.mapPass) this.mapPass.dispose();\n }\n copy(source) {\n this.camera = source.camera.clone();\n this.bias = source.bias;\n this.radius = source.radius;\n this.mapSize.copy(source.mapSize);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n toJSON() {\n const object = {};\n if (this.bias !== 0) object.bias = this.bias;\n if (this.normalBias !== 0) object.normalBias = this.normalBias;\n if (this.radius !== 1) object.radius = this.radius;\n if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();\n object.camera = this.camera.toJSON(false).object;\n delete object.camera.matrix;\n return object;\n }\n}\nclass $a315ee31802fb757$var$SpotLightShadow extends $a315ee31802fb757$var$LightShadow {\n constructor(){\n super(new $a315ee31802fb757$export$74e4ae24825f68d7(50, 1, 0.5, 500));\n this.isSpotLightShadow = true;\n this.focus = 1;\n }\n updateMatrices(light) {\n const camera = this.camera;\n const fov = $a315ee31802fb757$var$RAD2DEG * 2 * light.angle * this.focus;\n const aspect = this.mapSize.width / this.mapSize.height;\n const far = light.distance || camera.far;\n if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) {\n camera.fov = fov;\n camera.aspect = aspect;\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n super.updateMatrices(light);\n }\n copy(source) {\n super.copy(source);\n this.focus = source.focus;\n return this;\n }\n}\nclass $a315ee31802fb757$export$81495cbb73897362 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2){\n super(color, intensity);\n this.isSpotLight = true;\n this.type = \"SpotLight\";\n this.position.copy($a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.target = new $a315ee31802fb757$export$e4dd07dff30cc924();\n this.distance = distance;\n this.angle = angle;\n this.penumbra = penumbra;\n this.decay = decay;\n this.map = null;\n this.shadow = new $a315ee31802fb757$var$SpotLightShadow();\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n return this.intensity * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / Math.PI;\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.distance = source.distance;\n this.angle = source.angle;\n this.penumbra = source.penumbra;\n this.decay = source.decay;\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nconst $a315ee31802fb757$var$_projScreenMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_lightPositionWorld = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_lookTarget = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$var$PointLightShadow extends $a315ee31802fb757$var$LightShadow {\n constructor(){\n super(new $a315ee31802fb757$export$74e4ae24825f68d7(90, 1, 0.5, 500));\n this.isPointLightShadow = true;\n this._frameExtents = new $a315ee31802fb757$export$c977b3e384af9ae1(4, 2);\n this._viewportCount = 6;\n this._viewports = [\n // These viewports map a cube-map onto a 2D texture with the\n // following orientation:\n //\n // xzXZ\n // y Y\n //\n // X - Positive x direction\n // x - Negative x direction\n // Y - Positive y direction\n // y - Negative y direction\n // Z - Positive z direction\n // z - Negative z direction\n // positive X\n new $a315ee31802fb757$export$fa7daccca11cdbe3(2, 1, 1, 1),\n // negative X\n new $a315ee31802fb757$export$fa7daccca11cdbe3(0, 1, 1, 1),\n // positive Z\n new $a315ee31802fb757$export$fa7daccca11cdbe3(3, 1, 1, 1),\n // negative Z\n new $a315ee31802fb757$export$fa7daccca11cdbe3(1, 1, 1, 1),\n // positive Y\n new $a315ee31802fb757$export$fa7daccca11cdbe3(3, 0, 1, 1),\n // negative Y\n new $a315ee31802fb757$export$fa7daccca11cdbe3(1, 0, 1, 1)\n ];\n this._cubeDirections = [\n new $a315ee31802fb757$export$64b5c384219d3699(1, 0, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(-1, 0, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 1),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 0, -1),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, -1, 0)\n ];\n this._cubeUps = [\n new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 1, 0),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 1),\n new $a315ee31802fb757$export$64b5c384219d3699(0, 0, -1)\n ];\n }\n updateMatrices(light, viewportIndex = 0) {\n const camera = this.camera;\n const shadowMatrix = this.matrix;\n const far = light.distance || camera.far;\n if (far !== camera.far) {\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n $a315ee31802fb757$var$_lightPositionWorld.setFromMatrixPosition(light.matrixWorld);\n camera.position.copy($a315ee31802fb757$var$_lightPositionWorld);\n $a315ee31802fb757$var$_lookTarget.copy(camera.position);\n $a315ee31802fb757$var$_lookTarget.add(this._cubeDirections[viewportIndex]);\n camera.up.copy(this._cubeUps[viewportIndex]);\n camera.lookAt($a315ee31802fb757$var$_lookTarget);\n camera.updateMatrixWorld();\n shadowMatrix.makeTranslation(-$a315ee31802fb757$var$_lightPositionWorld.x, -$a315ee31802fb757$var$_lightPositionWorld.y, -$a315ee31802fb757$var$_lightPositionWorld.z);\n $a315ee31802fb757$var$_projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix($a315ee31802fb757$var$_projScreenMatrix);\n }\n}\nclass $a315ee31802fb757$export$4c9c1cb3f0b6f455 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(color, intensity, distance = 0, decay = 2){\n super(color, intensity);\n this.isPointLight = true;\n this.type = \"PointLight\";\n this.distance = distance;\n this.decay = decay;\n this.shadow = new $a315ee31802fb757$var$PointLightShadow();\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n return this.intensity * 4 * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / (4 * Math.PI);\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.distance = source.distance;\n this.decay = source.decay;\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nclass $a315ee31802fb757$var$DirectionalLightShadow extends $a315ee31802fb757$var$LightShadow {\n constructor(){\n super(new $a315ee31802fb757$export$9ebf355ee4ed261b(-5, 5, 5, -5, 0.5, 500));\n this.isDirectionalLightShadow = true;\n }\n}\nclass $a315ee31802fb757$export$3fea33cc9972c868 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(color, intensity){\n super(color, intensity);\n this.isDirectionalLight = true;\n this.type = \"DirectionalLight\";\n this.position.copy($a315ee31802fb757$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.target = new $a315ee31802fb757$export$e4dd07dff30cc924();\n this.shadow = new $a315ee31802fb757$var$DirectionalLightShadow();\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source) {\n super.copy(source);\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nclass $a315ee31802fb757$export$af279bfef9ec2c96 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(color, intensity){\n super(color, intensity);\n this.isAmbientLight = true;\n this.type = \"AmbientLight\";\n }\n}\nclass $a315ee31802fb757$export$61db2d908bbd2429 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(color, intensity, width = 10, height = 10){\n super(color, intensity);\n this.isRectAreaLight = true;\n this.type = \"RectAreaLight\";\n this.width = width;\n this.height = height;\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in nits)\n return this.intensity * this.width * this.height * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in nits) from the desired luminous power (in lumens)\n this.intensity = power / (this.width * this.height * Math.PI);\n }\n copy(source) {\n super.copy(source);\n this.width = source.width;\n this.height = source.height;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.width = this.width;\n data.object.height = this.height;\n return data;\n }\n}\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */ // 3-band SH defined by 9 coefficients\nclass $a315ee31802fb757$export$ba61ce607e1f405a {\n constructor(){\n this.isSphericalHarmonics3 = true;\n this.coefficients = [];\n for(let i = 0; i < 9; i++)this.coefficients.push(new $a315ee31802fb757$export$64b5c384219d3699());\n }\n set(coefficients) {\n for(let i = 0; i < 9; i++)this.coefficients[i].copy(coefficients[i]);\n return this;\n }\n zero() {\n for(let i = 0; i < 9; i++)this.coefficients[i].set(0, 0, 0);\n return this;\n }\n // get the radiance in the direction of the normal\n // target is a Vector3\n getAt(normal, target) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n const coeff = this.coefficients;\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.282095);\n // band 1\n target.addScaledVector(coeff[1], 0.488603 * y);\n target.addScaledVector(coeff[2], 0.488603 * z);\n target.addScaledVector(coeff[3], 0.488603 * x);\n // band 2\n target.addScaledVector(coeff[4], 1.092548 * (x * y));\n target.addScaledVector(coeff[5], 1.092548 * (y * z));\n target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0));\n target.addScaledVector(coeff[7], 1.092548 * (x * z));\n target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y));\n return target;\n }\n // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n // target is a Vector3\n // https://graphics.stanford.edu/papers/envmap/envmap.pdf\n getIrradianceAt(normal, target) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n const coeff = this.coefficients;\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095\n // band 1\n target.addScaledVector(coeff[1], 1.023328 * y); // ( 2 * π / 3 ) * 0.488603\n target.addScaledVector(coeff[2], 1.023328 * z);\n target.addScaledVector(coeff[3], 1.023328 * x);\n // band 2\n target.addScaledVector(coeff[4], 0.858086 * x * y); // ( π / 4 ) * 1.092548\n target.addScaledVector(coeff[5], 0.858086 * y * z);\n target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( π / 4 ) * 0.315392 * 3\n target.addScaledVector(coeff[7], 0.858086 * x * z);\n target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274\n return target;\n }\n add(sh) {\n for(let i = 0; i < 9; i++)this.coefficients[i].add(sh.coefficients[i]);\n return this;\n }\n addScaledSH(sh, s) {\n for(let i = 0; i < 9; i++)this.coefficients[i].addScaledVector(sh.coefficients[i], s);\n return this;\n }\n scale(s) {\n for(let i = 0; i < 9; i++)this.coefficients[i].multiplyScalar(s);\n return this;\n }\n lerp(sh, alpha) {\n for(let i = 0; i < 9; i++)this.coefficients[i].lerp(sh.coefficients[i], alpha);\n return this;\n }\n equals(sh) {\n for(let i = 0; i < 9; i++){\n if (!this.coefficients[i].equals(sh.coefficients[i])) return false;\n }\n return true;\n }\n copy(sh) {\n return this.set(sh.coefficients);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n fromArray(array, offset = 0) {\n const coefficients = this.coefficients;\n for(let i = 0; i < 9; i++)coefficients[i].fromArray(array, offset + i * 3);\n return this;\n }\n toArray(array = [], offset = 0) {\n const coefficients = this.coefficients;\n for(let i = 0; i < 9; i++)coefficients[i].toArray(array, offset + i * 3);\n return array;\n }\n // evaluate the basis functions\n // shBasis is an Array[ 9 ]\n static getBasisAt(normal, shBasis) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n // band 0\n shBasis[0] = 0.282095;\n // band 1\n shBasis[1] = 0.488603 * y;\n shBasis[2] = 0.488603 * z;\n shBasis[3] = 0.488603 * x;\n // band 2\n shBasis[4] = 1.092548 * x * y;\n shBasis[5] = 1.092548 * y * z;\n shBasis[6] = 0.315392 * (3 * z * z - 1);\n shBasis[7] = 1.092548 * x * z;\n shBasis[8] = 0.546274 * (x * x - y * y);\n }\n}\nclass $a315ee31802fb757$export$e7ef036e309b38d2 extends $a315ee31802fb757$export$6ecadb6ed240d696 {\n constructor(sh = new $a315ee31802fb757$export$ba61ce607e1f405a(), intensity = 1){\n super(undefined, intensity);\n this.isLightProbe = true;\n this.sh = sh;\n }\n copy(source) {\n super.copy(source);\n this.sh.copy(source.sh);\n return this;\n }\n fromJSON(json) {\n this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n this.sh.fromArray(json.sh);\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.sh = this.sh.toArray();\n return data;\n }\n}\nclass $a315ee31802fb757$export$3bd6d323353dcf96 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n this.textures = {};\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const textures = this.textures;\n function getTexture(name) {\n if (textures[name] === undefined) console.warn(\"THREE.MaterialLoader: Undefined texture\", name);\n return textures[name];\n }\n const material = $a315ee31802fb757$export$3bd6d323353dcf96.createMaterialFromType(json.type);\n if (json.uuid !== undefined) material.uuid = json.uuid;\n if (json.name !== undefined) material.name = json.name;\n if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);\n if (json.roughness !== undefined) material.roughness = json.roughness;\n if (json.metalness !== undefined) material.metalness = json.metalness;\n if (json.sheen !== undefined) material.sheen = json.sheen;\n if (json.sheenColor !== undefined) material.sheenColor = new $a315ee31802fb757$export$892596cec99bc70e().setHex(json.sheenColor);\n if (json.sheenRoughness !== undefined) material.sheenRoughness = json.sheenRoughness;\n if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);\n if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);\n if (json.specularIntensity !== undefined) material.specularIntensity = json.specularIntensity;\n if (json.specularColor !== undefined && material.specularColor !== undefined) material.specularColor.setHex(json.specularColor);\n if (json.shininess !== undefined) material.shininess = json.shininess;\n if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;\n if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;\n if (json.iridescence !== undefined) material.iridescence = json.iridescence;\n if (json.iridescenceIOR !== undefined) material.iridescenceIOR = json.iridescenceIOR;\n if (json.iridescenceThicknessRange !== undefined) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n if (json.transmission !== undefined) material.transmission = json.transmission;\n if (json.thickness !== undefined) material.thickness = json.thickness;\n if (json.attenuationDistance !== undefined) material.attenuationDistance = json.attenuationDistance;\n if (json.attenuationColor !== undefined && material.attenuationColor !== undefined) material.attenuationColor.setHex(json.attenuationColor);\n if (json.anisotropy !== undefined) material.anisotropy = json.anisotropy;\n if (json.anisotropyRotation !== undefined) material.anisotropyRotation = json.anisotropyRotation;\n if (json.fog !== undefined) material.fog = json.fog;\n if (json.flatShading !== undefined) material.flatShading = json.flatShading;\n if (json.blending !== undefined) material.blending = json.blending;\n if (json.combine !== undefined) material.combine = json.combine;\n if (json.side !== undefined) material.side = json.side;\n if (json.shadowSide !== undefined) material.shadowSide = json.shadowSide;\n if (json.opacity !== undefined) material.opacity = json.opacity;\n if (json.transparent !== undefined) material.transparent = json.transparent;\n if (json.alphaTest !== undefined) material.alphaTest = json.alphaTest;\n if (json.alphaHash !== undefined) material.alphaHash = json.alphaHash;\n if (json.depthTest !== undefined) material.depthTest = json.depthTest;\n if (json.depthWrite !== undefined) material.depthWrite = json.depthWrite;\n if (json.colorWrite !== undefined) material.colorWrite = json.colorWrite;\n if (json.stencilWrite !== undefined) material.stencilWrite = json.stencilWrite;\n if (json.stencilWriteMask !== undefined) material.stencilWriteMask = json.stencilWriteMask;\n if (json.stencilFunc !== undefined) material.stencilFunc = json.stencilFunc;\n if (json.stencilRef !== undefined) material.stencilRef = json.stencilRef;\n if (json.stencilFuncMask !== undefined) material.stencilFuncMask = json.stencilFuncMask;\n if (json.stencilFail !== undefined) material.stencilFail = json.stencilFail;\n if (json.stencilZFail !== undefined) material.stencilZFail = json.stencilZFail;\n if (json.stencilZPass !== undefined) material.stencilZPass = json.stencilZPass;\n if (json.wireframe !== undefined) material.wireframe = json.wireframe;\n if (json.wireframeLinewidth !== undefined) material.wireframeLinewidth = json.wireframeLinewidth;\n if (json.wireframeLinecap !== undefined) material.wireframeLinecap = json.wireframeLinecap;\n if (json.wireframeLinejoin !== undefined) material.wireframeLinejoin = json.wireframeLinejoin;\n if (json.rotation !== undefined) material.rotation = json.rotation;\n if (json.linewidth !== 1) material.linewidth = json.linewidth;\n if (json.dashSize !== undefined) material.dashSize = json.dashSize;\n if (json.gapSize !== undefined) material.gapSize = json.gapSize;\n if (json.scale !== undefined) material.scale = json.scale;\n if (json.polygonOffset !== undefined) material.polygonOffset = json.polygonOffset;\n if (json.polygonOffsetFactor !== undefined) material.polygonOffsetFactor = json.polygonOffsetFactor;\n if (json.polygonOffsetUnits !== undefined) material.polygonOffsetUnits = json.polygonOffsetUnits;\n if (json.dithering !== undefined) material.dithering = json.dithering;\n if (json.alphaToCoverage !== undefined) material.alphaToCoverage = json.alphaToCoverage;\n if (json.premultipliedAlpha !== undefined) material.premultipliedAlpha = json.premultipliedAlpha;\n if (json.forceSinglePass !== undefined) material.forceSinglePass = json.forceSinglePass;\n if (json.visible !== undefined) material.visible = json.visible;\n if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped;\n if (json.userData !== undefined) material.userData = json.userData;\n if (json.vertexColors !== undefined) {\n if (typeof json.vertexColors === \"number\") material.vertexColors = json.vertexColors > 0 ? true : false;\n else material.vertexColors = json.vertexColors;\n }\n // Shader Material\n if (json.uniforms !== undefined) for(const name in json.uniforms){\n const uniform = json.uniforms[name];\n material.uniforms[name] = {};\n switch(uniform.type){\n case \"t\":\n material.uniforms[name].value = getTexture(uniform.value);\n break;\n case \"c\":\n material.uniforms[name].value = new $a315ee31802fb757$export$892596cec99bc70e().setHex(uniform.value);\n break;\n case \"v2\":\n material.uniforms[name].value = new $a315ee31802fb757$export$c977b3e384af9ae1().fromArray(uniform.value);\n break;\n case \"v3\":\n material.uniforms[name].value = new $a315ee31802fb757$export$64b5c384219d3699().fromArray(uniform.value);\n break;\n case \"v4\":\n material.uniforms[name].value = new $a315ee31802fb757$export$fa7daccca11cdbe3().fromArray(uniform.value);\n break;\n case \"m3\":\n material.uniforms[name].value = new $a315ee31802fb757$export$8ff26dafa08918().fromArray(uniform.value);\n break;\n case \"m4\":\n material.uniforms[name].value = new $a315ee31802fb757$export$2ae72fc923e5eb5().fromArray(uniform.value);\n break;\n default:\n material.uniforms[name].value = uniform.value;\n }\n }\n if (json.defines !== undefined) material.defines = json.defines;\n if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;\n if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;\n if (json.glslVersion !== undefined) material.glslVersion = json.glslVersion;\n if (json.extensions !== undefined) for(const key in json.extensions)material.extensions[key] = json.extensions[key];\n if (json.lights !== undefined) material.lights = json.lights;\n if (json.clipping !== undefined) material.clipping = json.clipping;\n // for PointsMaterial\n if (json.size !== undefined) material.size = json.size;\n if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation;\n // maps\n if (json.map !== undefined) material.map = getTexture(json.map);\n if (json.matcap !== undefined) material.matcap = getTexture(json.matcap);\n if (json.alphaMap !== undefined) material.alphaMap = getTexture(json.alphaMap);\n if (json.bumpMap !== undefined) material.bumpMap = getTexture(json.bumpMap);\n if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale;\n if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap);\n if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType;\n if (json.normalScale !== undefined) {\n let normalScale = json.normalScale;\n if (Array.isArray(normalScale) === false) // Blender exporter used to export a scalar. See #7459\n normalScale = [\n normalScale,\n normalScale\n ];\n material.normalScale = new $a315ee31802fb757$export$c977b3e384af9ae1().fromArray(normalScale);\n }\n if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap);\n if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale;\n if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias;\n if (json.roughnessMap !== undefined) material.roughnessMap = getTexture(json.roughnessMap);\n if (json.metalnessMap !== undefined) material.metalnessMap = getTexture(json.metalnessMap);\n if (json.emissiveMap !== undefined) material.emissiveMap = getTexture(json.emissiveMap);\n if (json.emissiveIntensity !== undefined) material.emissiveIntensity = json.emissiveIntensity;\n if (json.specularMap !== undefined) material.specularMap = getTexture(json.specularMap);\n if (json.specularIntensityMap !== undefined) material.specularIntensityMap = getTexture(json.specularIntensityMap);\n if (json.specularColorMap !== undefined) material.specularColorMap = getTexture(json.specularColorMap);\n if (json.envMap !== undefined) material.envMap = getTexture(json.envMap);\n if (json.envMapIntensity !== undefined) material.envMapIntensity = json.envMapIntensity;\n if (json.reflectivity !== undefined) material.reflectivity = json.reflectivity;\n if (json.refractionRatio !== undefined) material.refractionRatio = json.refractionRatio;\n if (json.lightMap !== undefined) material.lightMap = getTexture(json.lightMap);\n if (json.lightMapIntensity !== undefined) material.lightMapIntensity = json.lightMapIntensity;\n if (json.aoMap !== undefined) material.aoMap = getTexture(json.aoMap);\n if (json.aoMapIntensity !== undefined) material.aoMapIntensity = json.aoMapIntensity;\n if (json.gradientMap !== undefined) material.gradientMap = getTexture(json.gradientMap);\n if (json.clearcoatMap !== undefined) material.clearcoatMap = getTexture(json.clearcoatMap);\n if (json.clearcoatRoughnessMap !== undefined) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap);\n if (json.clearcoatNormalMap !== undefined) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap);\n if (json.clearcoatNormalScale !== undefined) material.clearcoatNormalScale = new $a315ee31802fb757$export$c977b3e384af9ae1().fromArray(json.clearcoatNormalScale);\n if (json.iridescenceMap !== undefined) material.iridescenceMap = getTexture(json.iridescenceMap);\n if (json.iridescenceThicknessMap !== undefined) material.iridescenceThicknessMap = getTexture(json.iridescenceThicknessMap);\n if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap);\n if (json.thicknessMap !== undefined) material.thicknessMap = getTexture(json.thicknessMap);\n if (json.anisotropyMap !== undefined) material.anisotropyMap = getTexture(json.anisotropyMap);\n if (json.sheenColorMap !== undefined) material.sheenColorMap = getTexture(json.sheenColorMap);\n if (json.sheenRoughnessMap !== undefined) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap);\n return material;\n }\n setTextures(value) {\n this.textures = value;\n return this;\n }\n static createMaterialFromType(type) {\n const materialLib = {\n ShadowMaterial: $a315ee31802fb757$export$e8564da406055a3,\n SpriteMaterial: $a315ee31802fb757$export$5ec7dd1c6994bf8e,\n RawShaderMaterial: $a315ee31802fb757$export$21c421a2e1df9d22,\n ShaderMaterial: $a315ee31802fb757$export$83c7d75d550a8b0d,\n PointsMaterial: $a315ee31802fb757$export$a178c45366ce5d6b,\n MeshPhysicalMaterial: $a315ee31802fb757$export$28d04986c4269c9f,\n MeshStandardMaterial: $a315ee31802fb757$export$f2980790215acccd,\n MeshPhongMaterial: $a315ee31802fb757$export$24c72f71cbaf0678,\n MeshToonMaterial: $a315ee31802fb757$export$df893cf97e765622,\n MeshNormalMaterial: $a315ee31802fb757$export$bfe8c0a091f41ae7,\n MeshLambertMaterial: $a315ee31802fb757$export$5023a9a8114806b8,\n MeshDepthMaterial: $a315ee31802fb757$export$2698c22ec13825db,\n MeshDistanceMaterial: $a315ee31802fb757$export$33e187ed002f2a19,\n MeshBasicMaterial: $a315ee31802fb757$export$55cbcc9b622fe1f5,\n MeshMatcapMaterial: $a315ee31802fb757$export$6f5fef6235ec12ee,\n LineDashedMaterial: $a315ee31802fb757$export$327886a3efaeaebe,\n LineBasicMaterial: $a315ee31802fb757$export$fbaaa33907730a0c,\n Material: $a315ee31802fb757$export$a2d8b23205c25948\n };\n return new materialLib[type]();\n }\n}\nclass $a315ee31802fb757$export$b5d2dc08d867e41a {\n static decodeText(array) {\n if (typeof TextDecoder !== \"undefined\") return new TextDecoder().decode(array);\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n let s = \"\";\n for(let i = 0, il = array.length; i < il; i++)// Implicitly assumes little-endian.\n s += String.fromCharCode(array[i]);\n try {\n // merges multi-byte utf-8 characters.\n return decodeURIComponent(escape(s));\n } catch (e) {\n return s;\n }\n }\n static extractUrlBase(url) {\n const index = url.lastIndexOf(\"/\");\n if (index === -1) return \"./\";\n return url.slice(0, index + 1);\n }\n static resolveURL(url, path) {\n // Invalid URL\n if (typeof url !== \"string\" || url === \"\") return \"\";\n // Host Relative URL\n if (/^https?:\\/\\//i.test(path) && /^\\//.test(url)) path = path.replace(/(^https?:\\/\\/[^\\/]+).*/i, \"$1\");\n // Absolute URL http://,https://,//\n if (/^(https?:)?\\/\\//i.test(url)) return url;\n // Data URI\n if (/^data:.*,.*$/i.test(url)) return url;\n // Blob URL\n if (/^blob:.*$/i.test(url)) return url;\n // Relative URL\n return path + url;\n }\n}\nclass $a315ee31802fb757$export$231f009cbe414146 extends $a315ee31802fb757$export$b7be63a67df8959 {\n constructor(){\n super();\n this.isInstancedBufferGeometry = true;\n this.type = \"InstancedBufferGeometry\";\n this.instanceCount = Infinity;\n }\n copy(source) {\n super.copy(source);\n this.instanceCount = source.instanceCount;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.instanceCount = this.instanceCount;\n data.isInstancedBufferGeometry = true;\n return data;\n }\n}\nclass $a315ee31802fb757$export$dc275bb96327833a extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const interleavedBufferMap = {};\n const arrayBufferMap = {};\n function getInterleavedBuffer(json, uuid) {\n if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid];\n const interleavedBuffers = json.interleavedBuffers;\n const interleavedBuffer = interleavedBuffers[uuid];\n const buffer = getArrayBuffer(json, interleavedBuffer.buffer);\n const array = $a315ee31802fb757$var$getTypedArray(interleavedBuffer.type, buffer);\n const ib = new $a315ee31802fb757$export$3d5cd879f108f53f(array, interleavedBuffer.stride);\n ib.uuid = interleavedBuffer.uuid;\n interleavedBufferMap[uuid] = ib;\n return ib;\n }\n function getArrayBuffer(json, uuid) {\n if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid];\n const arrayBuffers = json.arrayBuffers;\n const arrayBuffer = arrayBuffers[uuid];\n const ab = new Uint32Array(arrayBuffer).buffer;\n arrayBufferMap[uuid] = ab;\n return ab;\n }\n const geometry = json.isInstancedBufferGeometry ? new $a315ee31802fb757$export$231f009cbe414146() : new $a315ee31802fb757$export$b7be63a67df8959();\n const index = json.data.index;\n if (index !== undefined) {\n const typedArray = $a315ee31802fb757$var$getTypedArray(index.type, index.array);\n geometry.setIndex(new $a315ee31802fb757$export$8dea267bd6bde117(typedArray, 1));\n }\n const attributes = json.data.attributes;\n for(const key in attributes){\n const attribute = attributes[key];\n let bufferAttribute;\n if (attribute.isInterleavedBufferAttribute) {\n const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);\n bufferAttribute = new $a315ee31802fb757$export$920b6d07334599c7(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);\n } else {\n const typedArray = $a315ee31802fb757$var$getTypedArray(attribute.type, attribute.array);\n const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? $a315ee31802fb757$export$32ea87a8b54d744a : $a315ee31802fb757$export$8dea267bd6bde117;\n bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized);\n }\n if (attribute.name !== undefined) bufferAttribute.name = attribute.name;\n if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage);\n if (attribute.updateRange !== undefined) {\n bufferAttribute.updateRange.offset = attribute.updateRange.offset;\n bufferAttribute.updateRange.count = attribute.updateRange.count;\n }\n geometry.setAttribute(key, bufferAttribute);\n }\n const morphAttributes = json.data.morphAttributes;\n if (morphAttributes) for(const key in morphAttributes){\n const attributeArray = morphAttributes[key];\n const array = [];\n for(let i = 0, il = attributeArray.length; i < il; i++){\n const attribute = attributeArray[i];\n let bufferAttribute;\n if (attribute.isInterleavedBufferAttribute) {\n const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);\n bufferAttribute = new $a315ee31802fb757$export$920b6d07334599c7(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);\n } else {\n const typedArray = $a315ee31802fb757$var$getTypedArray(attribute.type, attribute.array);\n bufferAttribute = new $a315ee31802fb757$export$8dea267bd6bde117(typedArray, attribute.itemSize, attribute.normalized);\n }\n if (attribute.name !== undefined) bufferAttribute.name = attribute.name;\n array.push(bufferAttribute);\n }\n geometry.morphAttributes[key] = array;\n }\n const morphTargetsRelative = json.data.morphTargetsRelative;\n if (morphTargetsRelative) geometry.morphTargetsRelative = true;\n const groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n if (groups !== undefined) for(let i = 0, n = groups.length; i !== n; ++i){\n const group = groups[i];\n geometry.addGroup(group.start, group.count, group.materialIndex);\n }\n const boundingSphere = json.data.boundingSphere;\n if (boundingSphere !== undefined) {\n const center = new $a315ee31802fb757$export$64b5c384219d3699();\n if (boundingSphere.center !== undefined) center.fromArray(boundingSphere.center);\n geometry.boundingSphere = new $a315ee31802fb757$export$805e8b72413ccaba(center, boundingSphere.radius);\n }\n if (json.name) geometry.name = json.name;\n if (json.userData) geometry.userData = json.userData;\n return geometry;\n }\n}\nclass $a315ee31802fb757$export$40110c8505c5ad19 extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const path = this.path === \"\" ? $a315ee31802fb757$export$b5d2dc08d867e41a.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(text) {\n let json = null;\n try {\n json = JSON.parse(text);\n } catch (error) {\n if (onError !== undefined) onError(error);\n console.error(\"THREE:ObjectLoader: Can't parse \" + url + \".\", error.message);\n return;\n }\n const metadata = json.metadata;\n if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === \"geometry\") {\n if (onError !== undefined) onError(new Error(\"THREE.ObjectLoader: Can't load \" + url));\n console.error(\"THREE.ObjectLoader: Can't load \" + url);\n return;\n }\n scope.parse(json, onLoad);\n }, onProgress, onError);\n }\n async loadAsync(url, onProgress) {\n const scope = this;\n const path = this.path === \"\" ? $a315ee31802fb757$export$b5d2dc08d867e41a.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n const text = await loader.loadAsync(url, onProgress);\n const json = JSON.parse(text);\n const metadata = json.metadata;\n if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === \"geometry\") throw new Error(\"THREE.ObjectLoader: Can't load \" + url);\n return await scope.parseAsync(json);\n }\n parse(json, onLoad) {\n const animations = this.parseAnimations(json.animations);\n const shapes = this.parseShapes(json.shapes);\n const geometries = this.parseGeometries(json.geometries, shapes);\n const images = this.parseImages(json.images, function() {\n if (onLoad !== undefined) onLoad(object);\n });\n const textures = this.parseTextures(json.textures, images);\n const materials = this.parseMaterials(json.materials, textures);\n const object = this.parseObject(json.object, geometries, materials, textures, animations);\n const skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n //\n if (onLoad !== undefined) {\n let hasImages = false;\n for(const uuid in images)if (images[uuid].data instanceof HTMLImageElement) {\n hasImages = true;\n break;\n }\n if (hasImages === false) onLoad(object);\n }\n return object;\n }\n async parseAsync(json) {\n const animations = this.parseAnimations(json.animations);\n const shapes = this.parseShapes(json.shapes);\n const geometries = this.parseGeometries(json.geometries, shapes);\n const images = await this.parseImagesAsync(json.images);\n const textures = this.parseTextures(json.textures, images);\n const materials = this.parseMaterials(json.materials, textures);\n const object = this.parseObject(json.object, geometries, materials, textures, animations);\n const skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n return object;\n }\n parseShapes(json) {\n const shapes = {};\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const shape = new $a315ee31802fb757$export$6428a7f2611ef1fa().fromJSON(json[i]);\n shapes[shape.uuid] = shape;\n }\n return shapes;\n }\n parseSkeletons(json, object) {\n const skeletons = {};\n const bones = {};\n // generate bone lookup table\n object.traverse(function(child) {\n if (child.isBone) bones[child.uuid] = child;\n });\n // create skeletons\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const skeleton = new $a315ee31802fb757$export$8f31e4c4a37b8e9c().fromJSON(json[i], bones);\n skeletons[skeleton.uuid] = skeleton;\n }\n return skeletons;\n }\n parseGeometries(json, shapes) {\n const geometries = {};\n if (json !== undefined) {\n const bufferGeometryLoader = new $a315ee31802fb757$export$dc275bb96327833a();\n for(let i = 0, l = json.length; i < l; i++){\n let geometry;\n const data = json[i];\n switch(data.type){\n case \"BufferGeometry\":\n case \"InstancedBufferGeometry\":\n geometry = bufferGeometryLoader.parse(data);\n break;\n default:\n if (data.type in $a315ee31802fb757$var$Geometries) geometry = $a315ee31802fb757$var$Geometries[data.type].fromJSON(data, shapes);\n else console.warn(`THREE.ObjectLoader: Unsupported geometry type \"${data.type}\"`);\n }\n geometry.uuid = data.uuid;\n if (data.name !== undefined) geometry.name = data.name;\n if (data.userData !== undefined) geometry.userData = data.userData;\n geometries[data.uuid] = geometry;\n }\n }\n return geometries;\n }\n parseMaterials(json, textures) {\n const cache = {}; // MultiMaterial\n const materials = {};\n if (json !== undefined) {\n const loader = new $a315ee31802fb757$export$3bd6d323353dcf96();\n loader.setTextures(textures);\n for(let i = 0, l = json.length; i < l; i++){\n const data = json[i];\n if (cache[data.uuid] === undefined) cache[data.uuid] = loader.parse(data);\n materials[data.uuid] = cache[data.uuid];\n }\n }\n return materials;\n }\n parseAnimations(json) {\n const animations = {};\n if (json !== undefined) for(let i = 0; i < json.length; i++){\n const data = json[i];\n const clip = $a315ee31802fb757$export$d942c706bf23829c.parse(data);\n animations[clip.uuid] = clip;\n }\n return animations;\n }\n parseImages(json, onLoad) {\n const scope = this;\n const images = {};\n let loader;\n function loadImage(url) {\n scope.manager.itemStart(url);\n return loader.load(url, function() {\n scope.manager.itemEnd(url);\n }, undefined, function() {\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n }\n function deserializeImage(image) {\n if (typeof image === \"string\") {\n const url = image;\n const path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(url) ? url : scope.resourcePath + url;\n return loadImage(path);\n } else {\n if (image.data) return {\n data: $a315ee31802fb757$var$getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n };\n else return null;\n }\n }\n if (json !== undefined && json.length > 0) {\n const manager = new $a315ee31802fb757$export$99cc795e99919eed(onLoad);\n loader = new $a315ee31802fb757$export$8905ce1c7a2464a1(manager);\n loader.setCrossOrigin(this.crossOrigin);\n for(let i = 0, il = json.length; i < il; i++){\n const image = json[i];\n const url = image.url;\n if (Array.isArray(url)) {\n // load array of images e.g CubeTexture\n const imageArray = [];\n for(let j = 0, jl = url.length; j < jl; j++){\n const currentUrl = url[j];\n const deserializedImage = deserializeImage(currentUrl);\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) imageArray.push(deserializedImage);\n else // special case: handle array of data textures for cube textures\n imageArray.push(new $a315ee31802fb757$export$b691f601014eabe1(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n images[image.uuid] = new $a315ee31802fb757$export$1d2df86270c81ecb(imageArray);\n } else {\n // load single image\n const deserializedImage = deserializeImage(image.url);\n images[image.uuid] = new $a315ee31802fb757$export$1d2df86270c81ecb(deserializedImage);\n }\n }\n }\n return images;\n }\n async parseImagesAsync(json) {\n const scope = this;\n const images = {};\n let loader;\n async function deserializeImage(image) {\n if (typeof image === \"string\") {\n const url = image;\n const path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(url) ? url : scope.resourcePath + url;\n return await loader.loadAsync(path);\n } else {\n if (image.data) return {\n data: $a315ee31802fb757$var$getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n };\n else return null;\n }\n }\n if (json !== undefined && json.length > 0) {\n loader = new $a315ee31802fb757$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n for(let i = 0, il = json.length; i < il; i++){\n const image = json[i];\n const url = image.url;\n if (Array.isArray(url)) {\n // load array of images e.g CubeTexture\n const imageArray = [];\n for(let j = 0, jl = url.length; j < jl; j++){\n const currentUrl = url[j];\n const deserializedImage = await deserializeImage(currentUrl);\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) imageArray.push(deserializedImage);\n else // special case: handle array of data textures for cube textures\n imageArray.push(new $a315ee31802fb757$export$b691f601014eabe1(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n images[image.uuid] = new $a315ee31802fb757$export$1d2df86270c81ecb(imageArray);\n } else {\n // load single image\n const deserializedImage = await deserializeImage(image.url);\n images[image.uuid] = new $a315ee31802fb757$export$1d2df86270c81ecb(deserializedImage);\n }\n }\n }\n return images;\n }\n parseTextures(json, images) {\n function parseConstant(value, type) {\n if (typeof value === \"number\") return value;\n console.warn(\"THREE.ObjectLoader.parseTexture: Constant should be in numeric form.\", value);\n return type[value];\n }\n const textures = {};\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const data = json[i];\n if (data.image === undefined) console.warn('THREE.ObjectLoader: No \"image\" specified for', data.uuid);\n if (images[data.image] === undefined) console.warn(\"THREE.ObjectLoader: Undefined image\", data.image);\n const source = images[data.image];\n const image = source.data;\n let texture;\n if (Array.isArray(image)) {\n texture = new $a315ee31802fb757$export$ee2e5a18258a4049();\n if (image.length === 6) texture.needsUpdate = true;\n } else {\n if (image && image.data) texture = new $a315ee31802fb757$export$b691f601014eabe1();\n else texture = new $a315ee31802fb757$export$5431306cf43de24a();\n if (image) texture.needsUpdate = true; // textures can have undefined image data\n }\n texture.source = source;\n texture.uuid = data.uuid;\n if (data.name !== undefined) texture.name = data.name;\n if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, $a315ee31802fb757$var$TEXTURE_MAPPING);\n if (data.channel !== undefined) texture.channel = data.channel;\n if (data.offset !== undefined) texture.offset.fromArray(data.offset);\n if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat);\n if (data.center !== undefined) texture.center.fromArray(data.center);\n if (data.rotation !== undefined) texture.rotation = data.rotation;\n if (data.wrap !== undefined) {\n texture.wrapS = parseConstant(data.wrap[0], $a315ee31802fb757$var$TEXTURE_WRAPPING);\n texture.wrapT = parseConstant(data.wrap[1], $a315ee31802fb757$var$TEXTURE_WRAPPING);\n }\n if (data.format !== undefined) texture.format = data.format;\n if (data.internalFormat !== undefined) texture.internalFormat = data.internalFormat;\n if (data.type !== undefined) texture.type = data.type;\n if (data.colorSpace !== undefined) texture.colorSpace = data.colorSpace;\n if (data.encoding !== undefined) texture.encoding = data.encoding; // @deprecated, r152\n if (data.minFilter !== undefined) texture.minFilter = parseConstant(data.minFilter, $a315ee31802fb757$var$TEXTURE_FILTER);\n if (data.magFilter !== undefined) texture.magFilter = parseConstant(data.magFilter, $a315ee31802fb757$var$TEXTURE_FILTER);\n if (data.anisotropy !== undefined) texture.anisotropy = data.anisotropy;\n if (data.flipY !== undefined) texture.flipY = data.flipY;\n if (data.generateMipmaps !== undefined) texture.generateMipmaps = data.generateMipmaps;\n if (data.premultiplyAlpha !== undefined) texture.premultiplyAlpha = data.premultiplyAlpha;\n if (data.unpackAlignment !== undefined) texture.unpackAlignment = data.unpackAlignment;\n if (data.compareFunction !== undefined) texture.compareFunction = data.compareFunction;\n if (data.userData !== undefined) texture.userData = data.userData;\n textures[data.uuid] = texture;\n }\n return textures;\n }\n parseObject(data, geometries, materials, textures, animations) {\n let object;\n function getGeometry(name) {\n if (geometries[name] === undefined) console.warn(\"THREE.ObjectLoader: Undefined geometry\", name);\n return geometries[name];\n }\n function getMaterial(name) {\n if (name === undefined) return undefined;\n if (Array.isArray(name)) {\n const array = [];\n for(let i = 0, l = name.length; i < l; i++){\n const uuid = name[i];\n if (materials[uuid] === undefined) console.warn(\"THREE.ObjectLoader: Undefined material\", uuid);\n array.push(materials[uuid]);\n }\n return array;\n }\n if (materials[name] === undefined) console.warn(\"THREE.ObjectLoader: Undefined material\", name);\n return materials[name];\n }\n function getTexture(uuid) {\n if (textures[uuid] === undefined) console.warn(\"THREE.ObjectLoader: Undefined texture\", uuid);\n return textures[uuid];\n }\n let geometry, material;\n switch(data.type){\n case \"Scene\":\n object = new $a315ee31802fb757$export$38af1803e3442a7f();\n if (data.background !== undefined) {\n if (Number.isInteger(data.background)) object.background = new $a315ee31802fb757$export$892596cec99bc70e(data.background);\n else object.background = getTexture(data.background);\n }\n if (data.environment !== undefined) object.environment = getTexture(data.environment);\n if (data.fog !== undefined) {\n if (data.fog.type === \"Fog\") object.fog = new $a315ee31802fb757$export$3c890837b09508d4(data.fog.color, data.fog.near, data.fog.far);\n else if (data.fog.type === \"FogExp2\") object.fog = new $a315ee31802fb757$export$6f1519f023b8d0f6(data.fog.color, data.fog.density);\n }\n if (data.backgroundBlurriness !== undefined) object.backgroundBlurriness = data.backgroundBlurriness;\n if (data.backgroundIntensity !== undefined) object.backgroundIntensity = data.backgroundIntensity;\n break;\n case \"PerspectiveCamera\":\n object = new $a315ee31802fb757$export$74e4ae24825f68d7(data.fov, data.aspect, data.near, data.far);\n if (data.focus !== undefined) object.focus = data.focus;\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.filmGauge !== undefined) object.filmGauge = data.filmGauge;\n if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case \"OrthographicCamera\":\n object = new $a315ee31802fb757$export$9ebf355ee4ed261b(data.left, data.right, data.top, data.bottom, data.near, data.far);\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case \"AmbientLight\":\n object = new $a315ee31802fb757$export$af279bfef9ec2c96(data.color, data.intensity);\n break;\n case \"DirectionalLight\":\n object = new $a315ee31802fb757$export$3fea33cc9972c868(data.color, data.intensity);\n break;\n case \"PointLight\":\n object = new $a315ee31802fb757$export$4c9c1cb3f0b6f455(data.color, data.intensity, data.distance, data.decay);\n break;\n case \"RectAreaLight\":\n object = new $a315ee31802fb757$export$61db2d908bbd2429(data.color, data.intensity, data.width, data.height);\n break;\n case \"SpotLight\":\n object = new $a315ee31802fb757$export$81495cbb73897362(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay);\n break;\n case \"HemisphereLight\":\n object = new $a315ee31802fb757$export$8d474f55edbb9624(data.color, data.groundColor, data.intensity);\n break;\n case \"LightProbe\":\n object = new $a315ee31802fb757$export$e7ef036e309b38d2().fromJSON(data);\n break;\n case \"SkinnedMesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new $a315ee31802fb757$export$b303577035157ecf(geometry, material);\n if (data.bindMode !== undefined) object.bindMode = data.bindMode;\n if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix);\n if (data.skeleton !== undefined) object.skeleton = data.skeleton;\n break;\n case \"Mesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new $a315ee31802fb757$export$e176487c05830cc5(geometry, material);\n break;\n case \"InstancedMesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n const count = data.count;\n const instanceMatrix = data.instanceMatrix;\n const instanceColor = data.instanceColor;\n object = new $a315ee31802fb757$export$f3c979c331175ad7(geometry, material, count);\n object.instanceMatrix = new $a315ee31802fb757$export$32ea87a8b54d744a(new Float32Array(instanceMatrix.array), 16);\n if (instanceColor !== undefined) object.instanceColor = new $a315ee31802fb757$export$32ea87a8b54d744a(new Float32Array(instanceColor.array), instanceColor.itemSize);\n break;\n case \"LOD\":\n object = new $a315ee31802fb757$export$112e7237be0c5f30();\n break;\n case \"Line\":\n object = new $a315ee31802fb757$export$17d680238e50603e(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"LineLoop\":\n object = new $a315ee31802fb757$export$f85a24d745e4f17d(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"LineSegments\":\n object = new $a315ee31802fb757$export$ff1ed10fedfdd604(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"PointCloud\":\n case \"Points\":\n object = new $a315ee31802fb757$export$1c787534cb11aa3e(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"Sprite\":\n object = new $a315ee31802fb757$export$3075603db8e6204c(getMaterial(data.material));\n break;\n case \"Group\":\n object = new $a315ee31802fb757$export$eb2fcfdbd7ba97d4();\n break;\n case \"Bone\":\n object = new $a315ee31802fb757$export$b127726e56765aa4();\n break;\n default:\n object = new $a315ee31802fb757$export$e4dd07dff30cc924();\n }\n object.uuid = data.uuid;\n if (data.name !== undefined) object.name = data.name;\n if (data.matrix !== undefined) {\n object.matrix.fromArray(data.matrix);\n if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate;\n if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale);\n } else {\n if (data.position !== undefined) object.position.fromArray(data.position);\n if (data.rotation !== undefined) object.rotation.fromArray(data.rotation);\n if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion);\n if (data.scale !== undefined) object.scale.fromArray(data.scale);\n }\n if (data.up !== undefined) object.up.fromArray(data.up);\n if (data.castShadow !== undefined) object.castShadow = data.castShadow;\n if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow;\n if (data.shadow) {\n if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias;\n if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias;\n if (data.shadow.radius !== undefined) object.shadow.radius = data.shadow.radius;\n if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize);\n if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera);\n }\n if (data.visible !== undefined) object.visible = data.visible;\n if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled;\n if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder;\n if (data.userData !== undefined) object.userData = data.userData;\n if (data.layers !== undefined) object.layers.mask = data.layers;\n if (data.children !== undefined) {\n const children = data.children;\n for(let i = 0; i < children.length; i++)object.add(this.parseObject(children[i], geometries, materials, textures, animations));\n }\n if (data.animations !== undefined) {\n const objectAnimations = data.animations;\n for(let i = 0; i < objectAnimations.length; i++){\n const uuid = objectAnimations[i];\n object.animations.push(animations[uuid]);\n }\n }\n if (data.type === \"LOD\") {\n if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate;\n const levels = data.levels;\n for(let l = 0; l < levels.length; l++){\n const level = levels[l];\n const child = object.getObjectByProperty(\"uuid\", level.object);\n if (child !== undefined) object.addLevel(child, level.distance, level.hysteresis);\n }\n }\n return object;\n }\n bindSkeletons(object, skeletons) {\n if (Object.keys(skeletons).length === 0) return;\n object.traverse(function(child) {\n if (child.isSkinnedMesh === true && child.skeleton !== undefined) {\n const skeleton = skeletons[child.skeleton];\n if (skeleton === undefined) console.warn(\"THREE.ObjectLoader: No skeleton found with UUID:\", child.skeleton);\n else child.bind(skeleton, child.bindMatrix);\n }\n });\n }\n}\nconst $a315ee31802fb757$var$TEXTURE_MAPPING = {\n UVMapping: $a315ee31802fb757$export$1beec6768cbb3d2d,\n CubeReflectionMapping: $a315ee31802fb757$export$8759762a6477f2c4,\n CubeRefractionMapping: $a315ee31802fb757$export$dc59f8aed047f61d,\n EquirectangularReflectionMapping: $a315ee31802fb757$export$d64030b316d3b087,\n EquirectangularRefractionMapping: $a315ee31802fb757$export$ee99d97d46898098,\n CubeUVReflectionMapping: $a315ee31802fb757$export$dbf3e70ff37af79\n};\nconst $a315ee31802fb757$var$TEXTURE_WRAPPING = {\n RepeatWrapping: $a315ee31802fb757$export$533346c8e8dac0f5,\n ClampToEdgeWrapping: $a315ee31802fb757$export$9d9334239a5a5e06,\n MirroredRepeatWrapping: $a315ee31802fb757$export$c7e7c00b14f51a4f\n};\nconst $a315ee31802fb757$var$TEXTURE_FILTER = {\n NearestFilter: $a315ee31802fb757$export$727aa5ec3fe39bf0,\n NearestMipmapNearestFilter: $a315ee31802fb757$export$d129e38cf6feaa8c,\n NearestMipmapLinearFilter: $a315ee31802fb757$export$d2327c1afe5bfdf2,\n LinearFilter: $a315ee31802fb757$export$8a72f490b25c56c8,\n LinearMipmapNearestFilter: $a315ee31802fb757$export$19a719f377145a13,\n LinearMipmapLinearFilter: $a315ee31802fb757$export$5d8599b6a933fb1b\n};\nclass $a315ee31802fb757$export$52286b55c4a9b51f extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n this.isImageBitmapLoader = true;\n if (typeof createImageBitmap === \"undefined\") console.warn(\"THREE.ImageBitmapLoader: createImageBitmap() not supported.\");\n if (typeof fetch === \"undefined\") console.warn(\"THREE.ImageBitmapLoader: fetch() not supported.\");\n this.options = {\n premultiplyAlpha: \"none\"\n };\n }\n setOptions(options) {\n this.options = options;\n return this;\n }\n load(url, onLoad, onProgress, onError) {\n if (url === undefined) url = \"\";\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const scope = this;\n const cached = $a315ee31802fb757$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function() {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n const fetchOptions = {};\n fetchOptions.credentials = this.crossOrigin === \"anonymous\" ? \"same-origin\" : \"include\";\n fetchOptions.headers = this.requestHeader;\n fetch(url, fetchOptions).then(function(res) {\n return res.blob();\n }).then(function(blob) {\n return createImageBitmap(blob, Object.assign(scope.options, {\n colorSpaceConversion: \"none\"\n }));\n }).then(function(imageBitmap) {\n $a315ee31802fb757$export$94affb487e701bf2.add(url, imageBitmap);\n if (onLoad) onLoad(imageBitmap);\n scope.manager.itemEnd(url);\n }).catch(function(e) {\n if (onError) onError(e);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n scope.manager.itemStart(url);\n }\n}\nlet $a315ee31802fb757$var$_context;\nclass $a315ee31802fb757$export$fcbc63750ec2a81f {\n static getContext() {\n if ($a315ee31802fb757$var$_context === undefined) $a315ee31802fb757$var$_context = new (window.AudioContext || window.webkitAudioContext)();\n return $a315ee31802fb757$var$_context;\n }\n static setContext(value) {\n $a315ee31802fb757$var$_context = value;\n }\n}\nclass $a315ee31802fb757$export$d8d5fccfbf47714e extends $a315ee31802fb757$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $a315ee31802fb757$export$98435a25b5cf7b2b(this.manager);\n loader.setResponseType(\"arraybuffer\");\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(buffer) {\n try {\n // Create a copy of the buffer. The `decodeAudioData` method\n // detaches the buffer when complete, preventing reuse.\n const bufferCopy = buffer.slice(0);\n const context = $a315ee31802fb757$export$fcbc63750ec2a81f.getContext();\n context.decodeAudioData(bufferCopy, function(audioBuffer) {\n onLoad(audioBuffer);\n }, handleError);\n } catch (e) {\n handleError(e);\n }\n }, onProgress, onError);\n function handleError(e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }\n}\nclass $a315ee31802fb757$export$2f22dadc8bc42820 extends $a315ee31802fb757$export$e7ef036e309b38d2 {\n constructor(skyColor, groundColor, intensity = 1){\n super(undefined, intensity);\n this.isHemisphereLightProbe = true;\n const color1 = new $a315ee31802fb757$export$892596cec99bc70e().set(skyColor);\n const color2 = new $a315ee31802fb757$export$892596cec99bc70e().set(groundColor);\n const sky = new $a315ee31802fb757$export$64b5c384219d3699(color1.r, color1.g, color1.b);\n const ground = new $a315ee31802fb757$export$64b5c384219d3699(color2.r, color2.g, color2.b);\n // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n const c0 = Math.sqrt(Math.PI);\n const c1 = c0 * Math.sqrt(0.75);\n this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);\n this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);\n }\n}\nclass $a315ee31802fb757$export$afe310a21c86023d extends $a315ee31802fb757$export$e7ef036e309b38d2 {\n constructor(color, intensity = 1){\n super(undefined, intensity);\n this.isAmbientLightProbe = true;\n const color1 = new $a315ee31802fb757$export$892596cec99bc70e().set(color);\n // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI));\n }\n}\nconst $a315ee31802fb757$var$_eyeRight = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_eyeLeft = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_projectionMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nclass $a315ee31802fb757$export$bc7f73a1065bee0c {\n constructor(){\n this.type = \"StereoCamera\";\n this.aspect = 1;\n this.eyeSep = 0.064;\n this.cameraL = new $a315ee31802fb757$export$74e4ae24825f68d7();\n this.cameraL.layers.enable(1);\n this.cameraL.matrixAutoUpdate = false;\n this.cameraR = new $a315ee31802fb757$export$74e4ae24825f68d7();\n this.cameraR.layers.enable(2);\n this.cameraR.matrixAutoUpdate = false;\n this._cache = {\n focus: null,\n fov: null,\n aspect: null,\n near: null,\n far: null,\n zoom: null,\n eyeSep: null\n };\n }\n update(camera) {\n const cache = this._cache;\n const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n if (needsUpdate) {\n cache.focus = camera.focus;\n cache.fov = camera.fov;\n cache.aspect = camera.aspect * this.aspect;\n cache.near = camera.near;\n cache.far = camera.far;\n cache.zoom = camera.zoom;\n cache.eyeSep = this.eyeSep;\n // Off-axis stereoscopic effect based on\n // http://paulbourke.net/stereographics/stereorender/\n $a315ee31802fb757$var$_projectionMatrix.copy(camera.projectionMatrix);\n const eyeSepHalf = cache.eyeSep / 2;\n const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n const ymax = cache.near * Math.tan($a315ee31802fb757$var$DEG2RAD * cache.fov * 0.5) / cache.zoom;\n let xmin, xmax;\n // translate xOffset\n $a315ee31802fb757$var$_eyeLeft.elements[12] = -eyeSepHalf;\n $a315ee31802fb757$var$_eyeRight.elements[12] = eyeSepHalf;\n // for left eye\n xmin = -ymax * cache.aspect + eyeSepOnProjection;\n xmax = ymax * cache.aspect + eyeSepOnProjection;\n $a315ee31802fb757$var$_projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n $a315ee31802fb757$var$_projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraL.projectionMatrix.copy($a315ee31802fb757$var$_projectionMatrix);\n // for right eye\n xmin = -ymax * cache.aspect - eyeSepOnProjection;\n xmax = ymax * cache.aspect - eyeSepOnProjection;\n $a315ee31802fb757$var$_projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n $a315ee31802fb757$var$_projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraR.projectionMatrix.copy($a315ee31802fb757$var$_projectionMatrix);\n }\n this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply($a315ee31802fb757$var$_eyeLeft);\n this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply($a315ee31802fb757$var$_eyeRight);\n }\n}\nclass $a315ee31802fb757$export$9735c82c4bae3302 {\n constructor(autoStart = true){\n this.autoStart = autoStart;\n this.startTime = 0;\n this.oldTime = 0;\n this.elapsedTime = 0;\n this.running = false;\n }\n start() {\n this.startTime = $a315ee31802fb757$var$now();\n this.oldTime = this.startTime;\n this.elapsedTime = 0;\n this.running = true;\n }\n stop() {\n this.getElapsedTime();\n this.running = false;\n this.autoStart = false;\n }\n getElapsedTime() {\n this.getDelta();\n return this.elapsedTime;\n }\n getDelta() {\n let diff = 0;\n if (this.autoStart && !this.running) {\n this.start();\n return 0;\n }\n if (this.running) {\n const newTime = $a315ee31802fb757$var$now();\n diff = (newTime - this.oldTime) / 1000;\n this.oldTime = newTime;\n this.elapsedTime += diff;\n }\n return diff;\n }\n}\nfunction $a315ee31802fb757$var$now() {\n return (typeof performance === \"undefined\" ? Date : performance).now(); // see #10732\n}\nconst $a315ee31802fb757$var$_position$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_quaternion$1 = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nconst $a315ee31802fb757$var$_scale$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_orientation$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$8a1b810c6fde8951 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.type = \"AudioListener\";\n this.context = $a315ee31802fb757$export$fcbc63750ec2a81f.getContext();\n this.gain = this.context.createGain();\n this.gain.connect(this.context.destination);\n this.filter = null;\n this.timeDelta = 0;\n // private\n this._clock = new $a315ee31802fb757$export$9735c82c4bae3302();\n }\n getInput() {\n return this.gain;\n }\n removeFilter() {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n this.gain.connect(this.context.destination);\n this.filter = null;\n }\n return this;\n }\n getFilter() {\n return this.filter;\n }\n setFilter(value) {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n } else this.gain.disconnect(this.context.destination);\n this.filter = value;\n this.gain.connect(this.filter);\n this.filter.connect(this.context.destination);\n return this;\n }\n getMasterVolume() {\n return this.gain.gain.value;\n }\n setMasterVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n const listener = this.context.listener;\n const up = this.up;\n this.timeDelta = this._clock.getDelta();\n this.matrixWorld.decompose($a315ee31802fb757$var$_position$1, $a315ee31802fb757$var$_quaternion$1, $a315ee31802fb757$var$_scale$1);\n $a315ee31802fb757$var$_orientation$1.set(0, 0, -1).applyQuaternion($a315ee31802fb757$var$_quaternion$1);\n if (listener.positionX) {\n // code path for Chrome (see #14393)\n const endTime = this.context.currentTime + this.timeDelta;\n listener.positionX.linearRampToValueAtTime($a315ee31802fb757$var$_position$1.x, endTime);\n listener.positionY.linearRampToValueAtTime($a315ee31802fb757$var$_position$1.y, endTime);\n listener.positionZ.linearRampToValueAtTime($a315ee31802fb757$var$_position$1.z, endTime);\n listener.forwardX.linearRampToValueAtTime($a315ee31802fb757$var$_orientation$1.x, endTime);\n listener.forwardY.linearRampToValueAtTime($a315ee31802fb757$var$_orientation$1.y, endTime);\n listener.forwardZ.linearRampToValueAtTime($a315ee31802fb757$var$_orientation$1.z, endTime);\n listener.upX.linearRampToValueAtTime(up.x, endTime);\n listener.upY.linearRampToValueAtTime(up.y, endTime);\n listener.upZ.linearRampToValueAtTime(up.z, endTime);\n } else {\n listener.setPosition($a315ee31802fb757$var$_position$1.x, $a315ee31802fb757$var$_position$1.y, $a315ee31802fb757$var$_position$1.z);\n listener.setOrientation($a315ee31802fb757$var$_orientation$1.x, $a315ee31802fb757$var$_orientation$1.y, $a315ee31802fb757$var$_orientation$1.z, up.x, up.y, up.z);\n }\n }\n}\nclass $a315ee31802fb757$export$153755f98d9861de extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(listener){\n super();\n this.type = \"Audio\";\n this.listener = listener;\n this.context = listener.context;\n this.gain = this.context.createGain();\n this.gain.connect(listener.getInput());\n this.autoplay = false;\n this.buffer = null;\n this.detune = 0;\n this.loop = false;\n this.loopStart = 0;\n this.loopEnd = 0;\n this.offset = 0;\n this.duration = undefined;\n this.playbackRate = 1;\n this.isPlaying = false;\n this.hasPlaybackControl = true;\n this.source = null;\n this.sourceType = \"empty\";\n this._startedAt = 0;\n this._progress = 0;\n this._connected = false;\n this.filters = [];\n }\n getOutput() {\n return this.gain;\n }\n setNodeSource(audioNode) {\n this.hasPlaybackControl = false;\n this.sourceType = \"audioNode\";\n this.source = audioNode;\n this.connect();\n return this;\n }\n setMediaElementSource(mediaElement) {\n this.hasPlaybackControl = false;\n this.sourceType = \"mediaNode\";\n this.source = this.context.createMediaElementSource(mediaElement);\n this.connect();\n return this;\n }\n setMediaStreamSource(mediaStream) {\n this.hasPlaybackControl = false;\n this.sourceType = \"mediaStreamNode\";\n this.source = this.context.createMediaStreamSource(mediaStream);\n this.connect();\n return this;\n }\n setBuffer(audioBuffer) {\n this.buffer = audioBuffer;\n this.sourceType = \"buffer\";\n if (this.autoplay) this.play();\n return this;\n }\n play(delay = 0) {\n if (this.isPlaying === true) {\n console.warn(\"THREE.Audio: Audio is already playing.\");\n return;\n }\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this._startedAt = this.context.currentTime + delay;\n const source = this.context.createBufferSource();\n source.buffer = this.buffer;\n source.loop = this.loop;\n source.loopStart = this.loopStart;\n source.loopEnd = this.loopEnd;\n source.onended = this.onEnded.bind(this);\n source.start(this._startedAt, this._progress + this.offset, this.duration);\n this.isPlaying = true;\n this.source = source;\n this.setDetune(this.detune);\n this.setPlaybackRate(this.playbackRate);\n return this.connect();\n }\n pause() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n if (this.isPlaying === true) {\n // update current progress\n this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate;\n if (this.loop === true) // ensure _progress does not exceed duration with looped audios\n this._progress = this._progress % (this.duration || this.buffer.duration);\n this.source.stop();\n this.source.onended = null;\n this.isPlaying = false;\n }\n return this;\n }\n stop() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this._progress = 0;\n if (this.source !== null) {\n this.source.stop();\n this.source.onended = null;\n }\n this.isPlaying = false;\n return this;\n }\n connect() {\n if (this.filters.length > 0) {\n this.source.connect(this.filters[0]);\n for(let i = 1, l = this.filters.length; i < l; i++)this.filters[i - 1].connect(this.filters[i]);\n this.filters[this.filters.length - 1].connect(this.getOutput());\n } else this.source.connect(this.getOutput());\n this._connected = true;\n return this;\n }\n disconnect() {\n if (this.filters.length > 0) {\n this.source.disconnect(this.filters[0]);\n for(let i = 1, l = this.filters.length; i < l; i++)this.filters[i - 1].disconnect(this.filters[i]);\n this.filters[this.filters.length - 1].disconnect(this.getOutput());\n } else this.source.disconnect(this.getOutput());\n this._connected = false;\n return this;\n }\n getFilters() {\n return this.filters;\n }\n setFilters(value) {\n if (!value) value = [];\n if (this._connected === true) {\n this.disconnect();\n this.filters = value.slice();\n this.connect();\n } else this.filters = value.slice();\n return this;\n }\n setDetune(value) {\n this.detune = value;\n if (this.source.detune === undefined) return; // only set detune when available\n if (this.isPlaying === true) this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01);\n return this;\n }\n getDetune() {\n return this.detune;\n }\n getFilter() {\n return this.getFilters()[0];\n }\n setFilter(filter) {\n return this.setFilters(filter ? [\n filter\n ] : []);\n }\n setPlaybackRate(value) {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this.playbackRate = value;\n if (this.isPlaying === true) this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01);\n return this;\n }\n getPlaybackRate() {\n return this.playbackRate;\n }\n onEnded() {\n this.isPlaying = false;\n }\n getLoop() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return false;\n }\n return this.loop;\n }\n setLoop(value) {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this.loop = value;\n if (this.isPlaying === true) this.source.loop = this.loop;\n return this;\n }\n setLoopStart(value) {\n this.loopStart = value;\n return this;\n }\n setLoopEnd(value) {\n this.loopEnd = value;\n return this;\n }\n getVolume() {\n return this.gain.gain.value;\n }\n setVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n}\nconst $a315ee31802fb757$var$_position = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_quaternion = /*@__PURE__*/ new $a315ee31802fb757$export$23d6a54f0bbc85a3();\nconst $a315ee31802fb757$var$_scale = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_orientation = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$4b3e397ef1832507 extends $a315ee31802fb757$export$153755f98d9861de {\n constructor(listener){\n super(listener);\n this.panner = this.context.createPanner();\n this.panner.panningModel = \"HRTF\";\n this.panner.connect(this.gain);\n }\n connect() {\n super.connect();\n this.panner.connect(this.gain);\n }\n disconnect() {\n super.disconnect();\n this.panner.disconnect(this.gain);\n }\n getOutput() {\n return this.panner;\n }\n getRefDistance() {\n return this.panner.refDistance;\n }\n setRefDistance(value) {\n this.panner.refDistance = value;\n return this;\n }\n getRolloffFactor() {\n return this.panner.rolloffFactor;\n }\n setRolloffFactor(value) {\n this.panner.rolloffFactor = value;\n return this;\n }\n getDistanceModel() {\n return this.panner.distanceModel;\n }\n setDistanceModel(value) {\n this.panner.distanceModel = value;\n return this;\n }\n getMaxDistance() {\n return this.panner.maxDistance;\n }\n setMaxDistance(value) {\n this.panner.maxDistance = value;\n return this;\n }\n setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {\n this.panner.coneInnerAngle = coneInnerAngle;\n this.panner.coneOuterAngle = coneOuterAngle;\n this.panner.coneOuterGain = coneOuterGain;\n return this;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.hasPlaybackControl === true && this.isPlaying === false) return;\n this.matrixWorld.decompose($a315ee31802fb757$var$_position, $a315ee31802fb757$var$_quaternion, $a315ee31802fb757$var$_scale);\n $a315ee31802fb757$var$_orientation.set(0, 0, 1).applyQuaternion($a315ee31802fb757$var$_quaternion);\n const panner = this.panner;\n if (panner.positionX) {\n // code path for Chrome and Firefox (see #14393)\n const endTime = this.context.currentTime + this.listener.timeDelta;\n panner.positionX.linearRampToValueAtTime($a315ee31802fb757$var$_position.x, endTime);\n panner.positionY.linearRampToValueAtTime($a315ee31802fb757$var$_position.y, endTime);\n panner.positionZ.linearRampToValueAtTime($a315ee31802fb757$var$_position.z, endTime);\n panner.orientationX.linearRampToValueAtTime($a315ee31802fb757$var$_orientation.x, endTime);\n panner.orientationY.linearRampToValueAtTime($a315ee31802fb757$var$_orientation.y, endTime);\n panner.orientationZ.linearRampToValueAtTime($a315ee31802fb757$var$_orientation.z, endTime);\n } else {\n panner.setPosition($a315ee31802fb757$var$_position.x, $a315ee31802fb757$var$_position.y, $a315ee31802fb757$var$_position.z);\n panner.setOrientation($a315ee31802fb757$var$_orientation.x, $a315ee31802fb757$var$_orientation.y, $a315ee31802fb757$var$_orientation.z);\n }\n }\n}\nclass $a315ee31802fb757$export$d47da1ef3d382827 {\n constructor(audio, fftSize = 2048){\n this.analyser = audio.context.createAnalyser();\n this.analyser.fftSize = fftSize;\n this.data = new Uint8Array(this.analyser.frequencyBinCount);\n audio.getOutput().connect(this.analyser);\n }\n getFrequencyData() {\n this.analyser.getByteFrequencyData(this.data);\n return this.data;\n }\n getAverageFrequency() {\n let value = 0;\n const data = this.getFrequencyData();\n for(let i = 0; i < data.length; i++)value += data[i];\n return value / data.length;\n }\n}\nclass $a315ee31802fb757$export$dfe0af1ca1acb78a {\n constructor(binding, typeName, valueSize){\n this.binding = binding;\n this.valueSize = valueSize;\n let mixFunction, mixFunctionAdditive, setIdentity;\n // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n //\n // interpolators can use .buffer as their .result\n // the data then goes to 'incoming'\n //\n // 'accu0' and 'accu1' are used frame-interleaved for\n // the cumulative result and are compared to detect\n // changes\n //\n // 'orig' stores the original state of the property\n //\n // 'add' is used for additive cumulative results\n //\n // 'work' is optional and is only present for quaternion types. It is used\n // to store intermediate quaternion multiplication results\n switch(typeName){\n case \"quaternion\":\n mixFunction = this._slerp;\n mixFunctionAdditive = this._slerpAdditive;\n setIdentity = this._setAdditiveIdentityQuaternion;\n this.buffer = new Float64Array(valueSize * 6);\n this._workIndex = 5;\n break;\n case \"string\":\n case \"bool\":\n mixFunction = this._select;\n // Use the regular mix function and for additive on these types,\n // additive is not relevant for non-numeric types\n mixFunctionAdditive = this._select;\n setIdentity = this._setAdditiveIdentityOther;\n this.buffer = new Array(valueSize * 5);\n break;\n default:\n mixFunction = this._lerp;\n mixFunctionAdditive = this._lerpAdditive;\n setIdentity = this._setAdditiveIdentityNumeric;\n this.buffer = new Float64Array(valueSize * 5);\n }\n this._mixBufferRegion = mixFunction;\n this._mixBufferRegionAdditive = mixFunctionAdditive;\n this._setIdentity = setIdentity;\n this._origIndex = 3;\n this._addIndex = 4;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n this.useCount = 0;\n this.referenceCount = 0;\n }\n // accumulate data in the 'incoming' region into 'accu'\n accumulate(accuIndex, weight) {\n // note: happily accumulating nothing when weight = 0, the caller knows\n // the weight and shouldn't have made the call in the first place\n const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride;\n let currentWeight = this.cumulativeWeight;\n if (currentWeight === 0) {\n // accuN := incoming * weight\n for(let i = 0; i !== stride; ++i)buffer[offset + i] = buffer[i];\n currentWeight = weight;\n } else {\n // accuN := accuN + incoming * weight\n currentWeight += weight;\n const mix = weight / currentWeight;\n this._mixBufferRegion(buffer, offset, 0, mix, stride);\n }\n this.cumulativeWeight = currentWeight;\n }\n // accumulate data in the 'incoming' region into 'add'\n accumulateAdditive(weight) {\n const buffer = this.buffer, stride = this.valueSize, offset = stride * this._addIndex;\n if (this.cumulativeWeightAdditive === 0) // add = identity\n this._setIdentity();\n // add := add + incoming * weight\n this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);\n this.cumulativeWeightAdditive += weight;\n }\n // apply the state of 'accu' to the binding when accus differ\n apply(accuIndex) {\n const stride = this.valueSize, buffer = this.buffer, offset = accuIndex * stride + stride, weight = this.cumulativeWeight, weightAdditive = this.cumulativeWeightAdditive, binding = this.binding;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n if (weight < 1) {\n // accuN := accuN + original * ( 1 - cumulativeWeight )\n const originalValueOffset = stride * this._origIndex;\n this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n }\n if (weightAdditive > 0) // accuN := accuN + additive accuN\n this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n for(let i = stride, e = stride + stride; i !== e; ++i)if (buffer[i] !== buffer[i + stride]) {\n // value has changed -> update scene graph\n binding.setValue(buffer, offset);\n break;\n }\n }\n // remember the state of the bound property and copy it to both accus\n saveOriginalState() {\n const binding = this.binding;\n const buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * this._origIndex;\n binding.getValue(buffer, originalValueOffset);\n // accu[0..1] := orig -- initially detect changes against the original\n for(let i = stride, e = originalValueOffset; i !== e; ++i)buffer[i] = buffer[originalValueOffset + i % stride];\n // Add to identity for additive\n this._setIdentity();\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n }\n // apply the state previously taken via 'saveOriginalState' to the binding\n restoreOriginalState() {\n const originalValueOffset = this.valueSize * 3;\n this.binding.setValue(this.buffer, originalValueOffset);\n }\n _setAdditiveIdentityNumeric() {\n const startIndex = this._addIndex * this.valueSize;\n const endIndex = startIndex + this.valueSize;\n for(let i = startIndex; i < endIndex; i++)this.buffer[i] = 0;\n }\n _setAdditiveIdentityQuaternion() {\n this._setAdditiveIdentityNumeric();\n this.buffer[this._addIndex * this.valueSize + 3] = 1;\n }\n _setAdditiveIdentityOther() {\n const startIndex = this._origIndex * this.valueSize;\n const targetIndex = this._addIndex * this.valueSize;\n for(let i = 0; i < this.valueSize; i++)this.buffer[targetIndex + i] = this.buffer[startIndex + i];\n }\n // mix functions\n _select(buffer, dstOffset, srcOffset, t, stride) {\n if (t >= 0.5) for(let i = 0; i !== stride; ++i)buffer[dstOffset + i] = buffer[srcOffset + i];\n }\n _slerp(buffer, dstOffset, srcOffset, t) {\n $a315ee31802fb757$export$23d6a54f0bbc85a3.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t);\n }\n _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n const workOffset = this._workIndex * stride;\n // Store result in intermediate buffer offset\n $a315ee31802fb757$export$23d6a54f0bbc85a3.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset);\n // Slerp to the intermediate result\n $a315ee31802fb757$export$23d6a54f0bbc85a3.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t);\n }\n _lerp(buffer, dstOffset, srcOffset, t, stride) {\n const s = 1 - t;\n for(let i = 0; i !== stride; ++i){\n const j = dstOffset + i;\n buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t;\n }\n }\n _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n for(let i = 0; i !== stride; ++i){\n const j = dstOffset + i;\n buffer[j] = buffer[j] + buffer[srcOffset + i] * t;\n }\n }\n}\n// Characters [].:/ are reserved for track binding syntax.\nconst $a315ee31802fb757$var$_RESERVED_CHARS_RE = \"\\\\[\\\\]\\\\.:\\\\/\";\nconst $a315ee31802fb757$var$_reservedRe = new RegExp(\"[\" + $a315ee31802fb757$var$_RESERVED_CHARS_RE + \"]\", \"g\");\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst $a315ee31802fb757$var$_wordChar = \"[^\" + $a315ee31802fb757$var$_RESERVED_CHARS_RE + \"]\";\nconst $a315ee31802fb757$var$_wordCharOrDot = \"[^\" + $a315ee31802fb757$var$_RESERVED_CHARS_RE.replace(\"\\\\.\", \"\") + \"]\";\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst $a315ee31802fb757$var$_directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace(\"WC\", $a315ee31802fb757$var$_wordChar);\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst $a315ee31802fb757$var$_nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace(\"WCOD\", $a315ee31802fb757$var$_wordCharOrDot);\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst $a315ee31802fb757$var$_objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace(\"WC\", $a315ee31802fb757$var$_wordChar);\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst $a315ee31802fb757$var$_propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace(\"WC\", $a315ee31802fb757$var$_wordChar);\nconst $a315ee31802fb757$var$_trackRe = new RegExp(\"^\" + $a315ee31802fb757$var$_directoryRe + $a315ee31802fb757$var$_nodeRe + $a315ee31802fb757$var$_objectRe + $a315ee31802fb757$var$_propertyRe + \"$\");\nconst $a315ee31802fb757$var$_supportedObjectNames = [\n \"material\",\n \"materials\",\n \"bones\",\n \"map\"\n];\nclass $a315ee31802fb757$var$Composite {\n constructor(targetGroup, path, optionalParsedPath){\n const parsedPath = optionalParsedPath || $a315ee31802fb757$export$7bf70fcf9f891893.parseTrackName(path);\n this._targetGroup = targetGroup;\n this._bindings = targetGroup.subscribe_(path, parsedPath);\n }\n getValue(array, offset) {\n this.bind(); // bind all binding\n const firstValidIndex = this._targetGroup.nCachedObjects_, binding = this._bindings[firstValidIndex];\n // and only call .getValue on the first\n if (binding !== undefined) binding.getValue(array, offset);\n }\n setValue(array, offset) {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].setValue(array, offset);\n }\n bind() {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].bind();\n }\n unbind() {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].unbind();\n }\n}\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass $a315ee31802fb757$export$7bf70fcf9f891893 {\n constructor(rootNode, path, parsedPath){\n this.path = path;\n this.parsedPath = parsedPath || $a315ee31802fb757$export$7bf70fcf9f891893.parseTrackName(path);\n this.node = $a315ee31802fb757$export$7bf70fcf9f891893.findNode(rootNode, this.parsedPath.nodeName);\n this.rootNode = rootNode;\n // initial state of these methods that calls 'bind'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n static create(root, path, parsedPath) {\n if (!(root && root.isAnimationObjectGroup)) return new $a315ee31802fb757$export$7bf70fcf9f891893(root, path, parsedPath);\n else return new $a315ee31802fb757$export$7bf70fcf9f891893.Composite(root, path, parsedPath);\n }\n /**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */ static sanitizeNodeName(name) {\n return name.replace(/\\s/g, \"_\").replace($a315ee31802fb757$var$_reservedRe, \"\");\n }\n static parseTrackName(trackName) {\n const matches = $a315ee31802fb757$var$_trackRe.exec(trackName);\n if (matches === null) throw new Error(\"PropertyBinding: Cannot parse trackName: \" + trackName);\n const results = {\n // directoryName: matches[ 1 ], // (tschw) currently unused\n nodeName: matches[2],\n objectName: matches[3],\n objectIndex: matches[4],\n propertyName: matches[5],\n propertyIndex: matches[6]\n };\n const lastDot = results.nodeName && results.nodeName.lastIndexOf(\".\");\n if (lastDot !== undefined && lastDot !== -1) {\n const objectName = results.nodeName.substring(lastDot + 1);\n // Object names must be checked against an allowlist. Otherwise, there\n // is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n // 'bar' could be the objectName, or part of a nodeName (which can\n // include '.' characters).\n if ($a315ee31802fb757$var$_supportedObjectNames.indexOf(objectName) !== -1) {\n results.nodeName = results.nodeName.substring(0, lastDot);\n results.objectName = objectName;\n }\n }\n if (results.propertyName === null || results.propertyName.length === 0) throw new Error(\"PropertyBinding: can not parse propertyName from trackName: \" + trackName);\n return results;\n }\n static findNode(root, nodeName) {\n if (nodeName === undefined || nodeName === \"\" || nodeName === \".\" || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) return root;\n // search into skeleton bones.\n if (root.skeleton) {\n const bone = root.skeleton.getBoneByName(nodeName);\n if (bone !== undefined) return bone;\n }\n // search into node subtree.\n if (root.children) {\n const searchNodeSubtree = function(children) {\n for(let i = 0; i < children.length; i++){\n const childNode = children[i];\n if (childNode.name === nodeName || childNode.uuid === nodeName) return childNode;\n const result = searchNodeSubtree(childNode.children);\n if (result) return result;\n }\n return null;\n };\n const subTreeNode = searchNodeSubtree(root.children);\n if (subTreeNode) return subTreeNode;\n }\n return null;\n }\n // these are used to \"bind\" a nonexistent property\n _getValue_unavailable() {}\n _setValue_unavailable() {}\n // Getters\n _getValue_direct(buffer, offset) {\n buffer[offset] = this.targetObject[this.propertyName];\n }\n _getValue_array(buffer, offset) {\n const source = this.resolvedProperty;\n for(let i = 0, n = source.length; i !== n; ++i)buffer[offset++] = source[i];\n }\n _getValue_arrayElement(buffer, offset) {\n buffer[offset] = this.resolvedProperty[this.propertyIndex];\n }\n _getValue_toArray(buffer, offset) {\n this.resolvedProperty.toArray(buffer, offset);\n }\n // Direct\n _setValue_direct(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n }\n _setValue_direct_setNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // EntireArray\n _setValue_array(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n }\n _setValue_array_setNeedsUpdate(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n this.targetObject.needsUpdate = true;\n }\n _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // ArrayElement\n _setValue_arrayElement(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n }\n _setValue_arrayElement_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // HasToFromArray\n _setValue_fromArray(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n }\n _setValue_fromArray_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.needsUpdate = true;\n }\n _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n _getValue_unbound(targetArray, offset) {\n this.bind();\n this.getValue(targetArray, offset);\n }\n _setValue_unbound(sourceArray, offset) {\n this.bind();\n this.setValue(sourceArray, offset);\n }\n // create getter / setter pair for a property in the scene graph\n bind() {\n let targetObject = this.node;\n const parsedPath = this.parsedPath;\n const objectName = parsedPath.objectName;\n const propertyName = parsedPath.propertyName;\n let propertyIndex = parsedPath.propertyIndex;\n if (!targetObject) {\n targetObject = $a315ee31802fb757$export$7bf70fcf9f891893.findNode(this.rootNode, parsedPath.nodeName);\n this.node = targetObject;\n }\n // set fail state so we can just 'return' on error\n this.getValue = this._getValue_unavailable;\n this.setValue = this._setValue_unavailable;\n // ensure there is a value node\n if (!targetObject) {\n console.warn(\"THREE.PropertyBinding: No target node found for track: \" + this.path + \".\");\n return;\n }\n if (objectName) {\n let objectIndex = parsedPath.objectIndex;\n // special cases were we need to reach deeper into the hierarchy to get the face materials....\n switch(objectName){\n case \"materials\":\n if (!targetObject.material) {\n console.error(\"THREE.PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!targetObject.material.materials) {\n console.error(\"THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\", this);\n return;\n }\n targetObject = targetObject.material.materials;\n break;\n case \"bones\":\n if (!targetObject.skeleton) {\n console.error(\"THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.\", this);\n return;\n }\n // potential future optimization: skip this if propertyIndex is already an integer\n // and convert the integer string to a true integer.\n targetObject = targetObject.skeleton.bones;\n // support resolving morphTarget names into indices.\n for(let i = 0; i < targetObject.length; i++)if (targetObject[i].name === objectIndex) {\n objectIndex = i;\n break;\n }\n break;\n case \"map\":\n if (\"map\" in targetObject) {\n targetObject = targetObject.map;\n break;\n }\n if (!targetObject.material) {\n console.error(\"THREE.PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!targetObject.material.map) {\n console.error(\"THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.\", this);\n return;\n }\n targetObject = targetObject.material.map;\n break;\n default:\n if (targetObject[objectName] === undefined) {\n console.error(\"THREE.PropertyBinding: Can not bind to objectName of node undefined.\", this);\n return;\n }\n targetObject = targetObject[objectName];\n }\n if (objectIndex !== undefined) {\n if (targetObject[objectIndex] === undefined) {\n console.error(\"THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\", this, targetObject);\n return;\n }\n targetObject = targetObject[objectIndex];\n }\n }\n // resolve property\n const nodeProperty = targetObject[propertyName];\n if (nodeProperty === undefined) {\n const nodeName = parsedPath.nodeName;\n console.error(\"THREE.PropertyBinding: Trying to update property for track: \" + nodeName + \".\" + propertyName + \" but it wasn't found.\", targetObject);\n return;\n }\n // determine versioning scheme\n let versioning = this.Versioning.None;\n this.targetObject = targetObject;\n if (targetObject.needsUpdate !== undefined) versioning = this.Versioning.NeedsUpdate;\n else if (targetObject.matrixWorldNeedsUpdate !== undefined) versioning = this.Versioning.MatrixWorldNeedsUpdate;\n // determine how the property gets bound\n let bindingType = this.BindingType.Direct;\n if (propertyIndex !== undefined) {\n // access a sub element of the property array (only primitives are supported right now)\n if (propertyName === \"morphTargetInfluences\") {\n // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n // support resolving morphTarget names into indices.\n if (!targetObject.geometry) {\n console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\", this);\n return;\n }\n if (!targetObject.geometry.morphAttributes) {\n console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\", this);\n return;\n }\n if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) propertyIndex = targetObject.morphTargetDictionary[propertyIndex];\n }\n bindingType = this.BindingType.ArrayElement;\n this.resolvedProperty = nodeProperty;\n this.propertyIndex = propertyIndex;\n } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) {\n // must use copy for Object3D.Euler/Quaternion\n bindingType = this.BindingType.HasFromToArray;\n this.resolvedProperty = nodeProperty;\n } else if (Array.isArray(nodeProperty)) {\n bindingType = this.BindingType.EntireArray;\n this.resolvedProperty = nodeProperty;\n } else this.propertyName = propertyName;\n // select getter / setter\n this.getValue = this.GetterByBindingType[bindingType];\n this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];\n }\n unbind() {\n this.node = null;\n // back to the prototype version of getValue / setValue\n // note: avoiding to mutate the shape of 'this' via 'delete'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n}\n$a315ee31802fb757$export$7bf70fcf9f891893.Composite = $a315ee31802fb757$var$Composite;\n$a315ee31802fb757$export$7bf70fcf9f891893.prototype.BindingType = {\n Direct: 0,\n EntireArray: 1,\n ArrayElement: 2,\n HasFromToArray: 3\n};\n$a315ee31802fb757$export$7bf70fcf9f891893.prototype.Versioning = {\n None: 0,\n NeedsUpdate: 1,\n MatrixWorldNeedsUpdate: 2\n};\n$a315ee31802fb757$export$7bf70fcf9f891893.prototype.GetterByBindingType = [\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._getValue_direct,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._getValue_array,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._getValue_arrayElement,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._getValue_toArray\n];\n$a315ee31802fb757$export$7bf70fcf9f891893.prototype.SetterByBindingTypeAndVersioning = [\n [\n // Direct\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_direct,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_direct_setNeedsUpdate,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_direct_setMatrixWorldNeedsUpdate\n ],\n [\n // EntireArray\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_array,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_array_setNeedsUpdate,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_array_setMatrixWorldNeedsUpdate\n ],\n [\n // ArrayElement\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_arrayElement,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_arrayElement_setNeedsUpdate,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate\n ],\n [\n // HasToFromArray\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_fromArray,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_fromArray_setNeedsUpdate,\n $a315ee31802fb757$export$7bf70fcf9f891893.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate\n ]\n];\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */ class $a315ee31802fb757$export$30619c2afd3f34db {\n constructor(){\n this.isAnimationObjectGroup = true;\n this.uuid = $a315ee31802fb757$var$generateUUID();\n // cached objects followed by the active ones\n this._objects = Array.prototype.slice.call(arguments);\n this.nCachedObjects_ = 0; // threshold\n // note: read by PropertyBinding.Composite\n const indices = {};\n this._indicesByUUID = indices; // for bookkeeping\n for(let i = 0, n = arguments.length; i !== n; ++i)indices[arguments[i].uuid] = i;\n this._paths = []; // inside: string\n this._parsedPaths = []; // inside: { we don't care, here }\n this._bindings = []; // inside: Array< PropertyBinding >\n this._bindingsIndicesByPath = {}; // inside: indices in these arrays\n const scope = this;\n this.stats = {\n objects: {\n get total () {\n return scope._objects.length;\n },\n get inUse () {\n return this.total - scope.nCachedObjects_;\n }\n },\n get bindingsPerObject () {\n return scope._bindings.length;\n }\n };\n }\n add() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, nBindings = bindings.length;\n let knownObject = undefined, nObjects = objects.length, nCachedObjects = this.nCachedObjects_;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid;\n let index = indicesByUUID[uuid];\n if (index === undefined) {\n // unknown object -> add it to the ACTIVE region\n index = nObjects++;\n indicesByUUID[uuid] = index;\n objects.push(object);\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j)bindings[j].push(new $a315ee31802fb757$export$7bf70fcf9f891893(object, paths[j], parsedPaths[j]));\n } else if (index < nCachedObjects) {\n knownObject = objects[index];\n // move existing object to the ACTIVE region\n const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex];\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n indicesByUUID[uuid] = firstActiveIndex;\n objects[firstActiveIndex] = object;\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex];\n let binding = bindingsForPath[index];\n bindingsForPath[index] = lastCached;\n if (binding === undefined) // since we do not bother to create new bindings\n // for objects that are cached, the binding may\n // or may not exist\n binding = new $a315ee31802fb757$export$7bf70fcf9f891893(object, paths[j], parsedPaths[j]);\n bindingsForPath[firstActiveIndex] = binding;\n }\n } else if (objects[index] !== knownObject) console.error(\"THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.\");\n // else the object is already where we want it to be\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n remove() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;\n let nCachedObjects = this.nCachedObjects_;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid];\n if (index !== undefined && index >= nCachedObjects) {\n // move existing object into the CACHED region\n const lastCachedIndex = nCachedObjects++, firstActiveObject = objects[lastCachedIndex];\n indicesByUUID[firstActiveObject.uuid] = index;\n objects[index] = firstActiveObject;\n indicesByUUID[uuid] = lastCachedIndex;\n objects[lastCachedIndex] = object;\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], firstActive = bindingsForPath[lastCachedIndex], binding = bindingsForPath[index];\n bindingsForPath[index] = firstActive;\n bindingsForPath[lastCachedIndex] = binding;\n }\n }\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n // remove & forget\n uncache() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;\n let nCachedObjects = this.nCachedObjects_, nObjects = objects.length;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid];\n if (index !== undefined) {\n delete indicesByUUID[uuid];\n if (index < nCachedObjects) {\n // object is cached, shrink the CACHED region\n const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex];\n // last cached object takes this object's place\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n // last object goes to the activated slot and pop\n indicesByUUID[lastObject.uuid] = firstActiveIndex;\n objects[firstActiveIndex] = lastObject;\n objects.pop();\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex], last = bindingsForPath[lastIndex];\n bindingsForPath[index] = lastCached;\n bindingsForPath[firstActiveIndex] = last;\n bindingsForPath.pop();\n }\n } else {\n // object is active, just swap with the last and pop\n const lastIndex = --nObjects, lastObject = objects[lastIndex];\n if (lastIndex > 0) indicesByUUID[lastObject.uuid] = index;\n objects[index] = lastObject;\n objects.pop();\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j];\n bindingsForPath[index] = bindingsForPath[lastIndex];\n bindingsForPath.pop();\n }\n } // cached or active\n } // if object is known\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n // Internal interface used by befriended PropertyBinding.Composite:\n subscribe_(path, parsedPath) {\n // returns an array of bindings for the given path that is changed\n // according to the contained objects in the group\n const indicesByPath = this._bindingsIndicesByPath;\n let index = indicesByPath[path];\n const bindings = this._bindings;\n if (index !== undefined) return bindings[index];\n const paths = this._paths, parsedPaths = this._parsedPaths, objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, bindingsForPath = new Array(nObjects);\n index = bindings.length;\n indicesByPath[path] = index;\n paths.push(path);\n parsedPaths.push(parsedPath);\n bindings.push(bindingsForPath);\n for(let i = nCachedObjects, n = objects.length; i !== n; ++i){\n const object = objects[i];\n bindingsForPath[i] = new $a315ee31802fb757$export$7bf70fcf9f891893(object, path, parsedPath);\n }\n return bindingsForPath;\n }\n unsubscribe_(path) {\n // tells the group to forget about a property path and no longer\n // update the array previously obtained with 'subscribe_'\n const indicesByPath = this._bindingsIndicesByPath, index = indicesByPath[path];\n if (index !== undefined) {\n const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = path[lastBindingsIndex];\n indicesByPath[lastBindingsPath] = index;\n bindings[index] = lastBindings;\n bindings.pop();\n parsedPaths[index] = parsedPaths[lastBindingsIndex];\n parsedPaths.pop();\n paths[index] = paths[lastBindingsIndex];\n paths.pop();\n }\n }\n}\nclass $a315ee31802fb757$export$6946940a69e799e {\n constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode){\n this._mixer = mixer;\n this._clip = clip;\n this._localRoot = localRoot;\n this.blendMode = blendMode;\n const tracks = clip.tracks, nTracks = tracks.length, interpolants = new Array(nTracks);\n const interpolantSettings = {\n endingStart: $a315ee31802fb757$export$7f795934b84ab523,\n endingEnd: $a315ee31802fb757$export$7f795934b84ab523\n };\n for(let i = 0; i !== nTracks; ++i){\n const interpolant = tracks[i].createInterpolant(null);\n interpolants[i] = interpolant;\n interpolant.settings = interpolantSettings;\n }\n this._interpolantSettings = interpolantSettings;\n this._interpolants = interpolants; // bound by the mixer\n // inside: PropertyMixer (managed by the mixer)\n this._propertyBindings = new Array(nTracks);\n this._cacheIndex = null; // for the memory manager\n this._byClipCacheIndex = null; // for the memory manager\n this._timeScaleInterpolant = null;\n this._weightInterpolant = null;\n this.loop = $a315ee31802fb757$export$dfaf4422ce096e29;\n this._loopCount = -1;\n // global mixer time when the action is to be started\n // it's set back to 'null' upon start of the action\n this._startTime = null;\n // scaled local time of the action\n // gets clamped or wrapped to 0..clip.duration according to loop\n this.time = 0;\n this.timeScale = 1;\n this._effectiveTimeScale = 1;\n this.weight = 1;\n this._effectiveWeight = 1;\n this.repetitions = Infinity; // no. of repetitions when looping\n this.paused = false; // true -> zero effective time scale\n this.enabled = true; // false -> zero effective weight\n this.clampWhenFinished = false; // keep feeding the last frame?\n this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate\n this.zeroSlopeAtEnd = true; // clips for start, loop and end\n }\n // State & Scheduling\n play() {\n this._mixer._activateAction(this);\n return this;\n }\n stop() {\n this._mixer._deactivateAction(this);\n return this.reset();\n }\n reset() {\n this.paused = false;\n this.enabled = true;\n this.time = 0; // restart clip\n this._loopCount = -1; // forget previous loops\n this._startTime = null; // forget scheduling\n return this.stopFading().stopWarping();\n }\n isRunning() {\n return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);\n }\n // return true when play has been called\n isScheduled() {\n return this._mixer._isActiveAction(this);\n }\n startAt(time) {\n this._startTime = time;\n return this;\n }\n setLoop(mode, repetitions) {\n this.loop = mode;\n this.repetitions = repetitions;\n return this;\n }\n // Weight\n // set the weight stopping any scheduled fading\n // although .enabled = false yields an effective weight of zero, this\n // method does *not* change .enabled, because it would be confusing\n setEffectiveWeight(weight) {\n this.weight = weight;\n // note: same logic as when updated at runtime\n this._effectiveWeight = this.enabled ? weight : 0;\n return this.stopFading();\n }\n // return the weight considering fading and .enabled\n getEffectiveWeight() {\n return this._effectiveWeight;\n }\n fadeIn(duration) {\n return this._scheduleFading(duration, 0, 1);\n }\n fadeOut(duration) {\n return this._scheduleFading(duration, 1, 0);\n }\n crossFadeFrom(fadeOutAction, duration, warp) {\n fadeOutAction.fadeOut(duration);\n this.fadeIn(duration);\n if (warp) {\n const fadeInDuration = this._clip.duration, fadeOutDuration = fadeOutAction._clip.duration, startEndRatio = fadeOutDuration / fadeInDuration, endStartRatio = fadeInDuration / fadeOutDuration;\n fadeOutAction.warp(1.0, startEndRatio, duration);\n this.warp(endStartRatio, 1.0, duration);\n }\n return this;\n }\n crossFadeTo(fadeInAction, duration, warp) {\n return fadeInAction.crossFadeFrom(this, duration, warp);\n }\n stopFading() {\n const weightInterpolant = this._weightInterpolant;\n if (weightInterpolant !== null) {\n this._weightInterpolant = null;\n this._mixer._takeBackControlInterpolant(weightInterpolant);\n }\n return this;\n }\n // Time Scale Control\n // set the time scale stopping any scheduled warping\n // although .paused = true yields an effective time scale of zero, this\n // method does *not* change .paused, because it would be confusing\n setEffectiveTimeScale(timeScale) {\n this.timeScale = timeScale;\n this._effectiveTimeScale = this.paused ? 0 : timeScale;\n return this.stopWarping();\n }\n // return the time scale considering warping and .paused\n getEffectiveTimeScale() {\n return this._effectiveTimeScale;\n }\n setDuration(duration) {\n this.timeScale = this._clip.duration / duration;\n return this.stopWarping();\n }\n syncWith(action) {\n this.time = action.time;\n this.timeScale = action.timeScale;\n return this.stopWarping();\n }\n halt(duration) {\n return this.warp(this._effectiveTimeScale, 0, duration);\n }\n warp(startTimeScale, endTimeScale, duration) {\n const mixer = this._mixer, now = mixer.time, timeScale = this.timeScale;\n let interpolant = this._timeScaleInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._timeScaleInterpolant = interpolant;\n }\n const times = interpolant.parameterPositions, values = interpolant.sampleValues;\n times[0] = now;\n times[1] = now + duration;\n values[0] = startTimeScale / timeScale;\n values[1] = endTimeScale / timeScale;\n return this;\n }\n stopWarping() {\n const timeScaleInterpolant = this._timeScaleInterpolant;\n if (timeScaleInterpolant !== null) {\n this._timeScaleInterpolant = null;\n this._mixer._takeBackControlInterpolant(timeScaleInterpolant);\n }\n return this;\n }\n // Object Accessors\n getMixer() {\n return this._mixer;\n }\n getClip() {\n return this._clip;\n }\n getRoot() {\n return this._localRoot || this._mixer._root;\n }\n // Interna\n _update(time, deltaTime, timeDirection, accuIndex) {\n // called by the mixer\n if (!this.enabled) {\n // call ._updateWeight() to update ._effectiveWeight\n this._updateWeight(time);\n return;\n }\n const startTime = this._startTime;\n if (startTime !== null) {\n // check for scheduled start of action\n const timeRunning = (time - startTime) * timeDirection;\n if (timeRunning < 0 || timeDirection === 0) deltaTime = 0;\n else {\n this._startTime = null; // unschedule\n deltaTime = timeDirection * timeRunning;\n }\n }\n // apply time scale and advance time\n deltaTime *= this._updateTimeScale(time);\n const clipTime = this._updateTime(deltaTime);\n // note: _updateTime may disable the action resulting in\n // an effective weight of 0\n const weight = this._updateWeight(time);\n if (weight > 0) {\n const interpolants = this._interpolants;\n const propertyMixers = this._propertyBindings;\n switch(this.blendMode){\n case $a315ee31802fb757$export$d875e029ef558d3:\n for(let j = 0, m = interpolants.length; j !== m; ++j){\n interpolants[j].evaluate(clipTime);\n propertyMixers[j].accumulateAdditive(weight);\n }\n break;\n case $a315ee31802fb757$export$bcfbbdcf8de7f8cd:\n default:\n for(let j = 0, m = interpolants.length; j !== m; ++j){\n interpolants[j].evaluate(clipTime);\n propertyMixers[j].accumulate(accuIndex, weight);\n }\n }\n }\n }\n _updateWeight(time) {\n let weight = 0;\n if (this.enabled) {\n weight = this.weight;\n const interpolant = this._weightInterpolant;\n if (interpolant !== null) {\n const interpolantValue = interpolant.evaluate(time)[0];\n weight *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopFading();\n if (interpolantValue === 0) // faded out, disable\n this.enabled = false;\n }\n }\n }\n this._effectiveWeight = weight;\n return weight;\n }\n _updateTimeScale(time) {\n let timeScale = 0;\n if (!this.paused) {\n timeScale = this.timeScale;\n const interpolant = this._timeScaleInterpolant;\n if (interpolant !== null) {\n const interpolantValue = interpolant.evaluate(time)[0];\n timeScale *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopWarping();\n if (timeScale === 0) // motion has halted, pause\n this.paused = true;\n else // warp done - apply final time scale\n this.timeScale = timeScale;\n }\n }\n }\n this._effectiveTimeScale = timeScale;\n return timeScale;\n }\n _updateTime(deltaTime) {\n const duration = this._clip.duration;\n const loop = this.loop;\n let time = this.time + deltaTime;\n let loopCount = this._loopCount;\n const pingPong = loop === $a315ee31802fb757$export$f8f6f2041b78e210;\n if (deltaTime === 0) {\n if (loopCount === -1) return time;\n return pingPong && (loopCount & 1) === 1 ? duration - time : time;\n }\n if (loop === $a315ee31802fb757$export$d62fdc9d1b1cccad) {\n if (loopCount === -1) {\n // just started\n this._loopCount = 0;\n this._setEndings(true, true, false);\n }\n handle_stop: {\n if (time >= duration) time = duration;\n else if (time < 0) time = 0;\n else {\n this.time = time;\n break handle_stop;\n }\n if (this.clampWhenFinished) this.paused = true;\n else this.enabled = false;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"finished\",\n action: this,\n direction: deltaTime < 0 ? -1 : 1\n });\n }\n } else {\n if (loopCount === -1) {\n // just started\n if (deltaTime >= 0) {\n loopCount = 0;\n this._setEndings(true, this.repetitions === 0, pingPong);\n } else // when looping in reverse direction, the initial\n // transition through zero counts as a repetition,\n // so leave loopCount at -1\n this._setEndings(this.repetitions === 0, true, pingPong);\n }\n if (time >= duration || time < 0) {\n // wrap around\n const loopDelta = Math.floor(time / duration); // signed\n time -= duration * loopDelta;\n loopCount += Math.abs(loopDelta);\n const pending = this.repetitions - loopCount;\n if (pending <= 0) {\n // have to stop (switch state, clamp time, fire event)\n if (this.clampWhenFinished) this.paused = true;\n else this.enabled = false;\n time = deltaTime > 0 ? duration : 0;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"finished\",\n action: this,\n direction: deltaTime > 0 ? 1 : -1\n });\n } else {\n // keep running\n if (pending === 1) {\n // entering the last round\n const atStart = deltaTime < 0;\n this._setEndings(atStart, !atStart, pingPong);\n } else this._setEndings(false, false, pingPong);\n this._loopCount = loopCount;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"loop\",\n action: this,\n loopDelta: loopDelta\n });\n }\n } else this.time = time;\n if (pingPong && (loopCount & 1) === 1) // invert time for the \"pong round\"\n return duration - time;\n }\n return time;\n }\n _setEndings(atStart, atEnd, pingPong) {\n const settings = this._interpolantSettings;\n if (pingPong) {\n settings.endingStart = $a315ee31802fb757$export$24a4ccb5099273b5;\n settings.endingEnd = $a315ee31802fb757$export$24a4ccb5099273b5;\n } else {\n // assuming for LoopOnce atStart == atEnd == true\n if (atStart) settings.endingStart = this.zeroSlopeAtStart ? $a315ee31802fb757$export$24a4ccb5099273b5 : $a315ee31802fb757$export$7f795934b84ab523;\n else settings.endingStart = $a315ee31802fb757$export$8e8c3ecdcd8e1fee;\n if (atEnd) settings.endingEnd = this.zeroSlopeAtEnd ? $a315ee31802fb757$export$24a4ccb5099273b5 : $a315ee31802fb757$export$7f795934b84ab523;\n else settings.endingEnd = $a315ee31802fb757$export$8e8c3ecdcd8e1fee;\n }\n }\n _scheduleFading(duration, weightNow, weightThen) {\n const mixer = this._mixer, now = mixer.time;\n let interpolant = this._weightInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._weightInterpolant = interpolant;\n }\n const times = interpolant.parameterPositions, values = interpolant.sampleValues;\n times[0] = now;\n values[0] = weightNow;\n times[1] = now + duration;\n values[1] = weightThen;\n return this;\n }\n}\nconst $a315ee31802fb757$var$_controlInterpolantsResultBuffer = new Float32Array(1);\nclass $a315ee31802fb757$export$fbd77e5aefaa0102 extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(root){\n super();\n this._root = root;\n this._initMemoryManager();\n this._accuIndex = 0;\n this.time = 0;\n this.timeScale = 1.0;\n }\n _bindAction(action, prototypeAction) {\n const root = action._localRoot || this._root, tracks = action._clip.tracks, nTracks = tracks.length, bindings = action._propertyBindings, interpolants = action._interpolants, rootUuid = root.uuid, bindingsByRoot = this._bindingsByRootAndName;\n let bindingsByName = bindingsByRoot[rootUuid];\n if (bindingsByName === undefined) {\n bindingsByName = {};\n bindingsByRoot[rootUuid] = bindingsByName;\n }\n for(let i = 0; i !== nTracks; ++i){\n const track = tracks[i], trackName = track.name;\n let binding = bindingsByName[trackName];\n if (binding !== undefined) {\n ++binding.referenceCount;\n bindings[i] = binding;\n } else {\n binding = bindings[i];\n if (binding !== undefined) {\n // existing binding, make sure the cache knows\n if (binding._cacheIndex === null) {\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n }\n continue;\n }\n const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath;\n binding = new $a315ee31802fb757$export$dfe0af1ca1acb78a($a315ee31802fb757$export$7bf70fcf9f891893.create(root, trackName, path), track.ValueTypeName, track.getValueSize());\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n bindings[i] = binding;\n }\n interpolants[i].resultBuffer = binding.buffer;\n }\n }\n _activateAction(action) {\n if (!this._isActiveAction(action)) {\n if (action._cacheIndex === null) {\n // this action has been forgotten by the cache, but the user\n // appears to be still using it -> rebind\n const rootUuid = (action._localRoot || this._root).uuid, clipUuid = action._clip.uuid, actionsForClip = this._actionsByClip[clipUuid];\n this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]);\n this._addInactiveAction(action, clipUuid, rootUuid);\n }\n const bindings = action._propertyBindings;\n // increment reference counts / sort out state\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (binding.useCount++ === 0) {\n this._lendBinding(binding);\n binding.saveOriginalState();\n }\n }\n this._lendAction(action);\n }\n }\n _deactivateAction(action) {\n if (this._isActiveAction(action)) {\n const bindings = action._propertyBindings;\n // decrement reference counts / sort out state\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (--binding.useCount === 0) {\n binding.restoreOriginalState();\n this._takeBackBinding(binding);\n }\n }\n this._takeBackAction(action);\n }\n }\n // Memory manager\n _initMemoryManager() {\n this._actions = []; // 'nActiveActions' followed by inactive ones\n this._nActiveActions = 0;\n this._actionsByClip = {};\n // inside:\n // {\n // \tknownActions: Array< AnimationAction > - used as prototypes\n // \tactionByRoot: AnimationAction - lookup\n // }\n this._bindings = []; // 'nActiveBindings' followed by inactive ones\n this._nActiveBindings = 0;\n this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n this._controlInterpolants = []; // same game as above\n this._nActiveControlInterpolants = 0;\n const scope = this;\n this.stats = {\n actions: {\n get total () {\n return scope._actions.length;\n },\n get inUse () {\n return scope._nActiveActions;\n }\n },\n bindings: {\n get total () {\n return scope._bindings.length;\n },\n get inUse () {\n return scope._nActiveBindings;\n }\n },\n controlInterpolants: {\n get total () {\n return scope._controlInterpolants.length;\n },\n get inUse () {\n return scope._nActiveControlInterpolants;\n }\n }\n };\n }\n // Memory management for AnimationAction objects\n _isActiveAction(action) {\n const index = action._cacheIndex;\n return index !== null && index < this._nActiveActions;\n }\n _addInactiveAction(action, clipUuid, rootUuid) {\n const actions = this._actions, actionsByClip = this._actionsByClip;\n let actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip === undefined) {\n actionsForClip = {\n knownActions: [\n action\n ],\n actionByRoot: {}\n };\n action._byClipCacheIndex = 0;\n actionsByClip[clipUuid] = actionsForClip;\n } else {\n const knownActions = actionsForClip.knownActions;\n action._byClipCacheIndex = knownActions.length;\n knownActions.push(action);\n }\n action._cacheIndex = actions.length;\n actions.push(action);\n actionsForClip.actionByRoot[rootUuid] = action;\n }\n _removeInactiveAction(action) {\n const actions = this._actions, lastInactiveAction = actions[actions.length - 1], cacheIndex = action._cacheIndex;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n action._cacheIndex = null;\n const clipUuid = action._clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid], knownActionsForClip = actionsForClip.knownActions, lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], byClipCacheIndex = action._byClipCacheIndex;\n lastKnownAction._byClipCacheIndex = byClipCacheIndex;\n knownActionsForClip[byClipCacheIndex] = lastKnownAction;\n knownActionsForClip.pop();\n action._byClipCacheIndex = null;\n const actionByRoot = actionsForClip.actionByRoot, rootUuid = (action._localRoot || this._root).uuid;\n delete actionByRoot[rootUuid];\n if (knownActionsForClip.length === 0) delete actionsByClip[clipUuid];\n this._removeInactiveBindingsForAction(action);\n }\n _removeInactiveBindingsForAction(action) {\n const bindings = action._propertyBindings;\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (--binding.referenceCount === 0) this._removeInactiveBinding(binding);\n }\n }\n _lendAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions >| inactive actions ]\n // s a\n // <-swap->\n // a s\n const actions = this._actions, prevIndex = action._cacheIndex, lastActiveIndex = this._nActiveActions++, firstInactiveAction = actions[lastActiveIndex];\n action._cacheIndex = lastActiveIndex;\n actions[lastActiveIndex] = action;\n firstInactiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = firstInactiveAction;\n }\n _takeBackAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions |< inactive actions ]\n // a s\n // <-swap->\n // s a\n const actions = this._actions, prevIndex = action._cacheIndex, firstInactiveIndex = --this._nActiveActions, lastActiveAction = actions[firstInactiveIndex];\n action._cacheIndex = firstInactiveIndex;\n actions[firstInactiveIndex] = action;\n lastActiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = lastActiveAction;\n }\n // Memory management for PropertyMixer objects\n _addInactiveBinding(binding, rootUuid, trackName) {\n const bindingsByRoot = this._bindingsByRootAndName, bindings = this._bindings;\n let bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName === undefined) {\n bindingByName = {};\n bindingsByRoot[rootUuid] = bindingByName;\n }\n bindingByName[trackName] = binding;\n binding._cacheIndex = bindings.length;\n bindings.push(binding);\n }\n _removeInactiveBinding(binding) {\n const bindings = this._bindings, propBinding = binding.binding, rootUuid = propBinding.rootNode.uuid, trackName = propBinding.path, bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid], lastInactiveBinding = bindings[bindings.length - 1], cacheIndex = binding._cacheIndex;\n lastInactiveBinding._cacheIndex = cacheIndex;\n bindings[cacheIndex] = lastInactiveBinding;\n bindings.pop();\n delete bindingByName[trackName];\n if (Object.keys(bindingByName).length === 0) delete bindingsByRoot[rootUuid];\n }\n _lendBinding(binding) {\n const bindings = this._bindings, prevIndex = binding._cacheIndex, lastActiveIndex = this._nActiveBindings++, firstInactiveBinding = bindings[lastActiveIndex];\n binding._cacheIndex = lastActiveIndex;\n bindings[lastActiveIndex] = binding;\n firstInactiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = firstInactiveBinding;\n }\n _takeBackBinding(binding) {\n const bindings = this._bindings, prevIndex = binding._cacheIndex, firstInactiveIndex = --this._nActiveBindings, lastActiveBinding = bindings[firstInactiveIndex];\n binding._cacheIndex = firstInactiveIndex;\n bindings[firstInactiveIndex] = binding;\n lastActiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = lastActiveBinding;\n }\n // Memory management of Interpolants for weight and time scale\n _lendControlInterpolant() {\n const interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants++;\n let interpolant = interpolants[lastActiveIndex];\n if (interpolant === undefined) {\n interpolant = new $a315ee31802fb757$export$a8e6009059f51e1a(new Float32Array(2), new Float32Array(2), 1, $a315ee31802fb757$var$_controlInterpolantsResultBuffer);\n interpolant.__cacheIndex = lastActiveIndex;\n interpolants[lastActiveIndex] = interpolant;\n }\n return interpolant;\n }\n _takeBackControlInterpolant(interpolant) {\n const interpolants = this._controlInterpolants, prevIndex = interpolant.__cacheIndex, firstInactiveIndex = --this._nActiveControlInterpolants, lastActiveInterpolant = interpolants[firstInactiveIndex];\n interpolant.__cacheIndex = firstInactiveIndex;\n interpolants[firstInactiveIndex] = interpolant;\n lastActiveInterpolant.__cacheIndex = prevIndex;\n interpolants[prevIndex] = lastActiveInterpolant;\n }\n // return an action for a clip optionally using a custom root target\n // object (this method allocates a lot of dynamic memory in case a\n // previously unknown clip/root combination is specified)\n clipAction(clip, optionalRoot, blendMode) {\n const root = optionalRoot || this._root, rootUuid = root.uuid;\n let clipObject = typeof clip === \"string\" ? $a315ee31802fb757$export$d942c706bf23829c.findByName(root, clip) : clip;\n const clipUuid = clipObject !== null ? clipObject.uuid : clip;\n const actionsForClip = this._actionsByClip[clipUuid];\n let prototypeAction = null;\n if (blendMode === undefined) {\n if (clipObject !== null) blendMode = clipObject.blendMode;\n else blendMode = $a315ee31802fb757$export$bcfbbdcf8de7f8cd;\n }\n if (actionsForClip !== undefined) {\n const existingAction = actionsForClip.actionByRoot[rootUuid];\n if (existingAction !== undefined && existingAction.blendMode === blendMode) return existingAction;\n // we know the clip, so we don't have to parse all\n // the bindings again but can just copy\n prototypeAction = actionsForClip.knownActions[0];\n // also, take the clip from the prototype action\n if (clipObject === null) clipObject = prototypeAction._clip;\n }\n // clip must be known when specified via string\n if (clipObject === null) return null;\n // allocate all resources required to run it\n const newAction = new $a315ee31802fb757$export$6946940a69e799e(this, clipObject, optionalRoot, blendMode);\n this._bindAction(newAction, prototypeAction);\n // and make the action known to the memory manager\n this._addInactiveAction(newAction, clipUuid, rootUuid);\n return newAction;\n }\n // get an existing action\n existingAction(clip, optionalRoot) {\n const root = optionalRoot || this._root, rootUuid = root.uuid, clipObject = typeof clip === \"string\" ? $a315ee31802fb757$export$d942c706bf23829c.findByName(root, clip) : clip, clipUuid = clipObject ? clipObject.uuid : clip, actionsForClip = this._actionsByClip[clipUuid];\n if (actionsForClip !== undefined) return actionsForClip.actionByRoot[rootUuid] || null;\n return null;\n }\n // deactivates all previously scheduled actions\n stopAllAction() {\n const actions = this._actions, nActions = this._nActiveActions;\n for(let i = nActions - 1; i >= 0; --i)actions[i].stop();\n return this;\n }\n // advance the time and update apply the animation\n update(deltaTime) {\n deltaTime *= this.timeScale;\n const actions = this._actions, nActions = this._nActiveActions, time = this.time += deltaTime, timeDirection = Math.sign(deltaTime), accuIndex = this._accuIndex ^= 1;\n // run active actions\n for(let i = 0; i !== nActions; ++i){\n const action = actions[i];\n action._update(time, deltaTime, timeDirection, accuIndex);\n }\n // update scene graph\n const bindings = this._bindings, nBindings = this._nActiveBindings;\n for(let i = 0; i !== nBindings; ++i)bindings[i].apply(accuIndex);\n return this;\n }\n // Allows you to seek to a specific time in an animation.\n setTime(timeInSeconds) {\n this.time = 0; // Zero out time attribute for AnimationMixer object;\n for(let i = 0; i < this._actions.length; i++)this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n return this.update(timeInSeconds); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n }\n // return this mixer's root target object\n getRoot() {\n return this._root;\n }\n // free all resources specific to a particular clip\n uncacheClip(clip) {\n const actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip !== undefined) {\n // note: just calling _removeInactiveAction would mess up the\n // iteration state and also require updating the state we can\n // just throw away\n const actionsToRemove = actionsForClip.knownActions;\n for(let i = 0, n = actionsToRemove.length; i !== n; ++i){\n const action = actionsToRemove[i];\n this._deactivateAction(action);\n const cacheIndex = action._cacheIndex, lastInactiveAction = actions[actions.length - 1];\n action._cacheIndex = null;\n action._byClipCacheIndex = null;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n this._removeInactiveBindingsForAction(action);\n }\n delete actionsByClip[clipUuid];\n }\n }\n // free all resources specific to a particular root target object\n uncacheRoot(root) {\n const rootUuid = root.uuid, actionsByClip = this._actionsByClip;\n for(const clipUuid in actionsByClip){\n const actionByRoot = actionsByClip[clipUuid].actionByRoot, action = actionByRoot[rootUuid];\n if (action !== undefined) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n const bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName !== undefined) for(const trackName in bindingByName){\n const binding = bindingByName[trackName];\n binding.restoreOriginalState();\n this._removeInactiveBinding(binding);\n }\n }\n // remove a targeted clip from the cache\n uncacheAction(clip, optionalRoot) {\n const action = this.existingAction(clip, optionalRoot);\n if (action !== null) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n}\nclass $a315ee31802fb757$export$2947cebfe91c02f8 {\n constructor(value){\n this.value = value;\n }\n clone() {\n return new $a315ee31802fb757$export$2947cebfe91c02f8(this.value.clone === undefined ? this.value : this.value.clone());\n }\n}\nlet $a315ee31802fb757$var$id = 0;\nclass $a315ee31802fb757$export$c412d5ffe1f79209 extends $a315ee31802fb757$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isUniformsGroup = true;\n Object.defineProperty(this, \"id\", {\n value: $a315ee31802fb757$var$id++\n });\n this.name = \"\";\n this.usage = $a315ee31802fb757$export$763e8360f4d7f77d;\n this.uniforms = [];\n }\n add(uniform) {\n this.uniforms.push(uniform);\n return this;\n }\n remove(uniform) {\n const index = this.uniforms.indexOf(uniform);\n if (index !== -1) this.uniforms.splice(index, 1);\n return this;\n }\n setName(name) {\n this.name = name;\n return this;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n return this;\n }\n copy(source) {\n this.name = source.name;\n this.usage = source.usage;\n const uniformsSource = source.uniforms;\n this.uniforms.length = 0;\n for(let i = 0, l = uniformsSource.length; i < l; i++)this.uniforms.push(uniformsSource[i].clone());\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $a315ee31802fb757$export$25ec0e1af1389358 extends $a315ee31802fb757$export$3d5cd879f108f53f {\n constructor(array, stride, meshPerAttribute = 1){\n super(array, stride);\n this.isInstancedInterleavedBuffer = true;\n this.meshPerAttribute = meshPerAttribute;\n }\n copy(source) {\n super.copy(source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n clone(data) {\n const ib = super.clone(data);\n ib.meshPerAttribute = this.meshPerAttribute;\n return ib;\n }\n toJSON(data) {\n const json = super.toJSON(data);\n json.isInstancedInterleavedBuffer = true;\n json.meshPerAttribute = this.meshPerAttribute;\n return json;\n }\n}\nclass $a315ee31802fb757$export$6b7339ae8dbddf73 {\n constructor(buffer, type, itemSize, elementSize, count){\n this.isGLBufferAttribute = true;\n this.name = \"\";\n this.buffer = buffer;\n this.type = type;\n this.itemSize = itemSize;\n this.elementSize = elementSize;\n this.count = count;\n this.version = 0;\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setBuffer(buffer) {\n this.buffer = buffer;\n return this;\n }\n setType(type, elementSize) {\n this.type = type;\n this.elementSize = elementSize;\n return this;\n }\n setItemSize(itemSize) {\n this.itemSize = itemSize;\n return this;\n }\n setCount(count) {\n this.count = count;\n return this;\n }\n}\nclass $a315ee31802fb757$export$8b7aaceff00bd2f {\n constructor(origin, direction, near = 0, far = Infinity){\n this.ray = new $a315ee31802fb757$export$a186db52eed6d40e(origin, direction);\n // direction is assumed to be normalized (for accurate distance calculations)\n this.near = near;\n this.far = far;\n this.camera = null;\n this.layers = new $a315ee31802fb757$export$89312ce47c0ca777();\n this.params = {\n Mesh: {},\n Line: {\n threshold: 1\n },\n LOD: {},\n Points: {\n threshold: 1\n },\n Sprite: {}\n };\n }\n set(origin, direction) {\n // direction is assumed to be normalized (for accurate distance calculations)\n this.ray.set(origin, direction);\n }\n setFromCamera(coords, camera) {\n if (camera.isPerspectiveCamera) {\n this.ray.origin.setFromMatrixPosition(camera.matrixWorld);\n this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize();\n this.camera = camera;\n } else if (camera.isOrthographicCamera) {\n this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera\n this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld);\n this.camera = camera;\n } else console.error(\"THREE.Raycaster: Unsupported camera type: \" + camera.type);\n }\n intersectObject(object, recursive = true, intersects = []) {\n $a315ee31802fb757$var$intersectObject(object, this, intersects, recursive);\n intersects.sort($a315ee31802fb757$var$ascSort);\n return intersects;\n }\n intersectObjects(objects, recursive = true, intersects = []) {\n for(let i = 0, l = objects.length; i < l; i++)$a315ee31802fb757$var$intersectObject(objects[i], this, intersects, recursive);\n intersects.sort($a315ee31802fb757$var$ascSort);\n return intersects;\n }\n}\nfunction $a315ee31802fb757$var$ascSort(a, b) {\n return a.distance - b.distance;\n}\nfunction $a315ee31802fb757$var$intersectObject(object, raycaster, intersects, recursive) {\n if (object.layers.test(raycaster.layers)) object.raycast(raycaster, intersects);\n if (recursive === true) {\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)$a315ee31802fb757$var$intersectObject(children[i], raycaster, intersects, true);\n }\n}\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */ class $a315ee31802fb757$export$d712cd887b4a00f7 {\n constructor(radius = 1, phi = 0, theta = 0){\n this.radius = radius;\n this.phi = phi; // polar angle\n this.theta = theta; // azimuthal angle\n return this;\n }\n set(radius, phi, theta) {\n this.radius = radius;\n this.phi = phi;\n this.theta = theta;\n return this;\n }\n copy(other) {\n this.radius = other.radius;\n this.phi = other.phi;\n this.theta = other.theta;\n return this;\n }\n // restrict phi to be between EPS and PI-EPS\n makeSafe() {\n const EPS = 0.000001;\n this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi));\n return this;\n }\n setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + y * y + z * z);\n if (this.radius === 0) {\n this.theta = 0;\n this.phi = 0;\n } else {\n this.theta = Math.atan2(x, z);\n this.phi = Math.acos($a315ee31802fb757$var$clamp(y / this.radius, -1, 1));\n }\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */ class $a315ee31802fb757$export$287165bb2177f4fd {\n constructor(radius = 1, theta = 0, y = 0){\n this.radius = radius; // distance from the origin to a point in the x-z plane\n this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n this.y = y; // height above the x-z plane\n return this;\n }\n set(radius, theta, y) {\n this.radius = radius;\n this.theta = theta;\n this.y = y;\n return this;\n }\n copy(other) {\n this.radius = other.radius;\n this.theta = other.theta;\n this.y = other.y;\n return this;\n }\n setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + z * z);\n this.theta = Math.atan2(x, z);\n this.y = y;\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $a315ee31802fb757$var$_vector$4 = /*@__PURE__*/ new $a315ee31802fb757$export$c977b3e384af9ae1();\nclass $a315ee31802fb757$export$60f553fa130f08b0 {\n constructor(min = new $a315ee31802fb757$export$c977b3e384af9ae1(Infinity, Infinity), max = new $a315ee31802fb757$export$c977b3e384af9ae1(-Infinity, -Infinity)){\n this.isBox2 = true;\n this.min = min;\n this.max = max;\n }\n set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n setFromPoints(points) {\n this.makeEmpty();\n for(let i = 0, il = points.length; i < il; i++)this.expandByPoint(points[i]);\n return this;\n }\n setFromCenterAndSize(center, size) {\n const halfSize = $a315ee31802fb757$var$_vector$4.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n makeEmpty() {\n this.min.x = this.min.y = Infinity;\n this.max.x = this.max.y = -Infinity;\n return this;\n }\n isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n return this.max.x < this.min.x || this.max.y < this.min.y;\n }\n getCenter(target) {\n return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n getSize(target) {\n return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min);\n }\n expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true;\n }\n containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y;\n }\n getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));\n }\n intersectsBox(box) {\n // using 4 splitting planes to rule out intersections\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n }\n clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n distanceToPoint(point) {\n return this.clampPoint(point, $a315ee31802fb757$var$_vector$4).distanceTo(point);\n }\n intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n}\nconst $a315ee31802fb757$var$_startP = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_startEnd = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$e0ba6359f1954fd3 {\n constructor(start = new $a315ee31802fb757$export$64b5c384219d3699(), end = new $a315ee31802fb757$export$64b5c384219d3699()){\n this.start = start;\n this.end = end;\n }\n set(start, end) {\n this.start.copy(start);\n this.end.copy(end);\n return this;\n }\n copy(line) {\n this.start.copy(line.start);\n this.end.copy(line.end);\n return this;\n }\n getCenter(target) {\n return target.addVectors(this.start, this.end).multiplyScalar(0.5);\n }\n delta(target) {\n return target.subVectors(this.end, this.start);\n }\n distanceSq() {\n return this.start.distanceToSquared(this.end);\n }\n distance() {\n return this.start.distanceTo(this.end);\n }\n at(t, target) {\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n closestPointToPointParameter(point, clampToLine) {\n $a315ee31802fb757$var$_startP.subVectors(point, this.start);\n $a315ee31802fb757$var$_startEnd.subVectors(this.end, this.start);\n const startEnd2 = $a315ee31802fb757$var$_startEnd.dot($a315ee31802fb757$var$_startEnd);\n const startEnd_startP = $a315ee31802fb757$var$_startEnd.dot($a315ee31802fb757$var$_startP);\n let t = startEnd_startP / startEnd2;\n if (clampToLine) t = $a315ee31802fb757$var$clamp(t, 0, 1);\n return t;\n }\n closestPointToPoint(point, clampToLine, target) {\n const t = this.closestPointToPointParameter(point, clampToLine);\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n applyMatrix4(matrix) {\n this.start.applyMatrix4(matrix);\n this.end.applyMatrix4(matrix);\n return this;\n }\n equals(line) {\n return line.start.equals(this.start) && line.end.equals(this.end);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $a315ee31802fb757$var$_vector$3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$4b14638ffdd81e68 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(light, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"SpotLightHelper\";\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n const positions = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 0,\n 0,\n 0,\n -1,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n -1,\n 1\n ];\n for(let i = 0, j = 1, l = 32; i < l; i++, j++){\n const p1 = i / l * Math.PI * 2;\n const p2 = j / l * Math.PI * 2;\n positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1);\n }\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(positions, 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n fog: false,\n toneMapped: false\n });\n this.cone = new $a315ee31802fb757$export$ff1ed10fedfdd604(geometry, material);\n this.add(this.cone);\n this.update();\n }\n dispose() {\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n const coneLength = this.light.distance ? this.light.distance : 1000;\n const coneWidth = coneLength * Math.tan(this.light.angle);\n this.cone.scale.set(coneWidth, coneWidth, coneLength);\n $a315ee31802fb757$var$_vector$3.setFromMatrixPosition(this.light.target.matrixWorld);\n this.cone.lookAt($a315ee31802fb757$var$_vector$3);\n if (this.color !== undefined) this.cone.material.color.set(this.color);\n else this.cone.material.color.copy(this.light.color);\n }\n}\nconst $a315ee31802fb757$var$_vector$2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_boneMatrix = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nconst $a315ee31802fb757$var$_matrixWorldInv = /*@__PURE__*/ new $a315ee31802fb757$export$2ae72fc923e5eb5();\nclass $a315ee31802fb757$export$5277df3c9e732259 extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(object){\n const bones = $a315ee31802fb757$var$getBoneList(object);\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n const vertices = [];\n const colors = [];\n const color1 = new $a315ee31802fb757$export$892596cec99bc70e(0, 0, 1);\n const color2 = new $a315ee31802fb757$export$892596cec99bc70e(0, 1, 0);\n for(let i = 0; i < bones.length; i++){\n const bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n vertices.push(0, 0, 0);\n vertices.push(0, 0, 0);\n colors.push(color1.r, color1.g, color1.b);\n colors.push(color2.r, color2.g, color2.b);\n }\n }\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$cbe7a62641830ebd(colors, 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n vertexColors: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n transparent: true\n });\n super(geometry, material);\n this.isSkeletonHelper = true;\n this.type = \"SkeletonHelper\";\n this.root = object;\n this.bones = bones;\n this.matrix = object.matrixWorld;\n this.matrixAutoUpdate = false;\n }\n updateMatrixWorld(force) {\n const bones = this.bones;\n const geometry = this.geometry;\n const position = geometry.getAttribute(\"position\");\n $a315ee31802fb757$var$_matrixWorldInv.copy(this.root.matrixWorld).invert();\n for(let i = 0, j = 0; i < bones.length; i++){\n const bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n $a315ee31802fb757$var$_boneMatrix.multiplyMatrices($a315ee31802fb757$var$_matrixWorldInv, bone.matrixWorld);\n $a315ee31802fb757$var$_vector$2.setFromMatrixPosition($a315ee31802fb757$var$_boneMatrix);\n position.setXYZ(j, $a315ee31802fb757$var$_vector$2.x, $a315ee31802fb757$var$_vector$2.y, $a315ee31802fb757$var$_vector$2.z);\n $a315ee31802fb757$var$_boneMatrix.multiplyMatrices($a315ee31802fb757$var$_matrixWorldInv, bone.parent.matrixWorld);\n $a315ee31802fb757$var$_vector$2.setFromMatrixPosition($a315ee31802fb757$var$_boneMatrix);\n position.setXYZ(j + 1, $a315ee31802fb757$var$_vector$2.x, $a315ee31802fb757$var$_vector$2.y, $a315ee31802fb757$var$_vector$2.z);\n j += 2;\n }\n }\n geometry.getAttribute(\"position\").needsUpdate = true;\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nfunction $a315ee31802fb757$var$getBoneList(object) {\n const boneList = [];\n if (object.isBone === true) boneList.push(object);\n for(let i = 0; i < object.children.length; i++)boneList.push.apply(boneList, $a315ee31802fb757$var$getBoneList(object.children[i]));\n return boneList;\n}\nclass $a315ee31802fb757$export$9a9291685b9e4023 extends $a315ee31802fb757$export$e176487c05830cc5 {\n constructor(light, sphereSize, color){\n const geometry = new $a315ee31802fb757$export$1b417fc3b307a251(sphereSize, 4, 2);\n const material = new $a315ee31802fb757$export$55cbcc9b622fe1f5({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n super(geometry, material);\n this.light = light;\n this.color = color;\n this.type = \"PointLightHelper\";\n this.matrix = this.light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.update();\n /*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/ }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n if (this.color !== undefined) this.material.color.set(this.color);\n else this.material.color.copy(this.light.color);\n /*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/ }\n}\nconst $a315ee31802fb757$var$_vector$1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_color1 = /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e();\nconst $a315ee31802fb757$var$_color2 = /*@__PURE__*/ new $a315ee31802fb757$export$892596cec99bc70e();\nclass $a315ee31802fb757$export$8dca15f13f4f8172 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(light, size, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"HemisphereLightHelper\";\n const geometry = new $a315ee31802fb757$export$1954e2b809fe361e(size);\n geometry.rotateY(Math.PI * 0.5);\n this.material = new $a315ee31802fb757$export$55cbcc9b622fe1f5({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n if (this.color === undefined) this.material.vertexColors = true;\n const position = geometry.getAttribute(\"position\");\n const colors = new Float32Array(position.count * 3);\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$8dea267bd6bde117(colors, 3));\n this.add(new $a315ee31802fb757$export$e176487c05830cc5(geometry, this.material));\n this.update();\n }\n dispose() {\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n update() {\n const mesh = this.children[0];\n if (this.color !== undefined) this.material.color.set(this.color);\n else {\n const colors = mesh.geometry.getAttribute(\"color\");\n $a315ee31802fb757$var$_color1.copy(this.light.color);\n $a315ee31802fb757$var$_color2.copy(this.light.groundColor);\n for(let i = 0, l = colors.count; i < l; i++){\n const color = i < l / 2 ? $a315ee31802fb757$var$_color1 : $a315ee31802fb757$var$_color2;\n colors.setXYZ(i, color.r, color.g, color.b);\n }\n colors.needsUpdate = true;\n }\n this.light.updateWorldMatrix(true, false);\n mesh.lookAt($a315ee31802fb757$var$_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());\n }\n}\nclass $a315ee31802fb757$export$3875d39926561055 extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888){\n color1 = new $a315ee31802fb757$export$892596cec99bc70e(color1);\n color2 = new $a315ee31802fb757$export$892596cec99bc70e(color2);\n const center = divisions / 2;\n const step = size / divisions;\n const halfSize = size / 2;\n const vertices = [], colors = [];\n for(let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step){\n vertices.push(-halfSize, 0, k, halfSize, 0, k);\n vertices.push(k, 0, -halfSize, k, 0, halfSize);\n const color = i === center ? color1 : color2;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n }\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$cbe7a62641830ebd(colors, 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"GridHelper\";\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $a315ee31802fb757$export$361430a10f533cd3 extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888){\n color1 = new $a315ee31802fb757$export$892596cec99bc70e(color1);\n color2 = new $a315ee31802fb757$export$892596cec99bc70e(color2);\n const vertices = [];\n const colors = [];\n // create the sectors\n if (sectors > 1) for(let i = 0; i < sectors; i++){\n const v = i / sectors * (Math.PI * 2);\n const x = Math.sin(v) * radius;\n const z = Math.cos(v) * radius;\n vertices.push(0, 0, 0);\n vertices.push(x, 0, z);\n const color = i & 1 ? color1 : color2;\n colors.push(color.r, color.g, color.b);\n colors.push(color.r, color.g, color.b);\n }\n // create the rings\n for(let i = 0; i < rings; i++){\n const color = i & 1 ? color1 : color2;\n const r = radius - radius / rings * i;\n for(let j = 0; j < divisions; j++){\n // first vertex\n let v = j / divisions * (Math.PI * 2);\n let x = Math.sin(v) * r;\n let z = Math.cos(v) * r;\n vertices.push(x, 0, z);\n colors.push(color.r, color.g, color.b);\n // second vertex\n v = (j + 1) / divisions * (Math.PI * 2);\n x = Math.sin(v) * r;\n z = Math.cos(v) * r;\n vertices.push(x, 0, z);\n colors.push(color.r, color.g, color.b);\n }\n }\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$cbe7a62641830ebd(colors, 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"PolarGridHelper\";\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nconst $a315ee31802fb757$var$_v1 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v2 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_v3 = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nclass $a315ee31802fb757$export$f8e434dc14203e7d extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n constructor(light, size, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"DirectionalLightHelper\";\n if (size === undefined) size = 1;\n let geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd([\n -size,\n size,\n 0,\n size,\n size,\n 0,\n size,\n -size,\n 0,\n -size,\n -size,\n 0,\n -size,\n size,\n 0\n ], 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n fog: false,\n toneMapped: false\n });\n this.lightPlane = new $a315ee31802fb757$export$17d680238e50603e(geometry, material);\n this.add(this.lightPlane);\n geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd([\n 0,\n 0,\n 0,\n 0,\n 0,\n 1\n ], 3));\n this.targetLine = new $a315ee31802fb757$export$17d680238e50603e(geometry, material);\n this.add(this.targetLine);\n this.update();\n }\n dispose() {\n this.lightPlane.geometry.dispose();\n this.lightPlane.material.dispose();\n this.targetLine.geometry.dispose();\n this.targetLine.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n $a315ee31802fb757$var$_v1.setFromMatrixPosition(this.light.matrixWorld);\n $a315ee31802fb757$var$_v2.setFromMatrixPosition(this.light.target.matrixWorld);\n $a315ee31802fb757$var$_v3.subVectors($a315ee31802fb757$var$_v2, $a315ee31802fb757$var$_v1);\n this.lightPlane.lookAt($a315ee31802fb757$var$_v2);\n if (this.color !== undefined) {\n this.lightPlane.material.color.set(this.color);\n this.targetLine.material.color.set(this.color);\n } else {\n this.lightPlane.material.color.copy(this.light.color);\n this.targetLine.material.color.copy(this.light.color);\n }\n this.targetLine.lookAt($a315ee31802fb757$var$_v2);\n this.targetLine.scale.z = $a315ee31802fb757$var$_v3.length();\n }\n}\nconst $a315ee31802fb757$var$_vector = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nconst $a315ee31802fb757$var$_camera = /*@__PURE__*/ new $a315ee31802fb757$export$79f141de891a5fed();\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */ class $a315ee31802fb757$export$ed8e93f853cd795 extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(camera){\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n color: 0xffffff,\n vertexColors: true,\n toneMapped: false\n });\n const vertices = [];\n const colors = [];\n const pointMap = {};\n // near\n addLine(\"n1\", \"n2\");\n addLine(\"n2\", \"n4\");\n addLine(\"n4\", \"n3\");\n addLine(\"n3\", \"n1\");\n // far\n addLine(\"f1\", \"f2\");\n addLine(\"f2\", \"f4\");\n addLine(\"f4\", \"f3\");\n addLine(\"f3\", \"f1\");\n // sides\n addLine(\"n1\", \"f1\");\n addLine(\"n2\", \"f2\");\n addLine(\"n3\", \"f3\");\n addLine(\"n4\", \"f4\");\n // cone\n addLine(\"p\", \"n1\");\n addLine(\"p\", \"n2\");\n addLine(\"p\", \"n3\");\n addLine(\"p\", \"n4\");\n // up\n addLine(\"u1\", \"u2\");\n addLine(\"u2\", \"u3\");\n addLine(\"u3\", \"u1\");\n // target\n addLine(\"c\", \"t\");\n addLine(\"p\", \"c\");\n // cross\n addLine(\"cn1\", \"cn2\");\n addLine(\"cn3\", \"cn4\");\n addLine(\"cf1\", \"cf2\");\n addLine(\"cf3\", \"cf4\");\n function addLine(a, b) {\n addPoint(a);\n addPoint(b);\n }\n function addPoint(id) {\n vertices.push(0, 0, 0);\n colors.push(0, 0, 0);\n if (pointMap[id] === undefined) pointMap[id] = [];\n pointMap[id].push(vertices.length / 3 - 1);\n }\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$cbe7a62641830ebd(colors, 3));\n super(geometry, material);\n this.type = \"CameraHelper\";\n this.camera = camera;\n if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix();\n this.matrix = camera.matrixWorld;\n this.matrixAutoUpdate = false;\n this.pointMap = pointMap;\n this.update();\n // colors\n const colorFrustum = new $a315ee31802fb757$export$892596cec99bc70e(0xffaa00);\n const colorCone = new $a315ee31802fb757$export$892596cec99bc70e(0xff0000);\n const colorUp = new $a315ee31802fb757$export$892596cec99bc70e(0x00aaff);\n const colorTarget = new $a315ee31802fb757$export$892596cec99bc70e(0xffffff);\n const colorCross = new $a315ee31802fb757$export$892596cec99bc70e(0x333333);\n this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross);\n }\n setColors(frustum, cone, up, target, cross) {\n const geometry = this.geometry;\n const colorAttribute = geometry.getAttribute(\"color\");\n // near\n colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); // n1, n2\n colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); // n2, n4\n colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); // n4, n3\n colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); // n3, n1\n // far\n colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); // f1, f2\n colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); // f2, f4\n colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); // f4, f3\n colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); // f3, f1\n // sides\n colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); // n1, f1\n colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); // n2, f2\n colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); // n3, f3\n colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); // n4, f4\n // cone\n colorAttribute.setXYZ(24, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); // p, n1\n colorAttribute.setXYZ(26, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); // p, n2\n colorAttribute.setXYZ(28, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); // p, n3\n colorAttribute.setXYZ(30, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); // p, n4\n // up\n colorAttribute.setXYZ(32, up.r, up.g, up.b);\n colorAttribute.setXYZ(33, up.r, up.g, up.b); // u1, u2\n colorAttribute.setXYZ(34, up.r, up.g, up.b);\n colorAttribute.setXYZ(35, up.r, up.g, up.b); // u2, u3\n colorAttribute.setXYZ(36, up.r, up.g, up.b);\n colorAttribute.setXYZ(37, up.r, up.g, up.b); // u3, u1\n // target\n colorAttribute.setXYZ(38, target.r, target.g, target.b);\n colorAttribute.setXYZ(39, target.r, target.g, target.b); // c, t\n colorAttribute.setXYZ(40, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); // p, c\n // cross\n colorAttribute.setXYZ(42, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); // cn1, cn2\n colorAttribute.setXYZ(44, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); // cn3, cn4\n colorAttribute.setXYZ(46, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); // cf1, cf2\n colorAttribute.setXYZ(48, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); // cf3, cf4\n colorAttribute.needsUpdate = true;\n }\n update() {\n const geometry = this.geometry;\n const pointMap = this.pointMap;\n const w = 1, h = 1;\n // we need just camera projection matrix inverse\n // world matrix must be identity\n $a315ee31802fb757$var$_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);\n // center / target\n $a315ee31802fb757$var$setPoint(\"c\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, 0, -1);\n $a315ee31802fb757$var$setPoint(\"t\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, 0, 1);\n // near\n $a315ee31802fb757$var$setPoint(\"n1\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, -h, -1);\n $a315ee31802fb757$var$setPoint(\"n2\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, -h, -1);\n $a315ee31802fb757$var$setPoint(\"n3\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, h, -1);\n $a315ee31802fb757$var$setPoint(\"n4\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, h, -1);\n // far\n $a315ee31802fb757$var$setPoint(\"f1\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, -h, 1);\n $a315ee31802fb757$var$setPoint(\"f2\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, -h, 1);\n $a315ee31802fb757$var$setPoint(\"f3\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, h, 1);\n $a315ee31802fb757$var$setPoint(\"f4\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, h, 1);\n // up\n $a315ee31802fb757$var$setPoint(\"u1\", pointMap, geometry, $a315ee31802fb757$var$_camera, w * 0.7, h * 1.1, -1);\n $a315ee31802fb757$var$setPoint(\"u2\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w * 0.7, h * 1.1, -1);\n $a315ee31802fb757$var$setPoint(\"u3\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, h * 2, -1);\n // cross\n $a315ee31802fb757$var$setPoint(\"cf1\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, 0, 1);\n $a315ee31802fb757$var$setPoint(\"cf2\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, 0, 1);\n $a315ee31802fb757$var$setPoint(\"cf3\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, -h, 1);\n $a315ee31802fb757$var$setPoint(\"cf4\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, h, 1);\n $a315ee31802fb757$var$setPoint(\"cn1\", pointMap, geometry, $a315ee31802fb757$var$_camera, -w, 0, -1);\n $a315ee31802fb757$var$setPoint(\"cn2\", pointMap, geometry, $a315ee31802fb757$var$_camera, w, 0, -1);\n $a315ee31802fb757$var$setPoint(\"cn3\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, -h, -1);\n $a315ee31802fb757$var$setPoint(\"cn4\", pointMap, geometry, $a315ee31802fb757$var$_camera, 0, h, -1);\n geometry.getAttribute(\"position\").needsUpdate = true;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nfunction $a315ee31802fb757$var$setPoint(point, pointMap, geometry, camera, x, y, z) {\n $a315ee31802fb757$var$_vector.set(x, y, z).unproject(camera);\n const points = pointMap[point];\n if (points !== undefined) {\n const position = geometry.getAttribute(\"position\");\n for(let i = 0, l = points.length; i < l; i++)position.setXYZ(points[i], $a315ee31802fb757$var$_vector.x, $a315ee31802fb757$var$_vector.y, $a315ee31802fb757$var$_vector.z);\n }\n}\nconst $a315ee31802fb757$var$_box = /*@__PURE__*/ new $a315ee31802fb757$export$6f7d5a9418ab2aa3();\nclass $a315ee31802fb757$export$38a664cc862a6a9d extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(object, color = 0xffff00){\n const indices = new Uint16Array([\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 0,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 4,\n 0,\n 4,\n 1,\n 5,\n 2,\n 6,\n 3,\n 7\n ]);\n const positions = new Float32Array(24);\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setIndex(new $a315ee31802fb757$export$8dea267bd6bde117(indices, 1));\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$8dea267bd6bde117(positions, 3));\n super(geometry, new $a315ee31802fb757$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.object = object;\n this.type = \"BoxHelper\";\n this.matrixAutoUpdate = false;\n this.update();\n }\n update(object) {\n if (object !== undefined) console.warn(\"THREE.BoxHelper: .update() has no longer arguments.\");\n if (this.object !== undefined) $a315ee31802fb757$var$_box.setFromObject(this.object);\n if ($a315ee31802fb757$var$_box.isEmpty()) return;\n const min = $a315ee31802fb757$var$_box.min;\n const max = $a315ee31802fb757$var$_box.max;\n /*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/ const position = this.geometry.attributes.position;\n const array = position.array;\n array[0] = max.x;\n array[1] = max.y;\n array[2] = max.z;\n array[3] = min.x;\n array[4] = max.y;\n array[5] = max.z;\n array[6] = min.x;\n array[7] = min.y;\n array[8] = max.z;\n array[9] = max.x;\n array[10] = min.y;\n array[11] = max.z;\n array[12] = max.x;\n array[13] = max.y;\n array[14] = min.z;\n array[15] = min.x;\n array[16] = max.y;\n array[17] = min.z;\n array[18] = min.x;\n array[19] = min.y;\n array[20] = min.z;\n array[21] = max.x;\n array[22] = min.y;\n array[23] = min.z;\n position.needsUpdate = true;\n this.geometry.computeBoundingSphere();\n }\n setFromObject(object) {\n this.object = object;\n this.update();\n return this;\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.object = source.object;\n return this;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $a315ee31802fb757$export$ce39f4bb96c9a290 extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(box, color = 0xffff00){\n const indices = new Uint16Array([\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 0,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 4,\n 0,\n 4,\n 1,\n 5,\n 2,\n 6,\n 3,\n 7\n ]);\n const positions = [\n 1,\n 1,\n 1,\n -1,\n 1,\n 1,\n -1,\n -1,\n 1,\n 1,\n -1,\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n -1,\n -1,\n -1,\n 1,\n -1,\n -1\n ];\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setIndex(new $a315ee31802fb757$export$8dea267bd6bde117(indices, 1));\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(positions, 3));\n super(geometry, new $a315ee31802fb757$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.box = box;\n this.type = \"Box3Helper\";\n this.geometry.computeBoundingSphere();\n }\n updateMatrixWorld(force) {\n const box = this.box;\n if (box.isEmpty()) return;\n box.getCenter(this.position);\n box.getSize(this.scale);\n this.scale.multiplyScalar(0.5);\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $a315ee31802fb757$export$a34fe8156c66e5d7 extends $a315ee31802fb757$export$17d680238e50603e {\n constructor(plane, size = 1, hex = 0xffff00){\n const color = hex;\n const positions = [\n 1,\n -1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n 1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n -1,\n 0,\n 1,\n 1,\n 0\n ];\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(positions, 3));\n geometry.computeBoundingSphere();\n super(geometry, new $a315ee31802fb757$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.type = \"PlaneHelper\";\n this.plane = plane;\n this.size = size;\n const positions2 = [\n 1,\n 1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n -1,\n 0\n ];\n const geometry2 = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry2.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(positions2, 3));\n geometry2.computeBoundingSphere();\n this.add(new $a315ee31802fb757$export$e176487c05830cc5(geometry2, new $a315ee31802fb757$export$55cbcc9b622fe1f5({\n color: color,\n opacity: 0.2,\n transparent: true,\n depthWrite: false,\n toneMapped: false\n })));\n }\n updateMatrixWorld(force) {\n this.position.set(0, 0, 0);\n this.scale.set(0.5 * this.size, 0.5 * this.size, 1);\n this.lookAt(this.plane.normal);\n this.translateZ(-this.plane.constant);\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n}\nconst $a315ee31802fb757$var$_axis = /*@__PURE__*/ new $a315ee31802fb757$export$64b5c384219d3699();\nlet $a315ee31802fb757$var$_lineGeometry, $a315ee31802fb757$var$_coneGeometry;\nclass $a315ee31802fb757$export$a3008e7bd8d2cbe7 extends $a315ee31802fb757$export$e4dd07dff30cc924 {\n // dir is assumed to be normalized\n constructor(dir = new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 1), origin = new $a315ee31802fb757$export$64b5c384219d3699(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2){\n super();\n this.type = \"ArrowHelper\";\n if ($a315ee31802fb757$var$_lineGeometry === undefined) {\n $a315ee31802fb757$var$_lineGeometry = new $a315ee31802fb757$export$b7be63a67df8959();\n $a315ee31802fb757$var$_lineGeometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd([\n 0,\n 0,\n 0,\n 0,\n 1,\n 0\n ], 3));\n $a315ee31802fb757$var$_coneGeometry = new $a315ee31802fb757$export$68f745719dbe5198(0, 0.5, 1, 5, 1);\n $a315ee31802fb757$var$_coneGeometry.translate(0, -0.5, 0);\n }\n this.position.copy(origin);\n this.line = new $a315ee31802fb757$export$17d680238e50603e($a315ee31802fb757$var$_lineGeometry, new $a315ee31802fb757$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.line.matrixAutoUpdate = false;\n this.add(this.line);\n this.cone = new $a315ee31802fb757$export$e176487c05830cc5($a315ee31802fb757$var$_coneGeometry, new $a315ee31802fb757$export$55cbcc9b622fe1f5({\n color: color,\n toneMapped: false\n }));\n this.cone.matrixAutoUpdate = false;\n this.add(this.cone);\n this.setDirection(dir);\n this.setLength(length, headLength, headWidth);\n }\n setDirection(dir) {\n // dir is assumed to be normalized\n if (dir.y > 0.99999) this.quaternion.set(0, 0, 0, 1);\n else if (dir.y < -0.99999) this.quaternion.set(1, 0, 0, 0);\n else {\n $a315ee31802fb757$var$_axis.set(dir.z, 0, -dir.x).normalize();\n const radians = Math.acos(dir.y);\n this.quaternion.setFromAxisAngle($a315ee31802fb757$var$_axis, radians);\n }\n }\n setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) {\n this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458\n this.line.updateMatrix();\n this.cone.scale.set(headWidth, headLength, headWidth);\n this.cone.position.y = length;\n this.cone.updateMatrix();\n }\n setColor(color) {\n this.line.material.color.set(color);\n this.cone.material.color.set(color);\n }\n copy(source) {\n super.copy(source, false);\n this.line.copy(source.line);\n this.cone.copy(source.cone);\n return this;\n }\n dispose() {\n this.line.geometry.dispose();\n this.line.material.dispose();\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n}\nclass $a315ee31802fb757$export$6c8303f35b8578fd extends $a315ee31802fb757$export$ff1ed10fedfdd604 {\n constructor(size = 1){\n const vertices = [\n 0,\n 0,\n 0,\n size,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n size,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n size\n ];\n const colors = [\n 1,\n 0,\n 0,\n 1,\n 0.6,\n 0,\n 0,\n 1,\n 0,\n 0.6,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0.6,\n 1\n ];\n const geometry = new $a315ee31802fb757$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $a315ee31802fb757$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $a315ee31802fb757$export$cbe7a62641830ebd(colors, 3));\n const material = new $a315ee31802fb757$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"AxesHelper\";\n }\n setColors(xAxisColor, yAxisColor, zAxisColor) {\n const color = new $a315ee31802fb757$export$892596cec99bc70e();\n const array = this.geometry.attributes.color.array;\n color.set(xAxisColor);\n color.toArray(array, 0);\n color.toArray(array, 3);\n color.set(yAxisColor);\n color.toArray(array, 6);\n color.toArray(array, 9);\n color.set(zAxisColor);\n color.toArray(array, 12);\n color.toArray(array, 15);\n this.geometry.attributes.color.needsUpdate = true;\n return this;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $a315ee31802fb757$export$148534a3c727230b {\n constructor(){\n this.type = \"ShapePath\";\n this.color = new $a315ee31802fb757$export$892596cec99bc70e();\n this.subPaths = [];\n this.currentPath = null;\n }\n moveTo(x, y) {\n this.currentPath = new $a315ee31802fb757$export$4b2950bdac9b6ee9();\n this.subPaths.push(this.currentPath);\n this.currentPath.moveTo(x, y);\n return this;\n }\n lineTo(x, y) {\n this.currentPath.lineTo(x, y);\n return this;\n }\n quadraticCurveTo(aCPx, aCPy, aX, aY) {\n this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY);\n return this;\n }\n bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY);\n return this;\n }\n splineThru(pts) {\n this.currentPath.splineThru(pts);\n return this;\n }\n toShapes(isCCW) {\n function toShapesNoHoles(inSubpaths) {\n const shapes = [];\n for(let i = 0, l = inSubpaths.length; i < l; i++){\n const tmpPath = inSubpaths[i];\n const tmpShape = new $a315ee31802fb757$export$6428a7f2611ef1fa();\n tmpShape.curves = tmpPath.curves;\n shapes.push(tmpShape);\n }\n return shapes;\n }\n function isPointInsidePolygon(inPt, inPolygon) {\n const polyLen = inPolygon.length;\n // inPt on polygon contour => immediate success or\n // toggling of inside/outside at every single! intersection point of an edge\n // with the horizontal line through inPt, left of inPt\n // not counting lowerY endpoints of edges and whole edges on that line\n let inside = false;\n for(let p = polyLen - 1, q = 0; q < polyLen; p = q++){\n let edgeLowPt = inPolygon[p];\n let edgeHighPt = inPolygon[q];\n let edgeDx = edgeHighPt.x - edgeLowPt.x;\n let edgeDy = edgeHighPt.y - edgeLowPt.y;\n if (Math.abs(edgeDy) > Number.EPSILON) {\n // not parallel\n if (edgeDy < 0) {\n edgeLowPt = inPolygon[q];\n edgeDx = -edgeDx;\n edgeHighPt = inPolygon[p];\n edgeDy = -edgeDy;\n }\n if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue;\n if (inPt.y === edgeLowPt.y) {\n if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ?\n // continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n } else {\n const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);\n if (perpEdge === 0) return true; // inPt is on contour ?\n if (perpEdge < 0) continue;\n inside = !inside; // true intersection left of inPt\n }\n } else {\n // parallel or collinear\n if (inPt.y !== edgeLowPt.y) continue; // parallel\n // edge lies on the same horizontal line as inPt\n if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour !\n // continue;\n }\n }\n return inside;\n }\n const isClockWise = $a315ee31802fb757$export$96bdf6d9c66d7ba8.isClockWise;\n const subPaths = this.subPaths;\n if (subPaths.length === 0) return [];\n let solid, tmpPath, tmpShape;\n const shapes = [];\n if (subPaths.length === 1) {\n tmpPath = subPaths[0];\n tmpShape = new $a315ee31802fb757$export$6428a7f2611ef1fa();\n tmpShape.curves = tmpPath.curves;\n shapes.push(tmpShape);\n return shapes;\n }\n let holesFirst = !isClockWise(subPaths[0].getPoints());\n holesFirst = isCCW ? !holesFirst : holesFirst;\n // console.log(\"Holes first\", holesFirst);\n const betterShapeHoles = [];\n const newShapes = [];\n let newShapeHoles = [];\n let mainIdx = 0;\n let tmpPoints;\n newShapes[mainIdx] = undefined;\n newShapeHoles[mainIdx] = [];\n for(let i = 0, l = subPaths.length; i < l; i++){\n tmpPath = subPaths[i];\n tmpPoints = tmpPath.getPoints();\n solid = isClockWise(tmpPoints);\n solid = isCCW ? !solid : solid;\n if (solid) {\n if (!holesFirst && newShapes[mainIdx]) mainIdx++;\n newShapes[mainIdx] = {\n s: new $a315ee31802fb757$export$6428a7f2611ef1fa(),\n p: tmpPoints\n };\n newShapes[mainIdx].s.curves = tmpPath.curves;\n if (holesFirst) mainIdx++;\n newShapeHoles[mainIdx] = [];\n //console.log('cw', i);\n } else newShapeHoles[mainIdx].push({\n h: tmpPath,\n p: tmpPoints[0]\n });\n }\n // only Holes? -> probably all Shapes with wrong orientation\n if (!newShapes[0]) return toShapesNoHoles(subPaths);\n if (newShapes.length > 1) {\n let ambiguous = false;\n let toChange = 0;\n for(let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++)betterShapeHoles[sIdx] = [];\n for(let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++){\n const sho = newShapeHoles[sIdx];\n for(let hIdx = 0; hIdx < sho.length; hIdx++){\n const ho = sho[hIdx];\n let hole_unassigned = true;\n for(let s2Idx = 0; s2Idx < newShapes.length; s2Idx++)if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) {\n if (sIdx !== s2Idx) toChange++;\n if (hole_unassigned) {\n hole_unassigned = false;\n betterShapeHoles[s2Idx].push(ho);\n } else ambiguous = true;\n }\n if (hole_unassigned) betterShapeHoles[sIdx].push(ho);\n }\n }\n if (toChange > 0 && ambiguous === false) newShapeHoles = betterShapeHoles;\n }\n let tmpHoles;\n for(let i = 0, il = newShapes.length; i < il; i++){\n tmpShape = newShapes[i].s;\n shapes.push(tmpShape);\n tmpHoles = newShapeHoles[i];\n for(let j = 0, jl = tmpHoles.length; j < jl; j++)tmpShape.holes.push(tmpHoles[j].h);\n }\n //console.log(\"shape\", shapes);\n return shapes;\n }\n}\nif (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"register\", {\n detail: {\n revision: $a315ee31802fb757$export$3545e07a80636437\n }\n}));\nif (typeof window !== \"undefined\") {\n if (window.__THREE__) console.warn(\"WARNING: Multiple instances of Three.js being imported.\");\n else window.__THREE__ = $a315ee31802fb757$export$3545e07a80636437;\n}\n\n});\n\n})();\n//# sourceMappingURL=projectionAsync.worker.15f44cdc.js.map\n","/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '155';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst TwoPassDoubleSide = 2; // r149\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst AlphaFormat = 1021;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */\nconst LinearEncoding = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */\nconst sRGBEncoding = 3001;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst _SRGBAFormat = 1035; // fallback for WebGL 1\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [\n\t0.8224621, 0.0331941, 0.0170827,\n\t0.1775380, 0.9668058, 0.0723974,\n\t- 0.0000001, 0.0000001, 0.9105199\n] );\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [\n\t1.2249401, - 0.0420569, - 0.0196376,\n\t- 0.2249404, 1.0420571, - 0.0786361,\n\t0.0000001, 0.0000000, 1.0982735\n] );\n\nfunction DisplayP3ToLinearSRGB( color ) {\n\n\t// Display P3 uses the sRGB transfer functions\n\treturn color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );\n\n}\n\nfunction LinearSRGBToDisplayP3( color ) {\n\n\t// Display P3 uses the sRGB transfer functions\n\treturn color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB();\n\n}\n\n// Conversions from to Linear-sRGB reference space.\nconst TO_LINEAR = {\n\t[ LinearSRGBColorSpace ]: ( color ) => color,\n\t[ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),\n\t[ DisplayP3ColorSpace ]: DisplayP3ToLinearSRGB,\n};\n\n// Conversions to from Linear-sRGB reference space.\nconst FROM_LINEAR = {\n\t[ LinearSRGBColorSpace ]: ( color ) => color,\n\t[ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),\n\t[ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,\n};\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\tget legacyMode() {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\treturn ! this.enabled;\n\n\t},\n\n\tset legacyMode( legacyMode ) {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\tthis.enabled = ! legacyMode;\n\n\t},\n\n\tget workingColorSpace() {\n\n\t\treturn LinearSRGBColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .workingColorSpace is readonly.' );\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToLinear = TO_LINEAR[ sourceColorSpace ];\n\t\tconst targetFromLinear = FROM_LINEAR[ targetColorSpace ];\n\n\t\tif ( sourceToLinear === undefined || targetFromLinear === undefined ) {\n\n\t\t\tthrow new Error( `Unsupported color space conversion, \"${ sourceColorSpace }\" to \"${ targetColorSpace }\".` );\n\n\t\t}\n\n\t\treturn targetFromLinear( sourceToLinear( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this.workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this.workingColorSpace );\n\n\t},\n\n};\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tif ( typeof colorSpace === 'string' ) {\n\n\t\t\tthis.colorSpace = colorSpace;\n\n\t\t} else { // @deprecated, r152\n\n\t\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\t\tthis.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tget encoding() { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\treturn this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset encoding( encoding ) { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\tthis.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.flipY = false;\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n\t\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n\n\t\tthis.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n\n\t\tthis.samples = options.samples !== undefined ? options.samples : 0;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\t\t\tthis.texture.image.depth = depth;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t\tconst texture = this.texture;\n\n\t\tthis.texture = [];\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.texture[ i ] = texture.clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.texture.length; i < il; i ++ ) {\n\n\t\t\t\tthis.texture[ i ].image.width = width;\n\t\t\t\tthis.texture[ i ].image.height = height;\n\t\t\t\tthis.texture[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.dispose();\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.texture.length = 0;\n\n\t\tfor ( let i = 0, il = source.texture.length; i < il; i ++ ) {\n\n\t\t\tthis.texture[ i ] = source.texture[ i ].clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize();\n\t\t\tthis._onChangeCallback();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// calculate quat * vector\n\n\t\tconst ix = qw * x + qy * z - qz * y;\n\t\tconst iy = qw * y + qz * x - qx * z;\n\t\tconst iz = qw * z + qx * y - qy * x;\n\t\tconst iw = - qx * x - qy * y - qz * z;\n\n\t\t// calculate result * inverse quat\n\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$b.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$b );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$b.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$a.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\t_box$3.copy( object.boundingBox );\n\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\tthis.union( _box$3 );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry !== undefined ) {\n\n\t\t\t\tif ( precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined ) {\n\n\t\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\t\tfor ( let i = 0, l = position.count; i < l; i ++ ) {\n\n\t\t\t\t\t\t_vector$a.fromBufferAttribute( position, i ).applyMatrix4( object.matrixWorld );\n\t\t\t\t\t\tthis.expandByPoint( _vector$a );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$3.copy( geometry.boundingBox );\n\t\t\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\t\t\tthis.union( _box$3 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$a );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$a.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$a ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$a ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\n\nconst _box$3 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$2.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$9 ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$9.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$9.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$9.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$9.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$9.dot( this.direction );\n\t\tconst d2 = _vector$9.dot( _vector$9 ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$9 ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\tconst object = this.children[ i ];\n\n\t\t\tobject.parent = null;\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\tthis.children.length = 0;\n\n\t\treturn this;\n\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value ) {\n\n\t\tlet result = [];\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst childResult = this.children[ i ].getObjectsByProperty( name, value );\n\n\t\t\tif ( childResult.length > 0 ) {\n\n\t\t\t\tresult = result.concat( childResult );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$1 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nlet warnedGetUV = false;\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\t// arbitrary location outside of triangle?\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\n\t\t\treturn target.set( - 2, - 1, - 1 );\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\tthis.getBarycoord( point, a, b, c, _v3$1 );\n\n\t\treturn ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tthis.getBarycoord( point, p1, p2, p3, _v3$1 );\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$1.x );\n\t\ttarget.addScaledVector( v2, _v3$1.y );\n\t\ttarget.addScaledVector( v3, _v3$1.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nlet materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = this.transparent;\n\n\t\tdata.depthFunc = this.depthFunc;\n\t\tdata.depthTest = this.depthTest;\n\t\tdata.depthWrite = this.depthWrite;\n\t\tdata.colorWrite = this.colorWrite;\n\n\t\tdata.stencilWrite = this.stencilWrite;\n\t\tdata.stencilWriteMask = this.stencilWriteMask;\n\t\tdata.stencilFunc = this.stencilFunc;\n\t\tdata.stencilRef = this.stencilRef;\n\t\tdata.stencilFuncMask = this.stencilFuncMask;\n\t\tdata.stencilFail = this.stencilFail;\n\t\tdata.stencilZFail = this.stencilZFail;\n\t\tdata.stencilZPass = this.stencilZPass;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = this.alphaHash;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;\n\n\t\tif ( this.wireframe === true ) data.wireframe = this.wireframe;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = this.flatShading;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\t_hslA.h += h; _hslA.s += s; _hslA.l += l;\n\n\t\tthis.setHSL( _hslA.h, _hslA.s, _hslA.l );\n\n\t\treturn this;\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$8 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( this, i );\n\t\t\t\t_vector$8.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\t\tif ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$1 = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$1 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$1.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.min, _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.max, _box$1.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$1.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$1.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$7.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$7.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$7.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = this.getAttribute( 'tangent' ).array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$7.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$7.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$7.x, _vector$7.y, _vector$7.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$5.copy( geometry.boundingSphere );\n\t\t_sphere$5.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$5.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$5, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\t\t\tintersection.uv2 = intersection.uv1; // @deprecated, r152\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tif ( renderer.getRenderTarget() === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\treturn LinearSRGBColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tderivatives: false, // set to use derivatives\n\t\t\tfragDepth: false, // set to use fragment depth values\n\t\t\tdrawBuffers: false, // set to use draw buffers\n\t\t\tshaderTextureLOD: false // set to use shader texture LOD\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst renderTarget = this.renderTarget;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0 );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1 );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2 );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3 );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4 );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5 );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$4.center.set( 0, 0, 0 );\n\t\t_sphere$4.radius = 0.7071067811865476;\n\t\t_sphere$4.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$6 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute.updateRange;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 ) {\n\n\t\t\t// Not using update ranges\n\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = dFdx( surf_pos.xyz );\\n\\t\\tvec3 vSigmaY = dFdy( surf_pos.xyz );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\\tvec3 position;\\n\\tvec3 normal;\\n\\tvec3 viewDir;\\n#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal;\\n#endif\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_v0 0.339\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_v1 0.276\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_v4 0.046\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_v5 0.016\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_v6 0.0038\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"vec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\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}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\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\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\n\nvar 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\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar 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 vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tanisotropyV /= material.anisotropy;\\n\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec3 sheenSpecular = vec3( 0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometry.normal;\\n\\t\\tvec3 viewDir = geometry.viewDir;\\n\\t\\tvec3 position = geometry.position;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( 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\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, vMapUv );\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar 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}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\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 depth, const in float near, const in float far ) {\\n\\treturn depth * ( 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 depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar 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;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar 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\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\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\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar 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, vSpotLightCoord[ 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}\";\n\nvar 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\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tuniform int boneTextureSize;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tfloat j = i * 4.0;\\n\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\ty = dy * ( y + 0.5 );\\n\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\treturn bone;\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar 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\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\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\";\n\nconst vertex$h = \"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}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst xr = renderer.xr;\n\t\tconst environmentBlendMode = xr.getEnvironmentBlendMode();\n\n\t\tswitch ( environmentBlendMode ) {\n\n\t\t\tcase 'opaque':\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'additive':\n\t\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'alpha-blend':\n\t\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, extensions, attributes, capabilities ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );\n\tconst vaoAvailable = capabilities.isWebGL2 || extension !== null;\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tif ( vaoAvailable ) {\n\n\t\t\tconst state = getBindingState( geometry, program, material );\n\n\t\t\tif ( currentState !== state ) {\n\n\t\t\t\tcurrentState = state;\n\t\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t\t}\n\n\t\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\t} else {\n\n\t\t\tconst wireframe = ( material.wireframe === true );\n\n\t\t\tif ( currentState.geometry !== geometry.id ||\n\t\t\t\tcurrentState.program !== program.id ||\n\t\t\t\tcurrentState.wireframe !== wireframe ) {\n\n\t\t\t\tcurrentState.geometry = geometry.id;\n\t\t\t\tcurrentState.program = program.id;\n\t\t\t\tcurrentState.wireframe = wireframe;\n\n\t\t\t\tupdateBuffers = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.createVertexArray();\n\n\t\treturn extension.createVertexArrayOES();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );\n\n\t\treturn extension.bindVertexArrayOES( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );\n\n\t\treturn extension.deleteVertexArrayOES( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tconst extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes (WebGL 2 only)\n\n\t\t\t\t\tconst integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tconst isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\tconst floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );\n\tconst floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tconst maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tdrawBuffers: drawBuffers,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height / 2 );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {\n\n\t\t\t\t\ttexture.needsPMREMUpdate = false;\n\n\t\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cubeUVmaps.has( texture ) ) {\n\n\t\t\t\t\t\treturn cubeUVmaps.get( texture ).texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\tconst renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function ( capabilities ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\n\t\t\t} else {\n\n\t\t\t\tgetExtension( 'WEBGL_depth_texture' );\n\t\t\t\tgetExtension( 'OES_texture_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float_linear' );\n\t\t\t\tgetExtension( 'OES_standard_derivatives' );\n\t\t\t\tgetExtension( 'OES_element_index_uint' );\n\t\t\t\tgetExtension( 'OES_vertex_array_object' );\n\t\t\t\tgetExtension( 'ANGLE_instanced_arrays' );\n\n\t\t\t}\n\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction numericalSort( a, b ) {\n\n\treturn a[ 0 ] - b[ 0 ];\n\n}\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst influencesList = {};\n\tconst morphInfluences = new Float32Array( 8 );\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tconst workInfluences = [];\n\n\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\tworkInfluences[ i ] = [ i, 0 ];\n\n\t}\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tif ( capabilities.isWebGL2 === true ) {\n\n\t\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tlet entry = morphTextures.get( geometry );\n\n\t\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\t\tlet vertexDataCount = 0;\n\n\t\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\t\tlet height = 1;\n\n\t\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t\t}\n\n\t\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\t\ttexture.type = FloatType;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t// fill buffer\n\n\t\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tentry = {\n\t\t\t\t\tcount: morphTargetsCount,\n\t\t\t\t\ttexture: texture,\n\t\t\t\t\tsize: new Vector2( width, height )\n\t\t\t\t};\n\n\t\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\t\tfunction disposeTexture() {\n\n\t\t\t\t\ttexture.dispose();\n\n\t\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\n\t\t} else {\n\n\t\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\t\tconst length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\t\tlet influences = influencesList[ geometry.id ];\n\n\t\t\tif ( influences === undefined || influences.length !== length ) {\n\n\t\t\t\t// initialise list\n\n\t\t\t\tinfluences = [];\n\n\t\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t\t}\n\n\t\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t\t}\n\n\t\t\t// Collect influences\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst influence = influences[ i ];\n\n\t\t\t\tinfluence[ 0 ] = i;\n\t\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tinfluences.sort( absNumericalSort );\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tif ( i < length && influences[ i ][ 1 ] ) {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = influences[ i ][ 0 ];\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = influences[ i ][ 1 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tworkInfluences.sort( numericalSort );\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\tconst morphNormals = geometry.morphAttributes.normal;\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tconst influence = workInfluences[ i ];\n\t\t\t\tconst index = influence[ 0 ];\n\t\t\t\tconst value = influence[ 1 ];\n\n\t\t\t\tif ( index !== Number.MAX_SAFE_INTEGER && value ) {\n\n\t\t\t\t\tif ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphTarget' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\t\treturn [ 'Linear', '( value )' ];\n\t\tcase SRGBColorSpace:\n\t\t\treturn [ 'sRGB', '( value )' ];\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ 'Linear', '( value )' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tconst chunks = [\n\t\t( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map( [\n\t[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154\n\t[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154\n\t[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154\n] );\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\t// check for link errors\n\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\tlet runnable = true;\n\t\tlet haveDiagnostics = true;\n\n\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\trunnable = false;\n\n\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t} else {\n\n\t\t\t\t// default error reporting\n\n\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\tconsole.error(\n\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\tfragmentErrors\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t} else if ( programLog !== '' ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\thaveDiagnostics = false;\n\n\t\t}\n\n\t\tif ( haveDiagnostics ) {\n\n\t\t\tthis.diagnostics = {\n\n\t\t\t\trunnable: runnable,\n\n\t\t\t\tprogramLog: programLog,\n\n\t\t\t\tvertexShader: {\n\n\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t},\n\n\t\t\t\tfragmentShader: {\n\n\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}\n\n\t}\n\n\t// Clean up\n\n\t// Crashes in iOS9 and iOS10. #18402\n\t// gl.detachShader( program, glVertexShader );\n\t// gl.detachShader( program, glFragmentShader );\n\n\tgl.deleteShader( glVertexShader );\n\tgl.deleteShader( glFragmentShader );\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst programs = [];\n\n\tconst IS_WEBGL2 = capabilities.isWebGL2;\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tconst HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;\n\t\tconst HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;\n\t\tconst HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tisWebGL2: IS_WEBGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\t\t\tvertexUv1s: HAS_ATTRIBUTE_UV1,\n\t\t\tvertexUv2s: HAS_ATTRIBUTE_UV2,\n\t\t\tvertexUv3s: HAS_ATTRIBUTE_UV3,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\t\t\tuseLegacyLights: renderer._useLegacyLights,\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n\t\t\textensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n\t\t\textensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n\t\t\textensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n\n\t\t\trendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),\n\t\t\trendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),\n\t\t\trendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.isWebGL2 )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.useLegacyLights )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions, capabilities ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, useLegacyLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t// WebGL 2\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\t// WebGL 1\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions, capabilities ) {\n\n\tconst lights = new WebGLLights( extensions, capabilities );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( useLegacyLights ) {\n\n\t\tlights.setup( lightsArray, useLegacyLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions, capabilities ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = _renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\n\tif ( isWebGL2 ) {\n\n\t\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\t\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t}\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tdrawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t\t} else {\n\n\t\t\t\textensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );\n\n\t\t\t}\n\n\t\t}\n\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = gl.MIN;\n\t\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\t} else {\n\n\t\tconst extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\n\t\tif ( isWebGL2 === true ) {\n\n\t\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\t}\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst maxTextures = capabilities.maxTextures;\n\tconst maxCubemapSize = capabilities.maxCubemapSize;\n\tconst maxTextureSize = capabilities.maxTextureSize;\n\tconst maxSamples = capabilities.maxSamples;\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tconst floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n\n\t\t\t\tconst width = floor( scale * image.width );\n\t\t\t\tconst height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo$1( image ) {\n\n\t\treturn isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image, supportsMips ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn _gl.NEAREST;\n\n\t\t}\n\n\t\treturn _gl.LINEAR;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t\tinfo.memory.textures --;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = texture.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachmentProperties = properties.get( texture[ i ] );\n\n\t\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\t\tinfo.memory.textures --;\n\n\t\t\t\t}\n\n\t\t\t\tproperties.remove( texture[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2\n\t\t\tif ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );\n\n\t\t\tconst needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;\n\t\t\tlet image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst supportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tlet glType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\t// populate depth texture with dummy data\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT;\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tconsole.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// validation checks for WebGL 1\n\n\t\t\t\tif ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedIntType;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_STENCIL;\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tsupportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tlet levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\tif ( isMultisample || useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets !== true ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tif ( capabilities.drawBuffers ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = isMultipleRenderTargets ? texture : [ texture ];\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tconst textures = renderTarget.texture;\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture, supportsMips );\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\tconst invalidationArray = [];\n\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\n\t\t\t// If MRT we need to remove FBO attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tinvalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\tinvalidationArray.push( depthStyle );\n\n\t\t\t\t}\n\n\t\t\t\tconst ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;\n\n\t\t\t\tif ( ignoreDepthValues === false ) {\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\t\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ignoreDepthValues === true ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\tif ( supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( colorSpace === SRGBColorSpace ) {\n\n\t\t\t\tif ( isWebGL2 === false ) {\n\n\t\t\t\t\t// in WebGL 1, try to use EXT_sRGB extension and unsized formats\n\n\t\t\t\t\tif ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {\n\n\t\t\t\t\t\ttexture.format = _SRGBAFormat;\n\n\t\t\t\t\t\t// it's not possible to generate mips in WebGL 1 with this extension\n\n\t\t\t\t\t\ttexture.minFilter = LinearFilter;\n\t\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// slow fallback (CPU decode)\n\n\t\t\t\t\t\timage = ImageUtils.sRGBToLinear( image );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return gl.HALF_FLOAT;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL 1 sRGB fallback\n\n\t\tif ( p === _SRGBAFormat ) {\n\n\t\t\textension = extensions.get( 'EXT_sRGB' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.SRGB_ALPHA_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( colorSpace === SRGBColorSpace ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC1\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC2\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\t\tconst attributes = gl.getContextAttributes();\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tif ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0\n\t\t\t\t\t\t} );\n\n\t\t\t\t\tconst renderTargetProperties = renderer.properties.get( newRenderTarget );\n\t\t\t\t\trenderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tconst children = camera.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tchildren[ i ].updateMatrixWorld( true );\n\n\t\t\t}\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\n\t\t\t// artist-friendly light intensity scaling factor\n\t\t\tconst scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;\n\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\t// partly update the buffer if necessary\n\n\t\t\tif ( hasUniformChanged( uniform, i, cache ) === true ) {\n\n\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\tuniform.__data[ 3 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\tuniform.__data[ 7 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\tuniform.__data[ 11 ] = value.elements[ 0 ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, cache ) {\n\n\t\tconst value = uniform.value;\n\n\t\tif ( cache[ index ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tcache[ index ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tconst tempValues = [];\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\ttempValues.push( values[ i ].clone() );\n\n\t\t\t\t}\n\n\t\t\t\tcache[ index ] = tempValues;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tif ( cache[ index ] !== value ) {\n\n\t\t\t\t\tcache[ index ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tfor ( let i = 0; i < cachedObjects.length; i ++ ) {\n\n\t\t\t\t\tconst cachedObject = cachedObjects[ i ];\n\n\t\t\t\t\tif ( cachedObject.equals( values[ i ] ) === false ) {\n\n\t\t\t\t\t\tcachedObject.copy( values[ i ] );\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\t\tlet chunkOffset = 0; // offset within a single chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\tconst infos = {\n\t\t\t\tboundary: 0, // bytes\n\t\t\t\tstorage: 0 // bytes\n\t\t\t};\n\n\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\tfor ( let j = 0, jl = values.length; j < jl; j ++ ) {\n\n\t\t\t\tconst value = values[ j ];\n\n\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\tinfos.boundary += info.boundary;\n\t\t\t\tinfos.storage += info.storage;\n\n\t\t\t}\n\n\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\tuniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\tuniform.__offset = offset;\n\n\t\t\t//\n\n\t\t\tif ( i > 0 ) {\n\n\t\t\t\tchunkOffset = offset % chunkSize;\n\n\t\t\t\tconst remainingSizeInChunk = chunkSize - chunkOffset;\n\n\t\t\t\t// check for chunk overflow\n\n\t\t\t\tif ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {\n\n\t\t\t\t\t// add padding and adjust offset\n\n\t\t\t\t\toffset += ( chunkSize - chunkOffset );\n\t\t\t\t\tuniform.__offset = offset;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\toffset += infos.storage;\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tchunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' ) {\n\n\t\t\t// float/int\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = true,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis.outputColorSpace = SRGBColorSpace;\n\n\t\t// physical lights\n\n\t\tthis._useLegacyLights = false;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// transmission\n\n\t\tlet _transmissionRenderTarget = null;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector2 = new Vector2();\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextNames, contextAttributes ) {\n\n\t\t\tfor ( let i = 0; i < contextNames.length; i ++ ) {\n\n\t\t\t\tconst contextName = contextNames[ i ];\n\t\t\t\tconst context = canvas.getContext( contextName, contextAttributes );\n\t\t\t\tif ( context !== null ) return context;\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];\n\n\t\t\t\tif ( _this.isWebGL1Renderer === true ) {\n\n\t\t\t\t\tcontextNames.shift();\n\n\t\t\t\t}\n\n\t\t\t\t_gl = getContext( contextNames, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextNames ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );\n\n\t\t\t}\n\n\t\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\t\textensions.init( capabilities );\n\n\t\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions, capabilities );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) bits |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tif ( _transmissionRenderTarget ) {\n\n\t\t\t\t_transmissionRenderTarget.dispose();\n\t\t\t\t_transmissionRenderTarget = null;\n\n\t\t\t}\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tthis.compile = function ( scene, camera ) {\n\n\t\t\tfunction prepare( material, scene, object ) {\n\n\t\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tcurrentRenderState = renderStates.get( scene );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepare( material2, scene, object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepare( material, scene, object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\n\t\t\t//\n\n\t\t\tbackground.render( currentRenderList, scene );\n\n\t\t\t// render scene\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector3\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst isWebGL2 = capabilities.isWebGL2;\n\n\t\t\tif ( _transmissionRenderTarget === null ) {\n\n\t\t\t\t_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: ( isWebGL2 ) ? 4 : 0\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\t_this.getDrawingBufferSize( _vector2 );\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );\n\n\t\t\t} else {\n\n\t\t\t\t_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( _transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = renderItem.material;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tconst progUniforms = program.getUniforms();\n\t\t\tconst uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms );\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = uniformsList;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t\t// load material specific uniforms\n\t\t\t\t// (shader material also gets them for the sake of genericity)\n\n\t\t\t\tif ( material.isShaderMaterial ||\n\t\t\t\t\tmaterial.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.envMap ) {\n\n\t\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\t\tuCamPos.setValue( _gl,\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ||\n\t\t\t\t\tmaterial.isShadowMaterial ||\n\t\t\t\t\tobject.isSkinnedMesh ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );\n\n\t\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\tif ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );\n\n\t\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t\t! halfFloatSupportedByExt ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = srcTexture.image.width;\n\t\t\tconst height = srcTexture.image.height;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tif ( _this.isWebGL1Renderer ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst width = sourceBox.max.x - sourceBox.min.x + 1;\n\t\t\tconst height = sourceBox.max.y - sourceBox.min.y + 1;\n\t\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget physicallyCorrectLights() { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\treturn ! this.useLegacyLights;\n\n\t}\n\n\tset physicallyCorrectLights( value ) { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\tthis.useLegacyLights = ! value;\n\n\t}\n\n\tget outputEncoding() { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\treturn this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset outputEncoding( encoding ) { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\tthis.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\n\t}\n\n\tget useLegacyLights() { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\treturn this._useLegacyLights;\n\n\t}\n\n\tset useLegacyLights( value ) { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\tthis._useLegacyLights = value;\n\n\t}\n\n}\n\nclass WebGL1Renderer extends WebGLRenderer {}\n\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$5 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = ( material !== undefined ) ? material : new SpriteMaterial();\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = 'attached';\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\t_vertex.fromBufferAttribute( positionAttribute, i );\n\t\t\tthis.applyBoneTransform( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\t_vertex.fromBufferAttribute( positionAttribute, i );\n\t\t\tthis.applyBoneTransform( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === 'attached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === 'detached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n\tboneTransform( index, vector ) { // @deprecated, r151\n\n\t\tconsole.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );\n\t\treturn this.applyBoneTransform( index, vector );\n\n\t}\n\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\t\tthis.boneTextureSize = 0;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = ceilPowerOfTwo( size );\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\t\tthis.boneTextureSize = size;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$2.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$2.copy( this.boundingSphere );\n\t\t_sphere$2.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tthis.curves.push( new LineCurve( endPoint, startPoint ) );\n\n\t\t}\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// same as Array.prototype.slice, but also works on typed arrays\nfunction arraySlice( array, from, to ) {\n\n\tif ( isTypedArray( array ) ) {\n\n\t\t// in ios9 array.subarray(from, undefined) will return empty array\n\t\t// but array.subarray(from) or array.subarray(from, len) is correct\n\t\treturn new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );\n\n\t}\n\n\treturn array.slice( from, to );\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = arraySlice( interpolant.resultBuffer, startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tarraySlice: arraySlice,\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = arraySlice( times, from, to );\n\t\t\tthis.values = arraySlice( this.values, from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = arraySlice( this.times ),\n\t\t\tvalues = arraySlice( this.values ),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = arraySlice( times, 0, writeIndex );\n\t\t\tthis.values = arraySlice( values, 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = arraySlice( this.times, 0 );\n\t\tconst values = arraySlice( this.values, 0 );\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' ) || response.headers.get( 'X-File-Size' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t} else if ( texData.encoding !== undefined ) { // @deprecated, r152\n\n\t\t\t\ttexture.encoding = texData.encoding;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== 1 ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tif ( attribute.updateRange !== undefined ) {\n\n\t\t\t\tbufferAttribute.updateRange.offset = attribute.updateRange.offset;\n\t\t\t\tbufferAttribute.updateRange.count = attribute.updateRange.count;\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tfetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t}, handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nclass HemisphereLightProbe extends LightProbe {\n\n\tconstructor( skyColor, groundColor, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isHemisphereLightProbe = true;\n\n\t\tconst color1 = new Color().set( skyColor );\n\t\tconst color2 = new Color().set( groundColor );\n\n\t\tconst sky = new Vector3( color1.r, color1.g, color1.b );\n\t\tconst ground = new Vector3( color2.r, color2.g, color2.b );\n\n\t\t// without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n\t\tconst c0 = Math.sqrt( Math.PI );\n\t\tconst c1 = c0 * Math.sqrt( 0.75 );\n\n\t\tthis.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 );\n\t\tthis.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 );\n\n\t}\n\n}\n\nclass AmbientLightProbe extends LightProbe {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isAmbientLightProbe = true;\n\n\t\tconst color1 = new Color().set( color );\n\n\t\t// without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n\t\tthis.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) );\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tthis.uniforms.push( uniformsSource[ i ].clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\n\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = 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 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = 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 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, sRGBEncoding };\n"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$a315ee31802fb757$var$_canvas","$a315ee31802fb757$export$2ede184fc2998901","$a315ee31802fb757$export$d9f0486e75b5ace","$a315ee31802fb757$export$3b296b6f144d5b03","$a315ee31802fb757$export$6a7ef315a0d1ef07","$a315ee31802fb757$export$c977b3e384af9ae1","$a315ee31802fb757$export$64b5c384219d3699","$a315ee31802fb757$export$6f7d5a9418ab2aa3","$a315ee31802fb757$export$805e8b72413ccaba","$a315ee31802fb757$export$a186db52eed6d40e","$a315ee31802fb757$export$2ae72fc923e5eb5","$a315ee31802fb757$export$5a465592bfe74b48","$a315ee31802fb757$export$8dea267bd6bde117","$a315ee31802fb757$export$b7be63a67df8959","$a315ee31802fb757$export$7ff5ac152ef991b0","$a315ee31802fb757$export$6428a7f2611ef1fa","$a315ee31802fb757$export$96bdf6d9c66d7ba8","$a315ee31802fb757$export$57a29a1c803e9065","$a315ee31802fb757$export$e0ba6359f1954fd3","$a315ee31802fb757$export$561f394b24edfcaa","$a315ee31802fb757$export$42429b3acfb233a4","$a315ee31802fb757$export$626af19ae879bdf6","$a315ee31802fb757$export$f63012db5506e7dd","$a315ee31802fb757$export$ec8b666c5fe2c75a","addEventListener","type","listener","undefined","_listeners","listeners","indexOf","push","hasEventListener","removeEventListener","listenerArray","index","splice","dispatchEvent","event","target","array","slice","i","l","length","$a315ee31802fb757$var$_lut","$a315ee31802fb757$var$_seed","$a315ee31802fb757$var$DEG2RAD","Math","PI","$a315ee31802fb757$var$RAD2DEG","$a315ee31802fb757$var$generateUUID","d0","random","d1","d2","d3","uuid","toLowerCase","$a315ee31802fb757$var$clamp","value","min","max","$a315ee31802fb757$var$euclideanModulo","m","$a315ee31802fb757$var$lerp","x","y","t","$a315ee31802fb757$var$isPowerOfTwo","$a315ee31802fb757$var$floorPowerOfTwo","pow","floor","log","LN2","$a315ee31802fb757$var$denormalize","constructor","Float32Array","Uint32Array","Uint16Array","Uint8Array","Int32Array","Int16Array","Int8Array","$a315ee31802fb757$var$normalize","round","DEG2RAD","RAD2DEG","generateUUID","clamp","euclideanModulo","mapLinear","a1","a2","b1","b2","inverseLerp","lerp","damp","lambda","dt","exp","pingpong","abs","smoothstep","smootherstep","randInt","low","high","randFloat","randFloatSpread","range","seededRandom","imul","degToRad","degrees","radToDeg","radians","isPowerOfTwo","ceilPowerOfTwo","ceil","floorPowerOfTwo","setQuaternionFromProperEuler","q","a","b","c","order","cos","sin","c2","s2","c13","s13","c1_3","s1_3","c3_1","s3_1","console","warn","normalize","denormalize","prototype","isVector2","width","height","setScalar","scalar","setX","setY","setComponent","getComponent","clone","copy","add","addScalar","addVectors","addScaledVector","sub","subScalar","subVectors","multiply","multiplyScalar","divide","divideScalar","applyMatrix3","elements","clampScalar","minVal","maxVal","clampLength","roundToZero","negate","dot","cross","lengthSq","sqrt","manhattanLength","angle","atan2","angleTo","denominator","theta","acos","distanceTo","distanceToSquared","dx","dy","manhattanDistanceTo","setLength","alpha","lerpVectors","v1","v2","equals","fromArray","offset","toArray","fromBufferAttribute","attribute","getX","getY","rotateAround","center","Symbol","iterator","$a315ee31802fb757$export$8ff26dafa08918","n11","n12","n13","n21","n22","n23","n31","n32","n33","isMatrix3","te","identity","me","extractBasis","xAxis","yAxis","zAxis","setFromMatrix3Column","setFromMatrix4","multiplyMatrices","premultiply","ae","be","a11","a12","a13","a21","a22","a23","a31","a32","a33","b11","b12","b13","b21","b22","b23","b31","b32","b33","determinant","d","f","g","h","invert","t11","t12","t13","det","detInv","transpose","tmp","getNormalMatrix","matrix4","transposeIntoArray","r","setUvTransform","tx","ty","sx","sy","rotation","cx","cy","scale","$a315ee31802fb757$var$_m3","makeScale","rotate","makeRotation","translate","makeTranslation","matrix","$a315ee31802fb757$var$arrayNeedsUint32","$a315ee31802fb757$var$createElementNS","name","document","createElementNS","Uint8ClampedArray","Float64Array","$a315ee31802fb757$var$_cache","$a315ee31802fb757$var$warnOnce","message","$a315ee31802fb757$var$SRGBToLinear","$a315ee31802fb757$var$LinearToSRGB","$a315ee31802fb757$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3","$a315ee31802fb757$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB","$a315ee31802fb757$var$TO_LINEAR","color","convertSRGBToLinear","$a315ee31802fb757$var$FROM_LINEAR","convertLinearToSRGB","$a315ee31802fb757$export$5e6fd513f44698c","enabled","legacyMode","workingColorSpace","colorSpace","convert","sourceColorSpace","targetColorSpace","sourceToLinear","targetFromLinear","fromWorkingColorSpace","toWorkingColorSpace","$a315ee31802fb757$export$698882cf06df44aa","getDataURL","image","canvas","test","src","HTMLCanvasElement","context","getContext","ImageData","putImageData","drawImage","toDataURL","sRGBToLinear","HTMLImageElement","ImageBitmap","imageData","getImageData","data","$a315ee31802fb757$var$sourceId","$a315ee31802fb757$export$1d2df86270c81ecb","isSource","version","needsUpdate","toJSON","meta","isRootObject","images","output","url","Array","isArray","isDataTexture","$a315ee31802fb757$var$serializeImage","from","$a315ee31802fb757$var$textureId","$a315ee31802fb757$export$5431306cf43de24a","DEFAULT_IMAGE","mapping","DEFAULT_MAPPING","wrapS","wrapT","magFilter","minFilter","format","anisotropy","DEFAULT_ANISOTROPY","colorSpace1","isTexture","source","mipmaps","channel","internalFormat","repeat","matrixAutoUpdate","generateMipmaps","premultiplyAlpha","flipY","unpackAlignment","userData","onUpdate","isRenderTargetTexture","needsPMREMUpdate","updateMatrix","JSON","parse","stringify","textures","metadata","generator","wrap","keys","dispose","transformUv","uv","encoding","$a315ee31802fb757$export$fa7daccca11cdbe3","z","w","isVector4","setZ","setW","applyMatrix4","setAxisAngleFromQuaternion","setAxisAngleFromRotationMatrix","m11","m12","m13","m21","m22","m23","m31","m32","m33","xx","yy","zz","xy","xz","yz","getZ","getW","$a315ee31802fb757$export$efcb1f8bf367cbfb","options","isRenderTarget","depth","scissor","scissorTest","viewport","texture","depthBuffer","stencilBuffer","depthTexture","samples","setSize","assign","$a315ee31802fb757$export$3c052beb2e51e23f","isWebGLRenderTarget","$a315ee31802fb757$export$dfac6c8e811406a3","isDataArrayTexture","wrapR","$a315ee31802fb757$export$23d6a54f0bbc85a3","isQuaternion","_x","_y","_z","_w","slerpFlat","dst","dstOffset","src0","srcOffset0","src1","srcOffset1","x0","y0","z0","w0","x1","y1","z1","w1","dir","sqrSin","Number","EPSILON","len","tDir","multiplyQuaternionsFlat","_onChangeCallback","quaternion","setFromEuler","euler","update","_order","c1","c3","s1","s3","setFromAxisAngle","axis","halfAngle","setFromRotationMatrix","trace","setFromUnitVectors","vFrom","vTo","rotateTowards","step","slerp","conjugate","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","qb","cosHalfTheta","sqrSinHalfTheta","sinHalfTheta","halfTheta","ratioA","ratioB","slerpQuaternions","qa","u1","sqrt1u1","sqrtu1","u2","u3","_onChange","callback","isVector3","multiplyVectors","applyEuler","applyQuaternion","$a315ee31802fb757$var$_quaternion$4","applyAxisAngle","applyNormalMatrix","qx","qy","qz","qw","ix","iy","iz","iw","project","camera","matrixWorldInverse","projectionMatrix","unproject","projectionMatrixInverse","matrixWorld","transformDirection","crossVectors","ax","ay","az","bx","by","bz","projectOnVector","projectOnPlane","planeNormal","$a315ee31802fb757$var$_vector$b","reflect","normal","dz","setFromSpherical","setFromSphericalCoords","radius","phi","sinPhiRadius","setFromCylindrical","setFromCylindricalCoords","setFromMatrixPosition","setFromMatrixScale","setFromMatrixColumn","sz","setFromColor","randomDirection","u","Infinity","isBox3","setFromArray","makeEmpty","il","expandByPoint","$a315ee31802fb757$var$_vector$a","setFromBufferAttribute","count","setFromPoints","points","setFromCenterAndSize","size","halfSize","setFromObject","object","precise","expandByObject","box","isEmpty","getCenter","getSize","point","expandByVector","vector","expandByScalar","updateWorldMatrix","boundingBox","computeBoundingBox","$a315ee31802fb757$var$_box$3","union","geometry","attributes","position","children","containsPoint","containsBox","getParameter","intersectsBox","intersectsSphere","sphere","clampPoint","intersectsPlane","plane","constant","intersectsTriangle","triangle","$a315ee31802fb757$var$_center","$a315ee31802fb757$var$_extents","$a315ee31802fb757$var$_v0$2","$a315ee31802fb757$var$_v1$7","$a315ee31802fb757$var$_v2$4","$a315ee31802fb757$var$_f0","$a315ee31802fb757$var$_f1","$a315ee31802fb757$var$_f2","axes","$a315ee31802fb757$var$satForAxes","$a315ee31802fb757$var$_triangleNormal","distanceToPoint","getBoundingSphere","intersect","$a315ee31802fb757$var$_points","$a315ee31802fb757$var$_testAxis","v0","extents","j","p0","p1","p2","$a315ee31802fb757$var$_box$2","$a315ee31802fb757$var$_v1$6","$a315ee31802fb757$var$_v2$3","optionalCenter","maxRadiusSq","radiusSum","deltaLengthSq","getBoundingBox","getMaxScaleOnAxis","delta","$a315ee31802fb757$var$_vector$9","$a315ee31802fb757$var$_segCenter","$a315ee31802fb757$var$_segDir","$a315ee31802fb757$var$_diff","$a315ee31802fb757$var$_edge1","$a315ee31802fb757$var$_edge2","$a315ee31802fb757$var$_normal$1","origin","direction","ray","at","lookAt","recast","closestPointToPoint","directionDistance","distanceSqToPoint","distanceSqToSegment","optionalPointOnRay","optionalPointOnSegment","s0","sqrDist","extDet","segExtent","a01","b0","invDet","intersectSphere","tca","radius2","thc","t0","t1","distanceToPlane","intersectPlane","distToPoint","intersectBox","tmin","tmax","tymin","tymax","tzmin","tzmax","invdirx","invdiry","invdirz","isNaN","intersectTriangle","backfaceCulling","sign","DdN","DdQxE2","DdE1xQ","QdN","n14","n24","n34","n41","n42","n43","n44","isMatrix4","copyPosition","setFromMatrix3","makeBasis","extractRotation","scaleX","$a315ee31802fb757$var$_v1$5","scaleY","scaleZ","makeRotationFromEuler","af","bf","ce","cf","de","df","ac","ad","bc","bd","makeRotationFromQuaternion","compose","$a315ee31802fb757$var$_zero","$a315ee31802fb757$var$_one","eye","up","$a315ee31802fb757$var$_z","$a315ee31802fb757$var$_x","$a315ee31802fb757$var$_y","a14","a24","a34","a41","a42","a43","a44","b14","b24","b34","b41","b42","b43","b44","setPosition","t14","scaleXSq","scaleYSq","scaleZSq","makeRotationX","makeRotationY","makeRotationZ","makeRotationAxis","makeShear","yx","zx","zy","x2","y2","z2","wx","wy","wz","decompose","$a315ee31802fb757$var$_m1$2","invSX","invSY","invSZ","makePerspective","left","right","top","bottom","near","far","coordinateSystem","makeOrthographic","zInv","p","$a315ee31802fb757$var$_matrix","$a315ee31802fb757$var$_quaternion$3","$a315ee31802fb757$export$d93cc409a0768c5f","DEFAULT_ORDER","isEuler","asin","setFromQuaternion","setFromVector3","reorder","newOrder","$a315ee31802fb757$export$89312ce47c0ca777","mask","enable","enableAll","toggle","disable","disableAll","layers","isEnabled","$a315ee31802fb757$var$_object3DId","$a315ee31802fb757$var$_v1$4","$a315ee31802fb757$var$_q1","$a315ee31802fb757$var$_m1$1","$a315ee31802fb757$var$_target","$a315ee31802fb757$var$_position$3","$a315ee31802fb757$var$_scale$2","$a315ee31802fb757$var$_quaternion$2","$a315ee31802fb757$var$_xAxis","$a315ee31802fb757$var$_yAxis","$a315ee31802fb757$var$_zAxis","$a315ee31802fb757$var$_addedEvent","$a315ee31802fb757$var$_removedEvent","$a315ee31802fb757$export$e4dd07dff30cc924","isObject3D","parent","DEFAULT_UP","defineProperties","modelViewMatrix","normalMatrix","DEFAULT_MATRIX_AUTO_UPDATE","matrixWorldNeedsUpdate","matrixWorldAutoUpdate","DEFAULT_MATRIX_WORLD_AUTO_UPDATE","visible","castShadow","receiveShadow","frustumCulled","renderOrder","animations","onBeforeRender","onAfterRender","setRotationFromAxisAngle","setRotationFromEuler","setRotationFromMatrix","setRotationFromQuaternion","rotateOnAxis","rotateOnWorldAxis","rotateX","rotateY","rotateZ","translateOnAxis","distance","translateX","translateY","translateZ","localToWorld","worldToLocal","isCamera","isLight","arguments","error","remove","removeFromParent","clear","attach","getObjectById","getObjectByProperty","getObjectByName","child","getObjectsByProperty","result","childResult","concat","getWorldPosition","getWorldQuaternion","getWorldScale","getWorldDirection","raycast","traverse","traverseVisible","traverseAncestors","updateMatrixWorld","force","updateParents","updateChildren","geometries","materials","shapes","skeletons","nodes","serialize","library","element","isInstancedMesh","instanceMatrix","instanceColor","isScene","background","isColor","environment","isMesh","isLine","isPoints","parameters","shape","isSkinnedMesh","bindMode","bindMatrix","skeleton","material","uuids","animation","extractFromCache","cache","values","key","recursive","$a315ee31802fb757$var$_v0$1","$a315ee31802fb757$var$_v1$3","$a315ee31802fb757$var$_v2$2","$a315ee31802fb757$var$_v3$1","$a315ee31802fb757$var$_vab","$a315ee31802fb757$var$_vac","$a315ee31802fb757$var$_vbc","$a315ee31802fb757$var$_vap","$a315ee31802fb757$var$_vbp","$a315ee31802fb757$var$_vcp","$a315ee31802fb757$var$warnedGetUV","getNormal","targetLengthSq","getBarycoord","dot00","dot01","dot02","dot11","dot12","denom","invDenom","getUV","p3","uv1","uv2","uv3","getInterpolation","v3","isFrontFacing","setFromPointsAndIndices","i0","i1","i2","setFromAttributeAndIndices","getArea","getMidpoint","getPlane","setFromCoplanarPoints","d4","vc","d5","d6","vb","va","$a315ee31802fb757$var$materialId","$a315ee31802fb757$export$a2d8b23205c25948","isMaterial","blending","side","vertexColors","opacity","transparent","alphaHash","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","depthFunc","depthTest","depthWrite","stencilWriteMask","stencilFunc","stencilRef","stencilFuncMask","stencilFail","stencilZFail","stencilZPass","stencilWrite","clippingPlanes","clipIntersection","clipShadows","shadowSide","colorWrite","precision","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","dithering","alphaToCoverage","premultipliedAlpha","forceSinglePass","toneMapped","_alphaTest","alphaTest","onBuild","onBeforeCompile","customProgramCacheKey","toString","setValues","newValue","currentValue","getHex","roughness","metalness","sheen","sheenColor","sheenRoughness","emissive","emissiveIntensity","specular","specularIntensity","specularColor","shininess","clearcoat","clearcoatRoughness","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","clearcoatNormalScale","iridescence","iridescenceIOR","iridescenceThicknessRange","iridescenceMap","iridescenceThicknessMap","anisotropyRotation","anisotropyMap","map","matcap","alphaMap","lightMap","lightMapIntensity","aoMap","aoMapIntensity","bumpMap","bumpScale","normalMap","normalMapType","normalScale","displacementMap","displacementScale","displacementBias","roughnessMap","metalnessMap","emissiveMap","specularMap","specularIntensityMap","specularColorMap","envMap","combine","envMapIntensity","reflectivity","refractionRatio","gradientMap","transmission","transmissionMap","thickness","thicknessMap","attenuationDistance","attenuationColor","sizeAttenuation","linewidth","dashSize","gapSize","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","flatShading","fog","srcPlanes","dstPlanes","$a315ee31802fb757$var$_colorKeywords","$a315ee31802fb757$var$_hslA","$a315ee31802fb757$var$_hslB","$a315ee31802fb757$var$hue2rgb","$a315ee31802fb757$export$892596cec99bc70e","setHex","setStyle","setRGB","hex","setHSL","style","handleAlpha","string","parseFloat","exec","components","parseInt","charAt","setColorName","copySRGBToLinear","copyLinearToSRGB","$a315ee31802fb757$var$_color","getHexString","getHSL","hue","saturation","lightness","getRGB","getStyle","toFixed","offsetHSL","addColors","color1","color2","lerpColors","lerpHSL","NAMES","$a315ee31802fb757$export$55cbcc9b622fe1f5","isMeshBasicMaterial","$a315ee31802fb757$var$_vector$8","$a315ee31802fb757$var$_vector2$1","itemSize","normalized","TypeError","isBufferAttribute","usage","updateRange","gpuType","onUploadCallback","setUsage","copyAt","index1","index2","copyArray","setXY","setXYZ","component","setXYZW","onUpload","$a315ee31802fb757$export$640a853f68025f2e","$a315ee31802fb757$export$7eb8c9fa25cd5bd6","$a315ee31802fb757$export$cbe7a62641830ebd","$a315ee31802fb757$var$_id$1","$a315ee31802fb757$var$_m1","$a315ee31802fb757$var$_obj","$a315ee31802fb757$var$_offset","$a315ee31802fb757$var$_box$1","$a315ee31802fb757$var$_boxMorphTargets","$a315ee31802fb757$var$_vector$7","isBufferGeometry","morphAttributes","morphTargetsRelative","groups","boundingSphere","drawRange","start","getIndex","setIndex","getAttribute","setAttribute","deleteAttribute","hasAttribute","addGroup","materialIndex","clearGroups","setDrawRange","tangent","computeBoundingSphere","morphAttributesPosition","isGLBufferAttribute","morphAttribute","jl","computeTangents","indices","positions","normals","uvs","nVertices","tangents","tan1","tan2","vA","vB","vC","uvA","uvB","uvC","sdir","tdir","group","handleTriangle","isFinite","tmp2","n2","handleVertex","computeVertexNormals","positionAttribute","normalAttribute","pA","pB","pC","nA","nB","nC","cb","ab","normalizeNormals","toNonIndexed","convertBufferAttribute","array2","isInterleavedBufferAttribute","stride","geometry2","newAttribute","morphArray","hasMorphAttributes","attributeArray","$a315ee31802fb757$var$_inverseMatrix$3","$a315ee31802fb757$var$_ray$3","$a315ee31802fb757$var$_sphere$5","$a315ee31802fb757$var$_sphereHitAt","$a315ee31802fb757$var$_vA$1","$a315ee31802fb757$var$_vB$1","$a315ee31802fb757$var$_vC$1","$a315ee31802fb757$var$_tempA","$a315ee31802fb757$var$_morphA","$a315ee31802fb757$var$_uvA$1","$a315ee31802fb757$var$_uvB$1","$a315ee31802fb757$var$_uvC$1","$a315ee31802fb757$var$_normalA","$a315ee31802fb757$var$_normalB","$a315ee31802fb757$var$_normalC","$a315ee31802fb757$var$_intersectionPoint","$a315ee31802fb757$var$_intersectionPointWorld","$a315ee31802fb757$export$e176487c05830cc5","updateMorphTargets","morphTargetInfluences","morphTargetDictionary","ml","String","getVertexPosition","morphPosition","morphInfluences","influence","raycaster","intersects","_computeIntersections","rayLocalSpace","intersection","groupMaterial","end","$a315ee31802fb757$var$checkGeometryIntersection","faceIndex","face","$a315ee31802fb757$var$checkIntersection","$a315ee31802fb757$export$33e43285f7406bd5","widthSegments","heightSegments","depthSegments","scope","vertices","numberOfVertices","groupStart","buildPlane","udir","vdir","gridX","gridY","segmentWidth","segmentHeight","widthHalf","heightHalf","depthHalf","gridX1","gridY1","vertexCounter","groupCount","fromJSON","$a315ee31802fb757$var$cloneUniforms","property","$a315ee31802fb757$var$mergeUniforms","uniforms","merged","$a315ee31802fb757$var$getUnlitUniformColorSpace","renderer","getRenderTarget","outputColorSpace","$a315ee31802fb757$export$d8ecdf8615bfea69","merge","$a315ee31802fb757$export$83c7d75d550a8b0d","isShaderMaterial","defines","uniformsGroups","vertexShader","fragmentShader","lights","clipping","extensions","derivatives","fragDepth","drawBuffers","shaderTextureLOD","defaultAttributeValues","index0AttributeName","uniformsNeedUpdate","glslVersion","$a315ee31802fb757$var$cloneUniformsGroups","uniform","$a315ee31802fb757$export$79f141de891a5fed","$a315ee31802fb757$export$74e4ae24825f68d7","fov","aspect","isPerspectiveCamera","zoom","focus","view","filmGauge","filmOffset","updateProjectionMatrix","setFocalLength","focalLength","vExtentSlope","getFilmHeight","atan","getFocalLength","tan","getEffectiveFOV","getFilmWidth","setViewOffset","fullWidth","fullHeight","offsetX","offsetY","clearViewOffset","skew","$a315ee31802fb757$export$d0cdd0bd804995de","renderTarget","cameraPX","cameraNX","cameraPY","cameraNY","cameraPZ","cameraNZ","updateCoordinateSystem","cameras","scene","currentRenderTarget","currentXrEnabled","xr","setRenderTarget","render","$a315ee31802fb757$export$ee2e5a18258a4049","isCubeTexture","$a315ee31802fb757$export$ac386671d651941e","isWebGLCubeRenderTarget","fromEquirectangularTexture","shader","tEquirect","mesh","currentMinFilter","stencil","$a315ee31802fb757$var$_vector1","$a315ee31802fb757$var$_vector2","$a315ee31802fb757$var$_normalMatrix","isPlane","setComponents","setFromNormalAndCoplanarPoint","inverseNormalLength","distanceToSphere","projectPoint","intersectLine","line","intersectsLine","startSign","endSign","coplanarPoint","optionalNormalMatrix","referencePoint","$a315ee31802fb757$var$_sphere$4","$a315ee31802fb757$var$_vector$6","$a315ee31802fb757$export$35efe6f4c85463d2","p4","p5","planes","frustum","setFromProjectionMatrix","me0","me1","me2","me3","me4","me5","me6","me7","me8","me9","me10","me11","me12","me13","me14","me15","intersectsObject","intersectsSprite","sprite","negRadius","$a315ee31802fb757$var$WebGLAnimation","isAnimating","animationLoop","requestId","onAnimationFrame","time","frame","requestAnimationFrame","stop","cancelAnimationFrame","setAnimationLoop","setContext","$a315ee31802fb757$var$WebGLAttributes","gl","capabilities","isWebGL2","buffers","WeakMap","deleteBuffer","buffer","delete","bufferType","cached","bytesPerElement","elementSize","createBuffer","bindBuffer","bufferData","FLOAT","isFloat16BufferAttribute","HALF_FLOAT","UNSIGNED_SHORT","SHORT","UNSIGNED_INT","INT","BYTE","UNSIGNED_BYTE","BYTES_PER_ELEMENT","updateBuffer","bufferSubData","subarray","$a315ee31802fb757$export$967d831af31f69ce","width_half","height_half","segment_width","segment_height","$a315ee31802fb757$export$955f9f2e84c43c8b","alphahash_fragment","alphahash_pars_fragment","alphamap_fragment","alphamap_pars_fragment","alphatest_fragment","alphatest_pars_fragment","aomap_fragment","aomap_pars_fragment","begin_vertex","beginnormal_vertex","bsdfs","iridescence_fragment","bumpmap_pars_fragment","clipping_planes_fragment","clipping_planes_pars_fragment","clipping_planes_pars_vertex","clipping_planes_vertex","color_fragment","color_pars_fragment","color_pars_vertex","color_vertex","common","cube_uv_reflection_fragment","defaultnormal_vertex","displacementmap_pars_vertex","displacementmap_vertex","emissivemap_fragment","emissivemap_pars_fragment","colorspace_fragment","colorspace_pars_fragment","envmap_fragment","envmap_common_pars_fragment","envmap_pars_fragment","envmap_pars_vertex","envmap_physical_pars_fragment","envmap_vertex","fog_vertex","fog_pars_vertex","fog_fragment","fog_pars_fragment","gradientmap_pars_fragment","lightmap_fragment","lightmap_pars_fragment","lights_lambert_fragment","lights_lambert_pars_fragment","lights_pars_begin","lights_toon_fragment","lights_toon_pars_fragment","lights_phong_fragment","lights_phong_pars_fragment","lights_physical_fragment","lights_physical_pars_fragment","lights_fragment_begin","lights_fragment_maps","lights_fragment_end","logdepthbuf_fragment","logdepthbuf_pars_fragment","logdepthbuf_pars_vertex","logdepthbuf_vertex","map_fragment","map_pars_fragment","map_particle_fragment","map_particle_pars_fragment","metalnessmap_fragment","metalnessmap_pars_fragment","morphcolor_vertex","morphnormal_vertex","morphtarget_pars_vertex","morphtarget_vertex","normal_fragment_begin","normal_fragment_maps","normal_pars_fragment","normal_pars_vertex","normal_vertex","normalmap_pars_fragment","clearcoat_normal_fragment_begin","clearcoat_normal_fragment_maps","clearcoat_pars_fragment","iridescence_pars_fragment","opaque_fragment","packing","premultiplied_alpha_fragment","project_vertex","dithering_fragment","dithering_pars_fragment","roughnessmap_fragment","roughnessmap_pars_fragment","shadowmap_pars_fragment","shadowmap_pars_vertex","shadowmap_vertex","shadowmask_pars_fragment","skinbase_vertex","skinning_pars_vertex","skinning_vertex","skinnormal_vertex","specularmap_fragment","specularmap_pars_fragment","tonemapping_fragment","tonemapping_pars_fragment","transmission_fragment","transmission_pars_fragment","uv_pars_fragment","uv_pars_vertex","uv_vertex","worldpos_vertex","background_vert","background_frag","backgroundCube_vert","backgroundCube_frag","cube_vert","cube_frag","depth_vert","depth_frag","distanceRGBA_vert","distanceRGBA_frag","equirect_vert","equirect_frag","linedashed_vert","linedashed_frag","meshbasic_vert","meshbasic_frag","meshlambert_vert","meshlambert_frag","meshmatcap_vert","meshmatcap_frag","meshnormal_vert","meshnormal_frag","meshphong_vert","meshphong_frag","meshphysical_vert","meshphysical_frag","meshtoon_vert","meshtoon_frag","points_vert","points_frag","shadow_vert","shadow_frag","sprite_vert","sprite_frag","$a315ee31802fb757$export$6643083551874bf5","diffuse","mapTransform","alphaMapTransform","specularmap","specularMapTransform","envmap","flipEnvMap","ior","aomap","aoMapTransform","lightmap","lightMapTransform","bumpmap","bumpMapTransform","normalmap","normalMapTransform","displacementmap","displacementMapTransform","emissivemap","emissiveMapTransform","metalnessmap","metalnessMapTransform","roughnessmap","roughnessMapTransform","gradientmap","fogDensity","fogNear","fogFar","fogColor","ambientLightColor","lightProbe","directionalLights","properties","directionalLightShadows","shadowBias","shadowNormalBias","shadowRadius","shadowMapSize","directionalShadowMap","directionalShadowMatrix","spotLights","coneCos","penumbraCos","decay","spotLightShadows","spotLightMap","spotShadowMap","spotLightMatrix","pointLights","pointLightShadows","shadowCameraNear","shadowCameraFar","pointShadowMap","pointShadowMatrix","hemisphereLights","skyColor","groundColor","rectAreaLights","ltc_1","ltc_2","uvTransform","$a315ee31802fb757$export$bee4a7d47f8f5014","basic","lambert","phong","standard","toon","dashed","totalSize","t2D","backgroundIntensity","backgroundCube","backgroundBlurriness","cube","tCube","tFlip","equirect","distanceRGBA","referencePosition","nearDistance","farDistance","shadow","physical","clearcoatMapTransform","clearcoatNormalMapTransform","clearcoatRoughnessMapTransform","iridescenceMapTransform","iridescenceThicknessMinimum","iridescenceThicknessMaximum","iridescenceThicknessMapTransform","sheenColorMap","sheenColorMapTransform","sheenRoughnessMap","sheenRoughnessMapTransform","transmissionMapTransform","transmissionSamplerSize","transmissionSamplerMap","thicknessMapTransform","specularColorMapTransform","specularIntensityMapTransform","anisotropyVector","anisotropyMapTransform","$a315ee31802fb757$var$_rgb","$a315ee31802fb757$var$WebGLBackground","cubemaps","cubeuvmaps","state","objects","planeMesh","boxMesh","clearColor","clearAlpha","currentBackground","currentBackgroundVersion","currentTonemapping","setClear","getClearColor","setClearColor","getClearAlpha","setClearAlpha","renderList","forceClear","usePMREM","environmentBlendMode","getEnvironmentBlendMode","autoClear","autoClearColor","autoClearDepth","autoClearStencil","toneMapping","unshift","$a315ee31802fb757$var$WebGLBindingStates","maxVertexAttributes","MAX_VERTEX_ATTRIBS","extension","vaoAvailable","bindingStates","defaultState","createBindingState","currentState","forceUpdate","bindVertexArrayObject","vao","bindVertexArray","bindVertexArrayOES","deleteVertexArrayObject","deleteVertexArray","deleteVertexArrayOES","newAttributes","enabledAttributes","attributeDivisors","program","initAttributes","enableAttribute","enableAttributeAndDivisor","meshPerAttribute","enableVertexAttribArray","disableUnusedAttributes","disableVertexAttribArray","vertexAttribPointer","integer","vertexAttribIPointer","reset","resetDefaultState","setup","updateBuffers","getBindingState","programMap","stateMap","createVertexArray","createVertexArrayOES","cachedAttributes","geometryAttributes","attributesNum","programAttributes","getAttributes","programAttribute","location","cachedAttribute","geometryAttribute","saveCache","ELEMENT_ARRAY_BUFFER","setupVertexAttributes","isInstancedBufferGeometry","materialDefaultAttributeValues","isInstancedInterleavedBuffer","locationSize","_maxInstanceCount","ARRAY_BUFFER","isInstancedBufferAttribute","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","vertexAttrib1fv","geometryId","programId","releaseStatesOfGeometry","releaseStatesOfProgram","$a315ee31802fb757$var$WebGLBufferRenderer","info","mode","setMode","drawArrays","renderInstances","primcount","methodName","$a315ee31802fb757$var$WebGLCapabilities","maxAnisotropy","getMaxPrecision","getShaderPrecisionFormat","VERTEX_SHADER","HIGH_FLOAT","FRAGMENT_SHADER","MEDIUM_FLOAT","WebGL2RenderingContext","maxPrecision","has","logarithmicDepthBuffer","maxTextures","MAX_TEXTURE_IMAGE_UNITS","maxVertexTextures","MAX_VERTEX_TEXTURE_IMAGE_UNITS","maxTextureSize","MAX_TEXTURE_SIZE","maxCubemapSize","MAX_CUBE_MAP_TEXTURE_SIZE","maxAttributes","maxVertexUniforms","MAX_VERTEX_UNIFORM_VECTORS","maxVaryings","MAX_VARYING_VECTORS","maxFragmentUniforms","MAX_FRAGMENT_UNIFORM_VECTORS","vertexTextures","floatFragmentTextures","maxSamples","MAX_SAMPLES","getMaxAnisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT","floatVertexTextures","$a315ee31802fb757$var$WebGLClipping","globalState","numGlobalPlanes","localClippingEnabled","renderingShadows","viewNormalMatrix","projectPlanes","skipTransform","nPlanes","dstArray","flatSize","viewMatrix","i4","numPlanes","numIntersection","enableLocalClipping","beginShadows","endShadows","setGlobalState","setState","useCache","materialProperties","nGlobal","lGlobal","clippingState","$a315ee31802fb757$var$WebGLCubeMaps","mapTextureMapping","onTextureDispose","cubemap","$a315ee31802fb757$var$EXTRA_LOD_SIGMA","$a315ee31802fb757$var$_flatCamera","isOrthographicCamera","scaleW","scaleH","$a315ee31802fb757$var$_clearColor","$a315ee31802fb757$var$_oldTarget","$a315ee31802fb757$var$PHI","$a315ee31802fb757$var$INV_PHI","$a315ee31802fb757$var$_axisDirections","$a315ee31802fb757$export$6add42717753e221","_renderer","_pingPongRenderTarget","_lodMax","_cubeSize","_lodPlanes","_sizeLods","_sigmas","_blurMaterial","_cubemapMaterial","_equirectMaterial","_compileMaterial","fromScene","sigma","_setSize","cubeUVRenderTarget","_allocateTargets","_sceneToCubeUV","_blur","_applyPMREM","_cleanup","fromEquirectangular","equirectangular","_fromTexture","fromCubemap","compileCubemapShader","$a315ee31802fb757$var$_getCubemapMaterial","compileEquirectangularShader","$a315ee31802fb757$var$_getEquirectMaterial","_dispose","cubeSize","log2","outputTarget","$a315ee31802fb757$var$_setViewport","_textureToCubeUV","params","$a315ee31802fb757$var$_createRenderTarget","sizeLods","lodPlanes","sigmas","$a315ee31802fb757$var$_createPlanes","lodMax","lod","totalLods","sizeLod","texelSize","positionSize","uvSize","faceIndexSize","coordinates","fill","$a315ee31802fb757$var$_getBlurShader","weights","poleAxis","shaderMaterial","$a315ee31802fb757$var$_getCommonVertexShader","tmpMesh","compile","cubeCamera","upSign","forwardSign","originalAutoClear","backgroundMaterial","backgroundBox","useSolidColor","col","lodIn","lodOut","pingPongRenderTarget","_halfBlur","targetIn","targetOut","sigmaRadians","blurMaterial","blurMesh","blurUniforms","pixels","radiansPerPixel","sigmaPixels","STANDARD_DEVIATIONS","sum","weight","outputSize","$a315ee31802fb757$var$WebGLCubeUVMaps","cubeUVmaps","pmremGenerator","cubemapUV","isEquirectMap","isCubeMap","isCubeTextureComplete","$a315ee31802fb757$var$WebGLExtensions","getExtension","$a315ee31802fb757$var$WebGLGeometries","wireframeAttributes","onGeometryDispose","memory","updateWireframeAttribute","geometryIndex","geometryPosition","previousAttribute","getWireframeAttribute","currentAttribute","$a315ee31802fb757$var$WebGLIndexedBufferRenderer","drawElements","$a315ee31802fb757$var$WebGLInfo","calls","triangles","lines","programs","autoReset","instanceCount","TRIANGLES","LINES","LINE_STRIP","LINE_LOOP","POINTS","$a315ee31802fb757$var$numericalSort","$a315ee31802fb757$var$absNumericalSort","$a315ee31802fb757$var$WebGLMorphtargets","influencesList","morphTextures","morph","workInfluences","objectInfluences","morphTargetsCount","entry","hasMorphPosition","hasMorphNormals","hasMorphColors","morphTargets","morphNormals","morphColors","vertexDataCount","vertexDataStride","morphTarget","morphNormal","morphColor","disposeTexture","morphInfluencesSum","morphBaseInfluence","getUniforms","setValue","influences","sort","MAX_SAFE_INTEGER","$a315ee31802fb757$var$WebGLObjects","updateMap","onInstancedMeshDispose","instancedMesh","buffergeometry","$a315ee31802fb757$var$emptyTexture","$a315ee31802fb757$var$emptyArrayTexture","$a315ee31802fb757$var$empty3dTexture","isData3DTexture","$a315ee31802fb757$var$emptyCubeTexture","$a315ee31802fb757$var$arrayCacheF32","$a315ee31802fb757$var$arrayCacheI32","$a315ee31802fb757$var$mat4array","$a315ee31802fb757$var$mat3array","$a315ee31802fb757$var$mat2array","$a315ee31802fb757$var$flatten","nBlocks","blockSize","firstElem","$a315ee31802fb757$var$arraysEqual","$a315ee31802fb757$var$copyArray","$a315ee31802fb757$var$allocTexUnits","allocateTextureUnit","$a315ee31802fb757$var$setValueV1f","uniform1f","addr","$a315ee31802fb757$var$setValueV2f","uniform2f","uniform2fv","$a315ee31802fb757$var$setValueV3f","uniform3f","uniform3fv","$a315ee31802fb757$var$setValueV4f","uniform4f","uniform4fv","$a315ee31802fb757$var$setValueM2","uniformMatrix2fv","$a315ee31802fb757$var$setValueM3","uniformMatrix3fv","$a315ee31802fb757$var$setValueM4","uniformMatrix4fv","$a315ee31802fb757$var$setValueV1i","uniform1i","$a315ee31802fb757$var$setValueV2i","uniform2i","uniform2iv","$a315ee31802fb757$var$setValueV3i","uniform3i","uniform3iv","$a315ee31802fb757$var$setValueV4i","uniform4i","uniform4iv","$a315ee31802fb757$var$setValueV1ui","uniform1ui","$a315ee31802fb757$var$setValueV2ui","uniform2ui","uniform2uiv","$a315ee31802fb757$var$setValueV3ui","uniform3ui","uniform3uiv","$a315ee31802fb757$var$setValueV4ui","uniform4ui","uniform4uiv","$a315ee31802fb757$var$setValueT1","unit","setTexture2D","$a315ee31802fb757$var$setValueT3D1","setTexture3D","$a315ee31802fb757$var$setValueT6","setTextureCube","$a315ee31802fb757$var$setValueT2DArray1","setTexture2DArray","$a315ee31802fb757$var$setValueV1fArray","uniform1fv","$a315ee31802fb757$var$setValueV2fArray","$a315ee31802fb757$var$setValueV3fArray","$a315ee31802fb757$var$setValueV4fArray","$a315ee31802fb757$var$setValueM2Array","$a315ee31802fb757$var$setValueM3Array","$a315ee31802fb757$var$setValueM4Array","$a315ee31802fb757$var$setValueV1iArray","uniform1iv","$a315ee31802fb757$var$setValueV2iArray","$a315ee31802fb757$var$setValueV3iArray","$a315ee31802fb757$var$setValueV4iArray","$a315ee31802fb757$var$setValueV1uiArray","uniform1uiv","$a315ee31802fb757$var$setValueV2uiArray","$a315ee31802fb757$var$setValueV3uiArray","$a315ee31802fb757$var$setValueV4uiArray","$a315ee31802fb757$var$setValueT1Array","units","$a315ee31802fb757$var$setValueT3DArray","$a315ee31802fb757$var$setValueT6Array","$a315ee31802fb757$var$setValueT2DArrayArray","$a315ee31802fb757$var$SingleUniform","activeInfo","$a315ee31802fb757$var$getSingularSetter","$a315ee31802fb757$var$PureArrayUniform","$a315ee31802fb757$var$getPureArraySetter","$a315ee31802fb757$var$StructuredUniform","seq","$a315ee31802fb757$var$RePathPart","$a315ee31802fb757$var$addUniform","container","uniformObject","$a315ee31802fb757$var$WebGLUniforms","getProgramParameter","ACTIVE_UNIFORMS","getActiveUniform","getUniformLocation","$a315ee31802fb757$var$parseUniform","path","pathLength","lastIndex","match","matchEnd","idIsIndex","subscript","next","setOptional","upload","seqWithValue","$a315ee31802fb757$var$WebGLShader","createShader","shaderSource","compileShader","$a315ee31802fb757$var$programIdCount","$a315ee31802fb757$var$getShaderErrors","status","getShaderParameter","COMPILE_STATUS","errors","getShaderInfoLog","trim","errorMatches","errorLine","toUpperCase","$a315ee31802fb757$var$handleSource","split","lines2","to","join","getShaderSource","$a315ee31802fb757$var$filterEmptyLine","$a315ee31802fb757$var$replaceLightNums","numSpotLightCoords","numSpotLightShadows","numSpotLightMaps","numSpotLightShadowsWithMaps","replace","numDirLights","numSpotLights","numRectAreaLights","numPointLights","numHemiLights","numDirLightShadows","numPointLightShadows","$a315ee31802fb757$var$replaceClippingPlaneNums","numClippingPlanes","numClipIntersection","$a315ee31802fb757$var$includePattern","$a315ee31802fb757$var$resolveIncludes","$a315ee31802fb757$var$includeReplacer","$a315ee31802fb757$var$shaderChunkMap","Map","include","newInclude","$a315ee31802fb757$var$unrollLoopPattern","$a315ee31802fb757$var$unrollLoops","$a315ee31802fb757$var$loopReplacer","snippet","$a315ee31802fb757$var$generatePrecision","precisionstring","$a315ee31802fb757$var$WebGLProgram","cacheKey","prefixVertex","prefixFragment","cachedUniforms","shadowMapTypeDefine","envMapModeDefine","shadowMapType","envMapTypeDefine","$a315ee31802fb757$var$generateEnvMapTypeDefine","envMapMode","envMapBlendingDefine","$a315ee31802fb757$var$generateEnvMapBlendingDefine","envMapCubeUVSize","$a315ee31802fb757$var$generateCubeUVSize","imageHeight","envMapCubeUVHeight","maxMip","texelWidth","texelHeight","customExtensions","$a315ee31802fb757$var$generateExtensions","chunks","extensionDerivatives","normalMapTangentSpace","shaderID","extensionFragDepth","rendererExtensionFragDepth","extensionDrawBuffers","rendererExtensionDrawBuffers","extensionShaderTextureLOD","rendererExtensionShaderTextureLod","filter","customDefines","$a315ee31802fb757$var$generateDefines","createProgram","versionString","isRawShaderMaterial","shaderType","shaderName","instancing","instancingColor","useFog","fogExp2","normalMapObjectSpace","mapUv","alphaMapUv","lightMapUv","aoMapUv","emissiveMapUv","bumpMapUv","normalMapUv","displacementMapUv","metalnessMapUv","roughnessMapUv","anisotropyMapUv","clearcoatMapUv","clearcoatNormalMapUv","clearcoatRoughnessMapUv","iridescenceMapUv","iridescenceThicknessMapUv","sheenColorMapUv","sheenRoughnessMapUv","specularMapUv","specularColorMapUv","specularIntensityMapUv","transmissionMapUv","thicknessMapUv","vertexTangents","vertexAlphas","vertexUv1s","vertexUv2s","vertexUv3s","pointsUvs","skinning","morphTextureStride","doubleSided","flipSided","shadowMapEnabled","useLegacyLights","$a315ee31802fb757$var$getToneMappingFunction","functionName","toneMappingName","opaque","$a315ee31802fb757$var$getTexelEncodingFunction","$a315ee31802fb757$var$getEncodingComponents","useDepthPacking","depthPacking","vertexGlsl","fragmentGlsl","glVertexShader","glFragmentShader","attachShader","bindAttribLocation","linkProgram","debug","checkShaderErrors","programLog","getProgramInfoLog","vertexLog","fragmentLog","runnable","haveDiagnostics","LINK_STATUS","onShaderError","vertexErrors","fragmentErrors","getError","VALIDATE_STATUS","diagnostics","prefix","deleteShader","$a315ee31802fb757$var$fetchAttributeLocations","ACTIVE_ATTRIBUTES","getActiveAttrib","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","getAttribLocation","destroy","deleteProgram","usedTimes","$a315ee31802fb757$var$_id","$a315ee31802fb757$var$WebGLShaderCache","shaderCache","materialCache","vertexShaderStage","_getShaderStage","fragmentShaderStage","materialShaders","_getShaderCacheForMaterial","shaderStage","getVertexShaderID","getFragmentShaderID","Set","stage","$a315ee31802fb757$var$WebGLShaderStage","$a315ee31802fb757$var$WebGLPrograms","_programLayers","_customShaders","IS_WEBGL2","SUPPORTS_VERTEX_TEXTURES","shaderIDs","MeshDepthMaterial","MeshDistanceMaterial","MeshNormalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial","MeshStandardMaterial","MeshPhysicalMaterial","MeshMatcapMaterial","LineBasicMaterial","LineDashedMaterial","PointsMaterial","ShadowMaterial","SpriteMaterial","getChannel","getParameters","shadows","customVertexShaderID","customFragmentShaderID","isMeshStandardMaterial","IS_INSTANCEDMESH","HAS_MAP","HAS_MATCAP","HAS_ENVMAP","HAS_AOMAP","HAS_LIGHTMAP","HAS_BUMPMAP","HAS_NORMALMAP","HAS_DISPLACEMENTMAP","HAS_EMISSIVEMAP","HAS_METALNESSMAP","HAS_ROUGHNESSMAP","HAS_ANISOTROPY","HAS_CLEARCOAT","HAS_IRIDESCENCE","HAS_SHEEN","HAS_TRANSMISSION","HAS_ANISOTROPYMAP","HAS_CLEARCOATMAP","HAS_CLEARCOAT_NORMALMAP","HAS_CLEARCOAT_ROUGHNESSMAP","HAS_IRIDESCENCEMAP","HAS_IRIDESCENCE_THICKNESSMAP","HAS_SHEEN_COLORMAP","HAS_SHEEN_ROUGHNESSMAP","HAS_SPECULARMAP","HAS_SPECULAR_COLORMAP","HAS_SPECULAR_INTENSITYMAP","HAS_TRANSMISSIONMAP","HAS_THICKNESSMAP","HAS_GRADIENTMAP","HAS_ALPHAMAP","HAS_ALPHATEST","HAS_ALPHAHASH","HAS_EXTENSIONS","HAS_ATTRIBUTE_UV1","HAS_ATTRIBUTE_UV2","HAS_ATTRIBUTE_UV3","isXRRenderTarget","supportsVertexTextures","isFogExp2","directional","spot","rectArea","hemi","shadowMap","_useLegacyLights","getProgramCacheKey","morphAttributeCount","acquireProgram","pl","preexistingProgram","releaseProgram","pop","releaseShaderCache","$a315ee31802fb757$var$WebGLProperties","$a315ee31802fb757$var$painterSortStable","groupOrder","$a315ee31802fb757$var$reversePainterSortStable","$a315ee31802fb757$var$WebGLRenderList","renderItems","renderItemsIndex","transmissive","getNextRenderItem","renderItem","finish","customOpaqueSort","customTransparentSort","$a315ee31802fb757$var$WebGLRenderLists","lists","renderCallDepth","list","listArray","$a315ee31802fb757$var$UniformsCache","light","halfWidth","halfHeight","$a315ee31802fb757$var$nextVersion","$a315ee31802fb757$var$shadowCastingAndTexturingLightsFirst","lightA","lightB","$a315ee31802fb757$var$WebGLLights","shadowCache","$a315ee31802fb757$var$ShadowUniformsCache","hash","directionalLength","pointLength","spotLength","rectAreaLength","hemiLength","numDirectionalShadows","numPointShadows","numSpotShadows","numSpotMaps","ambient","probe","directionalShadow","spotShadow","rectAreaLTC1","rectAreaLTC2","pointShadow","vector3","matrix42","numSpotShadowsWithMaps","scaleFactor","intensity","isAmbientLight","isLightProbe","sh","coefficients","isDirectionalLight","shadowUniforms","bias","normalBias","mapSize","isSpotLight","penumbra","updateMatrices","isRectAreaLight","isPointLight","isHemisphereLight","LTC_FLOAT_1","LTC_FLOAT_2","LTC_HALF_1","LTC_HALF_2","setupView","$a315ee31802fb757$var$WebGLRenderState","lightsArray","shadowsArray","setupLights","setupLightsView","pushLight","pushShadow","shadowLight","$a315ee31802fb757$var$WebGLRenderStates","renderStates","renderState","renderStateArray","$a315ee31802fb757$export$2698c22ec13825db","isMeshDepthMaterial","$a315ee31802fb757$export$33e187ed002f2a19","isMeshDistanceMaterial","$a315ee31802fb757$var$WebGLShadowMap","_objects","_capabilities","_frustum","_shadowMapSize","_viewportSize","_viewport","_depthMaterial","_distanceMaterial","_materialCache","_maxTextureSize","shadowMaterialVertical","VSM_SAMPLES","shadow_pass","resolution","shadowMaterialHorizontal","HORIZONTAL_PASS","fullScreenTri","fullScreenMesh","autoUpdate","_previousType","getDepthMaterial","customMaterial","customDistanceMaterial","customDepthMaterial","keyA","keyB","materialsForVariant","cachedMaterial","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","_state","setBlending","setTest","setScissorTest","toVSM","fromVSM","shadowFrameExtents","getFrameExtents","pars","viewportCount","getViewportCount","vp","getViewport","getFrustum","renderObject","shadowCamera","k","kl","depthMaterial","renderBufferDirect","isPointLightShadow","VSMPass","blurSamples","mapPass","$a315ee31802fb757$var$WebGLState","colorBuffer","locked","currentColorMask","currentColorClear","setMask","colorMask","setLocked","lock","currentDepthMask","currentDepthFunc","currentDepthClear","DEPTH_TEST","depthMask","setFunc","NEVER","ALWAYS","LESS","LEQUAL","EQUAL","GEQUAL","GREATER","NOTEQUAL","clearDepth","currentStencilMask","currentStencilFunc","currentStencilRef","currentStencilFuncMask","currentStencilFail","currentStencilZFail","currentStencilZPass","currentStencilClear","stencilTest","STENCIL_TEST","stencilMask","setOp","stencilOp","clearStencil","uboBindings","uboProgramMap","enabledCapabilities","currentBoundFramebuffers","currentDrawbuffers","defaultDrawbuffers","currentProgram","currentBlendingEnabled","currentBlending","currentBlendEquation","currentBlendSrc","currentBlendDst","currentBlendEquationAlpha","currentBlendSrcAlpha","currentBlendDstAlpha","currentPremultipledAlpha","currentFlipSided","currentCullFace","currentLineWidth","currentPolygonOffsetFactor","currentPolygonOffsetUnits","MAX_COMBINED_TEXTURE_IMAGE_UNITS","lineWidthAvailable","glVersion","VERSION","currentTextureSlot","currentBoundTextures","scissorParam","SCISSOR_BOX","viewportParam","VIEWPORT","currentScissor","currentViewport","createTexture","dimensions","bindTexture","texParameteri","TEXTURE_MIN_FILTER","NEAREST","TEXTURE_MAG_FILTER","TEXTURE_3D","TEXTURE_2D_ARRAY","texImage3D","RGBA","texImage2D","emptyTextures","TEXTURE_2D","TEXTURE_CUBE_MAP","TEXTURE_CUBE_MAP_POSITIVE_X","setFlipSided","setCullFace","CULL_FACE","equationToGL","FUNC_ADD","FUNC_SUBTRACT","FUNC_REVERSE_SUBTRACT","MIN","MAX","MIN_EXT","MAX_EXT","factorToGL","ZERO","ONE","SRC_COLOR","SRC_ALPHA","SRC_ALPHA_SATURATE","DST_COLOR","DST_ALPHA","ONE_MINUS_SRC_COLOR","ONE_MINUS_SRC_ALPHA","ONE_MINUS_DST_COLOR","ONE_MINUS_DST_ALPHA","BLEND","blendFuncSeparate","blendFunc","blendEquationSeparate","frontFace","CW","CCW","cullFace","BACK","FRONT","FRONT_AND_BACK","setPolygonOffset","factor","POLYGON_OFFSET_FILL","bindFramebuffer","framebuffer","DRAW_FRAMEBUFFER","FRAMEBUFFER","isWebGLMultipleRenderTargets","COLOR_ATTACHMENT0","drawBuffersWEBGL","useProgram","setMaterial","frontFaceCW","SAMPLE_ALPHA_TO_COVERAGE","setLineWidth","lineWidth","SCISSOR_TEST","activeTexture","webglSlot","TEXTURE0","webglType","webglTexture","boundTexture","unbindTexture","compressedTexImage2D","apply","compressedTexImage3D","updateUBOMapping","uniformsGroup","blockIndex","getUniformBlockIndex","uniformBlockBinding","__bindingPointIndex","texStorage2D","texStorage3D","texSubImage2D","texSubImage3D","compressedTexSubImage2D","compressedTexSubImage3D","KEEP","READ_FRAMEBUFFER","$a315ee31802fb757$var$WebGLTextures","_gl","utils","_canvas","multisampledRTTExt","supportsInvalidateFramebuffer","navigator","userAgent","_videoTextures","_sources","useOffscreenCanvas","OffscreenCanvas","createCanvas","resizeImage","needsPowerOfTwo","needsNewCanvas","maxSize","isPowerOfTwo$1","textureNeedsGenerateMipmaps","supportsMips","generateMipmap","getInternalFormat","internalFormatName","glFormat","glType","forceLinearTransfer","RED","R32F","R16F","R8","RED_INTEGER","R8UI","R16UI","R32UI","R8I","R16I","R32I","RG","RG32F","RG16F","RG8","RGBA32F","RGBA16F","SRGB8_ALPHA8","RGBA8","UNSIGNED_SHORT_4_4_4_4","RGBA4","UNSIGNED_SHORT_5_5_5_1","RGB5_A1","getMipLevels","isFramebufferTexture","isCompressedTexture","filterFallback","LINEAR","deallocateTexture","textureProperties","__webglInit","webglTextures","__cacheKey","deleteTexture","isVideoTexture","onRenderTargetDispose","deallocateRenderTarget","renderTargetProperties","__webglTexture","__webglFramebuffer","level","deleteFramebuffer","__webglDepthbuffer","deleteRenderbuffer","__webglMultisampledFramebuffer","__webglColorRenderbuffer","__webglDepthRenderbuffer","attachmentProperties","textureUnits","slot","updateVideoTexture","__version","complete","uploadTexture","wrappingToGL","REPEAT","CLAMP_TO_EDGE","MIRRORED_REPEAT","filterToGL","NEAREST_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","compareToGL","setTextureParameters","textureType","TEXTURE_WRAP_S","TEXTURE_WRAP_T","TEXTURE_WRAP_R","compareFunction","TEXTURE_COMPARE_MODE","COMPARE_REF_TO_TEXTURE","TEXTURE_COMPARE_FUNC","__currentAnisotropy","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","initTexture","forceUpload","textureCacheKey","getTextureCacheKey","isCompressedArrayTexture","sourceProperties","mipmap","pixelStorei","UNPACK_FLIP_Y_WEBGL","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK_ALIGNMENT","UNPACK_COLORSPACE_CONVERSION_WEBGL","NONE","verifyColorSpace","glInternalFormat","useTexStorage","allocateMemory","levels","isDepthTexture","DEPTH_COMPONENT","DEPTH_COMPONENT32F","DEPTH_COMPONENT24","DEPTH24_STENCIL8","DEPTH_COMPONENT16","DEPTH_STENCIL","setupFrameBufferTexture","attachment","textureTarget","__hasExternalTextures","useMultisampledRTT","framebufferTexture2DMultisampleEXT","getRenderTargetSamples","TEXTURE_CUBE_MAP_NEGATIVE_Z","framebufferTexture2D","setupRenderBufferStorage","renderbuffer","isMultisample","bindRenderbuffer","RENDERBUFFER","renderbufferStorageMultisampleEXT","renderbufferStorageMultisample","renderbufferStorage","framebufferRenderbuffer","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","setupDepthRenderbuffer","isCube","__autoAllocateDepthBuffer","setupDepthTexture","webglDepthTexture","createRenderbuffer","__useRenderToTexture","textureUnit","resetTextureUnits","uploadCubeTexture","isCompressed","cubeImage","mipmapImage","rebindTextures","colorTexture","setupRenderTarget","isMultipleRenderTargets","createFramebuffer","glTextureType","isWebGL3DRenderTarget","isWebGLArrayRenderTarget","updateRenderTargetMipmap","updateMultisampleRenderTarget","COLOR_BUFFER_BIT","invalidationArray","depthStyle","ignoreDepthValues","__ignoreDepthValues","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","invalidateFramebuffer","blitFramebuffer","$a315ee31802fb757$export$ddaebcad857649a8","HALF_FLOAT_OES","ALPHA","LUMINANCE","LUMINANCE_ALPHA","SRGB_ALPHA_EXT","RG_INTEGER","RGBA_INTEGER","COMPRESSED_SRGB_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_PVRTC_4BPPV1_IMG","COMPRESSED_RGB_PVRTC_2BPPV1_IMG","COMPRESSED_RGBA_PVRTC_4BPPV1_IMG","COMPRESSED_RGBA_PVRTC_2BPPV1_IMG","COMPRESSED_RGB_ETC1_WEBGL","COMPRESSED_SRGB8_ETC2","COMPRESSED_RGB8_ETC2","COMPRESSED_SRGB8_ALPHA8_ETC2_EAC","COMPRESSED_RGBA8_ETC2_EAC","COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR","COMPRESSED_RGBA_ASTC_4x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR","COMPRESSED_RGBA_ASTC_5x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR","COMPRESSED_RGBA_ASTC_5x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR","COMPRESSED_RGBA_ASTC_6x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR","COMPRESSED_RGBA_ASTC_6x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR","COMPRESSED_RGBA_ASTC_8x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR","COMPRESSED_RGBA_ASTC_8x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR","COMPRESSED_RGBA_ASTC_8x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR","COMPRESSED_RGBA_ASTC_10x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR","COMPRESSED_RGBA_ASTC_10x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR","COMPRESSED_RGBA_ASTC_10x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR","COMPRESSED_RGBA_ASTC_10x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR","COMPRESSED_RGBA_ASTC_12x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR","COMPRESSED_RGBA_ASTC_12x12_KHR","COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT","COMPRESSED_RGBA_BPTC_UNORM_EXT","COMPRESSED_RED_RGTC1_EXT","COMPRESSED_SIGNED_RED_RGTC1_EXT","COMPRESSED_RED_GREEN_RGTC2_EXT","COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT","UNSIGNED_INT_24_8","UNSIGNED_INT_24_8_WEBGL","$a315ee31802fb757$export$56b937d9e5581166","isArrayCamera","$a315ee31802fb757$export$eb2fcfdbd7ba97d4","isGroup","$a315ee31802fb757$var$_moveEvent","$a315ee31802fb757$var$WebXRController","_targetRay","_grip","_hand","getHandSpace","joints","inputState","pinching","getTargetRaySpace","hasLinearVelocity","linearVelocity","hasAngularVelocity","angularVelocity","getGripSpace","connect","inputSource","hand","inputjoint","_getHandJoint","disconnect","referenceSpace","inputPose","gripPose","handPose","targetRay","grip","session","visibilityState","jointPose","getJointPose","joint","transform","jointRadius","indexTip","thumbTip","distanceToPinch","handedness","gripSpace","getPose","targetRaySpace","jointName","$a315ee31802fb757$export$fc830aa069cc8c2f","$a315ee31802fb757$var$WebXRManager","framebufferScaleFactor","referenceSpaceType","foveation","customReferenceSpace","pose","glBinding","glProjLayer","glBaseLayer","xrFrame","getContextAttributes","initialRenderTarget","newRenderTarget","controllers","controllerInputSources","cameraL","cameraR","cameraXR","_currentDepthNear","_currentDepthFar","onSessionEvent","controllerIndex","controller","onSessionEnd","onInputSourcesChange","isPresenting","removed","added","cameraAutoUpdate","getController","getControllerGrip","getHand","setFramebufferScaleFactor","setReferenceSpaceType","getReferenceSpace","setReferenceSpace","space","getBaseLayer","getBinding","getFrame","getSession","setSession","xrCompatible","makeXRCompatible","layerInit","antialias","XRWebGLLayer","updateRenderState","baseLayer","framebufferWidth","framebufferHeight","depthFormat","depthType","glDepthFormat","projectionlayerInit","colorFormat","XRWebGLBinding","createProjectionLayer","textureWidth","textureHeight","setFoveation","requestReferenceSpace","cameraLPos","cameraRPos","updateCamera","depthNear","depthFar","setProjectionFromUnion","ipd","projL","projR","topFov","bottomFov","leftFov","rightFov","zOffset","xOffset","near2","far2","left2","right2","top2","bottom2","updateUserCamera","getCamera","getFoveation","fixedFoveation","onAnimationFrameCallback","getViewerPose","views","setRenderTargetFramebuffer","cameraXRNeedsUpdate","glSubImage","getViewSubImage","setRenderTargetTextures","depthStencilTexture","detectedPlanes","$a315ee31802fb757$var$WebGLMaterials","refreshTransformUniform","refreshUniformsCommon","refreshFogUniforms","isFog","density","refreshMaterialUniforms","pixelRatio","transmissionRenderTarget","isMeshLambertMaterial","isMeshToonMaterial","isMeshPhongMaterial","refreshUniformsStandard","isMeshPhysicalMaterial","isMeshMatcapMaterial","refreshUniformsDistance","isMeshNormalMaterial","isLineBasicMaterial","isLineDashedMaterial","isPointsMaterial","isSpriteMaterial","isShadowMaterial","$a315ee31802fb757$var$WebGLUniformsGroups","updateList","allocatedBindingPoints","maxBindingPoints","MAX_UNIFORM_BUFFER_BINDINGS","getUniformSize","boundary","storage","onUniformsGroupsDispose","bind","webglProgram","prepareUniformsGroup","chunkOffset","infos","__data","__offset","remainingSizeInChunk","chunkSize","__size","__cache","bindingPointIndex","allocateBindingPointIndex","UNIFORM_BUFFER","bindBufferBase","updateBufferData","hasUniformChanged","tempValues","cachedObjects","cachedObject","arrayOffset","$a315ee31802fb757$export$f6cc00ef28d7cf97","_alpha","programCache","renderLists","morphtargets","bufferRenderer","indexedBufferRenderer","$a315ee31802fb757$var$createCanvasElement","display","preserveDrawingBuffer","powerPreference","failIfMajorPerformanceCaveat","isWebGLRenderer","uintClearColor","intClearColor","currentRenderList","currentRenderState","renderListStack","renderStateStack","domElement","sortObjects","toneMappingExposure","_this","_isContextLost","_currentActiveCubeFace","_currentActiveMipmapLevel","_currentRenderTarget","_currentMaterialId","_currentCamera","_currentViewport","_currentScissor","_currentScissorTest","_currentClearColor","_currentClearAlpha","_width","_height","_pixelRatio","_opaqueSort","_transparentSort","_scissor","_scissorTest","_clippingEnabled","_localClippingEnabled","_transmissionRenderTarget","_projScreenMatrix","_vector2","_vector3","_emptyScene","overrideMaterial","getTargetPixelRatio","contextNames","contextAttributes","contextName","onContextLost","onContextRestore","onContextCreationError","isWebGL1Renderer","shift","WebGLRenderingContext","initGLContext","preventDefault","infoAutoReset","shadowMapAutoUpdate","shadowMapNeedsUpdate","statusMessage","onMaterialDispose","releaseMaterialProgramReferences","forEach","forceContextLoss","loseContext","forceContextRestore","restoreContext","getPixelRatio","setPixelRatio","updateStyle","setViewport","getDrawingBufferSize","setDrawingBufferSize","getCurrentViewport","getScissor","setScissor","getScissorTest","boolean","setOpaqueSort","method","setTransparentSort","bits","isIntegerFormat","targetFormat","targetType","clearBufferuiv","COLOR","clearBufferiv","onXRSessionStart","onXRSessionEnd","setProgram","needsProgramChange","needsLights","lightsStateVersion","getProgram","refreshProgram","refreshMaterial","refreshLights","p_uniforms","m_uniforms","uCamPos","cameraPosition","boneTexture","computeBoneTexture","boneTextureSize","isMeshGouraudMaterial","uniformsList","rangeFactor","drawStart","drawEnd","drawCount","isLineSegments","isLineLoop","isSprite","maxInstanceCount","prepare","material2","renderScene","opaqueObjects","transmissiveObjects","transparentObjects","renderTransmissionPass","currentToneMapping","renderObjects","renderTargetNeedsUpdate","currentSide","programCacheKey","updateCommonMaterialProperties","progUniforms","projectObject","isLOD","camera2","defaultFramebuffer","__useDefaultFramebuffer","useDefaultFramebuffer","isRenderTarget3D","framebufferBound","layer","framebufferTextureLayer","readRenderTargetPixels","activeCubeFaceIndex","textureFormat","IMPLEMENTATION_COLOR_READ_FORMAT","halfFloatSupportedByExt","IMPLEMENTATION_COLOR_READ_TYPE","readPixels","copyFramebufferToTexture","levelScale","copyTexSubImage2D","copyTextureToTexture","srcTexture","dstTexture","copyTextureToTexture3D","sourceBox","glTarget","unpackRowLen","UNPACK_ROW_LENGTH","unpackImageHeight","UNPACK_IMAGE_HEIGHT","unpackSkipPixels","UNPACK_SKIP_PIXELS","unpackSkipRows","UNPACK_SKIP_ROWS","unpackSkipImages","UNPACK_SKIP_IMAGES","resetState","__THREE_DEVTOOLS__","CustomEvent","detail","physicallyCorrectLights","outputEncoding","$a315ee31802fb757$export$a2f65229194348f9","$a315ee31802fb757$export$b0e83c3ef8d2db1","arcLengthDivisions","getPoint","getPointAt","optionalTarget","getUtoTmapping","getPoints","divisions","getSpacedPoints","getLength","lengths","getLengths","cacheArcLengths","current","last","updateArcLengths","targetArcLength","arcLengths","comparison","lengthBefore","lengthAfter","getTangent","t2","pt1","pt2","getTangentAt","computeFrenetFrames","segments","closed","binormals","vec","mat","MAX_VALUE","tz","json","$a315ee31802fb757$export$3f87a931616cde04","aX","aY","xRadius","yRadius","aStartAngle","aEndAngle","aClockwise","aRotation","isEllipseCurve","twoPi","deltaAngle","samePoints","$a315ee31802fb757$var$CubicPoly","c0","initCatmullRom","x3","tension","initNonuniformCatmullRom","dt0","dt1","dt2","calc","$a315ee31802fb757$var$tmp","$a315ee31802fb757$var$px","$a315ee31802fb757$var$py","$a315ee31802fb757$var$pz","$a315ee31802fb757$var$CatmullRom","$a315ee31802fb757$var$QuadraticBezier","$a315ee31802fb757$var$QuadraticBezierP0","$a315ee31802fb757$var$CubicBezier","$a315ee31802fb757$var$CubicBezierP0","$a315ee31802fb757$var$CubicBezierP1","$a315ee31802fb757$export$e36650d36468bb39","isCubicBezierCurve","$a315ee31802fb757$export$ab2e07e76531a47e","isLineCurve","$a315ee31802fb757$export$5938c4ee491a43ad","isQuadraticBezierCurve","$a315ee31802fb757$export$bf3f4c7e459f90fc","isQuadraticBezierCurve3","$a315ee31802fb757$export$d3bdd77da77afc1b","isSplineCurve","intPoint","$a315ee31802fb757$var$Curves","freeze","__proto__","ArcCurve","aRadius","isArcCurve","CatmullRomCurve3","curveType","isCatmullRomCurve3","CubicBezierCurve","CubicBezierCurve3","isCubicBezierCurve3","EllipseCurve","LineCurve","LineCurve3","isLineCurve3","QuadraticBezierCurve","QuadraticBezierCurve3","SplineCurve","$a315ee31802fb757$export$4aaf9b66af1bbf2c","curves","autoClose","curve","closePath","startPoint","endPoint","curveLengths","getCurveLengths","diff","segmentLength","lens","cacheLengths","sums","pts","$a315ee31802fb757$export$4b2950bdac9b6ee9","currentPoint","moveTo","lineTo","quadraticCurveTo","aCPx","aCPy","bezierCurveTo","aCP1x","aCP1y","aCP2x","aCP2y","splineThru","npts","arc","absarc","absellipse","ellipse","firstPoint","lastPoint","$a315ee31802fb757$export$6d839803fcd1882c","phiStart","phiLength","initNormals","inverseSegments","vertex","curNormal","prevNormal","base","$a315ee31802fb757$export$41680e8551036033","capSegments","radialSegments","$a315ee31802fb757$export$d5c0e8d607467193","thetaStart","thetaLength","segment","$a315ee31802fb757$export$68f745719dbe5198","radiusTop","radiusBottom","openEnded","indexArray","generateCap","centerIndexStart","centerIndexEnd","cosTheta","sinTheta","generateTorso","slope","indexRow","$a315ee31802fb757$export$a7a48974f285c9b3","$a315ee31802fb757$export$60e57a7d3f20ff65","vertexBuffer","uvBuffer","pushVertex","getVertexByIndex","correctUV","azimuth","subdivide","subdivideFace","cols","aj","bj","rows","applyRadius","generateUVs","inclination","correctUVs","centroid","azi","correctSeam","details","$a315ee31802fb757$export$c0babfeb8708fc9c","holes","getPointsHoles","holesPts","extractPoints","hole","$a315ee31802fb757$var$Earcut","triangulate","holeIndices","dim","minX","minY","maxX","maxY","invSize","hasHoles","outerLen","outerNode","$a315ee31802fb757$var$linkedList","prev","$a315ee31802fb757$var$eliminateHoles","queue","steiner","$a315ee31802fb757$var$getLeftmost","leftmost","$a315ee31802fb757$var$compareX","$a315ee31802fb757$var$eliminateHole","bridge","$a315ee31802fb757$var$findHoleBridge","hx","hy","mx","my","tanMin","$a315ee31802fb757$var$pointInTriangle","$a315ee31802fb757$var$locallyInside","$a315ee31802fb757$var$area","bridgeReverse","$a315ee31802fb757$var$splitPolygon","$a315ee31802fb757$var$filterPoints","$a315ee31802fb757$var$earcutLinked","ear","pass","$a315ee31802fb757$var$indexCurve","$a315ee31802fb757$var$zOrder","prevZ","nextZ","$a315ee31802fb757$var$sortLinked","tail","numMerges","pSize","qSize","inSize","$a315ee31802fb757$var$isEarHashed","minZ","maxZ","$a315ee31802fb757$var$isEar","$a315ee31802fb757$var$removeNode","$a315ee31802fb757$var$cureLocalIntersections","$a315ee31802fb757$var$equals","$a315ee31802fb757$var$intersects","$a315ee31802fb757$var$splitEarcut","$a315ee31802fb757$var$intersectsPolygon","$a315ee31802fb757$var$middleInside","inside","px","py","clockwise","$a315ee31802fb757$var$signedArea","$a315ee31802fb757$var$insertNode","again","q1","q2","o1","$a315ee31802fb757$var$sign","o2","o3","o4","$a315ee31802fb757$var$onSegment","num","$a315ee31802fb757$var$Node","an","bp","area","contour","isClockWise","triangulateShape","faces","$a315ee31802fb757$var$removeDupEndPts","$a315ee31802fb757$var$addContour","holeIndex","$a315ee31802fb757$export$598697a1efa63ca7","verticesArray","uvArray","addShape","splineTube","binormal","position2","placeholder","curveSegments","steps","bevelEnabled","bevelThickness","bevelSize","bevelOffset","bevelSegments","extrudePath","uvgen","UVGenerator","$a315ee31802fb757$var$WorldUVGenerator","extrudePts","extrudeByPath","shapePoints","reverse","hl","ahole","scalePt2","pt","vlen","flen","getBevelVec","inPt","inPrev","inNext","v_trans_x","v_trans_y","shrink_by","v_prev_x","v_prev_y","v_next_x","v_next_y","v_prev_lensq","collinear0","v_prev_len","v_next_len","ptPrevShift_x","ptPrevShift_y","ptNextShift_x","ptNextShift_y","sf","v_trans_lensq","direction_eq","contourMovements","holesMovements","oneHoleMovements","verticesMovements","bs","vert","sidewalls","layeroffset","sl","slen1","slen2","f4","addVertex","nextIndex","generateSideWallUV","addUV","f3","generateTopUV","vector2","buildLidFaces","buildSideFaces","$a315ee31802fb757$var$toJSON$1","geometryShapes","indexA","indexB","indexC","a_x","a_y","b_x","b_y","c_x","c_y","indexD","a_z","b_z","c_z","d_x","d_y","d_z","$a315ee31802fb757$export$9567cc828c9535da","$a315ee31802fb757$export$1954e2b809fe361e","$a315ee31802fb757$export$68cb731f50f614af","innerRadius","outerRadius","thetaSegments","phiSegments","radiusStep","thetaSegmentLevel","indexOffset","shapeVertices","shapeHoles","shapeHole","$a315ee31802fb757$var$toJSON","$a315ee31802fb757$export$1b417fc3b307a251","thetaEnd","grid","verticesRow","uOffset","$a315ee31802fb757$export$fb3f7adc68bd6e02","$a315ee31802fb757$export$a2312a2a1fa56495","tube","tubularSegments","$a315ee31802fb757$export$77e9bfadfb9ab8c8","P1","P2","B","T","N","calculatePositionOnCurve","quOverP","cs","$a315ee31802fb757$export$7897d9d48904490c","frames","P","generateSegment","generateBufferData","generateIndices","$a315ee31802fb757$var$arraySlice","$a315ee31802fb757$var$isTypedArray","$a315ee31802fb757$var$convertArray","forceClone","ArrayBuffer","isView","DataView","$a315ee31802fb757$export$b558baee9c0f72d3","parameterPositions","sampleValues","sampleSize","resultBuffer","_cachedIndex","valueSize","settings","DefaultSettings_","evaluate","pp","validate_interval","seek","linear_scan","forward_scan","giveUpAt","copySampleValue_","t1global","mid","intervalChanged_","interpolate_","getSettings_","$a315ee31802fb757$export$3646682e7a3959","_weightPrev","_offsetPrev","_weightNext","_offsetNext","endingStart","endingEnd","iPrev","iNext","tPrev","tNext","halfDt","o0","oP","oN","wP","wN","ppp","sP","sN","$a315ee31802fb757$export$a8e6009059f51e1a","offset1","offset0","weight1","weight0","$a315ee31802fb757$export$fb9758ef7ef8d5cc","$a315ee31802fb757$export$b0e479f45b7006d6","times","interpolation","TimeBufferType","ValueBufferType","setInterpolation","DefaultInterpolation","track","trackType","ValueTypeName","InterpolantFactoryMethodDiscrete","getValueSize","InterpolantFactoryMethodLinear","InterpolantFactoryMethodSmooth","factoryMethod","createInterpolant","timeOffset","timeScale","startTime","endTime","nKeys","validate","valid","prevTime","currTime","optimize","smoothInterpolation","writeIndex","keep","timeNext","offsetP","offsetN","readOffset","writeOffset","TypedKeyframeTrack","$a315ee31802fb757$export$d3a344b98cf0b775","$a315ee31802fb757$export$83444c5d885347d8","$a315ee31802fb757$export$d45f0d1a4d9a9314","$a315ee31802fb757$export$2db1cfb7923d931e","$a315ee31802fb757$export$b8043f12b5aafbd7","$a315ee31802fb757$export$6ce41d4f3a8df9cd","$a315ee31802fb757$export$5ce2dcb4cc9f2bff","$a315ee31802fb757$var$_RESERVED_CHARS_RE","$a315ee31802fb757$var$_reservedRe","RegExp","$a315ee31802fb757$var$_wordChar","$a315ee31802fb757$var$_wordCharOrDot","$a315ee31802fb757$var$_directoryRe","$a315ee31802fb757$var$_nodeRe","$a315ee31802fb757$var$_objectRe","$a315ee31802fb757$var$_propertyRe","$a315ee31802fb757$var$_trackRe","$a315ee31802fb757$var$_supportedObjectNames","$a315ee31802fb757$export$7bf70fcf9f891893","rootNode","parsedPath","parseTrackName","node","findNode","nodeName","getValue","_getValue_unbound","_setValue_unbound","create","root","isAnimationObjectGroup","Composite","sanitizeNodeName","trackName","matches","results","objectName","objectIndex","propertyName","propertyIndex","lastDot","lastIndexOf","substring","bone","getBoneByName","searchNodeSubtree","childNode","subTreeNode","_getValue_unavailable","_setValue_unavailable","_getValue_direct","targetObject","_getValue_array","resolvedProperty","_getValue_arrayElement","_getValue_toArray","_setValue_direct","_setValue_direct_setNeedsUpdate","_setValue_direct_setMatrixWorldNeedsUpdate","_setValue_array","dest","_setValue_array_setNeedsUpdate","_setValue_array_setMatrixWorldNeedsUpdate","_setValue_arrayElement","_setValue_arrayElement_setNeedsUpdate","_setValue_arrayElement_setMatrixWorldNeedsUpdate","_setValue_fromArray","_setValue_fromArray_setNeedsUpdate","_setValue_fromArray_setMatrixWorldNeedsUpdate","targetArray","sourceArray","bones","nodeProperty","versioning","Versioning","None","NeedsUpdate","MatrixWorldNeedsUpdate","bindingType","BindingType","Direct","ArrayElement","HasFromToArray","EntireArray","GetterByBindingType","SetterByBindingTypeAndVersioning","unbind","targetGroup","optionalParsedPath","_targetGroup","_bindings","subscribe_","firstValidIndex","nCachedObjects_","binding","bindings","$a315ee31802fb757$var$_startP","$a315ee31802fb757$var$_startEnd","distanceSq","closestPointToPointParameter","clampToLine","startEnd2","startEnd_startP","revision","__THREE__"],"version":3,"file":"projectionAsync.worker.15f44cdc.js.map"} \ No newline at end of file diff --git a/example/bundle/projectionAsync.worker.28971622.js b/example/bundle/projectionAsync.worker.28971622.js new file mode 100644 index 0000000..89e4b05 --- /dev/null +++ b/example/bundle/projectionAsync.worker.28971622.js @@ -0,0 +1,2 @@ +(()=>{let e,t;var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n={},i={},o=r.parcelRequire6c98;null==o&&((o=function(e){if(e in n)return n[e].exports;if(e in i){var t=i[e];delete i[e];var r={id:e,exports:{}};return n[e]=r,t.call(r.exports,r,r.exports),r.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){i[e]=t},r.parcelRequire6c98=o),importScripts("./projectionAsync.worker.15f44cdc.js");var s=(o("e06gU"),o("e06gU"),o("e06gU"));let a=Symbol("SKIP_GENERATION");var s=o("e06gU");function l(e){return(e.index?e.index.count:e.attributes.position.count)/3}function u(e){let t=l(e),r=e.drawRange,n=r.start/3,i=(r.start+r.count)/3,o=Math.max(0,n);return[{offset:Math.floor(o),count:Math.floor(Math.min(t,i)-o)}]}function c(e){if(!e.groups||!e.groups.length)return u(e);let t=[],r=new Set,n=e.drawRange,i=n.start/3,o=(n.start+n.count)/3;for(let t of e.groups){let e=t.start/3,n=(t.start+t.count)/3;r.add(Math.max(i,e)),r.add(Math.min(o,n))}let s=Array.from(r.values()).sort((e,t)=>e-t);for(let e=0;er&&(r=i,t=n)}return t}function p(e,t,r){let n,i;for(let o=0;o<3;o++){let s=o+3;n=e[o],i=t[o],r[o]=ni?n:i}}function y(e,t,r){for(let n=0;n<3;n++){let i=t[e+2*n],o=t[e+2*n+1],s=i-o,a=i+o;sr[n+3]&&(r[n+3]=a)}}function h(e){let t=e[3]-e[0],r=e[4]-e[1],n=e[5]-e[2];return 2*(t*r+r*n+n*t)}function g(e,t,r,n,i=null){let o=1/0,s=1/0,a=1/0,l=-1/0,u=-1/0,c=-1/0,d=1/0,f=1/0,p=1/0,y=-1/0,h=-1/0,g=-1/0,x=null!==i;for(let n=6*t,i=(t+r)*6;nl&&(l=m),x&&ty&&(y=t);let w=e[n+2],B=e[n+3],b=w-B,A=w+B;bu&&(u=A),x&&wh&&(h=w);let T=e[n+4],M=e[n+5],P=T-M,v=T+M;Pc&&(c=v),x&&Tg&&(g=T)}n[0]=o,n[1]=s,n[2]=a,n[3]=l,n[4]=u,n[5]=c,x&&(i[0]=d,i[1]=f,i[2]=p,i[3]=y,i[4]=h,i[5]=g)}let x=(e,t)=>e.candidate-t.candidate,m=Array(32).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),w=new Float32Array(6);class B{constructor(){}}function b(e,t,r,n,i,o){let s=n,a=n+i-1,l=o.pos,u=2*o.axis;for(;;){for(;s<=a&&r[6*s+u]=l;)a--;if(!(s=l;)a--;if(!(sn?s:n}this.min=r,this.max=n}setFromPoints(e,t){let r=1/0,n=-1/0;for(let i=0,o=t.length;in?s:n}this.min=r,this.max=n}isSeparated(e){return this.min>e.max||e.min>this.max}}T.prototype.setFromBox=function(){let e=new s.Vector3;return function(t,r){let n=r.min,i=r.max,o=1/0,s=-1/0;for(let r=0;r<=1;r++)for(let a=0;a<=1;a++)for(let l=0;l<=1;l++){e.x=n.x*r+i.x*(1-r),e.y=n.y*a+i.y*(1-a),e.z=n.z*l+i.z*(1-l);let u=t.dot(e);o=Math.min(u,o),s=Math.max(u,s)}this.min=o,this.max=s}}(),new T;var s=(o("e06gU"),o("e06gU"));let M=function(){let e=new s.Vector3,t=new s.Vector3,r=new s.Vector3;return function(n,i,o){let s,a;let l=n.start,u=i.start;r.subVectors(l,u),e.subVectors(n.end,n.start),t.subVectors(i.end,i.start);let c=r.dot(t),d=t.dot(e),f=t.dot(t),p=r.dot(e),y=e.dot(e),h=y*f-d*d;s=0!==h?(c*d-p*f)/h:0,a=(c+s*d)/f,o.x=s,o.y=a}}(),P=function(){let e=new s.Vector2,t=new s.Vector3,r=new s.Vector3;return function(n,i,o,s){M(n,i,e);let a=e.x,l=e.y;if(a>=0&&a<=1&&l>=0&&l<=1){n.at(a,o),i.at(l,s);return}if(a>=0&&a<=1){l<0?i.at(0,s):i.at(1,s),n.closestPointToPoint(s,!0,o);return}if(l>=0&&l<=1){a<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,s);return}{let e,u;if(e=a<0?n.start:n.end,u=l<0?i.start:i.end,n.closestPointToPoint(u,!0,t),i.closestPointToPoint(e,!0,r),t.distanceToSquared(u)<=r.distanceToSquared(e)){o.copy(t),s.copy(u);return}o.copy(e),s.copy(r);return}}}(),v=function(){let e=new s.Vector3,t=new s.Vector3,r=new s.Plane,n=new s.Line3;return function(i,o){let{radius:s,center:a}=i,{a:l,b:u,c:c}=o;n.start=l,n.end=u;let d=n.closestPointToPoint(a,!0,e);if(d.distanceTo(a)<=s)return!0;n.start=l,n.end=c;let f=n.closestPointToPoint(a,!0,e);if(f.distanceTo(a)<=s)return!0;n.start=u,n.end=c;let p=n.closestPointToPoint(a,!0,e);if(p.distanceTo(a)<=s)return!0;let y=o.getPlane(r),h=Math.abs(y.distanceToPoint(a));if(h<=s){let e=y.projectPoint(a,t),r=o.containsPoint(e);if(r)return!0}return!1}}();function V(e){return 1e-15>Math.abs(e)}class U extends s.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=[,,,,].fill().map(()=>new s.Vector3),this.satBounds=[,,,,].fill().map(()=>new T),this.points=[this.a,this.b,this.c],this.sphere=new s.Sphere,this.plane=new s.Plane,this.needsUpdate=!0}intersectsSphere(e){return v(e,this)}update(){let e=this.a,t=this.b,r=this.c,n=this.points,i=this.satAxes,o=this.satBounds,s=i[0],a=o[0];this.getNormal(s),a.setFromPoints(s,n);let l=i[1],u=o[1];l.subVectors(e,t),u.setFromPoints(l,n);let c=i[2],d=o[2];c.subVectors(t,r),d.setFromPoints(c,n);let f=i[3],p=o[3];f.subVectors(r,e),p.setFromPoints(f,n),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(s,e),this.needsUpdate=!1}}U.prototype.closestPointToSegment=function(){let e=new s.Vector3,t=new s.Vector3,r=new s.Line3;return function(n,i=null,o=null){let s;let{start:a,end:l}=n,u=this.points,c=1/0;for(let a=0;a<3;a++){let l=(a+1)%3;r.start.copy(u[a]),r.end.copy(u[l]),P(r,n,e,t),(s=e.distanceToSquared(t))=2){let e=1===o?r.start:r.end;e.copy(y),i=2;break}if(2==++i&&-1===o)break}}return i}return function(s,a=null,d=!1){this.needsUpdate&&this.update(),s.isExtendedTriangle?s.needsUpdate&&s.update():(e.copy(s),e.update(),s=e);let y=this.plane,g=s.plane;if(Math.abs(y.normal.dot(g.normal))>1-1e-10){let e=this.satBounds,l=this.satAxes;r[0]=s.a,r[1]=s.b,r[2]=s.c;for(let t=0;t<4;t++){let i=e[t],o=l[t];if(n.setFromPoints(o,r),i.isSeparated(n))return!1}let u=s.satBounds,c=s.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let e=0;e<4;e++){let r=u[e],i=c[e];if(n.setFromPoints(i,t),r.isSeparated(n))return!1}for(let e=0;e<4;e++){let s=l[e];for(let e=0;e<4;e++){let a=c[e];if(o.crossVectors(s,a),n.setFromPoints(o,t),i.setFromPoints(o,r),n.isSeparated(i))return!1}}return a&&(d||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),a.start.set(0,0,0),a.end.set(0,0,0)),!0}{let e=h(this,g,f);if(1===e&&s.containsPoint(f.end))return a&&(a.start.copy(f.end),a.end.copy(f.end)),!0;if(2!==e)return!1;let t=h(s,y,p);if(1===t&&this.containsPoint(p.end))return a&&(a.start.copy(p.end),a.end.copy(p.end)),!0;if(2!==t)return!1;if(f.delta(l),p.delta(u),0>l.dot(u)){let e=p.start;p.start=p.end,p.end=e}let r=f.start.dot(l),n=f.end.dot(l),i=p.start.dot(l),o=p.end.dot(l);return(r===o||i===n||n0?a.start.copy(f.start):a.start.copy(p.start),c.subVectors(f.end,p.end),0>c.dot(l)?a.end.copy(f.end):a.end.copy(p.end)),!0)}}}(),U.prototype.distanceToPoint=function(){let e=new s.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),U.prototype.distanceToTriangle=function(){let e=new s.Vector3,t=new s.Vector3,r=["a","b","c"],n=new s.Line3,i=new s.Line3;return function(o,s=null,a=null){let l=s||a?n:null;if(this.intersectsTriangle(o,l))return(s||a)&&(s&&l.getCenter(s),a&&l.getCenter(a)),0;let u=1/0;for(let t=0;t<3;t++){let n;let i=r[t],l=o[i];this.closestPointToPoint(l,e),(n=l.distanceToSquared(e))new s.Vector3),this.satAxes=[,,,].fill().map(()=>new s.Vector3),this.satBounds=[,,,].fill().map(()=>new T),this.alignedSatBounds=[,,,].fill().map(()=>new T),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}S.prototype.update=function(){let e=this.matrix,t=this.min,r=this.max,n=this.points;for(let i=0;i<=1;i++)for(let o=0;o<=1;o++)for(let s=0;s<=1;s++){let a=1*i|2*o|4*s,l=n[a];l.x=i?r.x:t.x,l.y=o?r.y:t.y,l.z=s?r.z:t.z,l.applyMatrix4(e)}let i=this.satBounds,o=this.satAxes,s=n[0];for(let e=0;e<3;e++){let t=o[e],r=i[e],a=1<new s.Line3),r=Array(12).fill().map(()=>new s.Line3),n=new s.Vector3,i=new s.Vector3;return function(o,s=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(a||l)&&(o.getCenter(i),this.closestPointToPoint(i,n),o.closestPointToPoint(n,i),a&&a.copy(n),l&&l.copy(i)),0;let u=s*s,c=o.min,d=o.max,f=this.points,p=1/0;for(let e=0;e<8;e++){let t=f[e];i.copy(t).clamp(c,d);let r=t.distanceToSquared(i);if(rnew U)}};var s=o("e06gU");function _(e,t){return 65535===t[e+15]}function z(e,t){return t[e+14]}let L=new class{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let e=[],t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,0!==e.length&&this.setBuffer(e.pop())}}},q=[],E=new F(()=>new s.Box3);var s=o("e06gU");let C=new s.Vector3,R=new s.Vector3;var s=o("e06gU");let X=new s.Vector3,D=new s.Vector3,$=new s.Vector3,O=new s.Vector2,G=new s.Vector2,N=new s.Vector2,H=new s.Vector3,k=new s.Vector3,Y=new s.Vector3,Z=new s.Vector3;function j(e,t,r,n,i){let o=3*n,a=o+0,l=o+1,u=o+2,c=e.index;e.index&&(a=c.getX(a),l=c.getX(l),u=c.getX(u));let{position:d,normal:f,uv:p,uv1:y}=e.attributes,h=function(e,t,r,n,i,o,a,l,u){X.fromBufferAttribute(t,o),D.fromBufferAttribute(t,a),$.fromBufferAttribute(t,l);let c=function(e,t,r,n,i,o){if(null===(o===s.BackSide?e.intersectTriangle(n,r,t,!0,i):e.intersectTriangle(t,r,n,o!==s.DoubleSide,i)))return null;let a=e.origin.distanceTo(i);return{distance:a,point:i.clone()}}(e,X,D,$,Z,u);if(c){n&&(O.fromBufferAttribute(n,o),G.fromBufferAttribute(n,a),N.fromBufferAttribute(n,l),c.uv=(0,s.Triangle).getInterpolation(Z,X,D,$,O,G,N,new s.Vector2)),i&&(O.fromBufferAttribute(i,o),G.fromBufferAttribute(i,a),N.fromBufferAttribute(i,l),c.uv1=(0,s.Triangle).getInterpolation(Z,X,D,$,O,G,N,new s.Vector2)),r&&(H.fromBufferAttribute(r,o),k.fromBufferAttribute(r,a),Y.fromBufferAttribute(r,l),c.normal=(0,s.Triangle).getInterpolation(Z,X,D,$,H,k,Y,new s.Vector3),c.normal.dot(e.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:a,c:l,normal:new s.Vector3,materialIndex:0};(0,s.Triangle).getNormal(X,D,$,t.normal),c.face=t,c.faceIndex=o}return c}(r,d,f,p,y,a,l,u,t);return h?(h.faceIndex=n,i&&i.push(h),h):null}function K(e,t,r,n){let i=e.a,o=e.b,s=e.c,a=t,l=t+1,u=t+2;r&&(a=r.getX(a),l=r.getX(l),u=r.getX(u)),i.x=n.getX(a),i.y=n.getY(a),i.z=n.getZ(a),o.x=n.getX(l),o.y=n.getY(l),o.z=n.getZ(l),s.x=n.getX(u),s.y=n.getY(u),s.z=n.getZ(u)}function J(e,t,r,n,i,o,s){let{geometry:a}=r,{index:l}=a,u=a.attributes.position;for(let r=e,a=t+e;rf&&(f=t),np&&(p=n),iy&&(y=i)}return(o[r+0]!==s||o[r+1]!==u||o[r+2]!==d||o[r+3]!==f||o[r+4]!==p||o[r+5]!==y)&&(o[r+0]=s,o[r+1]=u,o[r+2]=d,o[r+3]=f,o[r+4]=p,o[r+5]=y,!0)}{let i=r+8,a=n[r+6],l=i+s,c=a+s,d=u,f=!1,p=!1;t?d||(f=t.has(l),p=t.has(c),d=!f&&!p):(f=!0,p=!0);let y=d||f,h=d||p,g=!1;y&&(g=e(i,s,d));let x=!1;h&&(x=e(a,s,d));let m=g||x;if(m)for(let e=0;e<3;e++){let t=i+e,n=a+e,s=o[t],l=o[t+3],u=o[n],c=o[n+3];o[r+e]=sc?l:c}return m}}(0,u),u+=r.byteLength}var s=(o("e06gU"),o("e06gU"),o("e06gU"));let W=new s.Box3;function ee(e,t,r,n){return d(e,t,W),r.intersectBox(W,n)}let et=new s.Vector3;function er(e,t,r,n,i){L.setBuffer(e._roots[t]),function e(t,r,n,i,o){let{float32Array:s,uint16Array:a,uint32Array:l}=L,u=2*t,c=_(u,a);if(c){let e=l[t+6],s=z(u,a);!function(e,t,r,n,i,o){let{geometry:s,_indirectBuffer:a}=e;for(let e=n,a=n+i;e=0;f?(s=t+8,l=a[t+6]):(s=a[t+6],l=t+8);let p=ee(s,o,i,en),y=p?e(s,r,n,i):null;if(y){let e=y.point[c],t=f?e<=o[l+u]:e>=o[l+u+3];if(t)return y}let h=ee(l,o,i,en),g=h?e(l,r,n,i):null;return y&&g?y.distance<=g.distance?y:g:y||g||null}}(0,e,r,n);return L.clearBuffer(),i}var s=o("e06gU");let es=new s.Box3,ea=new U,el=new U,eu=new s.Matrix4,ec=new S,ed=new S;function ef(e,t,r,n){L.setBuffer(e._roots[t]);let i=function e(t,r,n,i,o=null){let{float32Array:s,uint16Array:a,uint32Array:l}=L,u=2*t;null===o&&(n.boundingBox||n.computeBoundingBox(),ec.set(n.boundingBox.min,n.boundingBox.max,i),o=ec);let c=_(u,a);if(c){let e=r.geometry,o=e.index,c=e.attributes.position,f=n.index,p=n.attributes.position,y=l[t+6],h=z(u,a);if(eu.copy(i).invert(),n.boundsTree){d(t,s,ed),ed.matrix.copy(eu),ed.needsUpdate=!0;let e=n.boundsTree.shapecast({intersectsBounds:e=>ed.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(i),e.b.applyMatrix4(i),e.c.applyMatrix4(i),e.needsUpdate=!0;for(let t=3*y,r=(h+y)*3;tey.distanceToBox(e),intersectsBounds:(e,t,r)=>r{if(t.boundsTree){let i=t.boundsTree;return i.shapecast({boundsTraverseOrder:e=>eh.distanceToBox(e),intersectsBounds:(e,t,r)=>r{for(let s=t,a=t+i;s{for(let g=n,x=n+i;geT.intersectsBox(e),intersectsRange:(e,r,n,o,s,a)=>(eA.copy(a),eA.applyMatrix4(eb),t.shapecast({intersectsBounds:e=>eA.intersectsBox(e),intersectsRange:(t,n,a,l,u)=>i(e,r,t,n,o,s,l,u)}))});return I.releasePrimitive(c),I.releasePrimitive(d),f}function eP(e,t,r,n,i,o,s){let{geometry:a}=r,{index:l}=a,u=a.attributes.position;for(let a=e,c=t+e;ap&&(p=n),iy&&(y=i),oh&&(h=o)}}return(o[s+0]!==u||o[s+1]!==c||o[s+2]!==f||o[s+3]!==p||o[s+4]!==y||o[s+5]!==h)&&(o[s+0]=u,o[s+1]=c,o[s+2]=f,o[s+3]=p,o[s+4]=y,o[s+5]=h,!0)}{let e=s+8,i=n[s+6],a=e+u,l=i+u,d=c,f=!1,p=!1;t?d||(f=t.has(a),p=t.has(l),d=!f&&!p):(f=!0,p=!0);let y=d||f,h=d||p,g=!1;y&&(g=r(e,u,d));let x=!1;h&&(x=r(i,u,d));let m=g||x;if(m)for(let t=0;t<3;t++){let r=e+t,n=i+t,a=o[r],l=o[r+3],u=o[n],c=o[n+3];o[s+t]=ac?l:c}return m}}(0,u),u+=r.byteLength}var s=o("e06gU");let eV=new s.Vector3;function eU(e,t,r,n,i){L.setBuffer(e._roots[t]),function e(t,r,n,i,o){let{float32Array:s,uint16Array:a,uint32Array:l}=L,u=2*t,c=_(u,a);if(c){let e=l[t+6],s=z(u,a);!function(e,t,r,n,i,o){let{geometry:s,_indirectBuffer:a}=e;for(let e=n,l=n+i;e=0;f?(s=t+8,l=a[t+6]):(s=a[t+6],l=t+8);let p=ee(s,o,i,eS),y=p?e(s,r,n,i):null;if(y){let e=y.point[c],t=f?e<=o[l+u]:e>=o[l+u+3];if(t)return y}let h=ee(l,o,i,eS),g=h?e(l,r,n,i):null;return y&&g?y.distance<=g.distance?y:g:y||g||null}}(0,e,r,n);return L.clearBuffer(),i}var s=o("e06gU");let e_=new s.Box3,ez=new U,eL=new U,eq=new s.Matrix4,eE=new S,eC=new S;function eR(e,t,r,n){L.setBuffer(e._roots[t]);let i=function e(t,r,n,i,o=null){let{float32Array:s,uint16Array:a,uint32Array:l}=L,u=2*t;null===o&&(n.boundingBox||n.computeBoundingBox(),eE.set(n.boundingBox.min,n.boundingBox.max,i),o=eE);let c=_(u,a);if(c){let e=r.geometry,o=e.index,c=e.attributes.position,f=n.index,p=n.attributes.position,y=l[t+6],h=z(u,a);if(eq.copy(i).invert(),n.boundsTree){d(t,s,eC),eC.matrix.copy(eq),eC.needsUpdate=!0;let e=n.boundsTree.shapecast({intersectsBounds:e=>eC.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(i),e.b.applyMatrix4(i),e.c.applyMatrix4(i),e.needsUpdate=!0;for(let t=y,n=h+y;teD.distanceToBox(e),intersectsBounds:(e,t,r)=>r{if(t.boundsTree){let a=t.boundsTree;return a.shapecast({boundsTraverseOrder:e=>e$.distanceToBox(e),intersectsBounds:(e,t,r)=>r{for(let l=t,B=t+s;l{for(let m=f,w=f+p;mej.intersectsBox(e),intersectsRange:(e,r,n,o,s,a)=>(eZ.copy(a),eZ.applyMatrix4(eY),t.shapecast({intersectsBounds:e=>eZ.intersectsBox(e),intersectsRange:(t,n,a,l,u)=>i(e,r,t,n,o,s,l,u)}))});return I.releasePrimitive(c),I.releasePrimitive(d),f}let eJ=new S,eQ=new s.Box3;class eW{static serialize(e,t={}){t={cloneBuffers:!0,...t};let r=e.geometry,n=e._roots,i=e._indirectBuffer,o=r.getIndex();return t.cloneBuffers?{roots:n.map(e=>e.slice()),index:o.array.slice(),indirectBuffer:i?i.slice():null}:{roots:n,index:o.array,indirectBuffer:i}}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};let{index:n,roots:i,indirectBuffer:o}=e,l=new eW(t,{...r,[a]:!0});if(l._roots=i,l._indirectBuffer=o||null,r.setIndex){let r=t.getIndex();if(null===r){let r=new s.BufferAttribute(e.index,1,!1);t.setIndex(r)}else r.array!==n&&(r.array.set(n),r.needsUpdate=!0)}return l}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw Error("MeshBVH: Only BufferGeometries are supported.");if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[a]:!1},t)).useSharedArrayBuffer&&!("undefined"!=typeof SharedArrayBuffer))throw Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[a]||(function(e,t){let r,n,i;let o=e.geometry;t.indirect&&(e._indirectBuffer=function(e,t){let r=(e.index?e.index.count:e.attributes.position.count)/3,n=r>65536,i=n?4:2,o=t?new SharedArrayBuffer(r*i):new ArrayBuffer(r*i),s=n?new Uint32Array(o):new Uint16Array(o);for(let e=0,t=s.length;ee.offset-t.offset),n=r[r.length-1];n.count=Math.min(t-n.offset,n.count);let i=0;return r.forEach(({count:e})=>i+=e),t!==i}(o)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),e._indirectBuffer||function(e,t){if(!e.index){let r=e.attributes.position.count,n=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=function(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}(r,n);e.setIndex(new s.BufferAttribute(i,1));for(let e=0;eh&&(h=i),u>h&&(h=u);let g=(h-c)/2,x=2*e;o[l+x+0]=c+g,o[l+x+1]=g+(Math.abs(c)+g)*5960464477539063e-23,ct[e+3]&&(t[e+3]=h)}}return o}(r,v),S=t.indirect?A:b,F=[],I=t.indirect?u(r):c(r);if(1===I.length){let e=I[0],t=new B;t.boundingData=v,function(e,t,r,n){let i=1/0,o=1/0,s=1/0,a=-1/0,l=-1/0,u=-1/0;for(let n=6*t,c=(t+r)*6;na&&(a=t);let r=e[n+2];rl&&(l=r);let c=e[n+4];cu&&(u=c)}n[0]=i,n[1]=o,n[2]=s,n[3]=a,n[4]=l,n[5]=u}(U,e.offset,e.count,V),z(t,e.offset,e.count,V),F.push(t)}else for(let e of I){let t=new B;t.boundingData=new Float32Array(6),g(U,e.offset,e.count,t.boundingData,V),z(t,e.offset,e.count,V),F.push(t)}return F;function _(e){d&&d(e/T)}function z(e,t,l,u=null,c=0){if(!P&&c>=i&&(P=!0,o&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(r))),l<=s||c>=i)return _(t+l),e.offset=t,e.count=l,e;let d=function(e,t,r,n,i,o){let s=-1,a=0;if(0===o)-1!==(s=f(t))&&(a=(t[s]+t[s+3])/2);else if(1===o)-1!==(s=f(e))&&(a=function(e,t,r,n){let i=0;for(let o=t,s=t+r;o=o.candidate?y(n,r,o.rightCacheBounds):(y(n,r,o.leftCacheBounds),o.count++)}}for(let r=0;r=32&&(s=31);let a=m[s];a.count++,y(t,r,a.bounds)}let t=m[31];!function(e,t){t.set(e)}(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){let t=m[e],r=m[e+1];p(t.bounds,r.rightCacheBounds,t.rightCacheBounds)}let d=0;for(let t=0;t<31;t++){let r=m[t],n=r.count,u=r.bounds,c=m[t+1],f=c.rightCacheBounds;0!==n&&(0===d?function(e,t){t.set(e)}(u,w):p(u,w,w));let y=0,g=0;0!==(d+=n)&&(y=h(w)/o);let x=i-d;0!==x&&(g=h(f)/o);let B=1+1.25*(y*d+g*x);B4294967296)throw Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[s+6]=r/4,r=e(r,a),n[s+7]=l,r}}(0,t),d.push(s)}e._roots=d}(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new s.Box3)));let{_indirectBuffer:r}=this;this.resolveTriangleIndex=t.indirect?e=>r[e]:e=>e}refit(e=null){let t=this.indirect?ev:Q;return t(this,e)}traverse(e,t=0){let r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o,s=0){let a=2*o,l=65535===i[a+15];if(l){let t=n[o+6],u=i[a+14];e(s,l,new Float32Array(r,4*o,6),t,u)}else{let i=o+8,a=n[o+6],u=n[o+7],c=e(s,l,new Float32Array(r,4*o,6),u);c||(t(i,s+1),t(a,s+1))}}(0)}raycast(e,t=s.FrontSide){let r=this._roots,n=this.geometry,i=[],o=t.isMaterial,a=Array.isArray(t),l=n.groups,u=o?t.side:t,c=this.indirect?eU:er;for(let n=0,o=r.length;n!!e(t,r,o,s,a)||i(t,r,this,l,o,s,n)}else a||(a=l?(e,t,r,o)=>i(e,t,this,l,r,o,n):(e,t,r)=>r);let u=!1,c=0,f=this._roots;for(let r=0,n=f.length;r0&&(t=q[u-1],e=q[u-2]),l}(this,r,s,a,o,c))break;c+=n.byteLength}return I.releasePrimitive(n),u}bvhcast(e,t,r){let n=this.indirect?eK:eM;return n(this,e,t,r)}intersectsBox(e,t){return eJ.set(e.min,e.max,t),eJ.needsUpdate=!0,this.shapecast({intersectsBounds:e=>eJ.intersectsBox(e),intersectsTriangle:e=>eJ.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},n={},i=0,o=1/0){let s=this.indirect?ek:eB;return s(this,e,t,r,n,i,o)}closestPointToPoint(e,t={},r=0,n=1/0){return function(e,t,r={},n=0,i=1/0){let o=n*n,s=i*i,a=1/0,l=null;if(e.shapecast({boundsTraverseOrder:e=>(C.copy(t).clamp(e.min,e.max),C.distanceToSquared(t)),intersectsBounds:(e,t,r)=>r{e.closestPointToPoint(t,C);let n=t.distanceToSquared(C);return n{d(0,new Float32Array(t),eQ),e.union(eQ)}),e}}var s=o("e06gU");let e0=new s.Vector3(0,1,0),e1=new s.Vector3;function e3(e){return e.needsUpdate&&e.update(),1e-16>=Math.abs(e.plane.normal.dot(e0))}function e2(e,t){let{start:r,end:n}=t,i=e.points,o=!1,s=!1;for(let e=0;e<3;e++){let t=i[e];if(!o&&1e-16>=r.distanceToSquared(t)&&(o=!0),!s&&1e-16>=n.distanceToSquared(t)&&(s=!0),o&&s)return!0}return o&&s}var s=o("e06gU");let e6=new s.Vector3(0,1,0),e4=new s.Vector3,e5=new s.Vector3,e9=new s.Vector3,e8=new s.Triangle;var s=o("e06gU");let e7=new s.Line3;function te(e){e.sort((e,t)=>e[0]-t[0]);for(let t=1;t=r[0]&&(n[1]=Math.max(n[1],r[1]),e.splice(t,1),t--)}}var s=o("e06gU");let tt=new s.Vector3(0,1,0),tr=new s.Plane,tn=new s.Vector3,ti=new s.Vector3;var s=o("e06gU");let to=new s.Plane,ts=new s.Line3,ta=new s.Vector3,tl=new s.Vector3,tu=new U,tc=new s.Line3,td=new s.Line3,tf=new s.Vector3,tp=new s.Vector3;var s=o("e06gU");let ty=new s.Vector3,th=new s.Vector3,tg=new s.Vector3;var s=o("e06gU");let tx=new U,tm=new s.Line3,tw=new s.Vector3(0,1,0),tB=new s.Line3,tb=new s.Ray,tA=new s.Vector3,tT=new s.Line3;class tM{constructor(){this.edges=[]}getLineGeometry(e=0){let t=this.edges,r=new Float32Array(6*t.length),n=0;for(let i=0,o=t.length;i{let{signal:i}=t,o=this.generate(e,t);!function e(){i&&i.aborted&&n(Error("ProjectionGenerator: Process aborted via AbortSignal."));let t=o.next();t.done?r(t.value):requestAnimationFrame(e)}()})}*generate(e,t={}){let{onProgress:r}=t,{sortEdges:n,iterationTime:i,angleThreshold:o,includeIntersectionEdges:a}=this;e instanceof s.BufferGeometry&&(e=new eW(e,{maxLeafTris:1}));let l=e.geometry,u=function(e,t=e6,r=1){let n=[],i=Math.cos(s.MathUtils.DEG2RAD*r),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,u=[0,0,0],c=["a","b","c"],d=[,,,],f={};for(let e=0;eMath.abs(o)?0:o;let a=t.dot(e);a=1e-16>Math.abs(a)?0:a;let u=Math.sign(o)!==Math.sign(a);if(r||u){let e=new s.Line3;e.start.copy(l),e.end.copy(p),n.push(e)}f[h]=null}else y in f||(f[y]={index0:u[e],index1:u[r],normal:e9.clone()})}}for(let e in f)if(f[e]){let{index0:t,index1:r}=f[e];e4.fromBufferAttribute(a,t),e5.fromBufferAttribute(a,r);let i=new s.Line3;i.start.copy(e4),i.end.copy(e5),n.push(i)}return n}(l,tw,o);if(a){let t=yield*function*(e,t=30){let r=[],n=e.geometry,i=n.index,o=n.attributes.position,s=i?i.count:o,a=performance.now();for(let n=0;ne.intersectsTriangle(tx),intersectsTriangle:e=>!tx.equals(e)&&(e.needsUpdate&&e.update(),!(Math.abs(tx.plane.normal.dot(e.plane.normal))>1-1e-6)&&void(!tx.intersectsTriangle(e,tm,!0)||e2(tx,tm)||e2(e,tm)||(tm.start.y+=1e-6,tm.end.y+=1e-6,r.push(tm.clone()))))});let p=performance.now()-a;p>t&&(yield,a=performance.now())}return r}(e,i);u=u.concat(t)}n&&u.sort((e,t)=>Math.min(e.start.y,e.end.y)-Math.min(t.start.y,t.end.y)),yield;let c=new tM,d=performance.now();for(let t=0,n=u.length;t=.9999999999999999)continue;let o=Math.min(n.start.y,n.end.y),a=Math.max(n.start.y,n.end.y),l=[];e.shapecast({intersectsBounds:e=>{e.min.y=Math.min(o-1e-6,e.min.y);let{origin:t,direction:r}=tb;return t.copy(n.start),n.delta(r).normalize(),!!e.containsPoint(t)||!!tb.intersectBox(e,tA)&&t.distanceToSquared(tA){let t=Math.max(e.a.y,e.b.y,e.c.y);if(t<=o||e3(e)||e2(e,n))return!1;let r=Math.min(e.a.y,e.b.y,e.c.y);if(atr.normal.dot(tt)&&(tr.normal.multiplyScalar(-1),tr.constant*=-1);let n=tr.distanceToPoint(t.start),i=tr.distanceToPoint(t.end),o=1e-16>Math.abs(n),s=n<0,a=i<0;if(t.delta(ti).normalize(),1e-16>Math.abs(tr.normal.dot(ti)))return!o&&!!s&&(r.copy(t),!0);if(s&&a)return r.copy(t),!0;{if(!s&&!a)return!1;let e=tr.intersectLine(t,tn);if(!e&&(o&&(tn.copy(t.start),e=!0),1e-16>Math.abs(i)&&(tn.copy(t.end),e=!0)),e){if(s)return r.start.copy(t.start),r.end.copy(tn),!0;if(a)return r.end.copy(t.end),r.start.copy(tn),!0}}return!1}(e,n,tB))return!1;if(1e-10>tB.distance())return!1;if(function(e,t,r=new s.Line3){if(tu.copy(t),tu.a.y=0,tu.b.y=0,tu.c.y=0,tu.update(),tc.copy(e),tc.start.y=0,tc.end.y=0,1e-16>=tu.getArea())return null;tc.delta(tf).normalize(),tf.cross(tu.plane.normal).normalize(),to.setFromNormalAndCoplanarPoint(tf,tc.start);let n=0,{points:i}=tu;for(let e=0;e<3;e++){let t=i[e],r=i[(e+1)%3];ts.start.copy(t),ts.end.copy(r);let o=1e-16>Math.abs(to.distanceToPoint(ts.start)),s=1e-16>Math.abs(to.distanceToPoint(ts.end)),a=to.intersectLine(ts,ta);if((a&&!s||o)&&(o&&!a&&ta.copy(ts.start),0===n?td.start.copy(ta):td.end.copy(ta),2==++n))break}if(2===n){if(tc.delta(tf).normalize(),td.delta(tp).normalize(),0>tf.dot(tp)){let e=td.start;td.start=td.end,td.end=e}let t=tl.subVectors(tc.end,tc.start).dot(tf),n=tl.subVectors(td.start,tc.start).dot(tf),i=tl.subVectors(td.end,tc.start).dot(tf);return t<=n||i<=0?null:(e.at(Math.max(0,n)/tc.distance(),r.start),e.at(Math.min(t,i)/tc.distance(),r.end),r)}return null}(tB,e,tT)&&function(e,t,r){e.delta(ty),th.subVectors(t.start,e.start),tg.subVectors(t.end,e.start);let n=ty.length(),i=th.length()/n,o=tg.length()/n;return!(1e-16>=Math.abs((i=Math.min(Math.max(i,0),1))-(o=Math.min(Math.max(o,0),1))))&&(r.push(new Float32Array([i,o])),!0)}(n,tT,l)&&te(l),0!==l.length){let[e,t]=l[l.length-1];return 0===e&&1===t}return!1}}),function(e,t,r=[]){te(t);let n=[[0,1]];for(let e=0,r=t.length;ei){if(r){let e=t/u.length;r(e,c)}yield,d=performance.now()}}return c.getLineGeometry(0)}}onmessage=function({data:e}){let t=performance.now();try{let{index:r,position:n,options:i}=e,o=new s.BufferGeometry;o.setIndex(new s.BufferAttribute(r,1,!1)),o.setAttribute("position",new s.BufferAttribute(n,3,!1));let a=new tP;a.sortEdges=i.sortEdges??a.sortEdges,a.angleThreshold=i.angleThreshold??a.angleThreshold,a.includeIntersectionEdges=i.includeIntersectionEdges??a.includeIntersectionEdges;let l=a.generate(o,{onProgress:function(e){let r=performance.now();(r-t>=10||1===e)&&(postMessage({error:null,progress:e}),t=r)}}),u=l.next();for(;!u.done;)u=l.next();let c=u.value.attributes.position.array;postMessage({result:c,error:null,progress:1},[c.buffer])}catch(e){postMessage({error:e,progress:1})}}})(); +//# sourceMappingURL=projectionAsync.worker.28971622.js.map diff --git a/example/bundle/projectionAsync.worker.28971622.js.map b/example/bundle/projectionAsync.worker.28971622.js.map new file mode 100644 index 0000000..1cf3955 --- /dev/null +++ b/example/bundle/projectionAsync.worker.28971622.js.map @@ -0,0 +1 @@ +{"mappings":"A,C,SmBOI,EAAO,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,c,wC,I,G,E,S,E,S,E,UfmBJ,IAAM,EAAkB,OAAQ,mB,I,E,E,SElBhC,SAAS,EAAa,CAAG,EAE/B,MAAO,AANA,CAAA,AAMgB,EANZ,KAAA,CAAQ,AAMI,EANA,KAAA,CAAM,KAAA,CAAQ,AAMd,EANkB,UAAA,CAAW,QAAA,CAAS,KAA7D,AAAA,EAM+B,CAEhC,CA+CO,SAAS,EAAsB,CAAG,EAExC,IAAM,EAAW,EAAa,GACxB,EAAY,EAAI,SAAtB,CACM,EAAQ,EAAU,KAAA,CAAQ,EAC1B,EAAM,AAAE,CAAA,EAAU,KAAA,CAAQ,EAAU,KAAI,AAAJ,EAAU,EAE9C,EAAS,KAAK,GAAA,CAAK,EAAG,GAE5B,MAAO,CAAE,CACR,OAAQ,KAAK,KAA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node_modules/three-mesh-bvh/src/core/Constants.js","node_modules/three-mesh-bvh/src/core/build/buildTree.js","node_modules/three-mesh-bvh/src/core/build/geometryUtils.js","node_modules/three-mesh-bvh/src/core/build/computeBoundsUtils.js","node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js","node_modules/three-mesh-bvh/src/core/build/splitUtils.js","node_modules/three-mesh-bvh/src/core/MeshBVHNode.js","node_modules/three-mesh-bvh/src/core/build/sortUtils.generated.js","node_modules/three-mesh-bvh/src/core/build/sortUtils_indirect.generated.js","node_modules/three-mesh-bvh/src/math/OrientedBox.js","node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js","node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js","node_modules/three-mesh-bvh/src/math/MathUtilities.js","node_modules/three-mesh-bvh/src/utils/ExtendedTrianglePool.js","node_modules/three-mesh-bvh/src/utils/PrimitivePool.js","node_modules/three-mesh-bvh/src/core/cast/shapecast.js","node_modules/three-mesh-bvh/src/core/utils/nodeBufferUtils.js","node_modules/three-mesh-bvh/src/core/utils/BufferStack.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToPoint.js","node_modules/three-mesh-bvh/src/core/utils/iterationUtils.generated.js","node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js","node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js","node_modules/three-mesh-bvh/src/core/cast/refit.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycast.generated.js","node_modules/three-mesh-bvh/src/core/utils/intersectUtils.js","node_modules/three-mesh-bvh/src/core/cast/raycastFirst.generated.js","node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry.generated.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry.generated.js","node_modules/three-mesh-bvh/src/core/cast/bvhcast.generated.js","node_modules/three-mesh-bvh/src/core/utils/iterationUtils_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/refit_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycast_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycastFirst_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/bvhcast_indirect.generated.js","node_modules/three-mesh-bvh/src/utils/BufferUtils.js","src/utils/triangleLineUtils.js","src/utils/generateEdges.js","src/utils/overlapUtils.js","src/utils/trimToBeneathTriPlane.js","src/utils/getProjectedLineOverlap.js","src/utils/getProjectedOverlaps.js","src/utils/generateIntersectionEdges.js"],"sourcesContent":["(() => {\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nimportScripts(\"./projectionAsync.worker.15f44cdc.js\");\nvar $30a43f3c8b68694e$exports = {};\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nvar $e06gU = parcelRequire(\"e06gU\");\n// Split strategy constants\nconst $bc798809290ffd6b$export$91c2158bc24c63d4 = 0;\nconst $bc798809290ffd6b$export$d3bfe4097a2a8542 = 1;\nconst $bc798809290ffd6b$export$2b2cc3fb4f03d723 = 2;\nconst $bc798809290ffd6b$export$34b5498ca69d033 = 0;\nconst $bc798809290ffd6b$export$a26e00882057cd76 = 1;\nconst $bc798809290ffd6b$export$82ad94f0a038b67a = 2;\nconst $bc798809290ffd6b$export$22e1995328fd3cd9 = 1.25;\nconst $bc798809290ffd6b$export$f4b101accf1b23d1 = 1;\nconst $bc798809290ffd6b$export$a08e7d18fbc53be5 = 32;\nconst $bc798809290ffd6b$export$661fddb62bfe0e42 = 0xFFFF;\nconst $bc798809290ffd6b$export$859129fb5c8f4dc1 = Math.pow(2, -24);\nconst $bc798809290ffd6b$export$abef70518a11a6ba = Symbol(\"SKIP_GENERATION\");\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nfunction $512bf92b30757ce0$export$bb010cc24ecaa644(geo) {\n return geo.index ? geo.index.count : geo.attributes.position.count;\n}\nfunction $512bf92b30757ce0$export$c56c51fae37b2d63(geo) {\n return $512bf92b30757ce0$export$bb010cc24ecaa644(geo) / 3;\n}\nfunction $512bf92b30757ce0$export$62808f0201824da2(vertexCount, BufferConstructor = ArrayBuffer) {\n if (vertexCount > 65535) return new Uint32Array(new BufferConstructor(4 * vertexCount));\n else return new Uint16Array(new BufferConstructor(2 * vertexCount));\n}\nfunction $512bf92b30757ce0$export$90fd303420808ebb(geo, options) {\n if (!geo.index) {\n const vertexCount = geo.attributes.position.count;\n const BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n const index = $512bf92b30757ce0$export$62808f0201824da2(vertexCount, BufferConstructor);\n geo.setIndex(new (0, $e06gU.BufferAttribute)(index, 1));\n for(let i = 0; i < vertexCount; i++)index[i] = i;\n }\n}\nfunction $512bf92b30757ce0$export$8c9d42783264c26e(geo) {\n const triCount = $512bf92b30757ce0$export$c56c51fae37b2d63(geo);\n const drawRange = geo.drawRange;\n const start = drawRange.start / 3;\n const end = (drawRange.start + drawRange.count) / 3;\n const offset = Math.max(0, start);\n const count = Math.min(triCount, end) - offset;\n return [\n {\n offset: Math.floor(offset),\n count: Math.floor(count)\n }\n ];\n}\nfunction $512bf92b30757ce0$export$fd7a16c461f5043c(geo) {\n if (!geo.groups || !geo.groups.length) return $512bf92b30757ce0$export$8c9d42783264c26e(geo);\n const ranges = [];\n const rangeBoundaries = new Set();\n const drawRange = geo.drawRange;\n const drawRangeStart = drawRange.start / 3;\n const drawRangeEnd = (drawRange.start + drawRange.count) / 3;\n for (const group of geo.groups){\n const groupStart = group.start / 3;\n const groupEnd = (group.start + group.count) / 3;\n rangeBoundaries.add(Math.max(drawRangeStart, groupStart));\n rangeBoundaries.add(Math.min(drawRangeEnd, groupEnd));\n }\n // note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\n const sortedBoundaries = Array.from(rangeBoundaries.values()).sort((a, b)=>a - b);\n for(let i = 0; i < sortedBoundaries.length - 1; i++){\n const start = sortedBoundaries[i];\n const end = sortedBoundaries[i + 1];\n ranges.push({\n offset: Math.floor(start),\n count: Math.floor(end - start)\n });\n }\n return ranges;\n}\nfunction $512bf92b30757ce0$export$d3cf4eabab21775d(geometry) {\n if (geometry.groups.length === 0) return false;\n const vertexCount = $512bf92b30757ce0$export$c56c51fae37b2d63(geometry);\n const groups = $512bf92b30757ce0$export$fd7a16c461f5043c(geometry).sort((a, b)=>a.offset - b.offset);\n const finalGroup = groups[groups.length - 1];\n finalGroup.count = Math.min(vertexCount - finalGroup.offset, finalGroup.count);\n let total = 0;\n groups.forEach(({ count: count })=>total += count);\n return vertexCount !== total;\n}\n\n\n\nfunction $d5323e54f8bf740a$export$40b9a5e446bf11e0(nodeIndex32, array, target) {\n target.min.x = array[nodeIndex32];\n target.min.y = array[nodeIndex32 + 1];\n target.min.z = array[nodeIndex32 + 2];\n target.max.x = array[nodeIndex32 + 3];\n target.max.y = array[nodeIndex32 + 4];\n target.max.z = array[nodeIndex32 + 5];\n return target;\n}\nfunction $d5323e54f8bf740a$export$8737d658f04762d3(target) {\n target[0] = target[1] = target[2] = Infinity;\n target[3] = target[4] = target[5] = -Infinity;\n}\nfunction $d5323e54f8bf740a$export$dcdc414399b99746(bounds) {\n let splitDimIdx = -1;\n let splitDist = -Infinity;\n for(let i = 0; i < 3; i++){\n const dist = bounds[i + 3] - bounds[i];\n if (dist > splitDist) {\n splitDist = dist;\n splitDimIdx = i;\n }\n }\n return splitDimIdx;\n}\nfunction $d5323e54f8bf740a$export$14b050a767b4a3a7(source, target) {\n target.set(source);\n}\nfunction $d5323e54f8bf740a$export$a8a7063dce01a911(a, b, target) {\n let aVal, bVal;\n for(let d = 0; d < 3; d++){\n const d3 = d + 3;\n // set the minimum values\n aVal = a[d];\n bVal = b[d];\n target[d] = aVal < bVal ? aVal : bVal;\n // set the max values\n aVal = a[d3];\n bVal = b[d3];\n target[d3] = aVal > bVal ? aVal : bVal;\n }\n}\nfunction $d5323e54f8bf740a$export$c989e53c4b24c2f5(startIndex, triangleBounds, bounds) {\n for(let d = 0; d < 3; d++){\n const tCenter = triangleBounds[startIndex + 2 * d];\n const tHalf = triangleBounds[startIndex + 2 * d + 1];\n const tMin = tCenter - tHalf;\n const tMax = tCenter + tHalf;\n if (tMin < bounds[d]) bounds[d] = tMin;\n if (tMax > bounds[d + 3]) bounds[d + 3] = tMax;\n }\n}\nfunction $d5323e54f8bf740a$export$dbf4320364dc239e(bounds) {\n const d0 = bounds[3] - bounds[0];\n const d1 = bounds[4] - bounds[1];\n const d2 = bounds[5] - bounds[2];\n return 2 * (d0 * d1 + d1 * d2 + d2 * d0);\n}\n\n\n\nfunction $faecb3eca4385fa9$export$becd1e645219fa23(triangleBounds, offset, count, target, centroidTarget = null) {\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n let cminx = Infinity;\n let cminy = Infinity;\n let cminz = Infinity;\n let cmaxx = -Infinity;\n let cmaxy = -Infinity;\n let cmaxz = -Infinity;\n const includeCentroid = centroidTarget !== null;\n for(let i = offset * 6, end = (offset + count) * 6; i < end; i += 6){\n const cx = triangleBounds[i + 0];\n const hx = triangleBounds[i + 1];\n const lx = cx - hx;\n const rx = cx + hx;\n if (lx < minx) minx = lx;\n if (rx > maxx) maxx = rx;\n if (includeCentroid && cx < cminx) cminx = cx;\n if (includeCentroid && cx > cmaxx) cmaxx = cx;\n const cy = triangleBounds[i + 2];\n const hy = triangleBounds[i + 3];\n const ly = cy - hy;\n const ry = cy + hy;\n if (ly < miny) miny = ly;\n if (ry > maxy) maxy = ry;\n if (includeCentroid && cy < cminy) cminy = cy;\n if (includeCentroid && cy > cmaxy) cmaxy = cy;\n const cz = triangleBounds[i + 4];\n const hz = triangleBounds[i + 5];\n const lz = cz - hz;\n const rz = cz + hz;\n if (lz < minz) minz = lz;\n if (rz > maxz) maxz = rz;\n if (includeCentroid && cz < cminz) cminz = cz;\n if (includeCentroid && cz > cmaxz) cmaxz = cz;\n }\n target[0] = minx;\n target[1] = miny;\n target[2] = minz;\n target[3] = maxx;\n target[4] = maxy;\n target[5] = maxz;\n if (includeCentroid) {\n centroidTarget[0] = cminx;\n centroidTarget[1] = cminy;\n centroidTarget[2] = cminz;\n centroidTarget[3] = cmaxx;\n centroidTarget[4] = cmaxy;\n centroidTarget[5] = cmaxz;\n }\n}\nfunction $faecb3eca4385fa9$export$8eb05c58dc5aa2de(triangleBounds, offset, count, centroidTarget) {\n let cminx = Infinity;\n let cminy = Infinity;\n let cminz = Infinity;\n let cmaxx = -Infinity;\n let cmaxy = -Infinity;\n let cmaxz = -Infinity;\n for(let i = offset * 6, end = (offset + count) * 6; i < end; i += 6){\n const cx = triangleBounds[i + 0];\n if (cx < cminx) cminx = cx;\n if (cx > cmaxx) cmaxx = cx;\n const cy = triangleBounds[i + 2];\n if (cy < cminy) cminy = cy;\n if (cy > cmaxy) cmaxy = cy;\n const cz = triangleBounds[i + 4];\n if (cz < cminz) cminz = cz;\n if (cz > cmaxz) cmaxz = cz;\n }\n centroidTarget[0] = cminx;\n centroidTarget[1] = cminy;\n centroidTarget[2] = cminz;\n centroidTarget[3] = cmaxx;\n centroidTarget[4] = cmaxy;\n centroidTarget[5] = cmaxz;\n}\nfunction $faecb3eca4385fa9$export$b3cc4d5d5179e78c(geo, fullBounds) {\n // clear the bounds to empty\n (0, $d5323e54f8bf740a$export$8737d658f04762d3)(fullBounds);\n const posAttr = geo.attributes.position;\n const index = geo.index ? geo.index.array : null;\n const triCount = (0, $512bf92b30757ce0$export$c56c51fae37b2d63)(geo);\n const triangleBounds = new Float32Array(triCount * 6);\n const normalized = posAttr.normalized;\n // used for non-normalized positions\n const posArr = posAttr.array;\n // support for an interleaved position buffer\n const bufferOffset = posAttr.offset || 0;\n let stride = 3;\n if (posAttr.isInterleavedBufferAttribute) stride = posAttr.data.stride;\n // used for normalized positions\n const getters = [\n \"getX\",\n \"getY\",\n \"getZ\"\n ];\n for(let tri = 0; tri < triCount; tri++){\n const tri3 = tri * 3;\n const tri6 = tri * 6;\n let ai = tri3 + 0;\n let bi = tri3 + 1;\n let ci = tri3 + 2;\n if (index) {\n ai = index[ai];\n bi = index[bi];\n ci = index[ci];\n }\n // we add the stride and offset here since we access the array directly\n // below for the sake of performance\n if (!normalized) {\n ai = ai * stride + bufferOffset;\n bi = bi * stride + bufferOffset;\n ci = ci * stride + bufferOffset;\n }\n for(let el = 0; el < 3; el++){\n let a, b, c;\n if (normalized) {\n a = posAttr[getters[el]](ai);\n b = posAttr[getters[el]](bi);\n c = posAttr[getters[el]](ci);\n } else {\n a = posArr[ai + el];\n b = posArr[bi + el];\n c = posArr[ci + el];\n }\n let min = a;\n if (b < min) min = b;\n if (c < min) min = c;\n let max = a;\n if (b > max) max = b;\n if (c > max) max = c;\n // Increase the bounds size by float32 epsilon to avoid precision errors when\n // converting to 32 bit float. Scale the epsilon by the size of the numbers being\n // worked with.\n const halfExtents = (max - min) / 2;\n const el2 = el * 2;\n triangleBounds[tri6 + el2 + 0] = min + halfExtents;\n triangleBounds[tri6 + el2 + 1] = halfExtents + (Math.abs(min) + halfExtents) * (0, $bc798809290ffd6b$export$859129fb5c8f4dc1);\n if (min < fullBounds[el]) fullBounds[el] = min;\n if (max > fullBounds[el + 3]) fullBounds[el + 3] = max;\n }\n }\n return triangleBounds;\n}\n\n\n\n\nconst $62809835080ba262$var$BIN_COUNT = 32;\nconst $62809835080ba262$var$binsSort = (a, b)=>a.candidate - b.candidate;\nconst $62809835080ba262$var$sahBins = new Array($62809835080ba262$var$BIN_COUNT).fill().map(()=>{\n return {\n count: 0,\n bounds: new Float32Array(6),\n rightCacheBounds: new Float32Array(6),\n leftCacheBounds: new Float32Array(6),\n candidate: 0\n };\n});\nconst $62809835080ba262$var$leftBounds = new Float32Array(6);\nfunction $62809835080ba262$export$9e40712018083c80(nodeBoundingData, centroidBoundingData, triangleBounds, offset, count, strategy) {\n let axis = -1;\n let pos = 0;\n // Center\n if (strategy === (0, $bc798809290ffd6b$export$91c2158bc24c63d4)) {\n axis = (0, $d5323e54f8bf740a$export$dcdc414399b99746)(centroidBoundingData);\n if (axis !== -1) pos = (centroidBoundingData[axis] + centroidBoundingData[axis + 3]) / 2;\n } else if (strategy === (0, $bc798809290ffd6b$export$d3bfe4097a2a8542)) {\n axis = (0, $d5323e54f8bf740a$export$dcdc414399b99746)(nodeBoundingData);\n if (axis !== -1) pos = $62809835080ba262$var$getAverage(triangleBounds, offset, count, axis);\n } else if (strategy === (0, $bc798809290ffd6b$export$2b2cc3fb4f03d723)) {\n const rootSurfaceArea = (0, $d5323e54f8bf740a$export$dbf4320364dc239e)(nodeBoundingData);\n let bestCost = (0, $bc798809290ffd6b$export$22e1995328fd3cd9) * count;\n // iterate over all axes\n const cStart = offset * 6;\n const cEnd = (offset + count) * 6;\n for(let a = 0; a < 3; a++){\n const axisLeft = centroidBoundingData[a];\n const axisRight = centroidBoundingData[a + 3];\n const axisLength = axisRight - axisLeft;\n const binWidth = axisLength / $62809835080ba262$var$BIN_COUNT;\n // If we have fewer triangles than we're planning to split then just check all\n // the triangle positions because it will be faster.\n if (count < $62809835080ba262$var$BIN_COUNT / 4) {\n // initialize the bin candidates\n const truncatedBins = [\n ...$62809835080ba262$var$sahBins\n ];\n truncatedBins.length = count;\n // set the candidates\n let b = 0;\n for(let c = cStart; c < cEnd; c += 6, b++){\n const bin = truncatedBins[b];\n bin.candidate = triangleBounds[c + 2 * a];\n bin.count = 0;\n const { bounds: bounds, leftCacheBounds: leftCacheBounds, rightCacheBounds: rightCacheBounds } = bin;\n for(let d = 0; d < 3; d++){\n rightCacheBounds[d] = Infinity;\n rightCacheBounds[d + 3] = -Infinity;\n leftCacheBounds[d] = Infinity;\n leftCacheBounds[d + 3] = -Infinity;\n bounds[d] = Infinity;\n bounds[d + 3] = -Infinity;\n }\n (0, $d5323e54f8bf740a$export$c989e53c4b24c2f5)(c, triangleBounds, bounds);\n }\n truncatedBins.sort($62809835080ba262$var$binsSort);\n // remove redundant splits\n let splitCount = count;\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n while(bi + 1 < splitCount && truncatedBins[bi + 1].candidate === bin.candidate){\n truncatedBins.splice(bi + 1, 1);\n splitCount--;\n }\n }\n // find the appropriate bin for each triangle and expand the bounds.\n for(let c = cStart; c < cEnd; c += 6){\n const center = triangleBounds[c + 2 * a];\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n if (center >= bin.candidate) (0, $d5323e54f8bf740a$export$c989e53c4b24c2f5)(c, triangleBounds, bin.rightCacheBounds);\n else {\n (0, $d5323e54f8bf740a$export$c989e53c4b24c2f5)(c, triangleBounds, bin.leftCacheBounds);\n bin.count++;\n }\n }\n }\n // expand all the bounds\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n const leftCount = bin.count;\n const rightCount = count - bin.count;\n // check the cost of this split\n const leftBounds = bin.leftCacheBounds;\n const rightBounds = bin.rightCacheBounds;\n let leftProb = 0;\n if (leftCount !== 0) leftProb = (0, $d5323e54f8bf740a$export$dbf4320364dc239e)(leftBounds) / rootSurfaceArea;\n let rightProb = 0;\n if (rightCount !== 0) rightProb = (0, $d5323e54f8bf740a$export$dbf4320364dc239e)(rightBounds) / rootSurfaceArea;\n const cost = (0, $bc798809290ffd6b$export$f4b101accf1b23d1) + (0, $bc798809290ffd6b$export$22e1995328fd3cd9) * (leftProb * leftCount + rightProb * rightCount);\n if (cost < bestCost) {\n axis = a;\n bestCost = cost;\n pos = bin.candidate;\n }\n }\n } else {\n // reset the bins\n for(let i = 0; i < $62809835080ba262$var$BIN_COUNT; i++){\n const bin = $62809835080ba262$var$sahBins[i];\n bin.count = 0;\n bin.candidate = axisLeft + binWidth + i * binWidth;\n const bounds = bin.bounds;\n for(let d = 0; d < 3; d++){\n bounds[d] = Infinity;\n bounds[d + 3] = -Infinity;\n }\n }\n // iterate over all center positions\n for(let c = cStart; c < cEnd; c += 6){\n const triCenter = triangleBounds[c + 2 * a];\n const relativeCenter = triCenter - axisLeft;\n // in the partition function if the centroid lies on the split plane then it is\n // considered to be on the right side of the split\n let binIndex = ~~(relativeCenter / binWidth);\n if (binIndex >= $62809835080ba262$var$BIN_COUNT) binIndex = $62809835080ba262$var$BIN_COUNT - 1;\n const bin = $62809835080ba262$var$sahBins[binIndex];\n bin.count++;\n (0, $d5323e54f8bf740a$export$c989e53c4b24c2f5)(c, triangleBounds, bin.bounds);\n }\n // cache the unioned bounds from right to left so we don't have to regenerate them each time\n const lastBin = $62809835080ba262$var$sahBins[$62809835080ba262$var$BIN_COUNT - 1];\n (0, $d5323e54f8bf740a$export$14b050a767b4a3a7)(lastBin.bounds, lastBin.rightCacheBounds);\n for(let i = $62809835080ba262$var$BIN_COUNT - 2; i >= 0; i--){\n const bin = $62809835080ba262$var$sahBins[i];\n const nextBin = $62809835080ba262$var$sahBins[i + 1];\n (0, $d5323e54f8bf740a$export$a8a7063dce01a911)(bin.bounds, nextBin.rightCacheBounds, bin.rightCacheBounds);\n }\n let leftCount = 0;\n for(let i = 0; i < $62809835080ba262$var$BIN_COUNT - 1; i++){\n const bin = $62809835080ba262$var$sahBins[i];\n const binCount = bin.count;\n const bounds = bin.bounds;\n const nextBin = $62809835080ba262$var$sahBins[i + 1];\n const rightBounds = nextBin.rightCacheBounds;\n // don't do anything with the bounds if the new bounds have no triangles\n if (binCount !== 0) {\n if (leftCount === 0) (0, $d5323e54f8bf740a$export$14b050a767b4a3a7)(bounds, $62809835080ba262$var$leftBounds);\n else (0, $d5323e54f8bf740a$export$a8a7063dce01a911)(bounds, $62809835080ba262$var$leftBounds, $62809835080ba262$var$leftBounds);\n }\n leftCount += binCount;\n // check the cost of this split\n let leftProb = 0;\n let rightProb = 0;\n if (leftCount !== 0) leftProb = (0, $d5323e54f8bf740a$export$dbf4320364dc239e)($62809835080ba262$var$leftBounds) / rootSurfaceArea;\n const rightCount = count - leftCount;\n if (rightCount !== 0) rightProb = (0, $d5323e54f8bf740a$export$dbf4320364dc239e)(rightBounds) / rootSurfaceArea;\n const cost = (0, $bc798809290ffd6b$export$f4b101accf1b23d1) + (0, $bc798809290ffd6b$export$22e1995328fd3cd9) * (leftProb * leftCount + rightProb * rightCount);\n if (cost < bestCost) {\n axis = a;\n bestCost = cost;\n pos = bin.candidate;\n }\n }\n }\n }\n } else console.warn(`MeshBVH: Invalid build strategy value ${strategy} used.`);\n return {\n axis: axis,\n pos: pos\n };\n}\n// returns the average coordinate on the specified axis of the all the provided triangles\nfunction $62809835080ba262$var$getAverage(triangleBounds, offset, count, axis) {\n let avg = 0;\n for(let i = offset, end = offset + count; i < end; i++)avg += triangleBounds[i * 6 + axis * 2];\n return avg / count;\n}\n\n\nclass $5f1fa9198ab38bd9$export$6f473cc5f89b0a1c {\n constructor(){\n // internal nodes have boundingData, left, right, and splitAxis\n // leaf nodes have offset and count (referring to primitives in the mesh geometry)\n }\n}\n\n\n\n/********************************************************/ /* This file is generated from \"sortUtils.template.js\". */ /********************************************************/ // reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction $dc07fa3855e86015$export$b29f828819edca8d(indirectBuffer, index, triangleBounds, offset, count, split) {\n let left = offset;\n let right = offset + count - 1;\n const pos = split.pos;\n const axisOffset = split.axis * 2;\n // hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n while(true){\n while(left <= right && triangleBounds[left * 6 + axisOffset] < pos)left++;\n // if a triangle center lies on the partition plane it is considered to be on the right side\n while(left <= right && triangleBounds[right * 6 + axisOffset] >= pos)right--;\n if (left < right) {\n // we need to swap all of the information associated with the triangles at index\n // left and right; that's the verts in the geometry index, the bounds,\n // and perhaps the SAH planes\n for(let i = 0; i < 3; i++){\n let t0 = index[left * 3 + i];\n index[left * 3 + i] = index[right * 3 + i];\n index[right * 3 + i] = t0;\n }\n // swap bounds\n for(let i = 0; i < 6; i++){\n let tb = triangleBounds[left * 6 + i];\n triangleBounds[left * 6 + i] = triangleBounds[right * 6 + i];\n triangleBounds[right * 6 + i] = tb;\n }\n left++;\n right--;\n } else return left;\n }\n}\n\n\n/********************************************************/ /* This file is generated from \"sortUtils.template.js\". */ /********************************************************/ // reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction $aace0473d446b8ef$export$7cee363d477551d0(indirectBuffer, index, triangleBounds, offset, count, split) {\n let left = offset;\n let right = offset + count - 1;\n const pos = split.pos;\n const axisOffset = split.axis * 2;\n // hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n while(true){\n while(left <= right && triangleBounds[left * 6 + axisOffset] < pos)left++;\n // if a triangle center lies on the partition plane it is considered to be on the right side\n while(left <= right && triangleBounds[right * 6 + axisOffset] >= pos)right--;\n if (left < right) {\n // we need to swap all of the information associated with the triangles at index\n // left and right; that's the verts in the geometry index, the bounds,\n // and perhaps the SAH planes\n let t = indirectBuffer[left];\n indirectBuffer[left] = indirectBuffer[right];\n indirectBuffer[right] = t;\n // swap bounds\n for(let i = 0; i < 6; i++){\n let tb = triangleBounds[left * 6 + i];\n triangleBounds[left * 6 + i] = triangleBounds[right * 6 + i];\n triangleBounds[right * 6 + i] = tb;\n }\n left++;\n right--;\n } else return left;\n }\n}\n\n\nfunction $1b5942106133d63e$var$generateIndirectBuffer(geometry, useSharedArrayBuffer) {\n const triCount = (geometry.index ? geometry.index.count : geometry.attributes.position.count) / 3;\n const useUint32 = triCount > 2 ** 16;\n const byteCount = useUint32 ? 4 : 2;\n const buffer = useSharedArrayBuffer ? new SharedArrayBuffer(triCount * byteCount) : new ArrayBuffer(triCount * byteCount);\n const indirectBuffer = useUint32 ? new Uint32Array(buffer) : new Uint16Array(buffer);\n for(let i = 0, l = indirectBuffer.length; i < l; i++)indirectBuffer[i] = i;\n return indirectBuffer;\n}\nfunction $1b5942106133d63e$var$buildTree(bvh, options) {\n // Compute the full bounds of the geometry at the same time as triangle bounds because\n // we'll need it for the root bounds in the case with no groups and it should be fast here.\n // We can't use the geometry bounding box if it's available because it may be out of date.\n const geometry = bvh.geometry;\n const indexArray = geometry.index ? geometry.index.array : null;\n const maxDepth = options.maxDepth;\n const verbose = options.verbose;\n const maxLeafTris = options.maxLeafTris;\n const strategy = options.strategy;\n const onProgress = options.onProgress;\n const totalTriangles = (0, $512bf92b30757ce0$export$c56c51fae37b2d63)(geometry);\n const indirectBuffer = bvh._indirectBuffer;\n let reachedMaxDepth = false;\n const fullBounds = new Float32Array(6);\n const cacheCentroidBoundingData = new Float32Array(6);\n const triangleBounds = (0, $faecb3eca4385fa9$export$b3cc4d5d5179e78c)(geometry, fullBounds);\n const partionFunc = options.indirect ? (0, $aace0473d446b8ef$export$7cee363d477551d0) : (0, $dc07fa3855e86015$export$b29f828819edca8d);\n const roots = [];\n const ranges = options.indirect ? (0, $512bf92b30757ce0$export$8c9d42783264c26e)(geometry) : (0, $512bf92b30757ce0$export$fd7a16c461f5043c)(geometry);\n if (ranges.length === 1) {\n const range = ranges[0];\n const root = new (0, $5f1fa9198ab38bd9$export$6f473cc5f89b0a1c)();\n root.boundingData = fullBounds;\n (0, $faecb3eca4385fa9$export$8eb05c58dc5aa2de)(triangleBounds, range.offset, range.count, cacheCentroidBoundingData);\n splitNode(root, range.offset, range.count, cacheCentroidBoundingData);\n roots.push(root);\n } else for (let range of ranges){\n const root = new (0, $5f1fa9198ab38bd9$export$6f473cc5f89b0a1c)();\n root.boundingData = new Float32Array(6);\n (0, $faecb3eca4385fa9$export$becd1e645219fa23)(triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData);\n splitNode(root, range.offset, range.count, cacheCentroidBoundingData);\n roots.push(root);\n }\n return roots;\n function triggerProgress(trianglesProcessed) {\n if (onProgress) onProgress(trianglesProcessed / totalTriangles);\n }\n // either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\n // recording the offset and count of its triangles and writing them into the reordered geometry index.\n function splitNode(node, offset, count, centroidBoundingData = null, depth = 0) {\n if (!reachedMaxDepth && depth >= maxDepth) {\n reachedMaxDepth = true;\n if (verbose) {\n console.warn(`MeshBVH: Max depth of ${maxDepth} reached when generating BVH. Consider increasing maxDepth.`);\n console.warn(geometry);\n }\n }\n // early out if we've met our capacity\n if (count <= maxLeafTris || depth >= maxDepth) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n return node;\n }\n // Find where to split the volume\n const split = (0, $62809835080ba262$export$9e40712018083c80)(node.boundingData, centroidBoundingData, triangleBounds, offset, count, strategy);\n if (split.axis === -1) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n return node;\n }\n const splitOffset = partionFunc(indirectBuffer, indexArray, triangleBounds, offset, count, split);\n // create the two new child nodes\n if (splitOffset === offset || splitOffset === offset + count) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n } else {\n node.splitAxis = split.axis;\n // create the left child and compute its bounding box\n const left = new (0, $5f1fa9198ab38bd9$export$6f473cc5f89b0a1c)();\n const lstart = offset;\n const lcount = splitOffset - offset;\n node.left = left;\n left.boundingData = new Float32Array(6);\n (0, $faecb3eca4385fa9$export$becd1e645219fa23)(triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData);\n splitNode(left, lstart, lcount, cacheCentroidBoundingData, depth + 1);\n // repeat for right\n const right = new (0, $5f1fa9198ab38bd9$export$6f473cc5f89b0a1c)();\n const rstart = splitOffset;\n const rcount = count - lcount;\n node.right = right;\n right.boundingData = new Float32Array(6);\n (0, $faecb3eca4385fa9$export$becd1e645219fa23)(triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData);\n splitNode(right, rstart, rcount, cacheCentroidBoundingData, depth + 1);\n }\n return node;\n }\n}\nfunction $1b5942106133d63e$export$e63bca57f220b8e3(bvh, options) {\n const geometry = bvh.geometry;\n if (options.indirect) {\n bvh._indirectBuffer = $1b5942106133d63e$var$generateIndirectBuffer(geometry, options.useSharedArrayBuffer);\n if ((0, $512bf92b30757ce0$export$d3cf4eabab21775d)(geometry) && !options.verbose) console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the \"indirect\" option. BVH may incorrectly report intersections on unrendered portions of the geometry.');\n }\n if (!bvh._indirectBuffer) (0, $512bf92b30757ce0$export$90fd303420808ebb)(geometry, options);\n // boundingData \t\t\t\t: 6 float32\n // right / offset \t\t\t\t: 1 uint32\n // splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\n const roots = $1b5942106133d63e$var$buildTree(bvh, options);\n let float32Array;\n let uint32Array;\n let uint16Array;\n const packedRoots = [];\n const BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n for(let i = 0; i < roots.length; i++){\n const root = roots[i];\n let nodeCount = countNodes(root);\n const buffer = new BufferConstructor((0, $bc798809290ffd6b$export$a08e7d18fbc53be5) * nodeCount);\n float32Array = new Float32Array(buffer);\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n populateBuffer(0, root);\n packedRoots.push(buffer);\n }\n bvh._roots = packedRoots;\n return;\n function countNodes(node) {\n if (node.count) return 1;\n else return 1 + countNodes(node.left) + countNodes(node.right);\n }\n function populateBuffer(byteOffset, node) {\n const stride4Offset = byteOffset / 4;\n const stride2Offset = byteOffset / 2;\n const isLeaf = !!node.count;\n const boundingData = node.boundingData;\n for(let i = 0; i < 6; i++)float32Array[stride4Offset + i] = boundingData[i];\n if (isLeaf) {\n const offset = node.offset;\n const count = node.count;\n uint32Array[stride4Offset + 6] = offset;\n uint16Array[stride2Offset + 14] = count;\n uint16Array[stride2Offset + 15] = (0, $bc798809290ffd6b$export$661fddb62bfe0e42);\n return byteOffset + (0, $bc798809290ffd6b$export$a08e7d18fbc53be5);\n } else {\n const left = node.left;\n const right = node.right;\n const splitAxis = node.splitAxis;\n let nextUnusedPointer;\n nextUnusedPointer = populateBuffer(byteOffset + (0, $bc798809290ffd6b$export$a08e7d18fbc53be5), left);\n if (nextUnusedPointer / 4 > Math.pow(2, 32)) throw new Error(\"MeshBVH: Cannot store child pointer greater than 32 bits.\");\n uint32Array[stride4Offset + 6] = nextUnusedPointer / 4;\n nextUnusedPointer = populateBuffer(nextUnusedPointer, right);\n uint32Array[stride4Offset + 7] = splitAxis;\n return nextUnusedPointer;\n }\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nvar $e06gU = parcelRequire(\"e06gU\");\nclass $34f95eced4ec08e7$export$f758e41ecdcd8e69 {\n constructor(){\n this.min = Infinity;\n this.max = -Infinity;\n }\n setFromPointsField(points, field) {\n let min = Infinity;\n let max = -Infinity;\n for(let i = 0, l = points.length; i < l; i++){\n const p = points[i];\n const val = p[field];\n min = val < min ? val : min;\n max = val > max ? val : max;\n }\n this.min = min;\n this.max = max;\n }\n setFromPoints(axis, points) {\n let min = Infinity;\n let max = -Infinity;\n for(let i = 0, l = points.length; i < l; i++){\n const p = points[i];\n const val = axis.dot(p);\n min = val < min ? val : min;\n max = val > max ? val : max;\n }\n this.min = min;\n this.max = max;\n }\n isSeparated(other) {\n return this.min > other.max || other.min > this.max;\n }\n}\n$34f95eced4ec08e7$export$f758e41ecdcd8e69.prototype.setFromBox = function() {\n const p = new (0, $e06gU.Vector3)();\n return function setFromBox(axis, box) {\n const boxMin = box.min;\n const boxMax = box.max;\n let min = Infinity;\n let max = -Infinity;\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n p.x = boxMin.x * x + boxMax.x * (1 - x);\n p.y = boxMin.y * y + boxMax.y * (1 - y);\n p.z = boxMin.z * z + boxMax.z * (1 - z);\n const val = axis.dot(p);\n min = Math.min(val, min);\n max = Math.max(val, max);\n }\n }\n this.min = min;\n this.max = max;\n };\n}();\nconst $34f95eced4ec08e7$export$e086b7be1b4d1d36 = function() {\n const cacheSatBounds = new $34f95eced4ec08e7$export$f758e41ecdcd8e69();\n return function areIntersecting(shape1, shape2) {\n const points1 = shape1.points;\n const satAxes1 = shape1.satAxes;\n const satBounds1 = shape1.satBounds;\n const points2 = shape2.points;\n const satAxes2 = shape2.satAxes;\n const satBounds2 = shape2.satBounds;\n // check axes of the first shape\n for(let i = 0; i < 3; i++){\n const sb = satBounds1[i];\n const sa = satAxes1[i];\n cacheSatBounds.setFromPoints(sa, points2);\n if (sb.isSeparated(cacheSatBounds)) return false;\n }\n // check axes of the second shape\n for(let i = 0; i < 3; i++){\n const sb = satBounds2[i];\n const sa = satAxes2[i];\n cacheSatBounds.setFromPoints(sa, points1);\n if (sb.isSeparated(cacheSatBounds)) return false;\n }\n };\n}();\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $1300ab831e41e936$export$479eef7c8f1b846c = function() {\n // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n const dir1 = new (0, $e06gU.Vector3)();\n const dir2 = new (0, $e06gU.Vector3)();\n const v02 = new (0, $e06gU.Vector3)();\n return function closestPointLineToLine(l1, l2, result) {\n const v0 = l1.start;\n const v10 = dir1;\n const v2 = l2.start;\n const v32 = dir2;\n v02.subVectors(v0, v2);\n dir1.subVectors(l1.end, l1.start);\n dir2.subVectors(l2.end, l2.start);\n // float d0232 = v02.Dot(v32);\n const d0232 = v02.dot(v32);\n // float d3210 = v32.Dot(v10);\n const d3210 = v32.dot(v10);\n // float d3232 = v32.Dot(v32);\n const d3232 = v32.dot(v32);\n // float d0210 = v02.Dot(v10);\n const d0210 = v02.dot(v10);\n // float d1010 = v10.Dot(v10);\n const d1010 = v10.dot(v10);\n // float denom = d1010*d3232 - d3210*d3210;\n const denom = d1010 * d3232 - d3210 * d3210;\n let d, d2;\n if (denom !== 0) d = (d0232 * d3210 - d0210 * d3232) / denom;\n else d = 0;\n d2 = (d0232 + d * d3210) / d3232;\n result.x = d;\n result.y = d2;\n };\n}();\nconst $1300ab831e41e936$export$b09f296caca7547a = function() {\n // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n const paramResult = new (0, $e06gU.Vector2)();\n const temp1 = new (0, $e06gU.Vector3)();\n const temp2 = new (0, $e06gU.Vector3)();\n return function closestPointsSegmentToSegment(l1, l2, target1, target2) {\n $1300ab831e41e936$export$479eef7c8f1b846c(l1, l2, paramResult);\n let d = paramResult.x;\n let d2 = paramResult.y;\n if (d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1) {\n l1.at(d, target1);\n l2.at(d2, target2);\n return;\n } else if (d >= 0 && d <= 1) {\n // Only d2 is out of bounds.\n if (d2 < 0) l2.at(0, target2);\n else l2.at(1, target2);\n l1.closestPointToPoint(target2, true, target1);\n return;\n } else if (d2 >= 0 && d2 <= 1) {\n // Only d is out of bounds.\n if (d < 0) l1.at(0, target1);\n else l1.at(1, target1);\n l2.closestPointToPoint(target1, true, target2);\n return;\n } else {\n // Both u and u2 are out of bounds.\n let p;\n if (d < 0) p = l1.start;\n else p = l1.end;\n let p2;\n if (d2 < 0) p2 = l2.start;\n else p2 = l2.end;\n const closestPoint = temp1;\n const closestPoint2 = temp2;\n l1.closestPointToPoint(p2, true, temp1);\n l2.closestPointToPoint(p, true, temp2);\n if (closestPoint.distanceToSquared(p2) <= closestPoint2.distanceToSquared(p)) {\n target1.copy(closestPoint);\n target2.copy(p2);\n return;\n } else {\n target1.copy(p);\n target2.copy(closestPoint2);\n return;\n }\n }\n };\n}();\nconst $1300ab831e41e936$export$eed3a6606b3adc41 = function() {\n // https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n const closestPointTemp = new (0, $e06gU.Vector3)();\n const projectedPointTemp = new (0, $e06gU.Vector3)();\n const planeTemp = new (0, $e06gU.Plane)();\n const lineTemp = new (0, $e06gU.Line3)();\n return function sphereIntersectTriangle(sphere, triangle) {\n const { radius: radius, center: center } = sphere;\n const { a: a, b: b, c: c } = triangle;\n // phase 1\n lineTemp.start = a;\n lineTemp.end = b;\n const closestPoint1 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint1.distanceTo(center) <= radius) return true;\n lineTemp.start = a;\n lineTemp.end = c;\n const closestPoint2 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint2.distanceTo(center) <= radius) return true;\n lineTemp.start = b;\n lineTemp.end = c;\n const closestPoint3 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint3.distanceTo(center) <= radius) return true;\n // phase 2\n const plane = triangle.getPlane(planeTemp);\n const dp = Math.abs(plane.distanceToPoint(center));\n if (dp <= radius) {\n const pp = plane.projectPoint(center, projectedPointTemp);\n const cp = triangle.containsPoint(pp);\n if (cp) return true;\n }\n return false;\n };\n}();\n\n\nconst $277ed51eec8cb2f4$var$ZERO_EPSILON = 1e-15;\nfunction $277ed51eec8cb2f4$var$isNearZero(value) {\n return Math.abs(value) < $277ed51eec8cb2f4$var$ZERO_EPSILON;\n}\nclass $277ed51eec8cb2f4$export$a37f7ec1c23dfacf extends (0, $e06gU.Triangle) {\n constructor(...args){\n super(...args);\n this.isExtendedTriangle = true;\n this.satAxes = new Array(4).fill().map(()=>new (0, $e06gU.Vector3)());\n this.satBounds = new Array(4).fill().map(()=>new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)());\n this.points = [\n this.a,\n this.b,\n this.c\n ];\n this.sphere = new (0, $e06gU.Sphere)();\n this.plane = new (0, $e06gU.Plane)();\n this.needsUpdate = true;\n }\n intersectsSphere(sphere) {\n return (0, $1300ab831e41e936$export$eed3a6606b3adc41)(sphere, this);\n }\n update() {\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const points = this.points;\n const satAxes = this.satAxes;\n const satBounds = this.satBounds;\n const axis0 = satAxes[0];\n const sab0 = satBounds[0];\n this.getNormal(axis0);\n sab0.setFromPoints(axis0, points);\n const axis1 = satAxes[1];\n const sab1 = satBounds[1];\n axis1.subVectors(a, b);\n sab1.setFromPoints(axis1, points);\n const axis2 = satAxes[2];\n const sab2 = satBounds[2];\n axis2.subVectors(b, c);\n sab2.setFromPoints(axis2, points);\n const axis3 = satAxes[3];\n const sab3 = satBounds[3];\n axis3.subVectors(c, a);\n sab3.setFromPoints(axis3, points);\n this.sphere.setFromPoints(this.points);\n this.plane.setFromNormalAndCoplanarPoint(axis0, a);\n this.needsUpdate = false;\n }\n}\n$277ed51eec8cb2f4$export$a37f7ec1c23dfacf.prototype.closestPointToSegment = function() {\n const point1 = new (0, $e06gU.Vector3)();\n const point2 = new (0, $e06gU.Vector3)();\n const edge = new (0, $e06gU.Line3)();\n return function distanceToSegment(segment, target1 = null, target2 = null) {\n const { start: start, end: end } = segment;\n const points = this.points;\n let distSq;\n let closestDistanceSq = Infinity;\n // check the triangle edges\n for(let i = 0; i < 3; i++){\n const nexti = (i + 1) % 3;\n edge.start.copy(points[i]);\n edge.end.copy(points[nexti]);\n (0, $1300ab831e41e936$export$b09f296caca7547a)(edge, segment, point1, point2);\n distSq = point1.distanceToSquared(point2);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n }\n }\n // check end points\n this.closestPointToPoint(start, point1);\n distSq = start.distanceToSquared(point1);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(start);\n }\n this.closestPointToPoint(end, point1);\n distSq = end.distanceToSquared(point1);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(end);\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n$277ed51eec8cb2f4$export$a37f7ec1c23dfacf.prototype.intersectsTriangle = function() {\n const saTri2 = new $277ed51eec8cb2f4$export$a37f7ec1c23dfacf();\n const arr1 = new Array(3);\n const arr2 = new Array(3);\n const cachedSatBounds = new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)();\n const cachedSatBounds2 = new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)();\n const cachedAxis = new (0, $e06gU.Vector3)();\n const dir = new (0, $e06gU.Vector3)();\n const dir1 = new (0, $e06gU.Vector3)();\n const dir2 = new (0, $e06gU.Vector3)();\n const tempDir = new (0, $e06gU.Vector3)();\n const edge = new (0, $e06gU.Line3)();\n const edge1 = new (0, $e06gU.Line3)();\n const edge2 = new (0, $e06gU.Line3)();\n const tempPoint = new (0, $e06gU.Vector3)();\n function triIntersectPlane(tri, plane, targetEdge) {\n // find the edge that intersects the other triangle plane\n const points = tri.points;\n let count = 0;\n let startPointIntersection = -1;\n for(let i = 0; i < 3; i++){\n const { start: start, end: end } = edge;\n start.copy(points[i]);\n end.copy(points[(i + 1) % 3]);\n edge.delta(dir);\n const startIntersects = $277ed51eec8cb2f4$var$isNearZero(plane.distanceToPoint(start));\n if ($277ed51eec8cb2f4$var$isNearZero(plane.normal.dot(dir)) && startIntersects) {\n // if the edge lies on the plane then take the line\n targetEdge.copy(edge);\n count = 2;\n break;\n }\n // check if the start point is near the plane because \"intersectLine\" is not robust to that case\n const doesIntersect = plane.intersectLine(edge, tempPoint);\n if (!doesIntersect && startIntersects) tempPoint.copy(start);\n // ignore the end point\n if ((doesIntersect || startIntersects) && !$277ed51eec8cb2f4$var$isNearZero(tempPoint.distanceTo(end))) {\n if (count <= 1) {\n // assign to the start or end point and save which index was snapped to\n // the start point if necessary\n const point = count === 1 ? targetEdge.start : targetEdge.end;\n point.copy(tempPoint);\n if (startIntersects) startPointIntersection = count;\n } else if (count >= 2) {\n // if we're here that means that there must have been one point that had\n // snapped to the start point so replace it here\n const point = startPointIntersection === 1 ? targetEdge.start : targetEdge.end;\n point.copy(tempPoint);\n count = 2;\n break;\n }\n count++;\n if (count === 2 && startPointIntersection === -1) break;\n }\n }\n return count;\n }\n // TODO: If the triangles are coplanar and intersecting the target is nonsensical. It should at least\n // be a line contained by both triangles if not a different special case somehow represented in the return result.\n return function intersectsTriangle(other, target = null, suppressLog = false) {\n if (this.needsUpdate) this.update();\n if (!other.isExtendedTriangle) {\n saTri2.copy(other);\n saTri2.update();\n other = saTri2;\n } else if (other.needsUpdate) other.update();\n const plane1 = this.plane;\n const plane2 = other.plane;\n if (Math.abs(plane1.normal.dot(plane2.normal)) > 1.0 - 1e-10) {\n // perform separating axis intersection test only for coplanar triangles\n const satBounds1 = this.satBounds;\n const satAxes1 = this.satAxes;\n arr2[0] = other.a;\n arr2[1] = other.b;\n arr2[2] = other.c;\n for(let i = 0; i < 4; i++){\n const sb = satBounds1[i];\n const sa = satAxes1[i];\n cachedSatBounds.setFromPoints(sa, arr2);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n const satBounds2 = other.satBounds;\n const satAxes2 = other.satAxes;\n arr1[0] = this.a;\n arr1[1] = this.b;\n arr1[2] = this.c;\n for(let i = 0; i < 4; i++){\n const sb = satBounds2[i];\n const sa = satAxes2[i];\n cachedSatBounds.setFromPoints(sa, arr1);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n // check crossed axes\n for(let i = 0; i < 4; i++){\n const sa1 = satAxes1[i];\n for(let i2 = 0; i2 < 4; i2++){\n const sa2 = satAxes2[i2];\n cachedAxis.crossVectors(sa1, sa2);\n cachedSatBounds.setFromPoints(cachedAxis, arr1);\n cachedSatBounds2.setFromPoints(cachedAxis, arr2);\n if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;\n }\n }\n if (target) {\n // TODO find two points that intersect on the edges and make that the result\n if (!suppressLog) console.warn(\"ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.\");\n target.start.set(0, 0, 0);\n target.end.set(0, 0, 0);\n }\n return true;\n } else {\n // find the edge that intersects the other triangle plane\n const count1 = triIntersectPlane(this, plane2, edge1);\n if (count1 === 1 && other.containsPoint(edge1.end)) {\n if (target) {\n target.start.copy(edge1.end);\n target.end.copy(edge1.end);\n }\n return true;\n } else if (count1 !== 2) return false;\n // find the other triangles edge that intersects this plane\n const count2 = triIntersectPlane(other, plane1, edge2);\n if (count2 === 1 && this.containsPoint(edge2.end)) {\n if (target) {\n target.start.copy(edge2.end);\n target.end.copy(edge2.end);\n }\n return true;\n } else if (count2 !== 2) return false;\n // find swap the second edge so both lines are running the same direction\n edge1.delta(dir1);\n edge2.delta(dir2);\n if (dir1.dot(dir2) < 0) {\n let tmp = edge2.start;\n edge2.start = edge2.end;\n edge2.end = tmp;\n }\n // check if the edges are overlapping\n const s1 = edge1.start.dot(dir1);\n const e1 = edge1.end.dot(dir1);\n const s2 = edge2.start.dot(dir1);\n const e2 = edge2.end.dot(dir1);\n const separated1 = e1 < s2;\n const separated2 = s1 < e2;\n if (s1 !== e2 && s2 !== e1 && separated1 === separated2) return false;\n // assign the target output\n if (target) {\n tempDir.subVectors(edge1.start, edge2.start);\n if (tempDir.dot(dir1) > 0) target.start.copy(edge1.start);\n else target.start.copy(edge2.start);\n tempDir.subVectors(edge1.end, edge2.end);\n if (tempDir.dot(dir1) < 0) target.end.copy(edge1.end);\n else target.end.copy(edge2.end);\n }\n return true;\n }\n };\n}();\n$277ed51eec8cb2f4$export$a37f7ec1c23dfacf.prototype.distanceToPoint = function() {\n const target = new (0, $e06gU.Vector3)();\n return function distanceToPoint(point) {\n this.closestPointToPoint(point, target);\n return point.distanceTo(target);\n };\n}();\n$277ed51eec8cb2f4$export$a37f7ec1c23dfacf.prototype.distanceToTriangle = function() {\n const point = new (0, $e06gU.Vector3)();\n const point2 = new (0, $e06gU.Vector3)();\n const cornerFields = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const line1 = new (0, $e06gU.Line3)();\n const line2 = new (0, $e06gU.Line3)();\n return function distanceToTriangle(other, target1 = null, target2 = null) {\n const lineTarget = target1 || target2 ? line1 : null;\n if (this.intersectsTriangle(other, lineTarget)) {\n if (target1 || target2) {\n if (target1) lineTarget.getCenter(target1);\n if (target2) lineTarget.getCenter(target2);\n }\n return 0;\n }\n let closestDistanceSq = Infinity;\n // check all point distances\n for(let i = 0; i < 3; i++){\n let dist;\n const field = cornerFields[i];\n const otherVec = other[field];\n this.closestPointToPoint(otherVec, point);\n dist = otherVec.distanceToSquared(point);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point);\n if (target2) target2.copy(otherVec);\n }\n const thisVec = this[field];\n other.closestPointToPoint(thisVec, point);\n dist = thisVec.distanceToSquared(point);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(thisVec);\n if (target2) target2.copy(point);\n }\n }\n for(let i = 0; i < 3; i++){\n const f11 = cornerFields[i];\n const f12 = cornerFields[(i + 1) % 3];\n line1.set(this[f11], this[f12]);\n for(let i2 = 0; i2 < 3; i2++){\n const f21 = cornerFields[i2];\n const f22 = cornerFields[(i2 + 1) % 3];\n line2.set(other[f21], other[f22]);\n (0, $1300ab831e41e936$export$b09f296caca7547a)(line1, line2, point, point2);\n const dist = point.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point);\n if (target2) target2.copy(point2);\n }\n }\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n\n\n\nclass $2210a8ccded54a38$export$4ccecd8ac6ee0e58 {\n constructor(min, max, matrix){\n this.isOrientedBox = true;\n this.min = new (0, $e06gU.Vector3)();\n this.max = new (0, $e06gU.Vector3)();\n this.matrix = new (0, $e06gU.Matrix4)();\n this.invMatrix = new (0, $e06gU.Matrix4)();\n this.points = new Array(8).fill().map(()=>new (0, $e06gU.Vector3)());\n this.satAxes = new Array(3).fill().map(()=>new (0, $e06gU.Vector3)());\n this.satBounds = new Array(3).fill().map(()=>new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)());\n this.alignedSatBounds = new Array(3).fill().map(()=>new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)());\n this.needsUpdate = false;\n if (min) this.min.copy(min);\n if (max) this.max.copy(max);\n if (matrix) this.matrix.copy(matrix);\n }\n set(min, max, matrix) {\n this.min.copy(min);\n this.max.copy(max);\n this.matrix.copy(matrix);\n this.needsUpdate = true;\n }\n copy(other) {\n this.min.copy(other.min);\n this.max.copy(other.max);\n this.matrix.copy(other.matrix);\n this.needsUpdate = true;\n }\n}\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.update = function() {\n return function update() {\n const matrix = this.matrix;\n const min = this.min;\n const max = this.max;\n const points = this.points;\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n const i = 1 * x | 2 * y | 4 * z;\n const v = points[i];\n v.x = x ? max.x : min.x;\n v.y = y ? max.y : min.y;\n v.z = z ? max.z : min.z;\n v.applyMatrix4(matrix);\n }\n }\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n const minVec = points[0];\n for(let i = 0; i < 3; i++){\n const axis = satAxes[i];\n const sb = satBounds[i];\n const index = 1 << i;\n const pi = points[index];\n axis.subVectors(minVec, pi);\n sb.setFromPoints(axis, points);\n }\n const alignedSatBounds = this.alignedSatBounds;\n alignedSatBounds[0].setFromPointsField(points, \"x\");\n alignedSatBounds[1].setFromPointsField(points, \"y\");\n alignedSatBounds[2].setFromPointsField(points, \"z\");\n this.invMatrix.copy(this.matrix).invert();\n this.needsUpdate = false;\n };\n}();\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.intersectsBox = function() {\n const aabbBounds = new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)();\n return function intersectsBox(box) {\n // TODO: should this be doing SAT against the AABB?\n if (this.needsUpdate) this.update();\n const min = box.min;\n const max = box.max;\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n const alignedSatBounds = this.alignedSatBounds;\n aabbBounds.min = min.x;\n aabbBounds.max = max.x;\n if (alignedSatBounds[0].isSeparated(aabbBounds)) return false;\n aabbBounds.min = min.y;\n aabbBounds.max = max.y;\n if (alignedSatBounds[1].isSeparated(aabbBounds)) return false;\n aabbBounds.min = min.z;\n aabbBounds.max = max.z;\n if (alignedSatBounds[2].isSeparated(aabbBounds)) return false;\n for(let i = 0; i < 3; i++){\n const axis = satAxes[i];\n const sb = satBounds[i];\n aabbBounds.setFromBox(axis, box);\n if (sb.isSeparated(aabbBounds)) return false;\n }\n return true;\n };\n}();\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.intersectsTriangle = function() {\n const saTri = new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\n const pointsArr = new Array(3);\n const cachedSatBounds = new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)();\n const cachedSatBounds2 = new (0, $34f95eced4ec08e7$export$f758e41ecdcd8e69)();\n const cachedAxis = new (0, $e06gU.Vector3)();\n return function intersectsTriangle(triangle) {\n if (this.needsUpdate) this.update();\n if (!triangle.isExtendedTriangle) {\n saTri.copy(triangle);\n saTri.update();\n triangle = saTri;\n } else if (triangle.needsUpdate) triangle.update();\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n pointsArr[0] = triangle.a;\n pointsArr[1] = triangle.b;\n pointsArr[2] = triangle.c;\n for(let i = 0; i < 3; i++){\n const sb = satBounds[i];\n const sa = satAxes[i];\n cachedSatBounds.setFromPoints(sa, pointsArr);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n const triSatBounds = triangle.satBounds;\n const triSatAxes = triangle.satAxes;\n const points = this.points;\n for(let i = 0; i < 3; i++){\n const sb = triSatBounds[i];\n const sa = triSatAxes[i];\n cachedSatBounds.setFromPoints(sa, points);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n // check crossed axes\n for(let i = 0; i < 3; i++){\n const sa1 = satAxes[i];\n for(let i2 = 0; i2 < 4; i2++){\n const sa2 = triSatAxes[i2];\n cachedAxis.crossVectors(sa1, sa2);\n cachedSatBounds.setFromPoints(cachedAxis, pointsArr);\n cachedSatBounds2.setFromPoints(cachedAxis, points);\n if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;\n }\n }\n return true;\n };\n}();\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.closestPointToPoint = function() {\n return function closestPointToPoint(point, target1) {\n if (this.needsUpdate) this.update();\n target1.copy(point).applyMatrix4(this.invMatrix).clamp(this.min, this.max).applyMatrix4(this.matrix);\n return target1;\n };\n}();\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.distanceToPoint = function() {\n const target = new (0, $e06gU.Vector3)();\n return function distanceToPoint(point) {\n this.closestPointToPoint(point, target);\n return point.distanceTo(target);\n };\n}();\n$2210a8ccded54a38$export$4ccecd8ac6ee0e58.prototype.distanceToBox = function() {\n const xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n ];\n const segments1 = new Array(12).fill().map(()=>new (0, $e06gU.Line3)());\n const segments2 = new Array(12).fill().map(()=>new (0, $e06gU.Line3)());\n const point1 = new (0, $e06gU.Vector3)();\n const point2 = new (0, $e06gU.Vector3)();\n // early out if we find a value below threshold\n return function distanceToBox(box, threshold = 0, target1 = null, target2 = null) {\n if (this.needsUpdate) this.update();\n if (this.intersectsBox(box)) {\n if (target1 || target2) {\n box.getCenter(point2);\n this.closestPointToPoint(point2, point1);\n box.closestPointToPoint(point1, point2);\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n }\n return 0;\n }\n const threshold2 = threshold * threshold;\n const min = box.min;\n const max = box.max;\n const points = this.points;\n // iterate over every edge and compare distances\n let closestDistanceSq = Infinity;\n // check over all these points\n for(let i = 0; i < 8; i++){\n const p = points[i];\n point2.copy(p).clamp(min, max);\n const dist = p.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(p);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n // generate and check all line segment distances\n let count = 0;\n for(let i = 0; i < 3; i++){\n for(let i1 = 0; i1 <= 1; i1++)for(let i2 = 0; i2 <= 1; i2++){\n const nextIndex = (i + 1) % 3;\n const nextIndex2 = (i + 2) % 3;\n // get obb line segments\n const index = i1 << nextIndex | i2 << nextIndex2;\n const index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n const p1 = points[index];\n const p2 = points[index2];\n const line1 = segments1[count];\n line1.set(p1, p2);\n // get aabb line segments\n const f1 = xyzFields[i];\n const f2 = xyzFields[nextIndex];\n const f3 = xyzFields[nextIndex2];\n const line2 = segments2[count];\n const start = line2.start;\n const end = line2.end;\n start[f1] = min[f1];\n start[f2] = i1 ? min[f2] : max[f2];\n start[f3] = i2 ? min[f3] : max[f2];\n end[f1] = max[f1];\n end[f2] = i1 ? min[f2] : max[f2];\n end[f3] = i2 ? min[f3] : max[f2];\n count++;\n }\n }\n // check all the other boxes point\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n point2.x = x ? max.x : min.x;\n point2.y = y ? max.y : min.y;\n point2.z = z ? max.z : min.z;\n this.closestPointToPoint(point2, point1);\n const dist = point2.distanceToSquared(point1);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n }\n for(let i = 0; i < 12; i++){\n const l1 = segments1[i];\n for(let i2 = 0; i2 < 12; i2++){\n const l2 = segments2[i2];\n (0, $1300ab831e41e936$export$b09f296caca7547a)(l1, l2, point1, point2);\n const dist = point1.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n\n\n\n\nclass $4a3ee1d4de1c7643$export$bf300c504651112a {\n constructor(getNewPrimitive){\n this._getNewPrimitive = getNewPrimitive;\n this._primitives = [];\n }\n getPrimitive() {\n const primitives = this._primitives;\n if (primitives.length === 0) return this._getNewPrimitive();\n else return primitives.pop();\n }\n releasePrimitive(primitive) {\n this._primitives.push(primitive);\n }\n}\n\n\nclass $a7a12bd8496afd7c$var$ExtendedTrianglePoolBase extends (0, $4a3ee1d4de1c7643$export$bf300c504651112a) {\n constructor(){\n super(()=>new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)());\n }\n}\nconst $a7a12bd8496afd7c$export$2622f4315304edad = /* @__PURE__ */ new $a7a12bd8496afd7c$var$ExtendedTrianglePoolBase();\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\nfunction $8c79b2483f36f80e$export$bc7cbaf27fbe938e(n16, uint16Array) {\n return uint16Array[n16 + 15] === 0xFFFF;\n}\nfunction $8c79b2483f36f80e$export$3231e969238304f3(n32, uint32Array) {\n return uint32Array[n32 + 6];\n}\nfunction $8c79b2483f36f80e$export$d61684373eacdf61(n16, uint16Array) {\n return uint16Array[n16 + 14];\n}\nfunction $8c79b2483f36f80e$export$7a68bc00425859d(n32) {\n return n32 + 8;\n}\nfunction $8c79b2483f36f80e$export$4f44f52d9f75fa31(n32, uint32Array) {\n return uint32Array[n32 + 6];\n}\nfunction $8c79b2483f36f80e$export$b43717b3ca95505(n32, uint32Array) {\n return uint32Array[n32 + 7];\n}\nfunction $8c79b2483f36f80e$export$b5b7e27a1440579d(n32) {\n return n32;\n}\n\n\nclass $00672725876edc9e$var$_BufferStack {\n constructor(){\n this.float32Array = null;\n this.uint16Array = null;\n this.uint32Array = null;\n const stack = [];\n let prevBuffer = null;\n this.setBuffer = (buffer)=>{\n if (prevBuffer) stack.push(prevBuffer);\n prevBuffer = buffer;\n this.float32Array = new Float32Array(buffer);\n this.uint16Array = new Uint16Array(buffer);\n this.uint32Array = new Uint32Array(buffer);\n };\n this.clearBuffer = ()=>{\n prevBuffer = null;\n this.float32Array = null;\n this.uint16Array = null;\n this.uint32Array = null;\n if (stack.length !== 0) this.setBuffer(stack.pop());\n };\n }\n}\nconst $00672725876edc9e$export$7451c73ce907854f = new $00672725876edc9e$var$_BufferStack();\n\n\nlet $59a851f097f5ef7e$var$_box1, $59a851f097f5ef7e$var$_box2;\nconst $59a851f097f5ef7e$var$boxStack = [];\nconst $59a851f097f5ef7e$var$boxPool = /* @__PURE__ */ new (0, $4a3ee1d4de1c7643$export$bf300c504651112a)(()=>new (0, $e06gU.Box3)());\nfunction $59a851f097f5ef7e$export$963c78622ed2c172(bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset) {\n // setup\n $59a851f097f5ef7e$var$_box1 = $59a851f097f5ef7e$var$boxPool.getPrimitive();\n $59a851f097f5ef7e$var$_box2 = $59a851f097f5ef7e$var$boxPool.getPrimitive();\n $59a851f097f5ef7e$var$boxStack.push($59a851f097f5ef7e$var$_box1, $59a851f097f5ef7e$var$_box2);\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n const result = $59a851f097f5ef7e$var$shapecastTraverse(0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);\n // cleanup\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n $59a851f097f5ef7e$var$boxPool.releasePrimitive($59a851f097f5ef7e$var$_box1);\n $59a851f097f5ef7e$var$boxPool.releasePrimitive($59a851f097f5ef7e$var$_box2);\n $59a851f097f5ef7e$var$boxStack.pop();\n $59a851f097f5ef7e$var$boxStack.pop();\n const length = $59a851f097f5ef7e$var$boxStack.length;\n if (length > 0) {\n $59a851f097f5ef7e$var$_box2 = $59a851f097f5ef7e$var$boxStack[length - 1];\n $59a851f097f5ef7e$var$_box1 = $59a851f097f5ef7e$var$boxStack[length - 2];\n }\n return result;\n}\nfunction $59a851f097f5ef7e$var$shapecastTraverse(nodeIndex32, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc = null, nodeIndexByteOffset = 0, depth = 0) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(nodeIndex32), float32Array, $59a851f097f5ef7e$var$_box1);\n return intersectsRangeFunc(offset, count, false, depth, nodeIndexByteOffset + nodeIndex32, $59a851f097f5ef7e$var$_box1);\n } else {\n const left = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n const right = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n let c1 = left;\n let c2 = right;\n let score1, score2;\n let box1, box2;\n if (nodeScoreFunc) {\n box1 = $59a851f097f5ef7e$var$_box1;\n box2 = $59a851f097f5ef7e$var$_box2;\n // bounding data is not offset\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(c1), float32Array, box1);\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(c2), float32Array, box2);\n score1 = nodeScoreFunc(box1);\n score2 = nodeScoreFunc(box2);\n if (score2 < score1) {\n c1 = right;\n c2 = left;\n const temp = score1;\n score1 = score2;\n score2 = temp;\n box1 = box2;\n // box2 is always set before use below\n }\n }\n // Check box 1 intersection\n if (!box1) {\n box1 = $59a851f097f5ef7e$var$_box1;\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(c1), float32Array, box1);\n }\n const isC1Leaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(c1 * 2, uint16Array);\n const c1Intersection = intersectsBoundsFunc(box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1);\n let c1StopTraversal;\n if (c1Intersection === (0, $bc798809290ffd6b$export$82ad94f0a038b67a)) {\n const offset = getLeftOffset(c1);\n const end = getRightEndOffset(c1);\n const count = end - offset;\n c1StopTraversal = intersectsRangeFunc(offset, count, true, depth + 1, nodeIndexByteOffset + c1, box1);\n } else c1StopTraversal = c1Intersection && $59a851f097f5ef7e$var$shapecastTraverse(c1, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, nodeIndexByteOffset, depth + 1);\n if (c1StopTraversal) return true;\n // Check box 2 intersection\n // cached box2 will have been overwritten by previous traversal\n box2 = $59a851f097f5ef7e$var$_box2;\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(c2), float32Array, box2);\n const isC2Leaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(c2 * 2, uint16Array);\n const c2Intersection = intersectsBoundsFunc(box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2);\n let c2StopTraversal;\n if (c2Intersection === (0, $bc798809290ffd6b$export$82ad94f0a038b67a)) {\n const offset = getLeftOffset(c2);\n const end = getRightEndOffset(c2);\n const count = end - offset;\n c2StopTraversal = intersectsRangeFunc(offset, count, true, depth + 1, nodeIndexByteOffset + c2, box2);\n } else c2StopTraversal = c2Intersection && $59a851f097f5ef7e$var$shapecastTraverse(c2, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, nodeIndexByteOffset, depth + 1);\n if (c2StopTraversal) return true;\n return false;\n // Define these inside the function so it has access to the local variables needed\n // when converting to the buffer equivalents\n function getLeftOffset(nodeIndex32) {\n const { uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n // traverse until we find a leaf\n while(!(0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array)){\n nodeIndex32 = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n nodeIndex16 = nodeIndex32 * 2;\n }\n return (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n }\n function getRightEndOffset(nodeIndex32) {\n const { uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n // traverse until we find a leaf\n while(!(0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array)){\n // adjust offset to point to the right node\n nodeIndex32 = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n nodeIndex16 = nodeIndex32 * 2;\n }\n // return the end offset of the triangle range\n return (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array) + (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n }\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $452345387fe1f65a$var$temp = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $452345387fe1f65a$var$temp1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $452345387fe1f65a$export$96ec44700e587d99(bvh, point, target = {}, minThreshold = 0, maxThreshold = Infinity) {\n // early out if under minThreshold\n // skip checking if over maxThreshold\n // set minThreshold = maxThreshold to quickly check if a point is within a threshold\n // returns Infinity if no value found\n const minThresholdSq = minThreshold * minThreshold;\n const maxThresholdSq = maxThreshold * maxThreshold;\n let closestDistanceSq = Infinity;\n let closestDistanceTriIndex = null;\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n $452345387fe1f65a$var$temp.copy(point).clamp(box.min, box.max);\n return $452345387fe1f65a$var$temp.distanceToSquared(point);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistanceSq && score < maxThresholdSq;\n },\n intersectsTriangle: (tri, triIndex)=>{\n tri.closestPointToPoint(point, $452345387fe1f65a$var$temp);\n const distSq = point.distanceToSquared($452345387fe1f65a$var$temp);\n if (distSq < closestDistanceSq) {\n $452345387fe1f65a$var$temp1.copy($452345387fe1f65a$var$temp);\n closestDistanceSq = distSq;\n closestDistanceTriIndex = triIndex;\n }\n if (distSq < minThresholdSq) return true;\n else return false;\n }\n });\n if (closestDistanceSq === Infinity) return null;\n const closestDistance = Math.sqrt(closestDistanceSq);\n if (!target.point) target.point = $452345387fe1f65a$var$temp1.clone();\n else target.point.copy($452345387fe1f65a$var$temp1);\n target.distance = closestDistance, target.faceIndex = closestDistanceTriIndex;\n return target;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n// Ripped and modified From THREE.js Mesh raycast\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\nconst $7db34e138f2585de$var$_vA = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_vB = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_vC = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_uvA = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nconst $7db34e138f2585de$var$_uvB = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nconst $7db34e138f2585de$var$_uvC = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nconst $7db34e138f2585de$var$_normalA = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_normalB = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_normalC = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $7db34e138f2585de$var$_intersectionPoint = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $7db34e138f2585de$var$checkIntersection(ray, pA, pB, pC, point, side) {\n let intersect;\n if (side === (0, $e06gU.BackSide)) intersect = ray.intersectTriangle(pC, pB, pA, true, point);\n else intersect = ray.intersectTriangle(pA, pB, pC, side !== (0, $e06gU.DoubleSide), point);\n if (intersect === null) return null;\n const distance = ray.origin.distanceTo(point);\n return {\n distance: distance,\n point: point.clone()\n };\n}\nfunction $7db34e138f2585de$var$checkBufferGeometryIntersection(ray, position, normal, uv, uv1, a, b, c, side) {\n $7db34e138f2585de$var$_vA.fromBufferAttribute(position, a);\n $7db34e138f2585de$var$_vB.fromBufferAttribute(position, b);\n $7db34e138f2585de$var$_vC.fromBufferAttribute(position, c);\n const intersection = $7db34e138f2585de$var$checkIntersection(ray, $7db34e138f2585de$var$_vA, $7db34e138f2585de$var$_vB, $7db34e138f2585de$var$_vC, $7db34e138f2585de$var$_intersectionPoint, side);\n if (intersection) {\n if (uv) {\n $7db34e138f2585de$var$_uvA.fromBufferAttribute(uv, a);\n $7db34e138f2585de$var$_uvB.fromBufferAttribute(uv, b);\n $7db34e138f2585de$var$_uvC.fromBufferAttribute(uv, c);\n intersection.uv = (0, $e06gU.Triangle).getInterpolation($7db34e138f2585de$var$_intersectionPoint, $7db34e138f2585de$var$_vA, $7db34e138f2585de$var$_vB, $7db34e138f2585de$var$_vC, $7db34e138f2585de$var$_uvA, $7db34e138f2585de$var$_uvB, $7db34e138f2585de$var$_uvC, new (0, $e06gU.Vector2)());\n }\n if (uv1) {\n $7db34e138f2585de$var$_uvA.fromBufferAttribute(uv1, a);\n $7db34e138f2585de$var$_uvB.fromBufferAttribute(uv1, b);\n $7db34e138f2585de$var$_uvC.fromBufferAttribute(uv1, c);\n intersection.uv1 = (0, $e06gU.Triangle).getInterpolation($7db34e138f2585de$var$_intersectionPoint, $7db34e138f2585de$var$_vA, $7db34e138f2585de$var$_vB, $7db34e138f2585de$var$_vC, $7db34e138f2585de$var$_uvA, $7db34e138f2585de$var$_uvB, $7db34e138f2585de$var$_uvC, new (0, $e06gU.Vector2)());\n }\n if (normal) {\n $7db34e138f2585de$var$_normalA.fromBufferAttribute(normal, a);\n $7db34e138f2585de$var$_normalB.fromBufferAttribute(normal, b);\n $7db34e138f2585de$var$_normalC.fromBufferAttribute(normal, c);\n intersection.normal = (0, $e06gU.Triangle).getInterpolation($7db34e138f2585de$var$_intersectionPoint, $7db34e138f2585de$var$_vA, $7db34e138f2585de$var$_vB, $7db34e138f2585de$var$_vC, $7db34e138f2585de$var$_normalA, $7db34e138f2585de$var$_normalB, $7db34e138f2585de$var$_normalC, new (0, $e06gU.Vector3)());\n if (intersection.normal.dot(ray.direction) > 0) intersection.normal.multiplyScalar(-1);\n }\n const face = {\n a: a,\n b: b,\n c: c,\n normal: new (0, $e06gU.Vector3)(),\n materialIndex: 0\n };\n (0, $e06gU.Triangle).getNormal($7db34e138f2585de$var$_vA, $7db34e138f2585de$var$_vB, $7db34e138f2585de$var$_vC, face.normal);\n intersection.face = face;\n intersection.faceIndex = a;\n }\n return intersection;\n}\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\nfunction $7db34e138f2585de$export$1a557053019a130b(geo, side, ray, tri, intersections) {\n const triOffset = tri * 3;\n let a = triOffset + 0;\n let b = triOffset + 1;\n let c = triOffset + 2;\n const index = geo.index;\n if (geo.index) {\n a = index.getX(a);\n b = index.getX(b);\n c = index.getX(c);\n }\n const { position: position, normal: normal, uv: uv, uv1: uv1 } = geo.attributes;\n const intersection = $7db34e138f2585de$var$checkBufferGeometryIntersection(ray, position, normal, uv, uv1, a, b, c, side);\n if (intersection) {\n intersection.faceIndex = tri;\n if (intersections) intersections.push(intersection);\n return intersection;\n }\n return null;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nfunction $eb6f5960b3eb8549$export$32f7fa781964ae30(tri, i, index, pos) {\n const ta = tri.a;\n const tb = tri.b;\n const tc = tri.c;\n let i0 = i;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n ta.x = pos.getX(i0);\n ta.y = pos.getY(i0);\n ta.z = pos.getZ(i0);\n tb.x = pos.getX(i1);\n tb.y = pos.getY(i1);\n tb.z = pos.getZ(i1);\n tc.x = pos.getX(i2);\n tc.y = pos.getY(i2);\n tc.z = pos.getZ(i2);\n}\nconst $eb6f5960b3eb8549$var$tempV1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $eb6f5960b3eb8549$var$tempV2 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $eb6f5960b3eb8549$var$tempV3 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $eb6f5960b3eb8549$var$tempUV1 = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nconst $eb6f5960b3eb8549$var$tempUV2 = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nconst $eb6f5960b3eb8549$var$tempUV3 = /* @__PURE__ */ new (0, $e06gU.Vector2)();\nfunction $eb6f5960b3eb8549$export$d3cf03f2575167ef(point, geometry, triangleIndex, target) {\n const indices = geometry.getIndex().array;\n const positions = geometry.getAttribute(\"position\");\n const uvs = geometry.getAttribute(\"uv\");\n const a = indices[triangleIndex * 3];\n const b = indices[triangleIndex * 3 + 1];\n const c = indices[triangleIndex * 3 + 2];\n $eb6f5960b3eb8549$var$tempV1.fromBufferAttribute(positions, a);\n $eb6f5960b3eb8549$var$tempV2.fromBufferAttribute(positions, b);\n $eb6f5960b3eb8549$var$tempV3.fromBufferAttribute(positions, c);\n // find the associated material index\n let materialIndex = 0;\n const groups = geometry.groups;\n const firstVertexIndex = triangleIndex * 3;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n const { start: start, count: count } = group;\n if (firstVertexIndex >= start && firstVertexIndex < start + count) {\n materialIndex = group.materialIndex;\n break;\n }\n }\n // extract uvs\n let uv = null;\n if (uvs) {\n $eb6f5960b3eb8549$var$tempUV1.fromBufferAttribute(uvs, a);\n $eb6f5960b3eb8549$var$tempUV2.fromBufferAttribute(uvs, b);\n $eb6f5960b3eb8549$var$tempUV3.fromBufferAttribute(uvs, c);\n if (target && target.uv) uv = target.uv;\n else uv = new (0, $e06gU.Vector2)();\n (0, $e06gU.Triangle).getInterpolation(point, $eb6f5960b3eb8549$var$tempV1, $eb6f5960b3eb8549$var$tempV2, $eb6f5960b3eb8549$var$tempV3, $eb6f5960b3eb8549$var$tempUV1, $eb6f5960b3eb8549$var$tempUV2, $eb6f5960b3eb8549$var$tempUV3, uv);\n }\n // adjust the provided target or create a new one\n if (target) {\n if (!target.face) target.face = {};\n target.face.a = a;\n target.face.b = b;\n target.face.c = c;\n target.face.materialIndex = materialIndex;\n if (!target.face.normal) target.face.normal = new (0, $e06gU.Vector3)();\n (0, $e06gU.Triangle).getNormal($eb6f5960b3eb8549$var$tempV1, $eb6f5960b3eb8549$var$tempV2, $eb6f5960b3eb8549$var$tempV3, target.face.normal);\n if (uv) target.uv = uv;\n return target;\n } else return {\n face: {\n a: a,\n b: b,\n c: c,\n materialIndex: materialIndex,\n normal: (0, $e06gU.Triangle).getNormal($eb6f5960b3eb8549$var$tempV1, $eb6f5960b3eb8549$var$tempV2, $eb6f5960b3eb8549$var$tempV3, new (0, $e06gU.Vector3)())\n },\n uv: uv\n };\n}\n\n\n/*************************************************************/ /* This file is generated from \"iterationUtils.template.js\". */ /*************************************************************/ /* eslint-disable indent */ function $9474092dcc9c56eb$export$6f0a8fc5d2775a51(bvh, side, ray, offset, count, intersections) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n for(let i = offset, end = offset + count; i < end; i++)(0, $7db34e138f2585de$export$1a557053019a130b)(geometry, side, ray, i, intersections);\n}\nfunction $9474092dcc9c56eb$export$4331f2604b0bca4(bvh, side, ray, offset, count) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n let dist = Infinity;\n let res = null;\n for(let i = offset, end = offset + count; i < end; i++){\n let intersection;\n intersection = (0, $7db34e138f2585de$export$1a557053019a130b)(geometry, side, ray, i);\n if (intersection && intersection.distance < dist) {\n res = intersection;\n dist = intersection.distance;\n }\n }\n return res;\n}\nfunction $9474092dcc9c56eb$export$be1391b7aa79c0f6(offset, count, bvh, intersectsTriangleFunc, contained, depth, triangle) {\n const { geometry: geometry } = bvh;\n const { index: index } = geometry;\n const pos = geometry.attributes.position;\n for(let i = offset, l = count + offset; i < l; i++){\n let tri;\n tri = i;\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, tri * 3, index, pos);\n triangle.needsUpdate = true;\n if (intersectsTriangleFunc(triangle, tri, contained, depth)) return true;\n }\n return false;\n}\n\n\n\n/****************************************************/ /* This file is generated from \"refit.template.js\". */ /****************************************************/ function $d6886d66b20a1b65$export$8eb1eda96b2e6d7a(bvh, nodeIndices = null) {\n if (nodeIndices && Array.isArray(nodeIndices)) nodeIndices = new Set(nodeIndices);\n const geometry = bvh.geometry;\n const indexArr = geometry.index ? geometry.index.array : null;\n const posAttr = geometry.attributes.position;\n let buffer, uint32Array, uint16Array, float32Array;\n let byteOffset = 0;\n const roots = bvh._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n buffer = roots[i];\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n float32Array = new Float32Array(buffer);\n _traverse(0, byteOffset);\n byteOffset += buffer.byteLength;\n }\n function _traverse(node32Index, byteOffset, force = false) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $bc798809290ffd6b$export$661fddb62bfe0e42);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n for(let i = 3 * offset, l = 3 * (offset + count); i < l; i++){\n let index = indexArr[i];\n const x = posAttr.getX(index);\n const y = posAttr.getY(index);\n const z = posAttr.getZ(index);\n if (x < minx) minx = x;\n if (x > maxx) maxx = x;\n if (y < miny) miny = y;\n if (y > maxy) maxy = y;\n if (z < minz) minz = z;\n if (z > maxz) maxz = z;\n }\n if (float32Array[node32Index + 0] !== minx || float32Array[node32Index + 1] !== miny || float32Array[node32Index + 2] !== minz || float32Array[node32Index + 3] !== maxx || float32Array[node32Index + 4] !== maxy || float32Array[node32Index + 5] !== maxz) {\n float32Array[node32Index + 0] = minx;\n float32Array[node32Index + 1] = miny;\n float32Array[node32Index + 2] = minz;\n float32Array[node32Index + 3] = maxx;\n float32Array[node32Index + 4] = maxy;\n float32Array[node32Index + 5] = maxz;\n return true;\n } else return false;\n } else {\n const left = node32Index + 8;\n const right = uint32Array[node32Index + 6];\n // the identifying node indices provided by the shapecast function include offsets of all\n // root buffers to guarantee they're unique between roots so offset left and right indices here.\n const offsetLeft = left + byteOffset;\n const offsetRight = right + byteOffset;\n let forceChildren = force;\n let includesLeft = false;\n let includesRight = false;\n if (nodeIndices) // if we see that neither the left or right child are included in the set that need to be updated\n // then we assume that all children need to be updated.\n {\n if (!forceChildren) {\n includesLeft = nodeIndices.has(offsetLeft);\n includesRight = nodeIndices.has(offsetRight);\n forceChildren = !includesLeft && !includesRight;\n }\n } else {\n includesLeft = true;\n includesRight = true;\n }\n const traverseLeft = forceChildren || includesLeft;\n const traverseRight = forceChildren || includesRight;\n let leftChange = false;\n if (traverseLeft) leftChange = _traverse(left, byteOffset, forceChildren);\n let rightChange = false;\n if (traverseRight) rightChange = _traverse(right, byteOffset, forceChildren);\n const didChange = leftChange || rightChange;\n if (didChange) for(let i = 0; i < 3; i++){\n const lefti = left + i;\n const righti = right + i;\n const minLeftValue = float32Array[lefti];\n const maxLeftValue = float32Array[lefti + 3];\n const minRightValue = float32Array[righti];\n const maxRightValue = float32Array[righti + 3];\n float32Array[node32Index + i] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n float32Array[node32Index + i + 3] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n }\n return didChange;\n }\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nconst $c6fa00580fc66263$var$_boundingBox = /* @__PURE__ */ new (0, $e06gU.Box3)();\nfunction $c6fa00580fc66263$export$d5a069a08bb68982(nodeIndex32, array, ray, target) {\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)(nodeIndex32, array, $c6fa00580fc66263$var$_boundingBox);\n return ray.intersectBox($c6fa00580fc66263$var$_boundingBox, target);\n}\n\n\n\n\n\n\n/******************************************************/ /* This file is generated from \"raycast.template.js\". */ /******************************************************/ const $06f35bd135b4cbcc$var$_boxIntersection = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $06f35bd135b4cbcc$export$630e89aab3ddc1d6(bvh, root, side, ray, intersects) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n $06f35bd135b4cbcc$var$_raycast(0, bvh, side, ray, intersects);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n}\nfunction $06f35bd135b4cbcc$var$_raycast(nodeIndex32, bvh, side, ray, intersects) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n const nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n (0, $9474092dcc9c56eb$export$6f0a8fc5d2775a51)(bvh, side, ray, offset, count, intersects);\n } else {\n const leftIndex = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n if ((0, $c6fa00580fc66263$export$d5a069a08bb68982)(leftIndex, float32Array, ray, $06f35bd135b4cbcc$var$_boxIntersection)) $06f35bd135b4cbcc$var$_raycast(leftIndex, bvh, side, ray, intersects);\n const rightIndex = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n if ((0, $c6fa00580fc66263$export$d5a069a08bb68982)(rightIndex, float32Array, ray, $06f35bd135b4cbcc$var$_boxIntersection)) $06f35bd135b4cbcc$var$_raycast(rightIndex, bvh, side, ray, intersects);\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n\n/***********************************************************/ /* This file is generated from \"raycastFirst.template.js\". */ /***********************************************************/ const $8094198f7e753a2d$var$_boxIntersection = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $8094198f7e753a2d$var$_xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n];\nfunction $8094198f7e753a2d$export$1fa457bc72ef1a2a(bvh, root, side, ray) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n const result = $8094198f7e753a2d$var$_raycastFirst(0, bvh, side, ray);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n return result;\n}\nfunction $8094198f7e753a2d$var$_raycastFirst(nodeIndex32, bvh, side, ray) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n return (0, $9474092dcc9c56eb$export$4331f2604b0bca4)(bvh, side, ray, offset, count);\n } else {\n // consider the position of the split plane with respect to the oncoming ray; whichever direction\n // the ray is coming from, look for an intersection among that side of the tree first\n const splitAxis = (0, $8c79b2483f36f80e$export$b43717b3ca95505)(nodeIndex32, uint32Array);\n const xyzAxis = $8094198f7e753a2d$var$_xyzFields[splitAxis];\n const rayDir = ray.direction[xyzAxis];\n const leftToRight = rayDir >= 0;\n // c1 is the child to check first\n let c1, c2;\n if (leftToRight) {\n c1 = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n c2 = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n } else {\n c1 = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n c2 = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n }\n const c1Intersection = (0, $c6fa00580fc66263$export$d5a069a08bb68982)(c1, float32Array, ray, $8094198f7e753a2d$var$_boxIntersection);\n const c1Result = c1Intersection ? $8094198f7e753a2d$var$_raycastFirst(c1, bvh, side, ray) : null;\n // if we got an intersection in the first node and it's closer than the second node's bounding\n // box, we don't need to consider the second node because it couldn't possibly be a better result\n if (c1Result) {\n // check if the point is within the second bounds\n // \"point\" is in the local frame of the bvh\n const point = c1Result.point[xyzAxis];\n const isOutside = leftToRight ? point <= float32Array[c2 + splitAxis] : point >= float32Array[c2 + splitAxis + 3]; // max bounding data\n if (isOutside) return c1Result;\n }\n // either there was no intersection in the first node, or there could still be a closer\n // intersection in the second, so check the second node and then take the better of the two\n const c2Intersection = (0, $c6fa00580fc66263$export$d5a069a08bb68982)(c2, float32Array, ray, $8094198f7e753a2d$var$_boxIntersection);\n const c2Result = c2Intersection ? $8094198f7e753a2d$var$_raycastFirst(c2, bvh, side, ray) : null;\n if (c1Result && c2Result) return c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n else return c1Result || c2Result || null;\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n\n\n/*****************************************************************/ /* This file is generated from \"intersectsGeometry.template.js\". */ /*****************************************************************/ /* eslint-disable indent */ const $40028eca76a25282$var$boundingBox = /* @__PURE__ */ new (0, $e06gU.Box3)();\nconst $40028eca76a25282$var$triangle = /* @__PURE__ */ new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $40028eca76a25282$var$triangle2 = /* @__PURE__ */ new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $40028eca76a25282$var$invertedMat = /* @__PURE__ */ new (0, $e06gU.Matrix4)();\nconst $40028eca76a25282$var$obb = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $40028eca76a25282$var$obb2 = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nfunction $40028eca76a25282$export$b2f96b0abaf94e0a(bvh, root, otherGeometry, geometryToBvh) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n const result = $40028eca76a25282$var$_intersectsGeometry(0, bvh, otherGeometry, geometryToBvh);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n return result;\n}\nfunction $40028eca76a25282$var$_intersectsGeometry(nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n if (cachedObb === null) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $40028eca76a25282$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n cachedObb = $40028eca76a25282$var$obb;\n }\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const thisGeometry = bvh.geometry;\n const thisIndex = thisGeometry.index;\n const thisPos = thisGeometry.attributes.position;\n const index = otherGeometry.index;\n const pos = otherGeometry.attributes.position;\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n // get the inverse of the geometry matrix so we can transform our triangles into the\n // geometry space we're trying to test. We assume there are fewer triangles being checked\n // here.\n $40028eca76a25282$var$invertedMat.copy(geometryToBvh).invert();\n if (otherGeometry.boundsTree) {\n // if there's a bounds tree\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(nodeIndex32), float32Array, $40028eca76a25282$var$obb2);\n $40028eca76a25282$var$obb2.matrix.copy($40028eca76a25282$var$invertedMat);\n $40028eca76a25282$var$obb2.needsUpdate = true;\n // TODO: use a triangle iteration function here\n const res = otherGeometry.boundsTree.shapecast({\n intersectsBounds: (box)=>$40028eca76a25282$var$obb2.intersectsBox(box),\n intersectsTriangle: (tri)=>{\n tri.a.applyMatrix4(geometryToBvh);\n tri.b.applyMatrix4(geometryToBvh);\n tri.c.applyMatrix4(geometryToBvh);\n tri.needsUpdate = true;\n for(let i = offset * 3, l = (count + offset) * 3; i < l; i += 3){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($40028eca76a25282$var$triangle2, i, thisIndex, thisPos);\n $40028eca76a25282$var$triangle2.needsUpdate = true;\n if (tri.intersectsTriangle($40028eca76a25282$var$triangle2)) return true;\n }\n return false;\n }\n });\n return res;\n } else // if we're just dealing with raw geometry\n for(let i = offset * 3, l = (count + offset) * 3; i < l; i += 3){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($40028eca76a25282$var$triangle, i, thisIndex, thisPos);\n $40028eca76a25282$var$triangle.a.applyMatrix4($40028eca76a25282$var$invertedMat);\n $40028eca76a25282$var$triangle.b.applyMatrix4($40028eca76a25282$var$invertedMat);\n $40028eca76a25282$var$triangle.c.applyMatrix4($40028eca76a25282$var$invertedMat);\n $40028eca76a25282$var$triangle.needsUpdate = true;\n for(let i2 = 0, l2 = index.count; i2 < l2; i2 += 3){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($40028eca76a25282$var$triangle2, i2, index, pos);\n $40028eca76a25282$var$triangle2.needsUpdate = true;\n if ($40028eca76a25282$var$triangle.intersectsTriangle($40028eca76a25282$var$triangle2)) return true;\n }\n }\n } else {\n const left = nodeIndex32 + 8;\n const right = uint32Array[nodeIndex32 + 6];\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(left), float32Array, $40028eca76a25282$var$boundingBox);\n const leftIntersection = cachedObb.intersectsBox($40028eca76a25282$var$boundingBox) && $40028eca76a25282$var$_intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (leftIntersection) return true;\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(right), float32Array, $40028eca76a25282$var$boundingBox);\n const rightIntersection = cachedObb.intersectsBox($40028eca76a25282$var$boundingBox) && $40028eca76a25282$var$_intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (rightIntersection) return true;\n return false;\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n/*********************************************************************/ /* This file is generated from \"closestPointToGeometry.template.js\". */ /*********************************************************************/ const $c82df4aa752dbd95$var$tempMatrix = /* @__PURE__ */ new (0, $e06gU.Matrix4)();\nconst $c82df4aa752dbd95$var$obb = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $c82df4aa752dbd95$var$obb2 = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $c82df4aa752dbd95$var$temp1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $c82df4aa752dbd95$var$temp2 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $c82df4aa752dbd95$var$temp3 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $c82df4aa752dbd95$var$temp4 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $c82df4aa752dbd95$export$5912902c175a555e(bvh, otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $c82df4aa752dbd95$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n $c82df4aa752dbd95$var$obb.needsUpdate = true;\n const geometry = bvh.geometry;\n const pos = geometry.attributes.position;\n const index = geometry.index;\n const otherPos = otherGeometry.attributes.position;\n const otherIndex = otherGeometry.index;\n const triangle = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n const triangle2 = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n let tempTarget1 = $c82df4aa752dbd95$var$temp1;\n let tempTargetDest1 = $c82df4aa752dbd95$var$temp2;\n let tempTarget2 = null;\n let tempTargetDest2 = null;\n if (target2) {\n tempTarget2 = $c82df4aa752dbd95$var$temp3;\n tempTargetDest2 = $c82df4aa752dbd95$var$temp4;\n }\n let closestDistance = Infinity;\n let closestDistanceTriIndex = null;\n let closestDistanceOtherTriIndex = null;\n $c82df4aa752dbd95$var$tempMatrix.copy(geometryToBvh).invert();\n $c82df4aa752dbd95$var$obb2.matrix.copy($c82df4aa752dbd95$var$tempMatrix);\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $c82df4aa752dbd95$var$obb.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n if (score < closestDistance && score < maxThreshold) {\n // if we know the triangles of this bounds will be intersected next then\n // save the bounds to use during triangle checks.\n if (isLeaf) {\n $c82df4aa752dbd95$var$obb2.min.copy(box.min);\n $c82df4aa752dbd95$var$obb2.max.copy(box.max);\n $c82df4aa752dbd95$var$obb2.needsUpdate = true;\n }\n return true;\n }\n return false;\n },\n intersectsRange: (offset, count)=>{\n if (otherGeometry.boundsTree) {\n // if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n // the closest bounds in the other geometry to check.\n const otherBvh = otherGeometry.boundsTree;\n return otherBvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $c82df4aa752dbd95$var$obb2.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistance && score < maxThreshold;\n },\n intersectsRange: (otherOffset, otherCount)=>{\n for(let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, 3 * i, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n });\n } else {\n // If no bounds tree then we'll just check every triangle.\n const triCount = (0, $512bf92b30757ce0$export$c56c51fae37b2d63)(otherGeometry);\n for(let i2 = 0, l2 = triCount; i2 < l2; i2++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, 3 * i, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n }\n });\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle);\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle2);\n if (closestDistance === Infinity) return null;\n if (!target1.point) target1.point = tempTargetDest1.clone();\n else target1.point.copy(tempTargetDest1);\n target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;\n if (target2) {\n if (!target2.point) target2.point = tempTargetDest2.clone();\n else target2.point.copy(tempTargetDest2);\n target2.point.applyMatrix4($c82df4aa752dbd95$var$tempMatrix);\n tempTargetDest1.applyMatrix4($c82df4aa752dbd95$var$tempMatrix);\n target2.distance = tempTargetDest1.sub(target2.point).length();\n target2.faceIndex = closestDistanceOtherTriIndex;\n }\n return target1;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n/******************************************************/ /* This file is generated from \"bvhcast.template.js\". */ /******************************************************/ const $15ccf80f37db9874$var$tempMatrix = new (0, $e06gU.Matrix4)();\nconst $15ccf80f37db9874$var$aabb = /* @__PURE__ */ new (0, $e06gU.Box3)();\nconst $15ccf80f37db9874$var$aabb2 = /* @__PURE__ */ new (0, $e06gU.Box3)();\nfunction $15ccf80f37db9874$export$a2253c6980b92559(bvh, otherBvh, matrixToLocal, callbacks) {\n // BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n // than an approach that walks down the tree (see bvhcast.js file for more info).\n let { intersectsRanges: intersectsRanges, intersectsTriangles: intersectsTriangles } = callbacks;\n const indexAttr = bvh.geometry.index;\n const positionAttr = bvh.geometry.attributes.position;\n const otherIndexAttr = otherBvh.geometry.index;\n const otherPositionAttr = otherBvh.geometry.attributes.position;\n $15ccf80f37db9874$var$tempMatrix.copy(matrixToLocal).invert();\n const triangle = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n const triangle2 = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n if (intersectsTriangles) {\n const iterateOverDoubleTriangles = (offset1, count1, offset2, count2, depth1, index1, depth2, index2)=>{\n for(let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, i2 * 3, otherIndexAttr, otherPositionAttr);\n triangle2.a.applyMatrix4(matrixToLocal);\n triangle2.b.applyMatrix4(matrixToLocal);\n triangle2.c.applyMatrix4(matrixToLocal);\n triangle2.needsUpdate = true;\n for(let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, i1 * 3, indexAttr, positionAttr);\n triangle.needsUpdate = true;\n if (intersectsTriangles(triangle, triangle2, i1, i2, depth1, index1, depth2, index2)) return true;\n }\n }\n return false;\n };\n if (intersectsRanges) {\n const originalIntersectsRanges = intersectsRanges;\n intersectsRanges = function(offset1, count1, offset2, count2, depth1, index1, depth2, index2) {\n if (!originalIntersectsRanges(offset1, count1, offset2, count2, depth1, index1, depth2, index2)) return iterateOverDoubleTriangles(offset1, count1, offset2, count2, depth1, index1, depth2, index2);\n return true;\n };\n } else intersectsRanges = iterateOverDoubleTriangles;\n }\n otherBvh.getBoundingBox($15ccf80f37db9874$var$aabb2);\n $15ccf80f37db9874$var$aabb2.applyMatrix4(matrixToLocal);\n const result = bvh.shapecast({\n intersectsBounds: (box)=>$15ccf80f37db9874$var$aabb2.intersectsBox(box),\n intersectsRange: (offset1, count1, contained, depth1, nodeIndex1, box)=>{\n $15ccf80f37db9874$var$aabb.copy(box);\n $15ccf80f37db9874$var$aabb.applyMatrix4($15ccf80f37db9874$var$tempMatrix);\n return otherBvh.shapecast({\n intersectsBounds: (box)=>$15ccf80f37db9874$var$aabb.intersectsBox(box),\n intersectsRange: (offset2, count2, contained, depth2, nodeIndex2)=>{\n return intersectsRanges(offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2);\n }\n });\n }\n });\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle);\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle2);\n return result;\n}\n\n\n\n\n/*************************************************************/ /* This file is generated from \"iterationUtils.template.js\". */ /*************************************************************/ /* eslint-disable indent */ function $30624a994ba6e57c$export$7e7412b9f4f11a5c(bvh, side, ray, offset, count, intersections) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n for(let i = offset, end = offset + count; i < end; i++){\n let vi = _indirectBuffer ? _indirectBuffer[i] : i;\n (0, $7db34e138f2585de$export$1a557053019a130b)(geometry, side, ray, vi, intersections);\n }\n}\nfunction $30624a994ba6e57c$export$dddff414156655a1(bvh, side, ray, offset, count) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n let dist = Infinity;\n let res = null;\n for(let i = offset, end = offset + count; i < end; i++){\n let intersection;\n intersection = (0, $7db34e138f2585de$export$1a557053019a130b)(geometry, side, ray, _indirectBuffer ? _indirectBuffer[i] : i);\n if (intersection && intersection.distance < dist) {\n res = intersection;\n dist = intersection.distance;\n }\n }\n return res;\n}\nfunction $30624a994ba6e57c$export$dae1f8efdced590b(offset, count, bvh, intersectsTriangleFunc, contained, depth, triangle) {\n const { geometry: geometry } = bvh;\n const { index: index } = geometry;\n const pos = geometry.attributes.position;\n for(let i = offset, l = count + offset; i < l; i++){\n let tri;\n tri = bvh.resolveTriangleIndex(i);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, tri * 3, index, pos);\n triangle.needsUpdate = true;\n if (intersectsTriangleFunc(triangle, tri, contained, depth)) return true;\n }\n return false;\n}\n\n\n\n/****************************************************/ /* This file is generated from \"refit.template.js\". */ /****************************************************/ function $f4d14018db659d90$export$40f4af49b81ca898(bvh, nodeIndices = null) {\n if (nodeIndices && Array.isArray(nodeIndices)) nodeIndices = new Set(nodeIndices);\n const geometry = bvh.geometry;\n const indexArr = geometry.index ? geometry.index.array : null;\n const posAttr = geometry.attributes.position;\n let buffer, uint32Array, uint16Array, float32Array;\n let byteOffset = 0;\n const roots = bvh._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n buffer = roots[i];\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n float32Array = new Float32Array(buffer);\n _traverse(0, byteOffset);\n byteOffset += buffer.byteLength;\n }\n function _traverse(node32Index, byteOffset, force = false) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $bc798809290ffd6b$export$661fddb62bfe0e42);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n for(let i = offset, l = offset + count; i < l; i++){\n const t = 3 * bvh.resolveTriangleIndex(i);\n for(let j = 0; j < 3; j++){\n let index = t + j;\n index = indexArr ? indexArr[index] : index;\n const x = posAttr.getX(index);\n const y = posAttr.getY(index);\n const z = posAttr.getZ(index);\n if (x < minx) minx = x;\n if (x > maxx) maxx = x;\n if (y < miny) miny = y;\n if (y > maxy) maxy = y;\n if (z < minz) minz = z;\n if (z > maxz) maxz = z;\n }\n }\n if (float32Array[node32Index + 0] !== minx || float32Array[node32Index + 1] !== miny || float32Array[node32Index + 2] !== minz || float32Array[node32Index + 3] !== maxx || float32Array[node32Index + 4] !== maxy || float32Array[node32Index + 5] !== maxz) {\n float32Array[node32Index + 0] = minx;\n float32Array[node32Index + 1] = miny;\n float32Array[node32Index + 2] = minz;\n float32Array[node32Index + 3] = maxx;\n float32Array[node32Index + 4] = maxy;\n float32Array[node32Index + 5] = maxz;\n return true;\n } else return false;\n } else {\n const left = node32Index + 8;\n const right = uint32Array[node32Index + 6];\n // the identifying node indices provided by the shapecast function include offsets of all\n // root buffers to guarantee they're unique between roots so offset left and right indices here.\n const offsetLeft = left + byteOffset;\n const offsetRight = right + byteOffset;\n let forceChildren = force;\n let includesLeft = false;\n let includesRight = false;\n if (nodeIndices) // if we see that neither the left or right child are included in the set that need to be updated\n // then we assume that all children need to be updated.\n {\n if (!forceChildren) {\n includesLeft = nodeIndices.has(offsetLeft);\n includesRight = nodeIndices.has(offsetRight);\n forceChildren = !includesLeft && !includesRight;\n }\n } else {\n includesLeft = true;\n includesRight = true;\n }\n const traverseLeft = forceChildren || includesLeft;\n const traverseRight = forceChildren || includesRight;\n let leftChange = false;\n if (traverseLeft) leftChange = _traverse(left, byteOffset, forceChildren);\n let rightChange = false;\n if (traverseRight) rightChange = _traverse(right, byteOffset, forceChildren);\n const didChange = leftChange || rightChange;\n if (didChange) for(let i = 0; i < 3; i++){\n const lefti = left + i;\n const righti = right + i;\n const minLeftValue = float32Array[lefti];\n const maxLeftValue = float32Array[lefti + 3];\n const minRightValue = float32Array[righti];\n const maxRightValue = float32Array[righti + 3];\n float32Array[node32Index + i] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n float32Array[node32Index + i + 3] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n }\n return didChange;\n }\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n\n/******************************************************/ /* This file is generated from \"raycast.template.js\". */ /******************************************************/ const $c34151c023e22e2c$var$_boxIntersection = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $c34151c023e22e2c$export$1999205ebe856279(bvh, root, side, ray, intersects) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n $c34151c023e22e2c$var$_raycast(0, bvh, side, ray, intersects);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n}\nfunction $c34151c023e22e2c$var$_raycast(nodeIndex32, bvh, side, ray, intersects) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n const nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n (0, $30624a994ba6e57c$export$7e7412b9f4f11a5c)(bvh, side, ray, offset, count, intersects);\n } else {\n const leftIndex = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n if ((0, $c6fa00580fc66263$export$d5a069a08bb68982)(leftIndex, float32Array, ray, $c34151c023e22e2c$var$_boxIntersection)) $c34151c023e22e2c$var$_raycast(leftIndex, bvh, side, ray, intersects);\n const rightIndex = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n if ((0, $c6fa00580fc66263$export$d5a069a08bb68982)(rightIndex, float32Array, ray, $c34151c023e22e2c$var$_boxIntersection)) $c34151c023e22e2c$var$_raycast(rightIndex, bvh, side, ray, intersects);\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n\n/***********************************************************/ /* This file is generated from \"raycastFirst.template.js\". */ /***********************************************************/ const $c27191358c129b43$var$_boxIntersection = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $c27191358c129b43$var$_xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n];\nfunction $c27191358c129b43$export$44e48d4cf2fe0609(bvh, root, side, ray) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n const result = $c27191358c129b43$var$_raycastFirst(0, bvh, side, ray);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n return result;\n}\nfunction $c27191358c129b43$var$_raycastFirst(nodeIndex32, bvh, side, ray) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n return (0, $30624a994ba6e57c$export$dddff414156655a1)(bvh, side, ray, offset, count);\n } else {\n // consider the position of the split plane with respect to the oncoming ray; whichever direction\n // the ray is coming from, look for an intersection among that side of the tree first\n const splitAxis = (0, $8c79b2483f36f80e$export$b43717b3ca95505)(nodeIndex32, uint32Array);\n const xyzAxis = $c27191358c129b43$var$_xyzFields[splitAxis];\n const rayDir = ray.direction[xyzAxis];\n const leftToRight = rayDir >= 0;\n // c1 is the child to check first\n let c1, c2;\n if (leftToRight) {\n c1 = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n c2 = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n } else {\n c1 = (0, $8c79b2483f36f80e$export$4f44f52d9f75fa31)(nodeIndex32, uint32Array);\n c2 = (0, $8c79b2483f36f80e$export$7a68bc00425859d)(nodeIndex32);\n }\n const c1Intersection = (0, $c6fa00580fc66263$export$d5a069a08bb68982)(c1, float32Array, ray, $c27191358c129b43$var$_boxIntersection);\n const c1Result = c1Intersection ? $c27191358c129b43$var$_raycastFirst(c1, bvh, side, ray) : null;\n // if we got an intersection in the first node and it's closer than the second node's bounding\n // box, we don't need to consider the second node because it couldn't possibly be a better result\n if (c1Result) {\n // check if the point is within the second bounds\n // \"point\" is in the local frame of the bvh\n const point = c1Result.point[xyzAxis];\n const isOutside = leftToRight ? point <= float32Array[c2 + splitAxis] : point >= float32Array[c2 + splitAxis + 3]; // max bounding data\n if (isOutside) return c1Result;\n }\n // either there was no intersection in the first node, or there could still be a closer\n // intersection in the second, so check the second node and then take the better of the two\n const c2Intersection = (0, $c6fa00580fc66263$export$d5a069a08bb68982)(c2, float32Array, ray, $c27191358c129b43$var$_boxIntersection);\n const c2Result = c2Intersection ? $c27191358c129b43$var$_raycastFirst(c2, bvh, side, ray) : null;\n if (c1Result && c2Result) return c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n else return c1Result || c2Result || null;\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n\n\n/*****************************************************************/ /* This file is generated from \"intersectsGeometry.template.js\". */ /*****************************************************************/ /* eslint-disable indent */ const $e7beda6ce58ad8bf$var$boundingBox = /* @__PURE__ */ new (0, $e06gU.Box3)();\nconst $e7beda6ce58ad8bf$var$triangle = /* @__PURE__ */ new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $e7beda6ce58ad8bf$var$triangle2 = /* @__PURE__ */ new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $e7beda6ce58ad8bf$var$invertedMat = /* @__PURE__ */ new (0, $e06gU.Matrix4)();\nconst $e7beda6ce58ad8bf$var$obb = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $e7beda6ce58ad8bf$var$obb2 = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nfunction $e7beda6ce58ad8bf$export$80dca0df80ee0084(bvh, root, otherGeometry, geometryToBvh) {\n (0, $00672725876edc9e$export$7451c73ce907854f).setBuffer(bvh._roots[root]);\n const result = $e7beda6ce58ad8bf$var$_intersectsGeometry(0, bvh, otherGeometry, geometryToBvh);\n (0, $00672725876edc9e$export$7451c73ce907854f).clearBuffer();\n return result;\n}\nfunction $e7beda6ce58ad8bf$var$_intersectsGeometry(nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $00672725876edc9e$export$7451c73ce907854f);\n let nodeIndex16 = nodeIndex32 * 2;\n if (cachedObb === null) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $e7beda6ce58ad8bf$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n cachedObb = $e7beda6ce58ad8bf$var$obb;\n }\n const isLeaf = (0, $8c79b2483f36f80e$export$bc7cbaf27fbe938e)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const thisGeometry = bvh.geometry;\n const thisIndex = thisGeometry.index;\n const thisPos = thisGeometry.attributes.position;\n const index = otherGeometry.index;\n const pos = otherGeometry.attributes.position;\n const offset = (0, $8c79b2483f36f80e$export$3231e969238304f3)(nodeIndex32, uint32Array);\n const count = (0, $8c79b2483f36f80e$export$d61684373eacdf61)(nodeIndex16, uint16Array);\n // get the inverse of the geometry matrix so we can transform our triangles into the\n // geometry space we're trying to test. We assume there are fewer triangles being checked\n // here.\n $e7beda6ce58ad8bf$var$invertedMat.copy(geometryToBvh).invert();\n if (otherGeometry.boundsTree) {\n // if there's a bounds tree\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(nodeIndex32), float32Array, $e7beda6ce58ad8bf$var$obb2);\n $e7beda6ce58ad8bf$var$obb2.matrix.copy($e7beda6ce58ad8bf$var$invertedMat);\n $e7beda6ce58ad8bf$var$obb2.needsUpdate = true;\n // TODO: use a triangle iteration function here\n const res = otherGeometry.boundsTree.shapecast({\n intersectsBounds: (box)=>$e7beda6ce58ad8bf$var$obb2.intersectsBox(box),\n intersectsTriangle: (tri)=>{\n tri.a.applyMatrix4(geometryToBvh);\n tri.b.applyMatrix4(geometryToBvh);\n tri.c.applyMatrix4(geometryToBvh);\n tri.needsUpdate = true;\n for(let i = offset, l = count + offset; i < l; i++){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($e7beda6ce58ad8bf$var$triangle2, 3 * bvh.resolveTriangleIndex(i), thisIndex, thisPos);\n $e7beda6ce58ad8bf$var$triangle2.needsUpdate = true;\n if (tri.intersectsTriangle($e7beda6ce58ad8bf$var$triangle2)) return true;\n }\n return false;\n }\n });\n return res;\n } else // if we're just dealing with raw geometry\n for(let i = offset, l = count + offset; i < l; i++){\n // this triangle needs to be transformed into the current BVH coordinate frame\n const ti = bvh.resolveTriangleIndex(i);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($e7beda6ce58ad8bf$var$triangle, 3 * ti, thisIndex, thisPos);\n $e7beda6ce58ad8bf$var$triangle.a.applyMatrix4($e7beda6ce58ad8bf$var$invertedMat);\n $e7beda6ce58ad8bf$var$triangle.b.applyMatrix4($e7beda6ce58ad8bf$var$invertedMat);\n $e7beda6ce58ad8bf$var$triangle.c.applyMatrix4($e7beda6ce58ad8bf$var$invertedMat);\n $e7beda6ce58ad8bf$var$triangle.needsUpdate = true;\n for(let i2 = 0, l2 = index.count; i2 < l2; i2 += 3){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)($e7beda6ce58ad8bf$var$triangle2, i2, index, pos);\n $e7beda6ce58ad8bf$var$triangle2.needsUpdate = true;\n if ($e7beda6ce58ad8bf$var$triangle.intersectsTriangle($e7beda6ce58ad8bf$var$triangle2)) return true;\n }\n }\n } else {\n const left = nodeIndex32 + 8;\n const right = uint32Array[nodeIndex32 + 6];\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(left), float32Array, $e7beda6ce58ad8bf$var$boundingBox);\n const leftIntersection = cachedObb.intersectsBox($e7beda6ce58ad8bf$var$boundingBox) && $e7beda6ce58ad8bf$var$_intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (leftIntersection) return true;\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)((0, $8c79b2483f36f80e$export$b5b7e27a1440579d)(right), float32Array, $e7beda6ce58ad8bf$var$boundingBox);\n const rightIntersection = cachedObb.intersectsBox($e7beda6ce58ad8bf$var$boundingBox) && $e7beda6ce58ad8bf$var$_intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (rightIntersection) return true;\n return false;\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n\n\n/*********************************************************************/ /* This file is generated from \"closestPointToGeometry.template.js\". */ /*********************************************************************/ const $525a48157a09a04c$var$tempMatrix = /* @__PURE__ */ new (0, $e06gU.Matrix4)();\nconst $525a48157a09a04c$var$obb = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $525a48157a09a04c$var$obb2 = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $525a48157a09a04c$var$temp1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $525a48157a09a04c$var$temp2 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $525a48157a09a04c$var$temp3 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $525a48157a09a04c$var$temp4 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $525a48157a09a04c$export$334b669407b5ec06(bvh, otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $525a48157a09a04c$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n $525a48157a09a04c$var$obb.needsUpdate = true;\n const geometry = bvh.geometry;\n const pos = geometry.attributes.position;\n const index = geometry.index;\n const otherPos = otherGeometry.attributes.position;\n const otherIndex = otherGeometry.index;\n const triangle = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n const triangle2 = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n let tempTarget1 = $525a48157a09a04c$var$temp1;\n let tempTargetDest1 = $525a48157a09a04c$var$temp2;\n let tempTarget2 = null;\n let tempTargetDest2 = null;\n if (target2) {\n tempTarget2 = $525a48157a09a04c$var$temp3;\n tempTargetDest2 = $525a48157a09a04c$var$temp4;\n }\n let closestDistance = Infinity;\n let closestDistanceTriIndex = null;\n let closestDistanceOtherTriIndex = null;\n $525a48157a09a04c$var$tempMatrix.copy(geometryToBvh).invert();\n $525a48157a09a04c$var$obb2.matrix.copy($525a48157a09a04c$var$tempMatrix);\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $525a48157a09a04c$var$obb.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n if (score < closestDistance && score < maxThreshold) {\n // if we know the triangles of this bounds will be intersected next then\n // save the bounds to use during triangle checks.\n if (isLeaf) {\n $525a48157a09a04c$var$obb2.min.copy(box.min);\n $525a48157a09a04c$var$obb2.max.copy(box.max);\n $525a48157a09a04c$var$obb2.needsUpdate = true;\n }\n return true;\n }\n return false;\n },\n intersectsRange: (offset, count)=>{\n if (otherGeometry.boundsTree) {\n // if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n // the closest bounds in the other geometry to check.\n const otherBvh = otherGeometry.boundsTree;\n return otherBvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $525a48157a09a04c$var$obb2.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistance && score < maxThreshold;\n },\n intersectsRange: (otherOffset, otherCount)=>{\n for(let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2++){\n const ti2 = otherBvh.resolveTriangleIndex(i2);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, 3 * ti2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n const ti = bvh.resolveTriangleIndex(i);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, 3 * ti, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n });\n } else {\n // If no bounds tree then we'll just check every triangle.\n const triCount = (0, $512bf92b30757ce0$export$c56c51fae37b2d63)(otherGeometry);\n for(let i2 = 0, l2 = triCount; i2 < l2; i2++){\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n const ti = bvh.resolveTriangleIndex(i);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, 3 * ti, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n }\n });\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle);\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle2);\n if (closestDistance === Infinity) return null;\n if (!target1.point) target1.point = tempTargetDest1.clone();\n else target1.point.copy(tempTargetDest1);\n target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;\n if (target2) {\n if (!target2.point) target2.point = tempTargetDest2.clone();\n else target2.point.copy(tempTargetDest2);\n target2.point.applyMatrix4($525a48157a09a04c$var$tempMatrix);\n tempTargetDest1.applyMatrix4($525a48157a09a04c$var$tempMatrix);\n target2.distance = tempTargetDest1.sub(target2.point).length();\n target2.faceIndex = closestDistanceOtherTriIndex;\n }\n return target1;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\n/******************************************************/ /* This file is generated from \"bvhcast.template.js\". */ /******************************************************/ const $0cb92652a15353e8$var$tempMatrix = new (0, $e06gU.Matrix4)();\nconst $0cb92652a15353e8$var$aabb = /* @__PURE__ */ new (0, $e06gU.Box3)();\nconst $0cb92652a15353e8$var$aabb2 = /* @__PURE__ */ new (0, $e06gU.Box3)();\nfunction $0cb92652a15353e8$export$4e2970292710be2c(bvh, otherBvh, matrixToLocal, callbacks) {\n // BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n // than an approach that walks down the tree (see bvhcast.js file for more info).\n let { intersectsRanges: intersectsRanges, intersectsTriangles: intersectsTriangles } = callbacks;\n const indexAttr = bvh.geometry.index;\n const positionAttr = bvh.geometry.attributes.position;\n const otherIndexAttr = otherBvh.geometry.index;\n const otherPositionAttr = otherBvh.geometry.attributes.position;\n $0cb92652a15353e8$var$tempMatrix.copy(matrixToLocal).invert();\n const triangle = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n const triangle2 = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n if (intersectsTriangles) {\n const iterateOverDoubleTriangles = (offset1, count1, offset2, count2, depth1, index1, depth2, index2)=>{\n for(let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2++){\n const ti2 = otherBvh.resolveTriangleIndex(i2);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle2, ti2 * 3, otherIndexAttr, otherPositionAttr);\n triangle2.a.applyMatrix4(matrixToLocal);\n triangle2.b.applyMatrix4(matrixToLocal);\n triangle2.c.applyMatrix4(matrixToLocal);\n triangle2.needsUpdate = true;\n for(let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1++){\n const ti1 = bvh.resolveTriangleIndex(i1);\n (0, $eb6f5960b3eb8549$export$32f7fa781964ae30)(triangle, ti1 * 3, indexAttr, positionAttr);\n triangle.needsUpdate = true;\n if (intersectsTriangles(triangle, triangle2, i1, i2, depth1, index1, depth2, index2)) return true;\n }\n }\n return false;\n };\n if (intersectsRanges) {\n const originalIntersectsRanges = intersectsRanges;\n intersectsRanges = function(offset1, count1, offset2, count2, depth1, index1, depth2, index2) {\n if (!originalIntersectsRanges(offset1, count1, offset2, count2, depth1, index1, depth2, index2)) return iterateOverDoubleTriangles(offset1, count1, offset2, count2, depth1, index1, depth2, index2);\n return true;\n };\n } else intersectsRanges = iterateOverDoubleTriangles;\n }\n otherBvh.getBoundingBox($0cb92652a15353e8$var$aabb2);\n $0cb92652a15353e8$var$aabb2.applyMatrix4(matrixToLocal);\n const result = bvh.shapecast({\n intersectsBounds: (box)=>$0cb92652a15353e8$var$aabb2.intersectsBox(box),\n intersectsRange: (offset1, count1, contained, depth1, nodeIndex1, box)=>{\n $0cb92652a15353e8$var$aabb.copy(box);\n $0cb92652a15353e8$var$aabb.applyMatrix4($0cb92652a15353e8$var$tempMatrix);\n return otherBvh.shapecast({\n intersectsBounds: (box)=>$0cb92652a15353e8$var$aabb.intersectsBox(box),\n intersectsRange: (offset2, count2, contained, depth2, nodeIndex2)=>{\n return intersectsRanges(offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2);\n }\n });\n }\n });\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle);\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle2);\n return result;\n}\n\n\nfunction $38253ed0649349ad$export$9c28fa8114adc339() {\n return typeof SharedArrayBuffer !== \"undefined\";\n}\n\n\nconst $d1f63a316b8768c2$var$obb = /* @__PURE__ */ new (0, $2210a8ccded54a38$export$4ccecd8ac6ee0e58)();\nconst $d1f63a316b8768c2$var$tempBox = /* @__PURE__ */ new (0, $e06gU.Box3)();\nclass $d1f63a316b8768c2$export$9d614b3bc2c4eacf {\n static serialize(bvh, options = {}) {\n options = {\n cloneBuffers: true,\n ...options\n };\n const geometry = bvh.geometry;\n const rootData = bvh._roots;\n const indirectBuffer = bvh._indirectBuffer;\n const indexAttribute = geometry.getIndex();\n let result;\n if (options.cloneBuffers) result = {\n roots: rootData.map((root)=>root.slice()),\n index: indexAttribute.array.slice(),\n indirectBuffer: indirectBuffer ? indirectBuffer.slice() : null\n };\n else result = {\n roots: rootData,\n index: indexAttribute.array,\n indirectBuffer: indirectBuffer\n };\n return result;\n }\n static deserialize(data, geometry, options = {}) {\n options = {\n setIndex: true,\n indirect: Boolean(data.indirectBuffer),\n ...options\n };\n const { index: index, roots: roots, indirectBuffer: indirectBuffer } = data;\n const bvh = new $d1f63a316b8768c2$export$9d614b3bc2c4eacf(geometry, {\n ...options,\n [(0, $bc798809290ffd6b$export$abef70518a11a6ba)]: true\n });\n bvh._roots = roots;\n bvh._indirectBuffer = indirectBuffer || null;\n if (options.setIndex) {\n const indexAttribute = geometry.getIndex();\n if (indexAttribute === null) {\n const newIndex = new (0, $e06gU.BufferAttribute)(data.index, 1, false);\n geometry.setIndex(newIndex);\n } else if (indexAttribute.array !== index) {\n indexAttribute.array.set(index);\n indexAttribute.needsUpdate = true;\n }\n }\n return bvh;\n }\n get indirect() {\n return !!this._indirectBuffer;\n }\n constructor(geometry, options = {}){\n if (!geometry.isBufferGeometry) throw new Error(\"MeshBVH: Only BufferGeometries are supported.\");\n else if (geometry.index && geometry.index.isInterleavedBufferAttribute) throw new Error(\"MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.\");\n // default options\n options = Object.assign({\n strategy: (0, $bc798809290ffd6b$export$91c2158bc24c63d4),\n maxDepth: 40,\n maxLeafTris: 10,\n verbose: true,\n useSharedArrayBuffer: false,\n setBoundingBox: true,\n onProgress: null,\n indirect: false,\n // undocumented options\n // Whether to skip generating the tree. Used for deserialization.\n [(0, $bc798809290ffd6b$export$abef70518a11a6ba)]: false\n }, options);\n if (options.useSharedArrayBuffer && !(0, $38253ed0649349ad$export$9c28fa8114adc339)()) throw new Error(\"MeshBVH: SharedArrayBuffer is not available.\");\n // retain references to the geometry so we can use them it without having to\n // take a geometry reference in every function.\n this.geometry = geometry;\n this._roots = null;\n this._indirectBuffer = null;\n if (!options[0, $bc798809290ffd6b$export$abef70518a11a6ba]) {\n (0, $1b5942106133d63e$export$e63bca57f220b8e3)(this, options);\n if (!geometry.boundingBox && options.setBoundingBox) geometry.boundingBox = this.getBoundingBox(new (0, $e06gU.Box3)());\n }\n const { _indirectBuffer: _indirectBuffer } = this;\n this.resolveTriangleIndex = options.indirect ? (i)=>_indirectBuffer[i] : (i)=>i;\n }\n refit(nodeIndices = null) {\n const refitFunc = this.indirect ? (0, $f4d14018db659d90$export$40f4af49b81ca898) : (0, $d6886d66b20a1b65$export$8eb1eda96b2e6d7a);\n return refitFunc(this, nodeIndices);\n }\n traverse(callback, rootIndex = 0) {\n const buffer = this._roots[rootIndex];\n const uint32Array = new Uint32Array(buffer);\n const uint16Array = new Uint16Array(buffer);\n _traverse(0);\n function _traverse(node32Index, depth = 0) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $bc798809290ffd6b$export$661fddb62bfe0e42);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n callback(depth, isLeaf, new Float32Array(buffer, node32Index * 4, 6), offset, count);\n } else {\n // TODO: use node functions here\n const left = node32Index + (0, $bc798809290ffd6b$export$a08e7d18fbc53be5) / 4;\n const right = uint32Array[node32Index + 6];\n const splitAxis = uint32Array[node32Index + 7];\n const stopTraversal = callback(depth, isLeaf, new Float32Array(buffer, node32Index * 4, 6), splitAxis);\n if (!stopTraversal) {\n _traverse(left, depth + 1);\n _traverse(right, depth + 1);\n }\n }\n }\n }\n /* Core Cast Functions */ raycast(ray, materialOrSide = (0, $e06gU.FrontSide)) {\n const roots = this._roots;\n const geometry = this.geometry;\n const intersects = [];\n const isMaterial = materialOrSide.isMaterial;\n const isArrayMaterial = Array.isArray(materialOrSide);\n const groups = geometry.groups;\n const side = isMaterial ? materialOrSide.side : materialOrSide;\n const raycastFunc = this.indirect ? (0, $c34151c023e22e2c$export$1999205ebe856279) : (0, $06f35bd135b4cbcc$export$630e89aab3ddc1d6);\n for(let i = 0, l = roots.length; i < l; i++){\n const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;\n const startCount = intersects.length;\n raycastFunc(this, i, materialSide, ray, intersects);\n if (isArrayMaterial) {\n const materialIndex = groups[i].materialIndex;\n for(let j = startCount, jl = intersects.length; j < jl; j++)intersects[j].face.materialIndex = materialIndex;\n }\n }\n return intersects;\n }\n raycastFirst(ray, materialOrSide = (0, $e06gU.FrontSide)) {\n const roots = this._roots;\n const geometry = this.geometry;\n const isMaterial = materialOrSide.isMaterial;\n const isArrayMaterial = Array.isArray(materialOrSide);\n let closestResult = null;\n const groups = geometry.groups;\n const side = isMaterial ? materialOrSide.side : materialOrSide;\n const raycastFirstFunc = this.indirect ? (0, $c27191358c129b43$export$44e48d4cf2fe0609) : (0, $8094198f7e753a2d$export$1fa457bc72ef1a2a);\n for(let i = 0, l = roots.length; i < l; i++){\n const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;\n const result = raycastFirstFunc(this, i, materialSide, ray);\n if (result != null && (closestResult == null || result.distance < closestResult.distance)) {\n closestResult = result;\n if (isArrayMaterial) result.face.materialIndex = groups[i].materialIndex;\n }\n }\n return closestResult;\n }\n intersectsGeometry(otherGeometry, geomToMesh) {\n let result = false;\n const roots = this._roots;\n const intersectsGeometryFunc = this.indirect ? (0, $e7beda6ce58ad8bf$export$80dca0df80ee0084) : (0, $40028eca76a25282$export$b2f96b0abaf94e0a);\n for(let i = 0, l = roots.length; i < l; i++){\n result = intersectsGeometryFunc(this, i, otherGeometry, geomToMesh);\n if (result) break;\n }\n return result;\n }\n shapecast(callbacks) {\n const triangle = (0, $a7a12bd8496afd7c$export$2622f4315304edad).getPrimitive();\n const iterateFunc = this.indirect ? (0, $30624a994ba6e57c$export$dae1f8efdced590b) : (0, $9474092dcc9c56eb$export$be1391b7aa79c0f6);\n let { boundsTraverseOrder: boundsTraverseOrder, intersectsBounds: intersectsBounds, intersectsRange: intersectsRange, intersectsTriangle: intersectsTriangle } = callbacks;\n // wrap the intersectsRange function\n if (intersectsRange && intersectsTriangle) {\n const originalIntersectsRange = intersectsRange;\n intersectsRange = (offset, count, contained, depth, nodeIndex)=>{\n if (!originalIntersectsRange(offset, count, contained, depth, nodeIndex)) return iterateFunc(offset, count, this, intersectsTriangle, contained, depth, triangle);\n return true;\n };\n } else if (!intersectsRange) {\n if (intersectsTriangle) intersectsRange = (offset, count, contained, depth)=>{\n return iterateFunc(offset, count, this, intersectsTriangle, contained, depth, triangle);\n };\n else intersectsRange = (offset, count, contained)=>{\n return contained;\n };\n }\n // run shapecast\n let result = false;\n let byteOffset = 0;\n const roots = this._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n const root = roots[i];\n result = (0, $59a851f097f5ef7e$export$963c78622ed2c172)(this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);\n if (result) break;\n byteOffset += root.byteLength;\n }\n (0, $a7a12bd8496afd7c$export$2622f4315304edad).releasePrimitive(triangle);\n return result;\n }\n bvhcast(otherBvh, matrixToLocal, callbacks) {\n const bvhcastFunc = this.indirect ? (0, $0cb92652a15353e8$export$4e2970292710be2c) : (0, $15ccf80f37db9874$export$a2253c6980b92559);\n return bvhcastFunc(this, otherBvh, matrixToLocal, callbacks);\n }\n /* Derived Cast Functions */ intersectsBox(box, boxToMesh) {\n $d1f63a316b8768c2$var$obb.set(box.min, box.max, boxToMesh);\n $d1f63a316b8768c2$var$obb.needsUpdate = true;\n return this.shapecast({\n intersectsBounds: (box)=>$d1f63a316b8768c2$var$obb.intersectsBox(box),\n intersectsTriangle: (tri)=>$d1f63a316b8768c2$var$obb.intersectsTriangle(tri)\n });\n }\n intersectsSphere(sphere) {\n return this.shapecast({\n intersectsBounds: (box)=>sphere.intersectsBox(box),\n intersectsTriangle: (tri)=>tri.intersectsSphere(sphere)\n });\n }\n closestPointToGeometry(otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n const closestPointToGeometryFunc = this.indirect ? (0, $525a48157a09a04c$export$334b669407b5ec06) : (0, $c82df4aa752dbd95$export$5912902c175a555e);\n return closestPointToGeometryFunc(this, otherGeometry, geometryToBvh, target1, target2, minThreshold, maxThreshold);\n }\n closestPointToPoint(point, target = {}, minThreshold = 0, maxThreshold = Infinity) {\n return (0, $452345387fe1f65a$export$96ec44700e587d99)(this, point, target, minThreshold, maxThreshold);\n }\n getBoundingBox(target) {\n target.makeEmpty();\n const roots = this._roots;\n roots.forEach((buffer)=>{\n (0, $d5323e54f8bf740a$export$40b9a5e446bf11e0)(0, new Float32Array(buffer), $d1f63a316b8768c2$var$tempBox);\n target.union($d1f63a316b8768c2$var$tempBox);\n });\n return target;\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $3e2a3abaa10886a8$var$EPSILON = 1e-16;\nconst $3e2a3abaa10886a8$var$UP_VECTOR = /* @__PURE__ */ new (0, $e06gU.Vector3)(0, 1, 0);\nconst $3e2a3abaa10886a8$var$_dir = new (0, $e06gU.Vector3)();\nfunction $3e2a3abaa10886a8$export$cec4aea73fa71fc5(line) {\n line.delta($3e2a3abaa10886a8$var$_dir).normalize();\n return Math.abs($3e2a3abaa10886a8$var$_dir.dot($3e2a3abaa10886a8$var$UP_VECTOR)) >= 1.0 - $3e2a3abaa10886a8$var$EPSILON;\n}\nfunction $3e2a3abaa10886a8$export$97cada60b6f00a63(tri) {\n if (tri.needsUpdate) tri.update();\n return Math.abs(tri.plane.normal.dot($3e2a3abaa10886a8$var$UP_VECTOR)) <= $3e2a3abaa10886a8$var$EPSILON;\n}\nfunction $3e2a3abaa10886a8$export$6ce1ecae0cd1cc55(tri, line) {\n // if this is the same line as on the triangle\n const { start: start, end: end } = line;\n const triPoints = tri.points;\n let startMatches = false;\n let endMatches = false;\n for(let i = 0; i < 3; i++){\n const tp = triPoints[i];\n if (!startMatches && start.distanceToSquared(tp) <= $3e2a3abaa10886a8$var$EPSILON) startMatches = true;\n if (!endMatches && end.distanceToSquared(tp) <= $3e2a3abaa10886a8$var$EPSILON) endMatches = true;\n if (startMatches && endMatches) return true;\n }\n return startMatches && endMatches;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n// Modified version of js EdgesGeometry logic to handle silhouette edges\nconst $2cd02d3dec669c62$var$EPSILON = 1e-16;\nconst $2cd02d3dec669c62$var$UP_VECTOR = /* @__PURE__ */ new (0, $e06gU.Vector3)(0, 1, 0);\nconst $2cd02d3dec669c62$var$_v0 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $2cd02d3dec669c62$var$_v1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $2cd02d3dec669c62$var$_normal = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $2cd02d3dec669c62$var$_triangle = /* @__PURE__ */ new (0, $e06gU.Triangle)();\nfunction $2cd02d3dec669c62$export$b2d7c053833d1662(geometry, projectionDir = $2cd02d3dec669c62$var$UP_VECTOR, thresholdAngle = 1) {\n const edges = [];\n const precisionPoints = 4;\n const precision = Math.pow(10, precisionPoints);\n const thresholdDot = Math.cos((0, $e06gU.MathUtils).DEG2RAD * thresholdAngle);\n const indexAttr = geometry.getIndex();\n const positionAttr = geometry.getAttribute(\"position\");\n const indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n const indexArr = [\n 0,\n 0,\n 0\n ];\n const vertKeys = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const hashes = new Array(3);\n const edgeData = {};\n for(let i = 0; i < indexCount; i += 3){\n if (indexAttr) {\n indexArr[0] = indexAttr.getX(i);\n indexArr[1] = indexAttr.getX(i + 1);\n indexArr[2] = indexAttr.getX(i + 2);\n } else {\n indexArr[0] = i;\n indexArr[1] = i + 1;\n indexArr[2] = i + 2;\n }\n const { a: a, b: b, c: c } = $2cd02d3dec669c62$var$_triangle;\n a.fromBufferAttribute(positionAttr, indexArr[0]);\n b.fromBufferAttribute(positionAttr, indexArr[1]);\n c.fromBufferAttribute(positionAttr, indexArr[2]);\n $2cd02d3dec669c62$var$_triangle.getNormal($2cd02d3dec669c62$var$_normal);\n // create hashes for the edge from the vertices\n hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;\n hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;\n hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`;\n // skip degenerate triangles\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) continue;\n // iterate over every edge\n for(let j = 0; j < 3; j++){\n // get the first and next vertex making up the edge\n const jNext = (j + 1) % 3;\n const vecHash0 = hashes[j];\n const vecHash1 = hashes[jNext];\n const v0 = $2cd02d3dec669c62$var$_triangle[vertKeys[j]];\n const v1 = $2cd02d3dec669c62$var$_triangle[vertKeys[jNext]];\n const hash = `${vecHash0}_${vecHash1}`;\n const reverseHash = `${vecHash1}_${vecHash0}`;\n if (reverseHash in edgeData && edgeData[reverseHash]) {\n // if we found a sibling edge add it into the vertex array if\n // it meets the angle threshold and delete the edge from the map.\n const otherNormal = edgeData[reverseHash].normal;\n const meetsThreshold = $2cd02d3dec669c62$var$_normal.dot(otherNormal) <= thresholdDot;\n // get the dot product relative to the projection angle and\n // add an epsilon for nearly vertical triangles\n let normDot = projectionDir.dot($2cd02d3dec669c62$var$_normal);\n normDot = Math.abs(normDot) < $2cd02d3dec669c62$var$EPSILON ? 0 : normDot;\n let otherDot = projectionDir.dot(otherNormal);\n otherDot = Math.abs(otherDot) < $2cd02d3dec669c62$var$EPSILON ? 0 : otherDot;\n const projectionThreshold = Math.sign(normDot) !== Math.sign(otherDot);\n if (meetsThreshold || projectionThreshold) {\n const line = new (0, $e06gU.Line3)();\n line.start.copy(v0);\n line.end.copy(v1);\n edges.push(line);\n }\n edgeData[reverseHash] = null;\n } else if (!(hash in edgeData)) // if we've already got an edge here then skip adding a new one\n edgeData[hash] = {\n index0: indexArr[j],\n index1: indexArr[jNext],\n normal: $2cd02d3dec669c62$var$_normal.clone()\n };\n }\n }\n // iterate over all remaining, unmatched edges and add them to the vertex array\n for(const key in edgeData)if (edgeData[key]) {\n const { index0: index0, index1: index1 } = edgeData[key];\n $2cd02d3dec669c62$var$_v0.fromBufferAttribute(positionAttr, index0);\n $2cd02d3dec669c62$var$_v1.fromBufferAttribute(positionAttr, index1);\n const line = new (0, $e06gU.Line3)();\n line.start.copy($2cd02d3dec669c62$var$_v0);\n line.end.copy($2cd02d3dec669c62$var$_v1);\n edges.push(line);\n }\n return edges;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $627e7388cda991d0$var$_line = /* @__PURE__ */ new (0, $e06gU.Line3)();\nfunction $627e7388cda991d0$export$84bed164e326c2f0(overlaps) {\n overlaps.sort((a, b)=>{\n return a[0] - b[0];\n });\n for(let i = 1; i < overlaps.length; i++){\n const overlap = overlaps[i];\n const prevOverlap = overlaps[i - 1];\n if (prevOverlap[1] >= overlap[0]) {\n prevOverlap[1] = Math.max(prevOverlap[1], overlap[1]);\n overlaps.splice(i, 1);\n i--;\n }\n }\n}\nfunction $627e7388cda991d0$export$fbbde8a5b23b7b65(line, overlaps, target = []) {\n $627e7388cda991d0$export$84bed164e326c2f0(overlaps);\n const invOverlaps = [\n [\n 0,\n 1\n ]\n ];\n for(let i = 0, l = overlaps.length; i < l; i++){\n const invOverlap = invOverlaps[i];\n const overlap = overlaps[i];\n invOverlap[1] = overlap[0];\n invOverlaps.push(new Float32Array([\n overlap[1],\n 1\n ]));\n }\n for(let i = 0, l = invOverlaps.length; i < l; i++){\n const { start: start, end: end } = line;\n $627e7388cda991d0$var$_line.start.lerpVectors(start, end, invOverlaps[i][0]);\n $627e7388cda991d0$var$_line.end.lerpVectors(start, end, invOverlaps[i][1]);\n target.push(new Float32Array([\n $627e7388cda991d0$var$_line.start.x,\n $627e7388cda991d0$var$_line.start.y,\n $627e7388cda991d0$var$_line.start.z,\n $627e7388cda991d0$var$_line.end.x,\n $627e7388cda991d0$var$_line.end.y,\n $627e7388cda991d0$var$_line.end.z\n ]));\n }\n return target;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nconst $aab05f562594c8e7$var$EPSILON = 1e-16;\nconst $aab05f562594c8e7$var$UP_VECTOR = /* @__PURE__ */ new (0, $e06gU.Vector3)(0, 1, 0);\nconst $aab05f562594c8e7$var$_plane = /* @__PURE__ */ new (0, $e06gU.Plane)();\nconst $aab05f562594c8e7$var$_planeHit = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $aab05f562594c8e7$var$_lineDirection = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $aab05f562594c8e7$export$3240a8dc8bb0ce4c(tri, line, lineTarget) {\n // if the triangle is insignificant then skip it\n if ((0, $3e2a3abaa10886a8$export$97cada60b6f00a63)(tri)) return false;\n // update triangle if needed\n if (tri.needsUpdate) tri.update();\n // if the plane is not facing up then flip the direction\n $aab05f562594c8e7$var$_plane.copy(tri.plane);\n if ($aab05f562594c8e7$var$_plane.normal.dot($aab05f562594c8e7$var$UP_VECTOR) < 0) {\n $aab05f562594c8e7$var$_plane.normal.multiplyScalar(-1);\n $aab05f562594c8e7$var$_plane.constant *= -1;\n }\n const startDist = $aab05f562594c8e7$var$_plane.distanceToPoint(line.start);\n const endDist = $aab05f562594c8e7$var$_plane.distanceToPoint(line.end);\n const isStartOnPlane = Math.abs(startDist) < $aab05f562594c8e7$var$EPSILON;\n const isEndOnPlane = Math.abs(endDist) < $aab05f562594c8e7$var$EPSILON;\n const isStartBelow = startDist < 0;\n const isEndBelow = endDist < 0;\n // if the line and plane are coplanar then return that we can't trim\n line.delta($aab05f562594c8e7$var$_lineDirection).normalize();\n if (Math.abs($aab05f562594c8e7$var$_plane.normal.dot($aab05f562594c8e7$var$_lineDirection)) < $aab05f562594c8e7$var$EPSILON) {\n if (isStartOnPlane || !isStartBelow) return false;\n else {\n lineTarget.copy(line);\n return true;\n }\n }\n // find the point that's below the plane. If both points are below the plane\n // then we assume we're dealing with floating point error\n if (isStartBelow && isEndBelow) {\n // if the whole line is below then just copy that\n lineTarget.copy(line);\n return true;\n } else if (!isStartBelow && !isEndBelow) // if it's wholly above then skip it\n return false;\n else {\n let didHit = $aab05f562594c8e7$var$_plane.intersectLine(line, $aab05f562594c8e7$var$_planeHit);\n if (!didHit) {\n if (isStartOnPlane) {\n $aab05f562594c8e7$var$_planeHit.copy(line.start);\n didHit = true;\n }\n if (isEndOnPlane) {\n $aab05f562594c8e7$var$_planeHit.copy(line.end);\n didHit = true;\n }\n }\n if (didHit) {\n if (isStartBelow) {\n lineTarget.start.copy(line.start);\n lineTarget.end.copy($aab05f562594c8e7$var$_planeHit);\n return true;\n } else if (isEndBelow) {\n lineTarget.end.copy(line.end);\n lineTarget.start.copy($aab05f562594c8e7$var$_planeHit);\n return true;\n }\n }\n }\n return false;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\nconst $485089c6d0563e10$var$AREA_EPSILON = 1e-16;\nconst $485089c6d0563e10$var$DIST_EPSILON = 1e-16;\nconst $485089c6d0563e10$var$_orthoPlane = /* @__PURE__ */ new (0, $e06gU.Plane)();\nconst $485089c6d0563e10$var$_edgeLine = /* @__PURE__ */ new (0, $e06gU.Line3)();\nconst $485089c6d0563e10$var$_point = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $485089c6d0563e10$var$_vec = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $485089c6d0563e10$var$_tri = /* @__PURE__ */ new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $485089c6d0563e10$var$_line = /* @__PURE__ */ new (0, $e06gU.Line3)();\nconst $485089c6d0563e10$var$_triLine = /* @__PURE__ */ new (0, $e06gU.Line3)();\nconst $485089c6d0563e10$var$_dir = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $485089c6d0563e10$var$_triDir = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $485089c6d0563e10$export$87b006ababf09c4d(line, triangle, lineTarget = new (0, $e06gU.Line3)()) {\n // flatten the shapes\n $485089c6d0563e10$var$_tri.copy(triangle);\n $485089c6d0563e10$var$_tri.a.y = 0;\n $485089c6d0563e10$var$_tri.b.y = 0;\n $485089c6d0563e10$var$_tri.c.y = 0;\n $485089c6d0563e10$var$_tri.update();\n $485089c6d0563e10$var$_line.copy(line);\n $485089c6d0563e10$var$_line.start.y = 0;\n $485089c6d0563e10$var$_line.end.y = 0;\n // if the triangle is degenerate then return no overlap\n if ($485089c6d0563e10$var$_tri.getArea() <= $485089c6d0563e10$var$AREA_EPSILON) return null;\n $485089c6d0563e10$var$_line.delta($485089c6d0563e10$var$_dir).normalize();\n $485089c6d0563e10$var$_dir.cross($485089c6d0563e10$var$_tri.plane.normal).normalize();\n $485089c6d0563e10$var$_orthoPlane.setFromNormalAndCoplanarPoint($485089c6d0563e10$var$_dir, $485089c6d0563e10$var$_line.start);\n // find the line of intersection of the triangle along the plane if it exists\n let intersectCount = 0;\n const { points: points } = $485089c6d0563e10$var$_tri;\n for(let i = 0; i < 3; i++){\n const p1 = points[i];\n const p2 = points[(i + 1) % 3];\n $485089c6d0563e10$var$_edgeLine.start.copy(p1);\n $485089c6d0563e10$var$_edgeLine.end.copy(p2);\n const startIntersects = Math.abs($485089c6d0563e10$var$_orthoPlane.distanceToPoint($485089c6d0563e10$var$_edgeLine.start)) < $485089c6d0563e10$var$DIST_EPSILON;\n const endIntersects = Math.abs($485089c6d0563e10$var$_orthoPlane.distanceToPoint($485089c6d0563e10$var$_edgeLine.end)) < $485089c6d0563e10$var$DIST_EPSILON;\n const edgeIntersects = $485089c6d0563e10$var$_orthoPlane.intersectLine($485089c6d0563e10$var$_edgeLine, $485089c6d0563e10$var$_point);\n if (edgeIntersects && !endIntersects || startIntersects) {\n if (startIntersects && !edgeIntersects) $485089c6d0563e10$var$_point.copy($485089c6d0563e10$var$_edgeLine.start);\n if (intersectCount === 0) $485089c6d0563e10$var$_triLine.start.copy($485089c6d0563e10$var$_point);\n else $485089c6d0563e10$var$_triLine.end.copy($485089c6d0563e10$var$_point);\n intersectCount++;\n if (intersectCount === 2) break;\n }\n }\n if (intersectCount === 2) {\n // find the intersect line if any\n $485089c6d0563e10$var$_line.delta($485089c6d0563e10$var$_dir).normalize();\n $485089c6d0563e10$var$_triLine.delta($485089c6d0563e10$var$_triDir).normalize();\n // swap edges so they're facing in the same direction\n if ($485089c6d0563e10$var$_dir.dot($485089c6d0563e10$var$_triDir) < 0) {\n let tmp = $485089c6d0563e10$var$_triLine.start;\n $485089c6d0563e10$var$_triLine.start = $485089c6d0563e10$var$_triLine.end;\n $485089c6d0563e10$var$_triLine.end = tmp;\n }\n // check if the edges are overlapping\n const s1 = 0;\n const e1 = $485089c6d0563e10$var$_vec.subVectors($485089c6d0563e10$var$_line.end, $485089c6d0563e10$var$_line.start).dot($485089c6d0563e10$var$_dir);\n const s2 = $485089c6d0563e10$var$_vec.subVectors($485089c6d0563e10$var$_triLine.start, $485089c6d0563e10$var$_line.start).dot($485089c6d0563e10$var$_dir);\n const e2 = $485089c6d0563e10$var$_vec.subVectors($485089c6d0563e10$var$_triLine.end, $485089c6d0563e10$var$_line.start).dot($485089c6d0563e10$var$_dir);\n const separated1 = e1 <= s2;\n const separated2 = e2 <= s1;\n if (separated1 || separated2) return null;\n line.at(Math.max(s1, s2) / $485089c6d0563e10$var$_line.distance(), lineTarget.start);\n line.at(Math.min(e1, e2) / $485089c6d0563e10$var$_line.distance(), lineTarget.end);\n return lineTarget;\n }\n return null;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $e911a95ad6b2a32e$var$DIST_EPSILON = 1e-16;\nconst $e911a95ad6b2a32e$var$_dir = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $e911a95ad6b2a32e$var$_v0 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $e911a95ad6b2a32e$var$_v1 = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $e911a95ad6b2a32e$export$23512680614f2620(line, overlapLine, overlapsTarget) {\n line.delta($e911a95ad6b2a32e$var$_dir);\n $e911a95ad6b2a32e$var$_v0.subVectors(overlapLine.start, line.start);\n $e911a95ad6b2a32e$var$_v1.subVectors(overlapLine.end, line.start);\n const length = $e911a95ad6b2a32e$var$_dir.length();\n let d0 = $e911a95ad6b2a32e$var$_v0.length() / length;\n let d1 = $e911a95ad6b2a32e$var$_v1.length() / length;\n d0 = Math.min(Math.max(d0, 0), 1);\n d1 = Math.min(Math.max(d1, 0), 1);\n if (!(Math.abs(d0 - d1) <= $e911a95ad6b2a32e$var$DIST_EPSILON)) {\n overlapsTarget.push(new Float32Array([\n d0,\n d1\n ]));\n return true;\n }\n return false;\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\n\n\nconst $f98ba1c508cee43d$var$OFFSET_EPSILON = 1e-6;\nconst $f98ba1c508cee43d$var$_tri = new (0, $277ed51eec8cb2f4$export$a37f7ec1c23dfacf)();\nconst $f98ba1c508cee43d$var$_line = new (0, $e06gU.Line3)();\nfunction* $f98ba1c508cee43d$export$983ba676a1dedbe3(bvh, iterationTime = 30) {\n const edges = [];\n const geometry = bvh.geometry;\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const vertCount = index ? index.count : posAttr;\n let time = performance.now();\n for(let i = 0; i < vertCount; i += 3){\n let i0 = i + 0;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n const { a: a, b: b, c: c } = $f98ba1c508cee43d$var$_tri;\n a.fromBufferAttribute(posAttr, i0);\n b.fromBufferAttribute(posAttr, i1);\n c.fromBufferAttribute(posAttr, i2);\n $f98ba1c508cee43d$var$_tri.needsUpdate = true;\n $f98ba1c508cee43d$var$_tri.update();\n bvh.shapecast({\n intersectsBounds: (box)=>{\n return box.intersectsTriangle($f98ba1c508cee43d$var$_tri);\n },\n intersectsTriangle: (tri2)=>{\n if ($f98ba1c508cee43d$var$_tri.equals(tri2)) return false;\n if (tri2.needsUpdate) tri2.update();\n if (Math.abs($f98ba1c508cee43d$var$_tri.plane.normal.dot(tri2.plane.normal)) > 1 - 1e-6) return false;\n if ($f98ba1c508cee43d$var$_tri.intersectsTriangle(tri2, $f98ba1c508cee43d$var$_line, true) && !(0, $3e2a3abaa10886a8$export$6ce1ecae0cd1cc55)($f98ba1c508cee43d$var$_tri, $f98ba1c508cee43d$var$_line) && !(0, $3e2a3abaa10886a8$export$6ce1ecae0cd1cc55)(tri2, $f98ba1c508cee43d$var$_line)) {\n $f98ba1c508cee43d$var$_line.start.y += $f98ba1c508cee43d$var$OFFSET_EPSILON;\n $f98ba1c508cee43d$var$_line.end.y += $f98ba1c508cee43d$var$OFFSET_EPSILON;\n edges.push($f98ba1c508cee43d$var$_line.clone());\n }\n }\n });\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n yield;\n time = performance.now();\n }\n }\n return edges;\n}\n\n\n// these shared variables are not used across \"yield\" boundaries in the\n// generator so there's no risk of overwriting another tasks data\nconst $1481377db44180ba$var$DIST_THRESHOLD = 1e-10;\nconst $1481377db44180ba$var$UP_VECTOR = /* @__PURE__ */ new (0, $e06gU.Vector3)(0, 1, 0);\nconst $1481377db44180ba$var$_beneathLine = /* @__PURE__ */ new (0, $e06gU.Line3)();\nconst $1481377db44180ba$var$_ray = /* @__PURE__ */ new (0, $e06gU.Ray)();\nconst $1481377db44180ba$var$_vec = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $1481377db44180ba$var$_overlapLine = /* @__PURE__ */ new (0, $e06gU.Line3)();\nclass $1481377db44180ba$var$EdgeSet {\n constructor(){\n this.edges = [];\n }\n getLineGeometry(y = 0) {\n const edges = this.edges;\n const edgeArray = new Float32Array(edges.length * 6);\n let c = 0;\n for(let i = 0, l = edges.length; i < l; i++){\n const line = edges[i];\n edgeArray[c++] = line[0];\n edgeArray[c++] = y;\n edgeArray[c++] = line[2];\n edgeArray[c++] = line[3];\n edgeArray[c++] = y;\n edgeArray[c++] = line[5];\n }\n const edgeGeom = new (0, $e06gU.BufferGeometry)();\n const edgeBuffer = new (0, $e06gU.BufferAttribute)(edgeArray, 3, true);\n edgeGeom.setAttribute(\"position\", edgeBuffer);\n return edgeGeom;\n }\n}\nclass $1481377db44180ba$export$4776387f3c0e5209 {\n constructor(){\n this.sortEdges = true;\n this.iterationTime = 30;\n this.angleThreshold = 50;\n this.includeIntersectionEdges = true;\n }\n generateAsync(geometry, options = {}) {\n return new Promise((resolve, reject)=>{\n const { signal: signal } = options;\n const task = this.generate(geometry, options);\n run();\n function run() {\n if (signal && signal.aborted) reject(new Error(\"ProjectionGenerator: Process aborted via AbortSignal.\"));\n const result = task.next();\n if (result.done) resolve(result.value);\n else requestAnimationFrame(run);\n }\n });\n }\n *generate(bvh, options = {}) {\n const { onProgress: onProgress } = options;\n const { sortEdges: sortEdges, iterationTime: iterationTime, angleThreshold: angleThreshold, includeIntersectionEdges: includeIntersectionEdges } = this;\n if (bvh instanceof (0, $e06gU.BufferGeometry)) bvh = new (0, $d1f63a316b8768c2$export$9d614b3bc2c4eacf)(bvh, {\n maxLeafTris: 1\n });\n const geometry = bvh.geometry;\n let edges = (0, $2cd02d3dec669c62$export$b2d7c053833d1662)(geometry, $1481377db44180ba$var$UP_VECTOR, angleThreshold);\n if (includeIntersectionEdges) {\n const results = yield* (0, $f98ba1c508cee43d$export$983ba676a1dedbe3)(bvh, iterationTime);\n edges = edges.concat(results);\n }\n if (sortEdges) edges.sort((a, b)=>{\n return Math.min(a.start.y, a.end.y) - Math.min(b.start.y, b.end.y);\n });\n yield;\n // trim the candidate edges\n const finalEdges = new $1481377db44180ba$var$EdgeSet();\n let time = performance.now();\n for(let i = 0, l = edges.length; i < l; i++){\n const line = edges[i];\n if ((0, $3e2a3abaa10886a8$export$cec4aea73fa71fc5)(line)) continue;\n const lowestLineY = Math.min(line.start.y, line.end.y);\n const highestLineY = Math.max(line.start.y, line.end.y);\n const hiddenOverlaps = [];\n bvh.shapecast({\n intersectsBounds: (box)=>{\n // expand the bounding box to the bottom height of the line\n box.min.y = Math.min(lowestLineY - 1e-6, box.min.y);\n // get the line as a ray\n const { origin: origin, direction: direction } = $1481377db44180ba$var$_ray;\n origin.copy(line.start);\n line.delta(direction).normalize();\n // if the ray is inside the box then we intersect it\n if (box.containsPoint(origin)) return true;\n // check if the line segment intersects the box\n if ($1481377db44180ba$var$_ray.intersectBox(box, $1481377db44180ba$var$_vec)) return origin.distanceToSquared($1481377db44180ba$var$_vec) < line.distanceSq();\n return false;\n },\n intersectsTriangle: (tri)=>{\n // skip the triangle if the triangle is completely below the line\n const highestTriangleY = Math.max(tri.a.y, tri.b.y, tri.c.y);\n if (highestTriangleY <= lowestLineY) return false;\n // if the projected triangle is just a line then don't check it\n if ((0, $3e2a3abaa10886a8$export$97cada60b6f00a63)(tri)) return false;\n // if this line lies on a triangle edge then don't check for visual overlaps\n // with this triangle\n if ((0, $3e2a3abaa10886a8$export$6ce1ecae0cd1cc55)(tri, line)) return false;\n // Retrieve the portion of line that is below the plane - and skip the triangle if none\n // of it is\n const lowestTriangleY = Math.min(tri.a.y, tri.b.y, tri.c.y);\n if (highestLineY < lowestTriangleY) $1481377db44180ba$var$_beneathLine.copy(line);\n else if (!(0, $aab05f562594c8e7$export$3240a8dc8bb0ce4c)(tri, line, $1481377db44180ba$var$_beneathLine)) return false;\n if ($1481377db44180ba$var$_beneathLine.distance() < $1481377db44180ba$var$DIST_THRESHOLD) return false;\n // compress the edge overlaps so we can easily tell if the whole edge is hidden already\n // and exit early\n if ((0, $485089c6d0563e10$export$87b006ababf09c4d)($1481377db44180ba$var$_beneathLine, tri, $1481377db44180ba$var$_overlapLine) && (0, $e911a95ad6b2a32e$export$23512680614f2620)(line, $1481377db44180ba$var$_overlapLine, hiddenOverlaps)) (0, $627e7388cda991d0$export$84bed164e326c2f0)(hiddenOverlaps);\n // if we're hiding the edge entirely now then skip further checks\n if (hiddenOverlaps.length !== 0) {\n const [d0, d1] = hiddenOverlaps[hiddenOverlaps.length - 1];\n return d0 === 0.0 && d1 === 1.0;\n }\n return false;\n }\n });\n // convert the overlap points to proper lines\n (0, $627e7388cda991d0$export$fbbde8a5b23b7b65)(line, hiddenOverlaps, finalEdges.edges);\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n if (onProgress) {\n const progress = i / edges.length;\n onProgress(progress, finalEdges);\n }\n yield;\n time = performance.now();\n }\n }\n return finalEdges.getLineGeometry(0);\n }\n}\n\n\nonmessage = function({ data: data }) {\n let prevTime = performance.now();\n function onProgressCallback(progress) {\n const currTime = performance.now();\n if (currTime - prevTime >= 10 || progress === 1.0) {\n postMessage({\n error: null,\n progress: progress\n });\n prevTime = currTime;\n }\n }\n try {\n const { index: index, position: position, options: options } = data;\n const geometry = new (0, $e06gU.BufferGeometry)();\n geometry.setIndex(new (0, $e06gU.BufferAttribute)(index, 1, false));\n geometry.setAttribute(\"position\", new (0, $e06gU.BufferAttribute)(position, 3, false));\n const generator = new (0, $1481377db44180ba$export$4776387f3c0e5209)();\n generator.sortEdges = options.sortEdges ?? generator.sortEdges;\n generator.angleThreshold = options.angleThreshold ?? generator.angleThreshold;\n generator.includeIntersectionEdges = options.includeIntersectionEdges ?? generator.includeIntersectionEdges;\n const task = generator.generate(geometry, {\n onProgress: onProgressCallback\n });\n let result = task.next();\n while(!result.done)result = task.next();\n const resultLines = result.value.attributes.position.array;\n postMessage({\n result: resultLines,\n error: null,\n progress: 1\n }, [\n resultLines.buffer\n ]);\n } catch (error) {\n postMessage({\n error: error,\n progress: 1\n });\n }\n};\n\n})();\n//# sourceMappingURL=projectionAsync.worker.28971622.js.map\n","import { BufferAttribute, BufferGeometry } from 'three';\nimport { ProjectionGenerator } from '../ProjectionGenerator.js';\n\nonmessage = function ( { data } ) {\n\n\tlet prevTime = performance.now();\n\tfunction onProgressCallback( progress ) {\n\n\t\tconst currTime = performance.now();\n\t\tif ( currTime - prevTime >= 10 || progress === 1.0 ) {\n\n\t\t\tpostMessage( {\n\n\t\t\t\terror: null,\n\t\t\t\tprogress,\n\n\t\t\t} );\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t}\n\n\ttry {\n\n\t\tconst { index, position, options } = data;\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( index, 1, false ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( position, 3, false ) );\n\n\t\tconst generator = new ProjectionGenerator();\n\t\tgenerator.sortEdges = options.sortEdges ?? generator.sortEdges;\n\t\tgenerator.angleThreshold = options.angleThreshold ?? generator.angleThreshold;\n\t\tgenerator.includeIntersectionEdges = options.includeIntersectionEdges ?? generator.includeIntersectionEdges;\n\n\t\tconst task = generator.generate( geometry, {\n\t\t\tonProgress: onProgressCallback,\n\t\t} );\n\n\t\tlet result = task.next();\n\t\twhile ( ! result.done ) {\n\n\t\t\tresult = task.next();\n\n\t\t}\n\n\t\tconst resultLines = result.value.attributes.position.array;\n\t\tpostMessage( {\n\n\t\t\tresult: resultLines,\n\t\t\terror: null,\n\t\t\tprogress: 1,\n\n\t\t}, [ resultLines.buffer ] );\n\n\t} catch ( error ) {\n\n\t\tpostMessage( {\n\n\t\t\terror,\n\t\t\tprogress: 1,\n\n\t\t} );\n\n\t}\n\n};\n","import {\n\tBufferGeometry,\n\tVector3,\n\tLine3,\n\tRay,\n\tBufferAttribute,\n} from 'three';\nimport { MeshBVH } from 'three-mesh-bvh';\nimport {\n\tisYProjectedTriangleDegenerate,\n\tisLineTriangleEdge,\n\tisYProjectedLineDegenerate,\n} from './utils/triangleLineUtils.js';\nimport { generateEdges } from './utils/generateEdges.js';\nimport { compressEdgeOverlaps, overlapsToLines } from './utils/overlapUtils.js';\nimport { trimToBeneathTriPlane } from './utils/trimToBeneathTriPlane.js';\nimport { getProjectedLineOverlap } from './utils/getProjectedLineOverlap.js';\nimport { appendOverlapRange } from './utils/getProjectedOverlaps.js';\nimport { generateIntersectionEdges } from './utils/generateIntersectionEdges.js';\n\n// these shared variables are not used across \"yield\" boundaries in the\n// generator so there's no risk of overwriting another tasks data\nconst DIST_THRESHOLD = 1e-10;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _beneathLine = /* @__PURE__ */ new Line3();\nconst _ray = /* @__PURE__ */ new Ray();\nconst _vec = /* @__PURE__ */ new Vector3();\nconst _overlapLine = /* @__PURE__ */ new Line3();\n\nclass EdgeSet {\n\n\tconstructor() {\n\n\t\tthis.edges = [];\n\n\t}\n\n\tgetLineGeometry( y = 0 ) {\n\n\t\tconst edges = this.edges;\n\t\tconst edgeArray = new Float32Array( edges.length * 6 );\n\t\tlet c = 0;\n\t\tfor ( let i = 0, l = edges.length; i < l; i ++ ) {\n\n\t\t\tconst line = edges[ i ];\n\t\t\tedgeArray[ c ++ ] = line[ 0 ];\n\t\t\tedgeArray[ c ++ ] = y;\n\t\t\tedgeArray[ c ++ ] = line[ 2 ];\n\t\t\tedgeArray[ c ++ ] = line[ 3 ];\n\t\t\tedgeArray[ c ++ ] = y;\n\t\t\tedgeArray[ c ++ ] = line[ 5 ];\n\n\t\t}\n\n\t\tconst edgeGeom = new BufferGeometry();\n\t\tconst edgeBuffer = new BufferAttribute( edgeArray, 3, true );\n\t\tedgeGeom.setAttribute( 'position', edgeBuffer );\n\t\treturn edgeGeom;\n\n\t}\n\n}\n\nexport class ProjectionGenerator {\n\n\tconstructor() {\n\n\t\tthis.sortEdges = true;\n\t\tthis.iterationTime = 30;\n\t\tthis.angleThreshold = 50;\n\t\tthis.includeIntersectionEdges = true;\n\n\t}\n\n\tgenerateAsync( geometry, options = {} ) {\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tconst { signal } = options;\n\t\t\tconst task = this.generate( geometry, options );\n\t\t\trun();\n\n\t\t\tfunction run() {\n\n\t\t\t\tif ( signal && signal.aborted ) {\n\n\t\t\t\t\treject( new Error( 'ProjectionGenerator: Process aborted via AbortSignal.' ) );\n\n\t\t\t\t}\n\n\t\t\t\tconst result = task.next();\n\t\t\t\tif ( result.done ) {\n\n\t\t\t\t\tresolve( result.value );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trequestAnimationFrame( run );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t} );\n\n\t}\n\n\t*generate( bvh, options = {} ) {\n\n\t\tconst { onProgress } = options;\n\t\tconst { sortEdges, iterationTime, angleThreshold, includeIntersectionEdges } = this;\n\n\t\tif ( bvh instanceof BufferGeometry ) {\n\n\t\t\tbvh = new MeshBVH( bvh, { maxLeafTris: 1 } );\n\n\t\t}\n\n\t\tconst geometry = bvh.geometry;\n\t\tlet edges = generateEdges( geometry, UP_VECTOR, angleThreshold );\n\t\tif ( includeIntersectionEdges ) {\n\n\t\t\tconst results = yield* generateIntersectionEdges( bvh, iterationTime );\n\t\t\tedges = edges.concat( results );\n\n\t\t}\n\n\t\tif ( sortEdges ) {\n\n\t\t\tedges.sort( ( a, b ) => {\n\n\t\t\t\treturn Math.min( a.start.y, a.end.y ) - Math.min( b.start.y, b.end.y );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tyield;\n\n\t\t// trim the candidate edges\n\t\tconst finalEdges = new EdgeSet();\n\t\tlet time = performance.now();\n\t\tfor ( let i = 0, l = edges.length; i < l; i ++ ) {\n\n\t\t\tconst line = edges[ i ];\n\t\t\tif ( isYProjectedLineDegenerate( line ) ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst lowestLineY = Math.min( line.start.y, line.end.y );\n\t\t\tconst highestLineY = Math.max( line.start.y, line.end.y );\n\t\t\tconst hiddenOverlaps = [];\n\t\t\tbvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => {\n\n\t\t\t\t\t// expand the bounding box to the bottom height of the line\n\t\t\t\t\tbox.min.y = Math.min( lowestLineY - 1e-6, box.min.y );\n\n\t\t\t\t\t// get the line as a ray\n\t\t\t\t\tconst { origin, direction } = _ray;\n\t\t\t\t\torigin.copy( line.start );\n\t\t\t\t\tline.delta( direction ).normalize();\n\n\t\t\t\t\t// if the ray is inside the box then we intersect it\n\t\t\t\t\tif ( box.containsPoint( origin ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// check if the line segment intersects the box\n\t\t\t\t\tif ( _ray.intersectBox( box, _vec ) ) {\n\n\t\t\t\t\t\treturn origin.distanceToSquared( _vec ) < line.distanceSq();\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\t// skip the triangle if the triangle is completely below the line\n\t\t\t\t\tconst highestTriangleY = Math.max( tri.a.y, tri.b.y, tri.c.y );\n\t\t\t\t\tif ( highestTriangleY <= lowestLineY ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if the projected triangle is just a line then don't check it\n\t\t\t\t\tif ( isYProjectedTriangleDegenerate( tri ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if this line lies on a triangle edge then don't check for visual overlaps\n\t\t\t\t\t// with this triangle\n\t\t\t\t\tif ( isLineTriangleEdge( tri, line ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Retrieve the portion of line that is below the plane - and skip the triangle if none\n\t\t\t\t\t// of it is\n\t\t\t\t\tconst lowestTriangleY = Math.min( tri.a.y, tri.b.y, tri.c.y );\n\t\t\t\t\tif ( highestLineY < lowestTriangleY ) {\n\n\t\t\t\t\t\t_beneathLine.copy( line );\n\n\t\t\t\t\t} else if ( ! trimToBeneathTriPlane( tri, line, _beneathLine ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( _beneathLine.distance() < DIST_THRESHOLD ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// compress the edge overlaps so we can easily tell if the whole edge is hidden already\n\t\t\t\t\t// and exit early\n\t\t\t\t\tif (\n\t\t\t\t\t\tgetProjectedLineOverlap( _beneathLine, tri, _overlapLine ) &&\n\t\t\t\t\t\tappendOverlapRange( line, _overlapLine, hiddenOverlaps )\n\t\t\t\t\t) {\n\n\t\t\t\t\t\tcompressEdgeOverlaps( hiddenOverlaps );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if we're hiding the edge entirely now then skip further checks\n\t\t\t\t\tif ( hiddenOverlaps.length !== 0 ) {\n\n\t\t\t\t\t\tconst [ d0, d1 ] = hiddenOverlaps[ hiddenOverlaps.length - 1 ];\n\t\t\t\t\t\treturn d0 === 0.0 && d1 === 1.0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t\t// convert the overlap points to proper lines\n\t\t\toverlapsToLines( line, hiddenOverlaps, finalEdges.edges );\n\n\t\t\tconst delta = performance.now() - time;\n\t\t\tif ( delta > iterationTime ) {\n\n\t\t\t\tif ( onProgress ) {\n\n\t\t\t\t\tconst progress = i / edges.length;\n\t\t\t\t\tonProgress( progress, finalEdges );\n\n\t\t\t\t}\n\n\t\t\t\tyield;\n\t\t\t\ttime = performance.now();\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn finalEdges.getLineGeometry( 0 );\n\n\t}\n\n}\n","import { BufferAttribute, Box3, FrontSide } from 'three';\nimport { CENTER, BYTES_PER_NODE, IS_LEAFNODE_FLAG, SKIP_GENERATION } from './Constants.js';\nimport { buildPackedTree } from './build/buildTree.js';\nimport { OrientedBox } from '../math/OrientedBox.js';\nimport { arrayToBox } from '../utils/ArrayBoxUtilities.js';\nimport { ExtendedTrianglePool } from '../utils/ExtendedTrianglePool.js';\nimport { shapecast } from './cast/shapecast.js';\nimport { closestPointToPoint } from './cast/closestPointToPoint.js';\n\nimport { iterateOverTriangles } from './utils/iterationUtils.generated.js';\nimport { refit } from './cast/refit.generated.js';\nimport { raycast } from './cast/raycast.generated.js';\nimport { raycastFirst } from './cast/raycastFirst.generated.js';\nimport { intersectsGeometry } from './cast/intersectsGeometry.generated.js';\nimport { closestPointToGeometry } from './cast/closestPointToGeometry.generated.js';\nimport { bvhcast } from './cast/bvhcast.generated.js';\n\nimport { iterateOverTriangles_indirect } from './utils/iterationUtils_indirect.generated.js';\nimport { refit_indirect } from './cast/refit_indirect.generated.js';\nimport { raycast_indirect } from './cast/raycast_indirect.generated.js';\nimport { raycastFirst_indirect } from './cast/raycastFirst_indirect.generated.js';\nimport { intersectsGeometry_indirect } from './cast/intersectsGeometry_indirect.generated.js';\nimport { closestPointToGeometry_indirect } from './cast/closestPointToGeometry_indirect.generated.js';\nimport { bvhcast_indirect } from './cast/bvhcast_indirect.generated.js';\nimport { isSharedArrayBufferSupported } from '../utils/BufferUtils.js';\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst tempBox = /* @__PURE__ */ new Box3();\n\nexport class MeshBVH {\n\n\tstatic serialize( bvh, options = {} ) {\n\n\t\toptions = {\n\t\t\tcloneBuffers: true,\n\t\t\t...options,\n\t\t};\n\n\t\tconst geometry = bvh.geometry;\n\t\tconst rootData = bvh._roots;\n\t\tconst indirectBuffer = bvh._indirectBuffer;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tlet result;\n\t\tif ( options.cloneBuffers ) {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData.map( root => root.slice() ),\n\t\t\t\tindex: indexAttribute.array.slice(),\n\t\t\t\tindirectBuffer: indirectBuffer ? indirectBuffer.slice() : null,\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData,\n\t\t\t\tindex: indexAttribute.array,\n\t\t\t\tindirectBuffer: indirectBuffer,\n\t\t\t};\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, options = {} ) {\n\n\t\toptions = {\n\t\t\tsetIndex: true,\n\t\t\tindirect: Boolean( data.indirectBuffer ),\n\t\t\t...options,\n\t\t};\n\n\t\tconst { index, roots, indirectBuffer } = data;\n\t\tconst bvh = new MeshBVH( geometry, { ...options, [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\t\tbvh._indirectBuffer = indirectBuffer || null;\n\n\t\tif ( options.setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tget indirect() {\n\n\t\treturn ! ! this._indirectBuffer;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\t\t\tuseSharedArrayBuffer: false,\n\t\t\tsetBoundingBox: true,\n\t\t\tonProgress: null,\n\t\t\tindirect: false,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false,\n\n\t\t}, options );\n\n\t\tif ( options.useSharedArrayBuffer && ! isSharedArrayBufferSupported() ) {\n\n\t\t\tthrow new Error( 'MeshBVH: SharedArrayBuffer is not available.' );\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\t\tthis._roots = null;\n\t\tthis._indirectBuffer = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tbuildPackedTree( this, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst { _indirectBuffer } = this;\n\t\tthis.resolveTriangleIndex = options.indirect ? i => _indirectBuffer[ i ] : i => i;\n\n\t}\n\n\trefit( nodeIndices = null ) {\n\n\t\tconst refitFunc = this.indirect ? refit_indirect : refit;\n\t\treturn refitFunc( this, nodeIndices );\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\t// TODO: use node functions here\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( ray, materialOrSide = FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst intersects = [];\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tconst raycastFunc = this.indirect ? raycast_indirect : raycast;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\t\t\tconst startCount = intersects.length;\n\n\t\t\traycastFunc( this, i, materialSide, ray, intersects );\n\n\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\tconst materialIndex = groups[ i ].materialIndex;\n\t\t\t\tfor ( let j = startCount, jl = intersects.length; j < jl; j ++ ) {\n\n\t\t\t\t\tintersects[ j ].face.materialIndex = materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn intersects;\n\n\t}\n\n\traycastFirst( ray, materialOrSide = FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tlet closestResult = null;\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tconst raycastFirstFunc = this.indirect ? raycastFirst_indirect : raycastFirst;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\t\t\tconst result = raycastFirstFunc( this, i, materialSide, ray );\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\t\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\t\tresult.face.materialIndex = groups[ i ].materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( otherGeometry, geomToMesh ) {\n\n\t\tlet result = false;\n\t\tconst roots = this._roots;\n\t\tconst intersectsGeometryFunc = this.indirect ? intersectsGeometry_indirect : intersectsGeometry;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tresult = intersectsGeometryFunc( this, i, otherGeometry, geomToMesh );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( callbacks ) {\n\n\t\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\t\tconst iterateFunc = this.indirect ? iterateOverTriangles_indirect : iterateOverTriangles;\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\t// wrap the intersectsRange function\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateFunc( offset, count, this, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateFunc( offset, count, this, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// run shapecast\n\t\tlet result = false;\n\t\tlet byteOffset = 0;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst root = roots[ i ];\n\t\t\tresult = shapecast( this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tbyteOffset += root.byteLength;\n\n\t\t}\n\n\t\tExtendedTrianglePool.releasePrimitive( triangle );\n\n\t\treturn result;\n\n\t}\n\n\tbvhcast( otherBvh, matrixToLocal, callbacks ) {\n\n\t\tconst bvhcastFunc = this.indirect ? bvhcast_indirect : bvhcast;\n\t\treturn bvhcastFunc( this, otherBvh, matrixToLocal, callbacks );\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.needsUpdate = true;\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( otherGeometry, geometryToBvh, target1 = { }, target2 = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tconst closestPointToGeometryFunc = this.indirect ? closestPointToGeometry_indirect : closestPointToGeometry;\n\t\treturn closestPointToGeometryFunc(\n\t\t\tthis,\n\t\t\totherGeometry,\n\t\t\tgeometryToBvh,\n\t\t\ttarget1,\n\t\t\ttarget2,\n\t\t\tminThreshold,\n\t\t\tmaxThreshold,\n\t\t);\n\n\t}\n\n\tclosestPointToPoint( point, target = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\treturn closestPointToPoint(\n\t\t\tthis,\n\t\t\tpoint,\n\t\t\ttarget,\n\t\t\tminThreshold,\n\t\t\tmaxThreshold,\n\t\t);\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","// Split strategy constants\nexport const CENTER = 0;\nexport const AVERAGE = 1;\nexport const SAH = 2;\n\n// Traversal constants\nexport const NOT_INTERSECTED = 0;\nexport const INTERSECTED = 1;\nexport const CONTAINED = 2;\n\n// SAH cost constants\n// TODO: hone these costs more. The relative difference between them should be the\n// difference in measured time to perform a triangle intersection vs traversing\n// bounds.\nexport const TRIANGLE_INTERSECT_COST = 1.25;\nexport const TRAVERSAL_COST = 1;\n\n\n// Build constants\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\n\n// EPSILON for computing floating point error during build\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\nexport const FLOAT32_EPSILON = Math.pow( 2, - 24 );\n\nexport const SKIP_GENERATION = Symbol( 'SKIP_GENERATION' );\n","import { ensureIndex, getFullGeometryRange, getRootIndexRanges, getTriCount, hasGroupGaps, } from './geometryUtils.js';\nimport { getBounds, getCentroidBounds, computeTriangleBounds } from './computeBoundsUtils.js';\nimport { getOptimalSplit } from './splitUtils.js';\nimport { MeshBVHNode } from '../MeshBVHNode.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG } from '../Constants.js';\n\nimport { partition } from './sortUtils.generated.js';\nimport { partition_indirect } from './sortUtils_indirect.generated.js';\n\nfunction generateIndirectBuffer( geometry, useSharedArrayBuffer ) {\n\n\tconst triCount = ( geometry.index ? geometry.index.count : geometry.attributes.position.count ) / 3;\n\tconst useUint32 = triCount > 2 ** 16;\n\tconst byteCount = useUint32 ? 4 : 2;\n\n\tconst buffer = useSharedArrayBuffer ? new SharedArrayBuffer( triCount * byteCount ) : new ArrayBuffer( triCount * byteCount );\n\tconst indirectBuffer = useUint32 ? new Uint32Array( buffer ) : new Uint16Array( buffer );\n\tfor ( let i = 0, l = indirectBuffer.length; i < l; i ++ ) {\n\n\t\tindirectBuffer[ i ] = i;\n\n\t}\n\n\treturn indirectBuffer;\n\n}\n\nfunction buildTree( bvh, options ) {\n\n\t// Compute the full bounds of the geometry at the same time as triangle bounds because\n\t// we'll need it for the root bounds in the case with no groups and it should be fast here.\n\t// We can't use the geometry bounding box if it's available because it may be out of date.\n\tconst geometry = bvh.geometry;\n\tconst indexArray = geometry.index ? geometry.index.array : null;\n\tconst maxDepth = options.maxDepth;\n\tconst verbose = options.verbose;\n\tconst maxLeafTris = options.maxLeafTris;\n\tconst strategy = options.strategy;\n\tconst onProgress = options.onProgress;\n\tconst totalTriangles = getTriCount( geometry );\n\tconst indirectBuffer = bvh._indirectBuffer;\n\tlet reachedMaxDepth = false;\n\n\tconst fullBounds = new Float32Array( 6 );\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\n\tconst triangleBounds = computeTriangleBounds( geometry, fullBounds );\n\tconst partionFunc = options.indirect ? partition_indirect : partition;\n\n\tconst roots = [];\n\tconst ranges = options.indirect ? getFullGeometryRange( geometry ) : getRootIndexRanges( geometry );\n\n\tif ( ranges.length === 1 ) {\n\n\t\tconst range = ranges[ 0 ];\n\t\tconst root = new MeshBVHNode();\n\t\troot.boundingData = fullBounds;\n\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\n\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\troots.push( root );\n\n\t} else {\n\n\t\tfor ( let range of ranges ) {\n\n\t\t\tconst root = new MeshBVHNode();\n\t\t\troot.boundingData = new Float32Array( 6 );\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\n\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\t\troots.push( root );\n\n\t\t}\n\n\t}\n\n\treturn roots;\n\n\tfunction triggerProgress( trianglesProcessed ) {\n\n\t\tif ( onProgress ) {\n\n\t\t\tonProgress( trianglesProcessed / totalTriangles );\n\n\t\t}\n\n\t}\n\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\n\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\n\n\t\t\treachedMaxDepth = true;\n\t\t\tif ( verbose ) {\n\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\n\t\t\t\tconsole.warn( geometry );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// early out if we've met our capacity\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\t// Find where to split the volume\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, offset, count, strategy );\n\t\tif ( split.axis === - 1 ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\tconst splitOffset = partionFunc( indirectBuffer, indexArray, triangleBounds, offset, count, split );\n\n\t\t// create the two new child nodes\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\n\t\t} else {\n\n\t\t\tnode.splitAxis = split.axis;\n\n\t\t\t// create the left child and compute its bounding box\n\t\t\tconst left = new MeshBVHNode();\n\t\t\tconst lstart = offset;\n\t\t\tconst lcount = splitOffset - offset;\n\t\t\tnode.left = left;\n\t\t\tleft.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t\t// repeat for right\n\t\t\tconst right = new MeshBVHNode();\n\t\t\tconst rstart = splitOffset;\n\t\t\tconst rcount = count - lcount;\n\t\t\tnode.right = right;\n\t\t\tright.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n}\n\nexport function buildPackedTree( bvh, options ) {\n\n\tconst geometry = bvh.geometry;\n\tif ( options.indirect ) {\n\n\t\tbvh._indirectBuffer = generateIndirectBuffer( geometry, options.useSharedArrayBuffer );\n\n\t\tif ( hasGroupGaps( geometry ) && ! options.verbose ) {\n\n\t\t\tconsole.warn(\n\t\t\t\t'MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the \"indirect\" option. ' +\n\t\t\t\t'BVH may incorrectly report intersections on unrendered portions of the geometry.'\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tif ( ! bvh._indirectBuffer ) {\n\n\t\tensureIndex( geometry, options );\n\n\t}\n\n\t// boundingData \t\t\t\t: 6 float32\n\t// right / offset \t\t\t\t: 1 uint32\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\n\tconst roots = buildTree( bvh, options );\n\n\tlet float32Array;\n\tlet uint32Array;\n\tlet uint16Array;\n\tconst packedRoots = [];\n\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\tfor ( let i = 0; i < roots.length; i ++ ) {\n\n\t\tconst root = roots[ i ];\n\t\tlet nodeCount = countNodes( root );\n\n\t\tconst buffer = new BufferConstructor( BYTES_PER_NODE * nodeCount );\n\t\tfloat32Array = new Float32Array( buffer );\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tpopulateBuffer( 0, root );\n\t\tpackedRoots.push( buffer );\n\n\t}\n\n\tbvh._roots = packedRoots;\n\treturn;\n\n\tfunction countNodes( node ) {\n\n\t\tif ( node.count ) {\n\n\t\t\treturn 1;\n\n\t\t} else {\n\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\n\n\t\t}\n\n\t}\n\n\tfunction populateBuffer( byteOffset, node ) {\n\n\t\tconst stride4Offset = byteOffset / 4;\n\t\tconst stride2Offset = byteOffset / 2;\n\t\tconst isLeaf = ! ! node.count;\n\t\tconst boundingData = node.boundingData;\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\n\n\t\t}\n\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = node.offset;\n\t\t\tconst count = node.count;\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\n\t\t\treturn byteOffset + BYTES_PER_NODE;\n\n\t\t} else {\n\n\t\t\tconst left = node.left;\n\t\t\tconst right = node.right;\n\t\t\tconst splitAxis = node.splitAxis;\n\n\t\t\tlet nextUnusedPointer;\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\n\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\n\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\n\n\t\t\t}\n\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\n\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\n\t\t\treturn nextUnusedPointer;\n\n\t\t}\n\n\t}\n\n}\n","import { BufferAttribute } from 'three';\n\nexport function getVertexCount( geo ) {\n\n\treturn geo.index ? geo.index.count : geo.attributes.position.count;\n\n}\n\nexport function getTriCount( geo ) {\n\n\treturn getVertexCount( geo ) / 3;\n\n}\n\nexport function getIndexArray( vertexCount, BufferConstructor = ArrayBuffer ) {\n\n\tif ( vertexCount > 65535 ) {\n\n\t\treturn new Uint32Array( new BufferConstructor( 4 * vertexCount ) );\n\n\t} else {\n\n\t\treturn new Uint16Array( new BufferConstructor( 2 * vertexCount ) );\n\n\t}\n\n}\n\n// ensures that an index is present on the geometry\nexport function ensureIndex( geo, options ) {\n\n\tif ( ! geo.index ) {\n\n\t\tconst vertexCount = geo.attributes.position.count;\n\t\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\t\tconst index = getIndexArray( vertexCount, BufferConstructor );\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\n\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tindex[ i ] = i;\n\n\t\t}\n\n\t}\n\n}\n\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\n// region in the geometry index that belongs to a different set of material groups requires\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\n// with triangle indices belongs to another group. For example, if the groups were like this:\n//\n// [-------------------------------------------------------------]\n// |__________________|\n// g0 = [0, 20] |______________________||_____________________|\n// g1 = [16, 40] g2 = [41, 60]\n//\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\nexport function getFullGeometryRange( geo ) {\n\n\tconst triCount = getTriCount( geo );\n\tconst drawRange = geo.drawRange;\n\tconst start = drawRange.start / 3;\n\tconst end = ( drawRange.start + drawRange.count ) / 3;\n\n\tconst offset = Math.max( 0, start );\n\tconst count = Math.min( triCount, end ) - offset;\n\treturn [ {\n\t\toffset: Math.floor( offset ),\n\t\tcount: Math.floor( count ),\n\t} ];\n\n}\n\nexport function getRootIndexRanges( geo ) {\n\n\tif ( ! geo.groups || ! geo.groups.length ) {\n\n\t\treturn getFullGeometryRange( geo );\n\n\t}\n\n\tconst ranges = [];\n\tconst rangeBoundaries = new Set();\n\n\tconst drawRange = geo.drawRange;\n\tconst drawRangeStart = drawRange.start / 3;\n\tconst drawRangeEnd = ( drawRange.start + drawRange.count ) / 3;\n\tfor ( const group of geo.groups ) {\n\n\t\tconst groupStart = group.start / 3;\n\t\tconst groupEnd = ( group.start + group.count ) / 3;\n\t\trangeBoundaries.add( Math.max( drawRangeStart, groupStart ) );\n\t\trangeBoundaries.add( Math.min( drawRangeEnd, groupEnd ) );\n\n\t}\n\n\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\n\n\t\tconst start = sortedBoundaries[ i ];\n\t\tconst end = sortedBoundaries[ i + 1 ];\n\n\t\tranges.push( {\n\t\t\toffset: Math.floor( start ),\n\t\t\tcount: Math.floor( end - start ),\n\t\t} );\n\n\t}\n\n\treturn ranges;\n\n}\n\nexport function hasGroupGaps( geometry ) {\n\n\tif ( geometry.groups.length === 0 ) {\n\n\t\treturn false;\n\n\t}\n\n\tconst vertexCount = getTriCount( geometry );\n\tconst groups = getRootIndexRanges( geometry )\n\t\t.sort( ( a, b ) => a.offset - b.offset );\n\n\tconst finalGroup = groups[ groups.length - 1 ];\n\tfinalGroup.count = Math.min( vertexCount - finalGroup.offset, finalGroup.count );\n\n\tlet total = 0;\n\tgroups.forEach( ( { count } ) => total += count );\n\treturn vertexCount !== total;\n\n}\n","import { FLOAT32_EPSILON } from '../Constants.js';\nimport { makeEmptyBounds } from '../../utils/ArrayBoxUtilities.js';\nimport { getTriCount } from './geometryUtils.js';\n\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\n// These are computed together to avoid redundant accesses to bounds array.\nexport function getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\n\n\tlet minx = Infinity;\n\tlet miny = Infinity;\n\tlet minz = Infinity;\n\tlet maxx = - Infinity;\n\tlet maxy = - Infinity;\n\tlet maxz = - Infinity;\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tconst includeCentroid = centroidTarget !== null;\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tconst hx = triangleBounds[ i + 1 ];\n\t\tconst lx = cx - hx;\n\t\tconst rx = cx + hx;\n\t\tif ( lx < minx ) minx = lx;\n\t\tif ( rx > maxx ) maxx = rx;\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tconst hy = triangleBounds[ i + 3 ];\n\t\tconst ly = cy - hy;\n\t\tconst ry = cy + hy;\n\t\tif ( ly < miny ) miny = ly;\n\t\tif ( ry > maxy ) maxy = ry;\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tconst hz = triangleBounds[ i + 5 ];\n\t\tconst lz = cz - hz;\n\t\tconst rz = cz + hz;\n\t\tif ( lz < minz ) minz = lz;\n\t\tif ( rz > maxz ) maxz = rz;\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\ttarget[ 0 ] = minx;\n\ttarget[ 1 ] = miny;\n\ttarget[ 2 ] = minz;\n\n\ttarget[ 3 ] = maxx;\n\ttarget[ 4 ] = maxy;\n\ttarget[ 5 ] = maxz;\n\n\tif ( includeCentroid ) {\n\n\t\tcentroidTarget[ 0 ] = cminx;\n\t\tcentroidTarget[ 1 ] = cminy;\n\t\tcentroidTarget[ 2 ] = cminz;\n\n\t\tcentroidTarget[ 3 ] = cmaxx;\n\t\tcentroidTarget[ 4 ] = cmaxy;\n\t\tcentroidTarget[ 5 ] = cmaxz;\n\n\t}\n\n}\n\n// A stand alone function for retrieving the centroid bounds.\nexport function getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tif ( cx < cminx ) cminx = cx;\n\t\tif ( cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tif ( cy < cminy ) cminy = cy;\n\t\tif ( cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tif ( cz < cminz ) cminz = cz;\n\t\tif ( cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\tcentroidTarget[ 0 ] = cminx;\n\tcentroidTarget[ 1 ] = cminy;\n\tcentroidTarget[ 2 ] = cminz;\n\n\tcentroidTarget[ 3 ] = cmaxx;\n\tcentroidTarget[ 4 ] = cmaxy;\n\tcentroidTarget[ 5 ] = cmaxz;\n\n}\n\n\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\n// result is an array of size tris.length * 6 where triangle i maps to a\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\n// representing the center and half-extent in each dimension of triangle i\nexport function computeTriangleBounds( geo, fullBounds ) {\n\n\t// clear the bounds to empty\n\tmakeEmptyBounds( fullBounds );\n\n\tconst posAttr = geo.attributes.position;\n\tconst index = geo.index ? geo.index.array : null;\n\tconst triCount = getTriCount( geo );\n\tconst triangleBounds = new Float32Array( triCount * 6 );\n\tconst normalized = posAttr.normalized;\n\n\t// used for non-normalized positions\n\tconst posArr = posAttr.array;\n\n\t// support for an interleaved position buffer\n\tconst bufferOffset = posAttr.offset || 0;\n\tlet stride = 3;\n\tif ( posAttr.isInterleavedBufferAttribute ) {\n\n\t\tstride = posAttr.data.stride;\n\n\t}\n\n\t// used for normalized positions\n\tconst getters = [ 'getX', 'getY', 'getZ' ];\n\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\n\n\t\tconst tri3 = tri * 3;\n\t\tconst tri6 = tri * 6;\n\n\t\tlet ai = tri3 + 0;\n\t\tlet bi = tri3 + 1;\n\t\tlet ci = tri3 + 2;\n\n\t\tif ( index ) {\n\n\t\t\tai = index[ ai ];\n\t\t\tbi = index[ bi ];\n\t\t\tci = index[ ci ];\n\n\t\t}\n\n\t\t// we add the stride and offset here since we access the array directly\n\t\t// below for the sake of performance\n\t\tif ( ! normalized ) {\n\n\t\t\tai = ai * stride + bufferOffset;\n\t\t\tbi = bi * stride + bufferOffset;\n\t\t\tci = ci * stride + bufferOffset;\n\n\t\t}\n\n\t\tfor ( let el = 0; el < 3; el ++ ) {\n\n\t\t\tlet a, b, c;\n\n\t\t\tif ( normalized ) {\n\n\t\t\t\ta = posAttr[ getters[ el ] ]( ai );\n\t\t\t\tb = posAttr[ getters[ el ] ]( bi );\n\t\t\t\tc = posAttr[ getters[ el ] ]( ci );\n\n\t\t\t} else {\n\n\t\t\t\ta = posArr[ ai + el ];\n\t\t\t\tb = posArr[ bi + el ];\n\t\t\t\tc = posArr[ ci + el ];\n\n\t\t\t}\n\n\t\t\tlet min = a;\n\t\t\tif ( b < min ) min = b;\n\t\t\tif ( c < min ) min = c;\n\n\t\t\tlet max = a;\n\t\t\tif ( b > max ) max = b;\n\t\t\tif ( c > max ) max = c;\n\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\n\t\t\t// worked with.\n\t\t\tconst halfExtents = ( max - min ) / 2;\n\t\t\tconst el2 = el * 2;\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\n\n\t\t\tif ( min < fullBounds[ el ] ) fullBounds[ el ] = min;\n\t\t\tif ( max > fullBounds[ el + 3 ] ) fullBounds[ el + 3 ] = max;\n\n\t\t}\n\n\t}\n\n\treturn triangleBounds;\n\n}\n","export function arrayToBox( nodeIndex32, array, target ) {\n\n\ttarget.min.x = array[ nodeIndex32 ];\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\n\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\n\n\treturn target;\n\n}\n\nexport function makeEmptyBounds( target ) {\n\n\ttarget[ 0 ] = target[ 1 ] = target[ 2 ] = Infinity;\n\ttarget[ 3 ] = target[ 4 ] = target[ 5 ] = - Infinity;\n\n}\n\nexport function getLongestEdgeIndex( bounds ) {\n\n\tlet splitDimIdx = - 1;\n\tlet splitDist = - Infinity;\n\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\n\t\tif ( dist > splitDist ) {\n\n\t\t\tsplitDist = dist;\n\t\t\tsplitDimIdx = i;\n\n\t\t}\n\n\t}\n\n\treturn splitDimIdx;\n\n}\n\n// copies bounds a into bounds b\nexport function copyBounds( source, target ) {\n\n\ttarget.set( source );\n\n}\n\n// sets bounds target to the union of bounds a and b\nexport function unionBounds( a, b, target ) {\n\n\tlet aVal, bVal;\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst d3 = d + 3;\n\n\t\t// set the minimum values\n\t\taVal = a[ d ];\n\t\tbVal = b[ d ];\n\t\ttarget[ d ] = aVal < bVal ? aVal : bVal;\n\n\t\t// set the max values\n\t\taVal = a[ d3 ];\n\t\tbVal = b[ d3 ];\n\t\ttarget[ d3 ] = aVal > bVal ? aVal : bVal;\n\n\t}\n\n}\n\n// expands the given bounds by the provided triangle bounds\nexport function expandByTriangleBounds( startIndex, triangleBounds, bounds ) {\n\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst tCenter = triangleBounds[ startIndex + 2 * d ];\n\t\tconst tHalf = triangleBounds[ startIndex + 2 * d + 1 ];\n\n\t\tconst tMin = tCenter - tHalf;\n\t\tconst tMax = tCenter + tHalf;\n\n\t\tif ( tMin < bounds[ d ] ) {\n\n\t\t\tbounds[ d ] = tMin;\n\n\t\t}\n\n\t\tif ( tMax > bounds[ d + 3 ] ) {\n\n\t\t\tbounds[ d + 3 ] = tMax;\n\n\t\t}\n\n\t}\n\n}\n\n// compute bounds surface area\nexport function computeSurfaceArea( bounds ) {\n\n\tconst d0 = bounds[ 3 ] - bounds[ 0 ];\n\tconst d1 = bounds[ 4 ] - bounds[ 1 ];\n\tconst d2 = bounds[ 5 ] - bounds[ 2 ];\n\n\treturn 2 * ( d0 * d1 + d1 * d2 + d2 * d0 );\n\n}\n","import { getLongestEdgeIndex, computeSurfaceArea, copyBounds, unionBounds, expandByTriangleBounds } from '../../utils/ArrayBoxUtilities.js';\nimport { CENTER, AVERAGE, SAH, TRIANGLE_INTERSECT_COST, TRAVERSAL_COST } from '../Constants.js';\n\nconst BIN_COUNT = 32;\nconst binsSort = ( a, b ) => a.candidate - b.candidate;\nconst sahBins = new Array( BIN_COUNT ).fill().map( () => {\n\n\treturn {\n\n\t\tcount: 0,\n\t\tbounds: new Float32Array( 6 ),\n\t\trightCacheBounds: new Float32Array( 6 ),\n\t\tleftCacheBounds: new Float32Array( 6 ),\n\t\tcandidate: 0,\n\n\t};\n\n} );\nconst leftBounds = new Float32Array( 6 );\n\nexport function getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, offset, count, strategy ) {\n\n\tlet axis = - 1;\n\tlet pos = 0;\n\n\t// Center\n\tif ( strategy === CENTER ) {\n\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\n\n\t\t}\n\n\t} else if ( strategy === AVERAGE ) {\n\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\n\n\t\t}\n\n\t} else if ( strategy === SAH ) {\n\n\t\tconst rootSurfaceArea = computeSurfaceArea( nodeBoundingData );\n\t\tlet bestCost = TRIANGLE_INTERSECT_COST * count;\n\n\t\t// iterate over all axes\n\t\tconst cStart = offset * 6;\n\t\tconst cEnd = ( offset + count ) * 6;\n\t\tfor ( let a = 0; a < 3; a ++ ) {\n\n\t\t\tconst axisLeft = centroidBoundingData[ a ];\n\t\t\tconst axisRight = centroidBoundingData[ a + 3 ];\n\t\t\tconst axisLength = axisRight - axisLeft;\n\t\t\tconst binWidth = axisLength / BIN_COUNT;\n\n\t\t\t// If we have fewer triangles than we're planning to split then just check all\n\t\t\t// the triangle positions because it will be faster.\n\t\t\tif ( count < BIN_COUNT / 4 ) {\n\n\t\t\t\t// initialize the bin candidates\n\t\t\t\tconst truncatedBins = [ ...sahBins ];\n\t\t\t\ttruncatedBins.length = count;\n\n\t\t\t\t// set the candidates\n\t\t\t\tlet b = 0;\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6, b ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ b ];\n\t\t\t\t\tbin.candidate = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tbin.count = 0;\n\n\t\t\t\t\tconst {\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\tleftCacheBounds,\n\t\t\t\t\t\trightCacheBounds,\n\t\t\t\t\t} = bin;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\trightCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\trightCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tleftCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\tleftCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bounds );\n\n\t\t\t\t}\n\n\t\t\t\ttruncatedBins.sort( binsSort );\n\n\t\t\t\t// remove redundant splits\n\t\t\t\tlet splitCount = count;\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\twhile ( bi + 1 < splitCount && truncatedBins[ bi + 1 ].candidate === bin.candidate ) {\n\n\t\t\t\t\t\ttruncatedBins.splice( bi + 1, 1 );\n\t\t\t\t\t\tsplitCount --;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// find the appropriate bin for each triangle and expand the bounds.\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst center = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\t\tif ( center >= bin.candidate ) {\n\n\t\t\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.rightCacheBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.leftCacheBounds );\n\t\t\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// expand all the bounds\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\tconst leftCount = bin.count;\n\t\t\t\t\tconst rightCount = count - bin.count;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tconst leftBounds = bin.leftCacheBounds;\n\t\t\t\t\tconst rightBounds = bin.rightCacheBounds;\n\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = computeSurfaceArea( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet rightProb = 0;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = computeSurfaceArea( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = TRAVERSAL_COST + TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// reset the bins\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tbin.count = 0;\n\t\t\t\t\tbin.candidate = axisLeft + binWidth + i * binWidth;\n\n\t\t\t\t\tconst bounds = bin.bounds;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over all center positions\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst triCenter = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tconst relativeCenter = triCenter - axisLeft;\n\n\t\t\t\t\t// in the partition function if the centroid lies on the split plane then it is\n\t\t\t\t\t// considered to be on the right side of the split\n\t\t\t\t\tlet binIndex = ~ ~ ( relativeCenter / binWidth );\n\t\t\t\t\tif ( binIndex >= BIN_COUNT ) binIndex = BIN_COUNT - 1;\n\n\t\t\t\t\tconst bin = sahBins[ binIndex ];\n\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.bounds );\n\n\t\t\t\t}\n\n\t\t\t\t// cache the unioned bounds from right to left so we don't have to regenerate them each time\n\t\t\t\tconst lastBin = sahBins[ BIN_COUNT - 1 ];\n\t\t\t\tcopyBounds( lastBin.bounds, lastBin.rightCacheBounds );\n\t\t\t\tfor ( let i = BIN_COUNT - 2; i >= 0; i -- ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\tunionBounds( bin.bounds, nextBin.rightCacheBounds, bin.rightCacheBounds );\n\n\t\t\t\t}\n\n\t\t\t\tlet leftCount = 0;\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT - 1; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst binCount = bin.count;\n\t\t\t\t\tconst bounds = bin.bounds;\n\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\tconst rightBounds = nextBin.rightCacheBounds;\n\n\t\t\t\t\t// don't do anything with the bounds if the new bounds have no triangles\n\t\t\t\t\tif ( binCount !== 0 ) {\n\n\t\t\t\t\t\tif ( leftCount === 0 ) {\n\n\t\t\t\t\t\t\tcopyBounds( bounds, leftBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tunionBounds( bounds, leftBounds, leftBounds );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tleftCount += binCount;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tlet rightProb = 0;\n\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = computeSurfaceArea( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst rightCount = count - leftCount;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = computeSurfaceArea( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = TRAVERSAL_COST + TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\tconsole.warn( `MeshBVH: Invalid build strategy value ${ strategy } used.` );\n\n\t}\n\n\treturn { axis, pos };\n\n}\n\n// returns the average coordinate on the specified axis of the all the provided triangles\nfunction getAverage( triangleBounds, offset, count, axis ) {\n\n\tlet avg = 0;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\n\n\t}\n\n\treturn avg / count;\n\n}\n","export class MeshBVHNode {\n\n\tconstructor() {\n\n\t\t// internal nodes have boundingData, left, right, and splitAxis\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\n\n\t}\n\n}\n","/********************************************************/\n/* This file is generated from \"sortUtils.template.js\". */\n/********************************************************/\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction partition( indirectBuffer, index, triangleBounds, offset, count, split ) {\n\n\tlet left = offset;\n\tlet right = offset + count - 1;\n\tconst pos = split.pos;\n\tconst axisOffset = split.axis * 2;\n\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n\twhile ( true ) {\n\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\n\n\t\t\tleft ++;\n\n\t\t}\n\n\t\t// if a triangle center lies on the partition plane it is considered to be on the right side\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\n\n\t\t\tright --;\n\n\t\t}\n\n\t\tif ( left < right ) {\n\n\t\t\t// we need to swap all of the information associated with the triangles at index\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\n\t\t\t// and perhaps the SAH planes\n\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\tlet t0 = index[ left * 3 + i ];\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\n\t\t\t\tindex[ right * 3 + i ] = t0;\n\n\t\t\t}\n\n\n\t\t\t// swap bounds\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tlet tb = triangleBounds[ left * 6 + i ];\n\t\t\t\ttriangleBounds[ left * 6 + i ] = triangleBounds[ right * 6 + i ];\n\t\t\t\ttriangleBounds[ right * 6 + i ] = tb;\n\n\t\t\t}\n\n\t\t\tleft ++;\n\t\t\tright --;\n\n\t\t} else {\n\n\t\t\treturn left;\n\n\t\t}\n\n\t}\n\n}\n\nexport { partition };\n","/********************************************************/\n/* This file is generated from \"sortUtils.template.js\". */\n/********************************************************/\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction partition_indirect( indirectBuffer, index, triangleBounds, offset, count, split ) {\n\n\tlet left = offset;\n\tlet right = offset + count - 1;\n\tconst pos = split.pos;\n\tconst axisOffset = split.axis * 2;\n\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n\twhile ( true ) {\n\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\n\n\t\t\tleft ++;\n\n\t\t}\n\n\t\t// if a triangle center lies on the partition plane it is considered to be on the right side\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\n\n\t\t\tright --;\n\n\t\t}\n\n\t\tif ( left < right ) {\n\n\t\t\t// we need to swap all of the information associated with the triangles at index\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\n\t\t\t// and perhaps the SAH planes\n\t\t\tlet t = indirectBuffer[ left ];\n\t\t\tindirectBuffer[ left ] = indirectBuffer[ right ];\n\t\t\tindirectBuffer[ right ] = t;\n\n\n\t\t\t// swap bounds\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tlet tb = triangleBounds[ left * 6 + i ];\n\t\t\t\ttriangleBounds[ left * 6 + i ] = triangleBounds[ right * 6 + i ];\n\t\t\t\ttriangleBounds[ right * 6 + i ] = tb;\n\n\t\t\t}\n\n\t\t\tleft ++;\n\t\t\tright --;\n\n\t\t} else {\n\n\t\t\treturn left;\n\n\t\t}\n\n\t}\n\n}\n\nexport { partition_indirect };\n","import { Vector3, Matrix4, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { ExtendedTriangle } from './ExtendedTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox {\n\n\tconstructor( min, max, matrix ) {\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.min = new Vector3();\n\t\tthis.max = new Vector3();\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.needsUpdate = false;\n\n\t\tif ( min ) this.min.copy( min );\n\t\tif ( max ) this.max.copy( max );\n\t\tif ( matrix ) this.matrix.copy( matrix );\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\t\tthis.matrix.copy( matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.min.copy( other.min );\n\t\tthis.max.copy( other.max );\n\t\tthis.matrix.copy( other.matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\t\tthis.needsUpdate = false;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\t// TODO: should this be doing SAT against the AABB?\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new ExtendedTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! triangle.isExtendedTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\t// early out if we find a value below threshold\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","import { Vector3 } from 'three';\n\nexport class SeparatingAxisBounds {\n\n\tconstructor() {\n\n\t\tthis.min = Infinity;\n\t\tthis.max = - Infinity;\n\n\t}\n\n\tsetFromPointsField( points, field ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = p[ field ];\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tsetFromPoints( axis, points ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = axis.dot( p );\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tisSeparated( other ) {\n\n\t\treturn this.min > other.max || other.min > this.max;\n\n\t}\n\n}\n\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\n\n\tconst p = new Vector3();\n\treturn function setFromBox( axis, box ) {\n\n\t\tconst boxMin = box.min;\n\t\tconst boxMax = box.max;\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\n\n\t\t\t\t\tconst val = axis.dot( p );\n\t\t\t\t\tmin = Math.min( val, min );\n\t\t\t\t\tmax = Math.max( val, max );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t};\n\n} )();\n\nexport const areIntersecting = ( function () {\n\n\tconst cacheSatBounds = new SeparatingAxisBounds();\n\treturn function areIntersecting( shape1, shape2 ) {\n\n\t\tconst points1 = shape1.points;\n\t\tconst satAxes1 = shape1.satAxes;\n\t\tconst satBounds1 = shape1.satBounds;\n\n\t\tconst points2 = shape2.points;\n\t\tconst satAxes2 = shape2.satAxes;\n\t\tconst satBounds2 = shape2.satBounds;\n\n\t\t// check axes of the first shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds1[ i ];\n\t\t\tconst sa = satAxes1[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check axes of the second shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds2[ i ];\n\t\t\tconst sa = satAxes2[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere, Plane } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\n\nconst ZERO_EPSILON = 1e-15;\nfunction isNearZero( value ) {\n\n\treturn Math.abs( value ) < ZERO_EPSILON;\n\n}\n\nexport class ExtendedTriangle extends Triangle {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isExtendedTriangle = true;\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.points = [ this.a, this.b, this.c ];\n\t\tthis.sphere = new Sphere();\n\t\tthis.plane = new Plane();\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphereIntersectTriangle( sphere, this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst a = this.a;\n\t\tconst b = this.b;\n\t\tconst c = this.c;\n\t\tconst points = this.points;\n\n\t\tconst satAxes = this.satAxes;\n\t\tconst satBounds = this.satBounds;\n\n\t\tconst axis0 = satAxes[ 0 ];\n\t\tconst sab0 = satBounds[ 0 ];\n\t\tthis.getNormal( axis0 );\n\t\tsab0.setFromPoints( axis0, points );\n\n\t\tconst axis1 = satAxes[ 1 ];\n\t\tconst sab1 = satBounds[ 1 ];\n\t\taxis1.subVectors( a, b );\n\t\tsab1.setFromPoints( axis1, points );\n\n\t\tconst axis2 = satAxes[ 2 ];\n\t\tconst sab2 = satBounds[ 2 ];\n\t\taxis2.subVectors( b, c );\n\t\tsab2.setFromPoints( axis2, points );\n\n\t\tconst axis3 = satAxes[ 3 ];\n\t\tconst sab3 = satBounds[ 3 ];\n\t\taxis3.subVectors( c, a );\n\t\tsab3.setFromPoints( axis3, points );\n\n\t\tthis.sphere.setFromPoints( this.points );\n\t\tthis.plane.setFromNormalAndCoplanarPoint( axis0, a );\n\t\tthis.needsUpdate = false;\n\n\t}\n\n}\n\nExtendedTriangle.prototype.closestPointToSegment = ( function () {\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\tconst edge = new Line3();\n\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\n\n\t\tconst { start, end } = segment;\n\t\tconst points = this.points;\n\t\tlet distSq;\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check the triangle edges\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst nexti = ( i + 1 ) % 3;\n\t\t\tedge.start.copy( points[ i ] );\n\t\t\tedge.end.copy( points[ nexti ] );\n\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\n\n\t\t\tdistSq = point1.distanceToSquared( point2 );\n\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check end points\n\t\tthis.closestPointToPoint( start, point1 );\n\t\tdistSq = start.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( start );\n\n\t\t}\n\n\t\tthis.closestPointToPoint( end, point1 );\n\t\tdistSq = end.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( end );\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n\nExtendedTriangle.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri2 = new ExtendedTriangle();\n\tconst arr1 = new Array( 3 );\n\tconst arr2 = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\tconst dir = new Vector3();\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst tempDir = new Vector3();\n\tconst edge = new Line3();\n\tconst edge1 = new Line3();\n\tconst edge2 = new Line3();\n\tconst tempPoint = new Vector3();\n\n\tfunction triIntersectPlane( tri, plane, targetEdge ) {\n\n\t\t// find the edge that intersects the other triangle plane\n\t\tconst points = tri.points;\n\t\tlet count = 0;\n\t\tlet startPointIntersection = - 1;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst { start, end } = edge;\n\t\t\tstart.copy( points[ i ] );\n\t\t\tend.copy( points[ ( i + 1 ) % 3 ] );\n\t\t\tedge.delta( dir );\n\n\t\t\tconst startIntersects = isNearZero( plane.distanceToPoint( start ) );\n\t\t\tif ( isNearZero( plane.normal.dot( dir ) ) && startIntersects ) {\n\n\t\t\t\t// if the edge lies on the plane then take the line\n\t\t\t\ttargetEdge.copy( edge );\n\t\t\t\tcount = 2;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\t// check if the start point is near the plane because \"intersectLine\" is not robust to that case\n\t\t\tconst doesIntersect = plane.intersectLine( edge, tempPoint );\n\t\t\tif ( ! doesIntersect && startIntersects ) {\n\n\t\t\t\ttempPoint.copy( start );\n\n\t\t\t}\n\n\t\t\t// ignore the end point\n\t\t\tif ( ( doesIntersect || startIntersects ) && ! isNearZero( tempPoint.distanceTo( end ) ) ) {\n\n\t\t\t\tif ( count <= 1 ) {\n\n\t\t\t\t\t// assign to the start or end point and save which index was snapped to\n\t\t\t\t\t// the start point if necessary\n\t\t\t\t\tconst point = count === 1 ? targetEdge.start : targetEdge.end;\n\t\t\t\t\tpoint.copy( tempPoint );\n\t\t\t\t\tif ( startIntersects ) {\n\n\t\t\t\t\t\tstartPointIntersection = count;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( count >= 2 ) {\n\n\t\t\t\t\t// if we're here that means that there must have been one point that had\n\t\t\t\t\t// snapped to the start point so replace it here\n\t\t\t\t\tconst point = startPointIntersection === 1 ? targetEdge.start : targetEdge.end;\n\t\t\t\t\tpoint.copy( tempPoint );\n\t\t\t\t\tcount = 2;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tcount ++;\n\t\t\t\tif ( count === 2 && startPointIntersection === - 1 ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn count;\n\n\t}\n\n\t// TODO: If the triangles are coplanar and intersecting the target is nonsensical. It should at least\n\t// be a line contained by both triangles if not a different special case somehow represented in the return result.\n\treturn function intersectsTriangle( other, target = null, suppressLog = false ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! other.isExtendedTriangle ) {\n\n\t\t\tsaTri2.copy( other );\n\t\t\tsaTri2.update();\n\t\t\tother = saTri2;\n\n\t\t} else if ( other.needsUpdate ) {\n\n\t\t\tother.update();\n\n\t\t}\n\n\t\tconst plane1 = this.plane;\n\t\tconst plane2 = other.plane;\n\n\t\tif ( Math.abs( plane1.normal.dot( plane2.normal ) ) > 1.0 - 1e-10 ) {\n\n\t\t\t// perform separating axis intersection test only for coplanar triangles\n\t\t\tconst satBounds1 = this.satBounds;\n\t\t\tconst satAxes1 = this.satAxes;\n\t\t\tarr2[ 0 ] = other.a;\n\t\t\tarr2[ 1 ] = other.b;\n\t\t\tarr2[ 2 ] = other.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds1[ i ];\n\t\t\t\tconst sa = satAxes1[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\tconst satBounds2 = other.satBounds;\n\t\t\tconst satAxes2 = other.satAxes;\n\t\t\tarr1[ 0 ] = this.a;\n\t\t\tarr1[ 1 ] = this.b;\n\t\t\tarr1[ 2 ] = this.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds2[ i ];\n\t\t\t\tconst sa = satAxes2[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\t// check crossed axes\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sa1 = satAxes1[ i ];\n\t\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\t\tconst sa2 = satAxes2[ i2 ];\n\t\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\n\t\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\n\t\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( target ) {\n\n\t\t\t\t// TODO find two points that intersect on the edges and make that the result\n\t\t\t\tif ( ! suppressLog ) {\n\n\t\t\t\t\tconsole.warn( 'ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.' );\n\n\t\t\t\t}\n\n\t\t\t\ttarget.start.set( 0, 0, 0 );\n\t\t\t\ttarget.end.set( 0, 0, 0 );\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// find the edge that intersects the other triangle plane\n\t\t\tconst count1 = triIntersectPlane( this, plane2, edge1 );\n\t\t\tif ( count1 === 1 && other.containsPoint( edge1.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.end );\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count1 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find the other triangles edge that intersects this plane\n\t\t\tconst count2 = triIntersectPlane( other, plane1, edge2 );\n\t\t\tif ( count2 === 1 && this.containsPoint( edge2.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge2.end );\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count2 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find swap the second edge so both lines are running the same direction\n\t\t\tedge1.delta( dir1 );\n\t\t\tedge2.delta( dir2 );\n\n\t\t\tif ( dir1.dot( dir2 ) < 0 ) {\n\n\t\t\t\tlet tmp = edge2.start;\n\t\t\t\tedge2.start = edge2.end;\n\t\t\t\tedge2.end = tmp;\n\n\t\t\t}\n\n\t\t\t// check if the edges are overlapping\n\t\t\tconst s1 = edge1.start.dot( dir1 );\n\t\t\tconst e1 = edge1.end.dot( dir1 );\n\t\t\tconst s2 = edge2.start.dot( dir1 );\n\t\t\tconst e2 = edge2.end.dot( dir1 );\n\t\t\tconst separated1 = e1 < s2;\n\t\t\tconst separated2 = s1 < e2;\n\n\t\t\tif ( s1 !== e2 && s2 !== e1 && separated1 === separated2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// assign the target output\n\t\t\tif ( target ) {\n\n\t\t\t\ttempDir.subVectors( edge1.start, edge2.start );\n\t\t\t\tif ( tempDir.dot( dir1 ) > 0 ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.start );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.start.copy( edge2.start );\n\n\t\t\t\t}\n\n\t\t\t\ttempDir.subVectors( edge1.end, edge2.end );\n\t\t\t\tif ( tempDir.dot( dir1 ) < 0 ) {\n\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToTriangle = ( function () {\n\n\tconst point = new Vector3();\n\tconst point2 = new Vector3();\n\tconst cornerFields = [ 'a', 'b', 'c' ];\n\tconst line1 = new Line3();\n\tconst line2 = new Line3();\n\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\n\n\t\tconst lineTarget = target1 || target2 ? line1 : null;\n\t\tif ( this.intersectsTriangle( other, lineTarget ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tif ( target1 ) lineTarget.getCenter( target1 );\n\t\t\t\tif ( target2 ) lineTarget.getCenter( target2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check all point distances\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tlet dist;\n\t\t\tconst field = cornerFields[ i ];\n\t\t\tconst otherVec = other[ field ];\n\t\t\tthis.closestPointToPoint( otherVec, point );\n\n\t\t\tdist = otherVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\n\n\t\t\t}\n\n\n\t\t\tconst thisVec = this[ field ];\n\t\t\tother.closestPointToPoint( thisVec, point );\n\n\t\t\tdist = thisVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\n\t\t\t\tif ( target2 ) target2.copy( point );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst f11 = cornerFields[ i ];\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\n\n\t\t\t\tconst f21 = cornerFields[ i2 ];\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\n\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\n\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\n\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l1.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { ExtendedTriangle } from '../math/ExtendedTriangle.js';\nimport { PrimitivePool } from './PrimitivePool.js';\n\nclass ExtendedTrianglePoolBase extends PrimitivePool {\n\n\tconstructor() {\n\n\t\tsuper( () => new ExtendedTriangle() );\n\n\t}\n\n}\n\nexport const ExtendedTrianglePool = /* @__PURE__ */ new ExtendedTrianglePoolBase();\n","export class PrimitivePool {\n\n\tconstructor( getNewPrimitive ) {\n\n\t\tthis._getNewPrimitive = getNewPrimitive;\n\t\tthis._primitives = [];\n\n\t}\n\n\tgetPrimitive() {\n\n\t\tconst primitives = this._primitives;\n\t\tif ( primitives.length === 0 ) {\n\n\t\t\treturn this._getNewPrimitive();\n\n\t\t} else {\n\n\t\t\treturn primitives.pop();\n\n\t\t}\n\n\t}\n\n\treleasePrimitive( primitive ) {\n\n\t\tthis._primitives.push( primitive );\n\n\t}\n\n}\n","import { Box3 } from 'three';\nimport { CONTAINED } from '../Constants.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { PrimitivePool } from '../../utils/PrimitivePool.js';\nimport { COUNT, OFFSET, LEFT_NODE, RIGHT_NODE, IS_LEAF, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\nlet _box1, _box2;\nconst boxStack = [];\nconst boxPool = /* @__PURE__ */ new PrimitivePool( () => new Box3() );\n\nexport function shapecast( bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ) {\n\n\t// setup\n\t_box1 = boxPool.getPrimitive();\n\t_box2 = boxPool.getPrimitive();\n\tboxStack.push( _box1, _box2 );\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\n\tconst result = shapecastTraverse( 0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\n\t// cleanup\n\tBufferStack.clearBuffer();\n\tboxPool.releasePrimitive( _box1 );\n\tboxPool.releasePrimitive( _box2 );\n\tboxStack.pop();\n\tboxStack.pop();\n\n\tconst length = boxStack.length;\n\tif ( length > 0 ) {\n\n\t\t_box2 = boxStack[ length - 1 ];\n\t\t_box1 = boxStack[ length - 2 ];\n\n\t}\n\n\treturn result;\n\n}\n\nfunction shapecastTraverse(\n\tnodeIndex32,\n\tgeometry,\n\tintersectsBoundsFunc,\n\tintersectsRangeFunc,\n\tnodeScoreFunc = null,\n\tnodeIndexByteOffset = 0, // offset for unique node identifier\n\tdepth = 0\n) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, _box1 );\n\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndexByteOffset + nodeIndex32, _box1 );\n\n\t} else {\n\n\t\tconst left = LEFT_NODE( nodeIndex32 );\n\t\tconst right = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tlet c1 = left;\n\t\tlet c2 = right;\n\n\t\tlet score1, score2;\n\t\tlet box1, box2;\n\t\tif ( nodeScoreFunc ) {\n\n\t\t\tbox1 = _box1;\n\t\t\tbox2 = _box2;\n\n\t\t\t// bounding data is not offset\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 );\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 );\n\n\t\t\tscore1 = nodeScoreFunc( box1 );\n\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\tc1 = right;\n\t\t\t\tc2 = left;\n\n\t\t\t\tconst temp = score1;\n\t\t\t\tscore1 = score2;\n\t\t\t\tscore2 = temp;\n\n\t\t\t\tbox1 = box2;\n\t\t\t\t// box2 is always set before use below\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Check box 1 intersection\n\t\tif ( ! box1 ) {\n\n\t\t\tbox1 = _box1;\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 );\n\n\t\t}\n\n\t\tconst isC1Leaf = IS_LEAF( c1 * 2, uint16Array );\n\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\n\n\t\tlet c1StopTraversal;\n\t\tif ( c1Intersection === CONTAINED ) {\n\n\t\t\tconst offset = getLeftOffset( c1 );\n\t\t\tconst end = getRightEndOffset( c1 );\n\t\t\tconst count = end - offset;\n\n\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1, box1 );\n\n\t\t} else {\n\n\t\t\tc1StopTraversal =\n\t\t\t\tc1Intersection &&\n\t\t\t\tshapecastTraverse(\n\t\t\t\t\tc1,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\tdepth + 1\n\t\t\t\t);\n\n\t\t}\n\n\t\tif ( c1StopTraversal ) return true;\n\n\t\t// Check box 2 intersection\n\t\t// cached box2 will have been overwritten by previous traversal\n\t\tbox2 = _box2;\n\t\tarrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 );\n\n\t\tconst isC2Leaf = IS_LEAF( c2 * 2, uint16Array );\n\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\n\n\t\tlet c2StopTraversal;\n\t\tif ( c2Intersection === CONTAINED ) {\n\n\t\t\tconst offset = getLeftOffset( c2 );\n\t\t\tconst end = getRightEndOffset( c2 );\n\t\t\tconst count = end - offset;\n\n\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2, box2 );\n\n\t\t} else {\n\n\t\t\tc2StopTraversal =\n\t\t\t\tc2Intersection &&\n\t\t\t\tshapecastTraverse(\n\t\t\t\t\tc2,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\tdepth + 1\n\t\t\t\t);\n\n\t\t}\n\n\t\tif ( c2StopTraversal ) return true;\n\n\t\treturn false;\n\n\t\t// Define these inside the function so it has access to the local variables needed\n\t\t// when converting to the buffer equivalents\n\t\tfunction getLeftOffset( nodeIndex32 ) {\n\n\t\t\tconst { uint16Array, uint32Array } = BufferStack;\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! IS_LEAF( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\tnodeIndex32 = LEFT_NODE( nodeIndex32 );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\treturn OFFSET( nodeIndex32, uint32Array );\n\n\t\t}\n\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\n\n\t\t\tconst { uint16Array, uint32Array } = BufferStack;\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! IS_LEAF( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\t// adjust offset to point to the right node\n\t\t\t\tnodeIndex32 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\t// return the end offset of the triangle range\n\t\t\treturn OFFSET( nodeIndex32, uint32Array ) + COUNT( nodeIndex16, uint16Array );\n\n\t\t}\n\n\t}\n\n}\n","export function IS_LEAF( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 15 ] === 0xFFFF;\n\n}\n\nexport function OFFSET( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nexport function COUNT( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 14 ];\n\n}\n\nexport function LEFT_NODE( n32 ) {\n\n\treturn n32 + 8;\n\n}\n\nexport function RIGHT_NODE( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nexport function SPLIT_AXIS( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 7 ];\n\n}\n\nexport function BOUNDING_DATA_INDEX( n32 ) {\n\n\treturn n32;\n\n}\n","class _BufferStack {\n\n\tconstructor() {\n\n\t\tthis.float32Array = null;\n\t\tthis.uint16Array = null;\n\t\tthis.uint32Array = null;\n\n\t\tconst stack = [];\n\t\tlet prevBuffer = null;\n\t\tthis.setBuffer = buffer => {\n\n\t\t\tif ( prevBuffer ) {\n\n\t\t\t\tstack.push( prevBuffer );\n\n\t\t\t}\n\n\t\t\tprevBuffer = buffer;\n\t\t\tthis.float32Array = new Float32Array( buffer );\n\t\t\tthis.uint16Array = new Uint16Array( buffer );\n\t\t\tthis.uint32Array = new Uint32Array( buffer );\n\n\t\t};\n\n\t\tthis.clearBuffer = () => {\n\n\t\t\tprevBuffer = null;\n\t\t\tthis.float32Array = null;\n\t\t\tthis.uint16Array = null;\n\t\t\tthis.uint32Array = null;\n\n\t\t\tif ( stack.length !== 0 ) {\n\n\t\t\t\tthis.setBuffer( stack.pop() );\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n}\n\nexport const BufferStack = new _BufferStack();\n","import { Vector3 } from 'three';\n\nconst temp = /* @__PURE__ */ new Vector3();\nconst temp1 = /* @__PURE__ */ new Vector3();\n\nexport function closestPointToPoint(\n\tbvh,\n\tpoint,\n\ttarget = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\t// early out if under minThreshold\n\t// skip checking if over maxThreshold\n\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t// returns Infinity if no value found\n\tconst minThresholdSq = minThreshold * minThreshold;\n\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\tlet closestDistanceSq = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tbvh.shapecast(\n\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t},\n\n\t\t\tintersectsTriangle: ( tri, triIndex ) => {\n\n\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\ttemp1.copy( temp );\n\t\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\t\tclosestDistanceTriIndex = triIndex;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tif ( closestDistanceSq === Infinity ) return null;\n\n\tconst closestDistance = Math.sqrt( closestDistanceSq );\n\n\tif ( ! target.point ) target.point = temp1.clone();\n\telse target.point.copy( temp1 );\n\ttarget.distance = closestDistance,\n\ttarget.faceIndex = closestDistanceTriIndex;\n\n\treturn target;\n\n}\n","import { intersectTri } from '../../utils/ThreeRayIntersectUtilities.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\n\n/*************************************************************/\n/* This file is generated from \"iterationUtils.template.js\". */\n/*************************************************************/\n/* eslint-disable indent */\n\nfunction intersectTris( bvh, side, ray, offset, count, intersections ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\n\t\tintersectTri( geometry, side, ray, i, intersections );\n\n\n\t}\n\n}\n\nfunction intersectClosestTri( bvh, side, ray, offset, count ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tlet dist = Infinity;\n\tlet res = null;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet intersection;\n\n\t\tintersection = intersectTri( geometry, side, ray, i );\n\n\n\t\tif ( intersection && intersection.distance < dist ) {\n\n\t\t\tres = intersection;\n\t\t\tdist = intersection.distance;\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\nfunction iterateOverTriangles(\n\toffset,\n\tcount,\n\tbvh,\n\tintersectsTriangleFunc,\n\tcontained,\n\tdepth,\n\ttriangle\n) {\n\n\tconst { geometry } = bvh;\n\tconst { index } = geometry;\n\tconst pos = geometry.attributes.position;\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\tlet tri;\n\n\t\ttri = i;\n\n\t\tsetTriangle( triangle, tri * 3, index, pos );\n\t\ttriangle.needsUpdate = true;\n\n\t\tif ( intersectsTriangleFunc( triangle, tri, contained, depth ) ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n\nexport { intersectClosestTri, intersectTris, iterateOverTriangles };\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\n\n// Ripped and modified From THREE.js Mesh raycast\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\nconst _vA = /* @__PURE__ */ new Vector3();\nconst _vB = /* @__PURE__ */ new Vector3();\nconst _vC = /* @__PURE__ */ new Vector3();\n\nconst _uvA = /* @__PURE__ */ new Vector2();\nconst _uvB = /* @__PURE__ */ new Vector2();\nconst _uvC = /* @__PURE__ */ new Vector2();\n\nconst _normalA = /* @__PURE__ */ new Vector3();\nconst _normalB = /* @__PURE__ */ new Vector3();\nconst _normalC = /* @__PURE__ */ new Vector3();\n\nconst _intersectionPoint = /* @__PURE__ */ new Vector3();\nfunction checkIntersection( ray, pA, pB, pC, point, side ) {\n\n\tlet intersect;\n\tif ( side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, side !== DoubleSide, point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\tconst distance = ray.origin.distanceTo( point );\n\n\treturn {\n\n\t\tdistance: distance,\n\t\tpoint: point.clone(),\n\n\t};\n\n}\n\nfunction checkBufferGeometryIntersection( ray, position, normal, uv, uv1, a, b, c, side ) {\n\n\t_vA.fromBufferAttribute( position, a );\n\t_vB.fromBufferAttribute( position, b );\n\t_vC.fromBufferAttribute( position, c );\n\n\tconst intersection = checkIntersection( ray, _vA, _vB, _vC, _intersectionPoint, side );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv, a );\n\t\t\t_uvB.fromBufferAttribute( uv, b );\n\t\t\t_uvC.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv1, a );\n\t\t\t_uvB.fromBufferAttribute( uv1, b );\n\t\t\t_uvC.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _normalA, _normalB, _normalC, new Vector3() );\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA, _vB, _vC, face.normal );\n\n\t\tintersection.face = face;\n\t\tintersection.faceIndex = a;\n\n\t}\n\n\treturn intersection;\n\n}\n\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\nfunction intersectTri( geo, side, ray, tri, intersections ) {\n\n\tconst triOffset = tri * 3;\n\tlet a = triOffset + 0;\n\tlet b = triOffset + 1;\n\tlet c = triOffset + 2;\n\n\tconst index = geo.index;\n\tif ( geo.index ) {\n\n\t\ta = index.getX( a );\n\t\tb = index.getX( b );\n\t\tc = index.getX( c );\n\n\t}\n\n\tconst { position, normal, uv, uv1 } = geo.attributes;\n\tconst intersection = checkBufferGeometryIntersection( ray, position, normal, uv, uv1, a, b, c, side );\n\n\tif ( intersection ) {\n\n\t\tintersection.faceIndex = tri;\n\t\tif ( intersections ) intersections.push( intersection );\n\t\treturn intersection;\n\n\t}\n\n\treturn null;\n\n}\n\nexport { intersectTri };\n","\nimport { Vector2, Vector3, Triangle } from 'three';\n\n// sets the vertices of triangle `tri` with the 3 vertices after i\nexport function setTriangle( tri, i, index, pos ) {\n\n\tconst ta = tri.a;\n\tconst tb = tri.b;\n\tconst tc = tri.c;\n\n\tlet i0 = i;\n\tlet i1 = i + 1;\n\tlet i2 = i + 2;\n\tif ( index ) {\n\n\t\ti0 = index.getX( i0 );\n\t\ti1 = index.getX( i1 );\n\t\ti2 = index.getX( i2 );\n\n\t}\n\n\tta.x = pos.getX( i0 );\n\tta.y = pos.getY( i0 );\n\tta.z = pos.getZ( i0 );\n\n\ttb.x = pos.getX( i1 );\n\ttb.y = pos.getY( i1 );\n\ttb.z = pos.getZ( i1 );\n\n\ttc.x = pos.getX( i2 );\n\ttc.y = pos.getY( i2 );\n\ttc.z = pos.getZ( i2 );\n\n}\n\nconst tempV1 = /* @__PURE__ */ new Vector3();\nconst tempV2 = /* @__PURE__ */ new Vector3();\nconst tempV3 = /* @__PURE__ */ new Vector3();\nconst tempUV1 = /* @__PURE__ */ new Vector2();\nconst tempUV2 = /* @__PURE__ */ new Vector2();\nconst tempUV3 = /* @__PURE__ */ new Vector2();\n\nexport function getTriangleHitPointInfo( point, geometry, triangleIndex, target ) {\n\n\tconst indices = geometry.getIndex().array;\n\tconst positions = geometry.getAttribute( 'position' );\n\tconst uvs = geometry.getAttribute( 'uv' );\n\n\tconst a = indices[ triangleIndex * 3 ];\n\tconst b = indices[ triangleIndex * 3 + 1 ];\n\tconst c = indices[ triangleIndex * 3 + 2 ];\n\n\ttempV1.fromBufferAttribute( positions, a );\n\ttempV2.fromBufferAttribute( positions, b );\n\ttempV3.fromBufferAttribute( positions, c );\n\n\t// find the associated material index\n\tlet materialIndex = 0;\n\tconst groups = geometry.groups;\n\tconst firstVertexIndex = triangleIndex * 3;\n\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\t\tconst { start, count } = group;\n\t\tif ( firstVertexIndex >= start && firstVertexIndex < start + count ) {\n\n\t\t\tmaterialIndex = group.materialIndex;\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\t// extract uvs\n\tlet uv = null;\n\tif ( uvs ) {\n\n\t\ttempUV1.fromBufferAttribute( uvs, a );\n\t\ttempUV2.fromBufferAttribute( uvs, b );\n\t\ttempUV3.fromBufferAttribute( uvs, c );\n\n\t\tif ( target && target.uv ) uv = target.uv;\n\t\telse uv = new Vector2();\n\n\t\tTriangle.getInterpolation( point, tempV1, tempV2, tempV3, tempUV1, tempUV2, tempUV3, uv );\n\n\t}\n\n\t// adjust the provided target or create a new one\n\tif ( target ) {\n\n\t\tif ( ! target.face ) target.face = { };\n\t\ttarget.face.a = a;\n\t\ttarget.face.b = b;\n\t\ttarget.face.c = c;\n\t\ttarget.face.materialIndex = materialIndex;\n\t\tif ( ! target.face.normal ) target.face.normal = new Vector3();\n\t\tTriangle.getNormal( tempV1, tempV2, tempV3, target.face.normal );\n\n\t\tif ( uv ) target.uv = uv;\n\n\t\treturn target;\n\n\t} else {\n\n\t\treturn {\n\t\t\tface: {\n\t\t\t\ta: a,\n\t\t\t\tb: b,\n\t\t\t\tc: c,\n\t\t\t\tmaterialIndex: materialIndex,\n\t\t\t\tnormal: Triangle.getNormal( tempV1, tempV2, tempV3, new Vector3() )\n\t\t\t},\n\t\t\tuv: uv\n\t\t};\n\n\t}\n\n}\n","import { IS_LEAFNODE_FLAG } from '../Constants.js';\n\n/****************************************************/\n/* This file is generated from \"refit.template.js\". */\n/****************************************************/\n\nfunction refit( bvh, nodeIndices = null ) {\n\n\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\tnodeIndices = new Set( nodeIndices );\n\n\t}\n\n\tconst geometry = bvh.geometry;\n\tconst indexArr = geometry.index ? geometry.index.array : null;\n\tconst posAttr = geometry.attributes.position;\n\n\tlet buffer, uint32Array, uint16Array, float32Array;\n\tlet byteOffset = 0;\n\tconst roots = bvh._roots;\n\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\tbuffer = roots[ i ];\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t_traverse( 0, byteOffset );\n\t\tbyteOffset += buffer.byteLength;\n\n\t}\n\n\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\tconst node16Index = node32Index * 2;\n\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\tlet minx = Infinity;\n\t\t\tlet miny = Infinity;\n\t\t\tlet minz = Infinity;\n\t\t\tlet maxx = - Infinity;\n\t\t\tlet maxy = - Infinity;\n\t\t\tlet maxz = - Infinity;\n\n\n\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\tlet index = indexArr[ i ];\n\t\t\t\tconst x = posAttr.getX( index );\n\t\t\t\tconst y = posAttr.getY( index );\n\t\t\t\tconst z = posAttr.getZ( index );\n\n\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t}\n\n\n\t\t\tif (\n\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t) {\n\n\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = node32Index + 8;\n\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t// the identifying node indices provided by the shapecast function include offsets of all\n\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\tconst offsetRight = right + byteOffset;\n\t\t\tlet forceChildren = force;\n\t\t\tlet includesLeft = false;\n\t\t\tlet includesRight = false;\n\n\t\t\tif ( nodeIndices ) {\n\n\t\t\t\t// if we see that neither the left or right child are included in the set that need to be updated\n\t\t\t\t// then we assume that all children need to be updated.\n\t\t\t\tif ( ! forceChildren ) {\n\n\t\t\t\t\tincludesLeft = nodeIndices.has( offsetLeft );\n\t\t\t\t\tincludesRight = nodeIndices.has( offsetRight );\n\t\t\t\t\tforceChildren = ! includesLeft && ! includesRight;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tincludesLeft = true;\n\t\t\t\tincludesRight = true;\n\n\t\t\t}\n\n\t\t\tconst traverseLeft = forceChildren || includesLeft;\n\t\t\tconst traverseRight = forceChildren || includesRight;\n\n\t\t\tlet leftChange = false;\n\t\t\tif ( traverseLeft ) {\n\n\t\t\t\tleftChange = _traverse( left, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tlet rightChange = false;\n\t\t\tif ( traverseRight ) {\n\n\t\t\t\trightChange = _traverse( right, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tconst didChange = leftChange || rightChange;\n\t\t\tif ( didChange ) {\n\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn didChange;\n\n\t\t}\n\n\t}\n\n}\n\nexport { refit };\n","import { Vector3 } from 'three';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { IS_LEAF, OFFSET, COUNT, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectTris } from '../utils/iterationUtils.generated.js';\nimport '../utils/iterationUtils_indirect.generated.js';\n\n/******************************************************/\n/* This file is generated from \"raycast.template.js\". */\n/******************************************************/\n\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nfunction raycast( bvh, root, side, ray, intersects ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\t_raycast( 0, bvh, side, ray, intersects );\n\tBufferStack.clearBuffer();\n\n}\n\nfunction _raycast( nodeIndex32, bvh, side, ray, intersects ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tconst nodeIndex16 = nodeIndex32 * 2;\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\n\t\tintersectTris( bvh, side, ray, offset, count, intersects );\n\n\n\t} else {\n\n\t\tconst leftIndex = LEFT_NODE( nodeIndex32 );\n\t\tif ( intersectRay( leftIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( leftIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tif ( intersectRay( rightIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( rightIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycast };\n","import { Box3 } from 'three';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\n\nconst _boundingBox = /* @__PURE__ */ new Box3();\nexport function intersectRay( nodeIndex32, array, ray, target ) {\n\n\tarrayToBox( nodeIndex32, array, _boundingBox );\n\treturn ray.intersectBox( _boundingBox, target );\n\n}\n","import { Vector3 } from 'three';\nimport { IS_LEAF, OFFSET, COUNT, SPLIT_AXIS, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { intersectClosestTri } from '../utils/iterationUtils.generated.js';\nimport '../utils/iterationUtils_indirect.generated.js';\n\n/***********************************************************/\n/* This file is generated from \"raycastFirst.template.js\". */\n/***********************************************************/\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nconst _xyzFields = [ 'x', 'y', 'z' ];\nfunction raycastFirst( bvh, root, side, ray ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _raycastFirst( 0, bvh, side, ray );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _raycastFirst( nodeIndex32, bvh, side, ray ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\n\t\treturn intersectClosestTri( bvh, side, ray, offset, count );\n\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = SPLIT_AXIS( nodeIndex32, uint32Array );\n\t\tconst xyzAxis = _xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = LEFT_NODE( nodeIndex32 );\n\t\t\tc2 = RIGHT_NODE( nodeIndex32, uint32Array );\n\n\t\t} else {\n\n\t\t\tc1 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\tc2 = LEFT_NODE( nodeIndex32 );\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, _boxIntersection );\n\t\tconst c1Result = c1Intersection ? _raycastFirst( c1, bvh, side, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\t// \"point\" is in the local frame of the bvh\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, _boxIntersection );\n\t\tconst c2Result = c2Intersection ? _raycastFirst( c2, bvh, side, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycastFirst };\n","import { Box3, Matrix4 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { ExtendedTriangle } from '../../math/ExtendedTriangle.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { IS_LEAF, OFFSET, COUNT, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\n/*****************************************************************/\n/* This file is generated from \"intersectsGeometry.template.js\". */\n/*****************************************************************/\n/* eslint-disable indent */\n\nconst boundingBox = /* @__PURE__ */ new Box3();\nconst triangle = /* @__PURE__ */ new ExtendedTriangle();\nconst triangle2 = /* @__PURE__ */ new ExtendedTriangle();\nconst invertedMat = /* @__PURE__ */ new Matrix4();\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\n\nfunction intersectsGeometry( bvh, root, otherGeometry, geometryToBvh ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _intersectsGeometry( 0, bvh, otherGeometry, geometryToBvh );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _intersectsGeometry( nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tif ( cachedObb === null ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tcachedObb = obb;\n\n\t}\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst thisGeometry = bvh.geometry;\n\t\tconst thisIndex = thisGeometry.index;\n\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\tconst index = otherGeometry.index;\n\t\tconst pos = otherGeometry.attributes.position;\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t// here.\n\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t// if there's a bounds tree\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 );\n\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\tobb2.needsUpdate = true;\n\n\t\t\t// TODO: use a triangle iteration function here\n\t\t\tconst res = otherGeometry.boundsTree.shapecast( {\n\n\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.needsUpdate = true;\n\n\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\treturn res;\n\n\t\t} else {\n\n\t\t\t// if we're just dealing with raw geometry\n\n\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\n\n\n\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\n\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\n\t\t}\n\n\t} else {\n\n\t\tconst left = nodeIndex32 + 8;\n\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox );\n\t\tconst leftIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( left, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( leftIntersection ) return true;\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox );\n\t\tconst rightIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( right, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( rightIntersection ) return true;\n\n\t\treturn false;\n\n\t}\n\n}\n\nexport { intersectsGeometry };\n","import { Matrix4, Vector3 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { getTriCount } from '../build/geometryUtils.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/*********************************************************************/\n/* This file is generated from \"closestPointToGeometry.template.js\". */\n/*********************************************************************/\n\nconst tempMatrix = /* @__PURE__ */ new Matrix4();\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\nconst temp1 = /* @__PURE__ */ new Vector3();\nconst temp2 = /* @__PURE__ */ new Vector3();\nconst temp3 = /* @__PURE__ */ new Vector3();\nconst temp4 = /* @__PURE__ */ new Vector3();\n\nfunction closestPointToGeometry(\n\tbvh,\n\totherGeometry,\n\tgeometryToBvh,\n\ttarget1 = { },\n\ttarget2 = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\tif ( ! otherGeometry.boundingBox ) {\n\n\t\totherGeometry.computeBoundingBox();\n\n\t}\n\n\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\tobb.needsUpdate = true;\n\n\tconst geometry = bvh.geometry;\n\tconst pos = geometry.attributes.position;\n\tconst index = geometry.index;\n\tconst otherPos = otherGeometry.attributes.position;\n\tconst otherIndex = otherGeometry.index;\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tlet tempTarget1 = temp1;\n\tlet tempTargetDest1 = temp2;\n\tlet tempTarget2 = null;\n\tlet tempTargetDest2 = null;\n\n\tif ( target2 ) {\n\n\t\ttempTarget2 = temp3;\n\t\ttempTargetDest2 = temp4;\n\n\t}\n\n\tlet closestDistance = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tlet closestDistanceOtherTriIndex = null;\n\ttempMatrix.copy( geometryToBvh ).invert();\n\tobb2.matrix.copy( tempMatrix );\n\tbvh.shapecast(\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\treturn obb.distanceToBox( box );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\tif ( score < closestDistance && score < maxThreshold ) {\n\n\t\t\t\t\t// if we know the triangles of this bounds will be intersected next then\n\t\t\t\t\t// save the bounds to use during triangle checks.\n\t\t\t\t\tif ( isLeaf ) {\n\n\t\t\t\t\t\tobb2.min.copy( box.min );\n\t\t\t\t\t\tobb2.max.copy( box.max );\n\t\t\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\n\t\t\tintersectsRange: ( offset, count ) => {\n\n\t\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t\t// if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n\t\t\t\t\t// the closest bounds in the other geometry to check.\n\t\t\t\t\tconst otherBvh = otherGeometry.boundsTree;\n\t\t\t\t\treturn otherBvh.shapecast( {\n\t\t\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\t\t\treturn obb2.distanceToBox( box );\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsRange: ( otherOffset, otherCount ) => {\n\n\t\t\t\t\t\t\tfor ( let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2 ++ ) {\n\n\n\t\t\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\n\t\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\n\t\t\t\t\t\t\t\t\tsetTriangle( triangle, 3 * i, index, pos );\n\n\t\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// If no bounds tree then we'll just check every triangle.\n\t\t\t\t\tconst triCount = getTriCount( otherGeometry );\n\t\t\t\t\tfor ( let i2 = 0, l2 = triCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\n\t\t\t\t\t\t\tsetTriangle( triangle, 3 * i, index, pos );\n\n\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\n\tif ( closestDistance === Infinity ) {\n\n\t\treturn null;\n\n\t}\n\n\tif ( ! target1.point ) {\n\n\t\ttarget1.point = tempTargetDest1.clone();\n\n\t} else {\n\n\t\ttarget1.point.copy( tempTargetDest1 );\n\n\t}\n\n\ttarget1.distance = closestDistance,\n\ttarget1.faceIndex = closestDistanceTriIndex;\n\n\tif ( target2 ) {\n\n\t\tif ( ! target2.point ) target2.point = tempTargetDest2.clone();\n\t\telse target2.point.copy( tempTargetDest2 );\n\t\ttarget2.point.applyMatrix4( tempMatrix );\n\t\ttempTargetDest1.applyMatrix4( tempMatrix );\n\t\ttarget2.distance = tempTargetDest1.sub( target2.point ).length();\n\t\ttarget2.faceIndex = closestDistanceOtherTriIndex;\n\n\t}\n\n\treturn target1;\n\n}\n\nexport { closestPointToGeometry };\n","import { Matrix4, Box3 } from 'three';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/******************************************************/\n/* This file is generated from \"bvhcast.template.js\". */\n/******************************************************/\n\nconst tempMatrix = new Matrix4();\nconst aabb = /* @__PURE__ */ new Box3();\nconst aabb2 = /* @__PURE__ */ new Box3();\nfunction bvhcast( bvh, otherBvh, matrixToLocal, callbacks ) {\n\n\t// BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n\t// than an approach that walks down the tree (see bvhcast.js file for more info).\n\n\tlet {\n\t\tintersectsRanges,\n\t\tintersectsTriangles,\n\t} = callbacks;\n\n\tconst indexAttr = bvh.geometry.index;\n\tconst positionAttr = bvh.geometry.attributes.position;\n\n\tconst otherIndexAttr = otherBvh.geometry.index;\n\tconst otherPositionAttr = otherBvh.geometry.attributes.position;\n\n\ttempMatrix.copy( matrixToLocal ).invert();\n\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tif ( intersectsTriangles ) {\n\n\t\tconst iterateOverDoubleTriangles = ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) => {\n\n\t\t\tfor ( let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2 ++ ) {\n\n\n\t\t\t\tsetTriangle( triangle2, i2 * 3, otherIndexAttr, otherPositionAttr );\n\n\n\t\t\t\ttriangle2.a.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.b.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.c.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\tfor ( let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1 ++ ) {\n\n\n\t\t\t\t\tsetTriangle( triangle, i1 * 3, indexAttr, positionAttr );\n\n\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\tif ( intersectsTriangles( triangle, triangle2, i1, i2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t\tif ( intersectsRanges ) {\n\n\t\t\tconst originalIntersectsRanges = intersectsRanges;\n\t\t\tintersectsRanges = function ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\tif ( ! originalIntersectsRanges( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\treturn iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tintersectsRanges = iterateOverDoubleTriangles;\n\n\t\t}\n\n\t}\n\n\totherBvh.getBoundingBox( aabb2 );\n\taabb2.applyMatrix4( matrixToLocal );\n\tconst result = bvh.shapecast( {\n\n\t\tintersectsBounds: box => aabb2.intersectsBox( box ),\n\n\t\tintersectsRange: ( offset1, count1, contained, depth1, nodeIndex1, box ) => {\n\n\t\t\taabb.copy( box );\n\t\t\taabb.applyMatrix4( tempMatrix );\n\t\t\treturn otherBvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => aabb.intersectsBox( box ),\n\n\t\t\t\tintersectsRange: ( offset2, count2, contained, depth2, nodeIndex2 ) => {\n\n\t\t\t\t\treturn intersectsRanges( offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2 );\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t}\n\n\t} );\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\treturn result;\n\n}\n\nexport { bvhcast };\n","import { intersectTri } from '../../utils/ThreeRayIntersectUtilities.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\n\n/*************************************************************/\n/* This file is generated from \"iterationUtils.template.js\". */\n/*************************************************************/\n/* eslint-disable indent */\n\nfunction intersectTris_indirect( bvh, side, ray, offset, count, intersections ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet vi = _indirectBuffer ? _indirectBuffer[ i ] : i;\n\t\tintersectTri( geometry, side, ray, vi, intersections );\n\n\n\t}\n\n}\n\nfunction intersectClosestTri_indirect( bvh, side, ray, offset, count ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tlet dist = Infinity;\n\tlet res = null;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet intersection;\n\t\tintersection = intersectTri( geometry, side, ray, _indirectBuffer ? _indirectBuffer[ i ] : i );\n\n\n\t\tif ( intersection && intersection.distance < dist ) {\n\n\t\t\tres = intersection;\n\t\t\tdist = intersection.distance;\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\nfunction iterateOverTriangles_indirect(\n\toffset,\n\tcount,\n\tbvh,\n\tintersectsTriangleFunc,\n\tcontained,\n\tdepth,\n\ttriangle\n) {\n\n\tconst { geometry } = bvh;\n\tconst { index } = geometry;\n\tconst pos = geometry.attributes.position;\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\tlet tri;\n\t\ttri = bvh.resolveTriangleIndex( i );\n\n\t\tsetTriangle( triangle, tri * 3, index, pos );\n\t\ttriangle.needsUpdate = true;\n\n\t\tif ( intersectsTriangleFunc( triangle, tri, contained, depth ) ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n\nexport { intersectClosestTri_indirect, intersectTris_indirect, iterateOverTriangles_indirect };\n","import { IS_LEAFNODE_FLAG } from '../Constants.js';\n\n/****************************************************/\n/* This file is generated from \"refit.template.js\". */\n/****************************************************/\n\nfunction refit_indirect( bvh, nodeIndices = null ) {\n\n\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\tnodeIndices = new Set( nodeIndices );\n\n\t}\n\n\tconst geometry = bvh.geometry;\n\tconst indexArr = geometry.index ? geometry.index.array : null;\n\tconst posAttr = geometry.attributes.position;\n\n\tlet buffer, uint32Array, uint16Array, float32Array;\n\tlet byteOffset = 0;\n\tconst roots = bvh._roots;\n\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\tbuffer = roots[ i ];\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t_traverse( 0, byteOffset );\n\t\tbyteOffset += buffer.byteLength;\n\n\t}\n\n\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\tconst node16Index = node32Index * 2;\n\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\tlet minx = Infinity;\n\t\t\tlet miny = Infinity;\n\t\t\tlet minz = Infinity;\n\t\t\tlet maxx = - Infinity;\n\t\t\tlet maxy = - Infinity;\n\t\t\tlet maxz = - Infinity;\n\n\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\tconst t = 3 * bvh.resolveTriangleIndex( i );\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\tlet index = t + j;\n\t\t\t\t\tindex = indexArr ? indexArr[ index ] : index;\n\n\t\t\t\t\tconst x = posAttr.getX( index );\n\t\t\t\t\tconst y = posAttr.getY( index );\n\t\t\t\t\tconst z = posAttr.getZ( index );\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tif (\n\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t) {\n\n\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = node32Index + 8;\n\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t// the identifying node indices provided by the shapecast function include offsets of all\n\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\tconst offsetRight = right + byteOffset;\n\t\t\tlet forceChildren = force;\n\t\t\tlet includesLeft = false;\n\t\t\tlet includesRight = false;\n\n\t\t\tif ( nodeIndices ) {\n\n\t\t\t\t// if we see that neither the left or right child are included in the set that need to be updated\n\t\t\t\t// then we assume that all children need to be updated.\n\t\t\t\tif ( ! forceChildren ) {\n\n\t\t\t\t\tincludesLeft = nodeIndices.has( offsetLeft );\n\t\t\t\t\tincludesRight = nodeIndices.has( offsetRight );\n\t\t\t\t\tforceChildren = ! includesLeft && ! includesRight;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tincludesLeft = true;\n\t\t\t\tincludesRight = true;\n\n\t\t\t}\n\n\t\t\tconst traverseLeft = forceChildren || includesLeft;\n\t\t\tconst traverseRight = forceChildren || includesRight;\n\n\t\t\tlet leftChange = false;\n\t\t\tif ( traverseLeft ) {\n\n\t\t\t\tleftChange = _traverse( left, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tlet rightChange = false;\n\t\t\tif ( traverseRight ) {\n\n\t\t\t\trightChange = _traverse( right, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tconst didChange = leftChange || rightChange;\n\t\t\tif ( didChange ) {\n\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn didChange;\n\n\t\t}\n\n\t}\n\n}\n\nexport { refit_indirect };\n","import { Vector3 } from 'three';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { IS_LEAF, OFFSET, COUNT, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport '../utils/iterationUtils.generated.js';\nimport { intersectTris_indirect } from '../utils/iterationUtils_indirect.generated.js';\n\n/******************************************************/\n/* This file is generated from \"raycast.template.js\". */\n/******************************************************/\n\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nfunction raycast_indirect( bvh, root, side, ray, intersects ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\t_raycast( 0, bvh, side, ray, intersects );\n\tBufferStack.clearBuffer();\n\n}\n\nfunction _raycast( nodeIndex32, bvh, side, ray, intersects ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tconst nodeIndex16 = nodeIndex32 * 2;\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\tintersectTris_indirect( bvh, side, ray, offset, count, intersects );\n\n\n\t} else {\n\n\t\tconst leftIndex = LEFT_NODE( nodeIndex32 );\n\t\tif ( intersectRay( leftIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( leftIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tif ( intersectRay( rightIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( rightIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycast_indirect };\n","import { Vector3 } from 'three';\nimport { IS_LEAF, OFFSET, COUNT, SPLIT_AXIS, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport '../utils/iterationUtils.generated.js';\nimport { intersectClosestTri_indirect } from '../utils/iterationUtils_indirect.generated.js';\n\n/***********************************************************/\n/* This file is generated from \"raycastFirst.template.js\". */\n/***********************************************************/\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nconst _xyzFields = [ 'x', 'y', 'z' ];\nfunction raycastFirst_indirect( bvh, root, side, ray ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _raycastFirst( 0, bvh, side, ray );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _raycastFirst( nodeIndex32, bvh, side, ray ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\treturn intersectClosestTri_indirect( bvh, side, ray, offset, count );\n\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = SPLIT_AXIS( nodeIndex32, uint32Array );\n\t\tconst xyzAxis = _xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = LEFT_NODE( nodeIndex32 );\n\t\t\tc2 = RIGHT_NODE( nodeIndex32, uint32Array );\n\n\t\t} else {\n\n\t\t\tc1 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\tc2 = LEFT_NODE( nodeIndex32 );\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, _boxIntersection );\n\t\tconst c1Result = c1Intersection ? _raycastFirst( c1, bvh, side, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\t// \"point\" is in the local frame of the bvh\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, _boxIntersection );\n\t\tconst c2Result = c2Intersection ? _raycastFirst( c2, bvh, side, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycastFirst_indirect };\n","import { Box3, Matrix4 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { ExtendedTriangle } from '../../math/ExtendedTriangle.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { IS_LEAF, OFFSET, COUNT, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\n/*****************************************************************/\n/* This file is generated from \"intersectsGeometry.template.js\". */\n/*****************************************************************/\n/* eslint-disable indent */\n\nconst boundingBox = /* @__PURE__ */ new Box3();\nconst triangle = /* @__PURE__ */ new ExtendedTriangle();\nconst triangle2 = /* @__PURE__ */ new ExtendedTriangle();\nconst invertedMat = /* @__PURE__ */ new Matrix4();\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\n\nfunction intersectsGeometry_indirect( bvh, root, otherGeometry, geometryToBvh ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _intersectsGeometry( 0, bvh, otherGeometry, geometryToBvh );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _intersectsGeometry( nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tif ( cachedObb === null ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tcachedObb = obb;\n\n\t}\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst thisGeometry = bvh.geometry;\n\t\tconst thisIndex = thisGeometry.index;\n\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\tconst index = otherGeometry.index;\n\t\tconst pos = otherGeometry.attributes.position;\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t// here.\n\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t// if there's a bounds tree\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 );\n\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\tobb2.needsUpdate = true;\n\n\t\t\t// TODO: use a triangle iteration function here\n\t\t\tconst res = otherGeometry.boundsTree.shapecast( {\n\n\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.needsUpdate = true;\n\n\t\t\t\t\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * bvh.resolveTriangleIndex( i ), thisIndex, thisPos );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\treturn res;\n\n\t\t} else {\n\n\t\t\t// if we're just dealing with raw geometry\n\t\t\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\tsetTriangle( triangle, 3 * ti, thisIndex, thisPos );\n\n\n\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\n\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t} else {\n\n\t\tconst left = nodeIndex32 + 8;\n\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox );\n\t\tconst leftIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( left, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( leftIntersection ) return true;\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox );\n\t\tconst rightIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( right, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( rightIntersection ) return true;\n\n\t\treturn false;\n\n\t}\n\n}\n\nexport { intersectsGeometry_indirect };\n","import { Matrix4, Vector3 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { getTriCount } from '../build/geometryUtils.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/*********************************************************************/\n/* This file is generated from \"closestPointToGeometry.template.js\". */\n/*********************************************************************/\n\nconst tempMatrix = /* @__PURE__ */ new Matrix4();\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\nconst temp1 = /* @__PURE__ */ new Vector3();\nconst temp2 = /* @__PURE__ */ new Vector3();\nconst temp3 = /* @__PURE__ */ new Vector3();\nconst temp4 = /* @__PURE__ */ new Vector3();\n\nfunction closestPointToGeometry_indirect(\n\tbvh,\n\totherGeometry,\n\tgeometryToBvh,\n\ttarget1 = { },\n\ttarget2 = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\tif ( ! otherGeometry.boundingBox ) {\n\n\t\totherGeometry.computeBoundingBox();\n\n\t}\n\n\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\tobb.needsUpdate = true;\n\n\tconst geometry = bvh.geometry;\n\tconst pos = geometry.attributes.position;\n\tconst index = geometry.index;\n\tconst otherPos = otherGeometry.attributes.position;\n\tconst otherIndex = otherGeometry.index;\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tlet tempTarget1 = temp1;\n\tlet tempTargetDest1 = temp2;\n\tlet tempTarget2 = null;\n\tlet tempTargetDest2 = null;\n\n\tif ( target2 ) {\n\n\t\ttempTarget2 = temp3;\n\t\ttempTargetDest2 = temp4;\n\n\t}\n\n\tlet closestDistance = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tlet closestDistanceOtherTriIndex = null;\n\ttempMatrix.copy( geometryToBvh ).invert();\n\tobb2.matrix.copy( tempMatrix );\n\tbvh.shapecast(\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\treturn obb.distanceToBox( box );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\tif ( score < closestDistance && score < maxThreshold ) {\n\n\t\t\t\t\t// if we know the triangles of this bounds will be intersected next then\n\t\t\t\t\t// save the bounds to use during triangle checks.\n\t\t\t\t\tif ( isLeaf ) {\n\n\t\t\t\t\t\tobb2.min.copy( box.min );\n\t\t\t\t\t\tobb2.max.copy( box.max );\n\t\t\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\n\t\t\tintersectsRange: ( offset, count ) => {\n\n\t\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t\t// if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n\t\t\t\t\t// the closest bounds in the other geometry to check.\n\t\t\t\t\tconst otherBvh = otherGeometry.boundsTree;\n\t\t\t\t\treturn otherBvh.shapecast( {\n\t\t\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\t\t\treturn obb2.distanceToBox( box );\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsRange: ( otherOffset, otherCount ) => {\n\n\t\t\t\t\t\t\tfor ( let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\t\t\tconst ti2 = otherBvh.resolveTriangleIndex( i2 );\n\t\t\t\t\t\t\t\tsetTriangle( triangle2, 3 * ti2, otherIndex, otherPos );\n\n\t\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\t\t\t\t\t\tsetTriangle( triangle, 3 * ti, index, pos );\n\n\t\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// If no bounds tree then we'll just check every triangle.\n\t\t\t\t\tconst triCount = getTriCount( otherGeometry );\n\t\t\t\t\tfor ( let i2 = 0, l2 = triCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\t\t\t\tsetTriangle( triangle, 3 * ti, index, pos );\n\n\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\n\tif ( closestDistance === Infinity ) {\n\n\t\treturn null;\n\n\t}\n\n\tif ( ! target1.point ) {\n\n\t\ttarget1.point = tempTargetDest1.clone();\n\n\t} else {\n\n\t\ttarget1.point.copy( tempTargetDest1 );\n\n\t}\n\n\ttarget1.distance = closestDistance,\n\ttarget1.faceIndex = closestDistanceTriIndex;\n\n\tif ( target2 ) {\n\n\t\tif ( ! target2.point ) target2.point = tempTargetDest2.clone();\n\t\telse target2.point.copy( tempTargetDest2 );\n\t\ttarget2.point.applyMatrix4( tempMatrix );\n\t\ttempTargetDest1.applyMatrix4( tempMatrix );\n\t\ttarget2.distance = tempTargetDest1.sub( target2.point ).length();\n\t\ttarget2.faceIndex = closestDistanceOtherTriIndex;\n\n\t}\n\n\treturn target1;\n\n}\n\nexport { closestPointToGeometry_indirect };\n","import { Matrix4, Box3 } from 'three';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/******************************************************/\n/* This file is generated from \"bvhcast.template.js\". */\n/******************************************************/\n\nconst tempMatrix = new Matrix4();\nconst aabb = /* @__PURE__ */ new Box3();\nconst aabb2 = /* @__PURE__ */ new Box3();\nfunction bvhcast_indirect( bvh, otherBvh, matrixToLocal, callbacks ) {\n\n\t// BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n\t// than an approach that walks down the tree (see bvhcast.js file for more info).\n\n\tlet {\n\t\tintersectsRanges,\n\t\tintersectsTriangles,\n\t} = callbacks;\n\n\tconst indexAttr = bvh.geometry.index;\n\tconst positionAttr = bvh.geometry.attributes.position;\n\n\tconst otherIndexAttr = otherBvh.geometry.index;\n\tconst otherPositionAttr = otherBvh.geometry.attributes.position;\n\n\ttempMatrix.copy( matrixToLocal ).invert();\n\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tif ( intersectsTriangles ) {\n\n\t\tconst iterateOverDoubleTriangles = ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) => {\n\n\t\t\tfor ( let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2 ++ ) {\n\n\t\t\t\tconst ti2 = otherBvh.resolveTriangleIndex( i2 );\n\t\t\t\tsetTriangle( triangle2, ti2 * 3, otherIndexAttr, otherPositionAttr );\n\n\n\t\t\t\ttriangle2.a.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.b.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.c.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\tfor ( let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1 ++ ) {\n\n\t\t\t\t\tconst ti1 = bvh.resolveTriangleIndex( i1 );\n\t\t\t\t\tsetTriangle( triangle, ti1 * 3, indexAttr, positionAttr );\n\n\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\tif ( intersectsTriangles( triangle, triangle2, i1, i2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t\tif ( intersectsRanges ) {\n\n\t\t\tconst originalIntersectsRanges = intersectsRanges;\n\t\t\tintersectsRanges = function ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\tif ( ! originalIntersectsRanges( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\treturn iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tintersectsRanges = iterateOverDoubleTriangles;\n\n\t\t}\n\n\t}\n\n\totherBvh.getBoundingBox( aabb2 );\n\taabb2.applyMatrix4( matrixToLocal );\n\tconst result = bvh.shapecast( {\n\n\t\tintersectsBounds: box => aabb2.intersectsBox( box ),\n\n\t\tintersectsRange: ( offset1, count1, contained, depth1, nodeIndex1, box ) => {\n\n\t\t\taabb.copy( box );\n\t\t\taabb.applyMatrix4( tempMatrix );\n\t\t\treturn otherBvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => aabb.intersectsBox( box ),\n\n\t\t\t\tintersectsRange: ( offset2, count2, contained, depth2, nodeIndex2 ) => {\n\n\t\t\t\t\treturn intersectsRanges( offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2 );\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t}\n\n\t} );\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\treturn result;\n\n}\n\nexport { bvhcast_indirect };\n","export function isSharedArrayBufferSupported() {\n\n\treturn typeof SharedArrayBuffer !== 'undefined';\n\n}\n","import { Vector3 } from 'three';\n\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _dir = new Vector3();\n\nexport function isYProjectedLineDegenerate( line ) {\n\n\tline.delta( _dir ).normalize();\n\treturn Math.abs( _dir.dot( UP_VECTOR ) ) >= 1.0 - EPSILON;\n\n}\n\n// checks whether the y-projected triangle will be degenerate\nexport function isYProjectedTriangleDegenerate( tri ) {\n\n\tif ( tri.needsUpdate ) {\n\n\t\ttri.update();\n\n\t}\n\n\treturn Math.abs( tri.plane.normal.dot( UP_VECTOR ) ) <= EPSILON;\n\n}\n\n// Is the provided line exactly an edge on the triangle\nexport function isLineTriangleEdge( tri, line ) {\n\n\t// if this is the same line as on the triangle\n\tconst { start, end } = line;\n\tconst triPoints = tri.points;\n\tlet startMatches = false;\n\tlet endMatches = false;\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst tp = triPoints[ i ];\n\t\tif ( ! startMatches && start.distanceToSquared( tp ) <= EPSILON ) {\n\n\t\t\tstartMatches = true;\n\n\t\t}\n\n\t\tif ( ! endMatches && end.distanceToSquared( tp ) <= EPSILON ) {\n\n\t\t\tendMatches = true;\n\n\t\t}\n\n\t\tif ( startMatches && endMatches ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn startMatches && endMatches;\n\n}\n","import { Vector3, Triangle, Line3, MathUtils } from 'three';\n\n// Modified version of js EdgesGeometry logic to handle silhouette edges\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _v0 = /* @__PURE__ */ new Vector3();\nconst _v1 = /* @__PURE__ */ new Vector3();\nconst _normal = /* @__PURE__ */ new Vector3();\nconst _triangle = /* @__PURE__ */ new Triangle();\n\nexport function generateEdges( geometry, projectionDir = UP_VECTOR, thresholdAngle = 1 ) {\n\n\tconst edges = [];\n\n\tconst precisionPoints = 4;\n\tconst precision = Math.pow( 10, precisionPoints );\n\tconst thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle );\n\n\tconst indexAttr = geometry.getIndex();\n\tconst positionAttr = geometry.getAttribute( 'position' );\n\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\tconst indexArr = [ 0, 0, 0 ];\n\tconst vertKeys = [ 'a', 'b', 'c' ];\n\tconst hashes = new Array( 3 );\n\n\tconst edgeData = {};\n\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\tif ( indexAttr ) {\n\n\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t} else {\n\n\t\t\tindexArr[ 0 ] = i;\n\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t}\n\n\t\tconst { a, b, c } = _triangle;\n\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t_triangle.getNormal( _normal );\n\n\t\t// create hashes for the edge from the vertices\n\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t// skip degenerate triangles\n\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\t// iterate over every edge\n\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t// get the first and next vertex making up the edge\n\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\tconst otherNormal = edgeData[ reverseHash ].normal;\n\t\t\t\tconst meetsThreshold = _normal.dot( otherNormal ) <= thresholdDot;\n\n\t\t\t\t// get the dot product relative to the projection angle and\n\t\t\t\t// add an epsilon for nearly vertical triangles\n\t\t\t\tlet normDot = projectionDir.dot( _normal );\n\t\t\t\tnormDot = Math.abs( normDot ) < EPSILON ? 0 : normDot;\n\n\t\t\t\tlet otherDot = projectionDir.dot( otherNormal );\n\t\t\t\totherDot = Math.abs( otherDot ) < EPSILON ? 0 : otherDot;\n\n\t\t\t\tconst projectionThreshold = Math.sign( normDot ) !== Math.sign( otherDot );\n\t\t\t\tif ( meetsThreshold || projectionThreshold ) {\n\n\t\t\t\t\tconst line = new Line3();\n\t\t\t\t\tline.start.copy( v0 );\n\t\t\t\t\tline.end.copy( v1 );\n\t\t\t\t\tedges.push( line );\n\n\t\t\t\t}\n\n\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\tfor ( const key in edgeData ) {\n\n\t\tif ( edgeData[ key ] ) {\n\n\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t_v1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\tconst line = new Line3();\n\t\t\tline.start.copy( _v0 );\n\t\t\tline.end.copy( _v1 );\n\t\t\tedges.push( line );\n\n\t\t}\n\n\t}\n\n\treturn edges;\n\n}\n","import { Line3 } from 'three';\n\nconst _line = /* @__PURE__ */ new Line3();\n\n// compresses the given edge overlaps into a minimal set of representative objects\nexport function compressEdgeOverlaps( overlaps ) {\n\n\toverlaps.sort( ( a, b ) => {\n\n\t\treturn a[ 0 ] - b[ 0 ];\n\n\t} );\n\n\tfor ( let i = 1; i < overlaps.length; i ++ ) {\n\n\t\tconst overlap = overlaps[ i ];\n\t\tconst prevOverlap = overlaps[ i - 1 ];\n\t\tif ( prevOverlap[ 1 ] >= overlap[ 0 ] ) {\n\n\t\t\tprevOverlap[ 1 ] = Math.max( prevOverlap[ 1 ], overlap[ 1 ] );\n\t\t\toverlaps.splice( i, 1 );\n\t\t\ti --;\n\n\t\t}\n\n\t}\n\n}\n\n\n// Converts the given array of overlaps into line segments\nexport function overlapsToLines( line, overlaps, target = [] ) {\n\n\tcompressEdgeOverlaps( overlaps );\n\n\tconst invOverlaps = [[ 0, 1 ]];\n\tfor ( let i = 0, l = overlaps.length; i < l; i ++ ) {\n\n\t\tconst invOverlap = invOverlaps[ i ];\n\t\tconst overlap = overlaps[ i ];\n\t\tinvOverlap[ 1 ] = overlap[ 0 ];\n\t\tinvOverlaps.push( new Float32Array( [ overlap[ 1 ], 1 ] ) );\n\n\t}\n\n\tfor ( let i = 0, l = invOverlaps.length; i < l; i ++ ) {\n\n\t\tconst { start, end } = line;\n\t\t_line.start.lerpVectors( start, end, invOverlaps[ i ][ 0 ] );\n\t\t_line.end.lerpVectors( start, end, invOverlaps[ i ][ 1 ] );\n\n\t\ttarget.push( new Float32Array( [\n\t\t\t_line.start.x,\n\t\t\t_line.start.y,\n\t\t\t_line.start.z,\n\n\t\t\t_line.end.x,\n\t\t\t_line.end.y,\n\t\t\t_line.end.z,\n\t\t] ) );\n\n\t}\n\n\treturn target;\n\n}\n","import { Plane, Vector3 } from 'three';\nimport { isYProjectedTriangleDegenerate } from './triangleLineUtils.js';\n\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _plane = /* @__PURE__ */ new Plane();\nconst _planeHit = /* @__PURE__ */ new Vector3();\nconst _lineDirection = /* @__PURE__ */ new Vector3();\nexport function trimToBeneathTriPlane( tri, line, lineTarget ) {\n\n\t// if the triangle is insignificant then skip it\n\tif ( isYProjectedTriangleDegenerate( tri ) ) {\n\n\t\treturn false;\n\n\t}\n\n\t// update triangle if needed\n\tif ( tri.needsUpdate ) {\n\n\t\ttri.update();\n\n\t}\n\n\t// if the plane is not facing up then flip the direction\n\t_plane.copy( tri.plane );\n\tif ( _plane.normal.dot( UP_VECTOR ) < 0 ) {\n\n\t\t_plane.normal.multiplyScalar( - 1 );\n\t\t_plane.constant *= - 1;\n\n\t}\n\n\tconst startDist = _plane.distanceToPoint( line.start );\n\tconst endDist = _plane.distanceToPoint( line.end );\n\tconst isStartOnPlane = Math.abs( startDist ) < EPSILON;\n\tconst isEndOnPlane = Math.abs( endDist ) < EPSILON;\n\tconst isStartBelow = startDist < 0;\n\tconst isEndBelow = endDist < 0;\n\n\t// if the line and plane are coplanar then return that we can't trim\n\tline.delta( _lineDirection ).normalize();\n\tif ( Math.abs( _plane.normal.dot( _lineDirection ) ) < EPSILON ) {\n\n\t\tif ( isStartOnPlane || ! isStartBelow ) {\n\n\t\t\treturn false;\n\n\t\t} else {\n\n\t\t\tlineTarget.copy( line );\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\t// find the point that's below the plane. If both points are below the plane\n\t// then we assume we're dealing with floating point error\n\tif ( isStartBelow && isEndBelow ) {\n\n\t\t// if the whole line is below then just copy that\n\t\tlineTarget.copy( line );\n\t\treturn true;\n\n\t} else if ( ! isStartBelow && ! isEndBelow ) {\n\n\t\t// if it's wholly above then skip it\n\t\treturn false;\n\n\t} else {\n\n\t\tlet didHit = _plane.intersectLine( line, _planeHit );\n\t\tif ( ! didHit ) {\n\n\t\t\tif ( isStartOnPlane ) {\n\n\t\t\t\t_planeHit.copy( line.start );\n\t\t\t\tdidHit = true;\n\n\t\t\t}\n\n\t\t\tif ( isEndOnPlane ) {\n\n\t\t\t\t_planeHit.copy( line.end );\n\t\t\t\tdidHit = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( didHit ) {\n\n\t\t\tif ( isStartBelow ) {\n\n\t\t\t\tlineTarget.start.copy( line.start );\n\t\t\t\tlineTarget.end.copy( _planeHit );\n\t\t\t\treturn true;\n\n\t\t\t} else if ( isEndBelow ) {\n\n\t\t\t\tlineTarget.end.copy( line.end );\n\t\t\t\tlineTarget.start.copy( _planeHit );\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n","import { Vector3, Line3, Plane } from 'three';\nimport { ExtendedTriangle } from 'three-mesh-bvh';\n\nconst AREA_EPSILON = 1e-16;\nconst DIST_EPSILON = 1e-16;\nconst _orthoPlane = /* @__PURE__ */ new Plane();\nconst _edgeLine = /* @__PURE__ */ new Line3();\nconst _point = /* @__PURE__ */ new Vector3();\nconst _vec = /* @__PURE__ */ new Vector3();\nconst _tri = /* @__PURE__ */ new ExtendedTriangle();\nconst _line = /* @__PURE__ */ new Line3();\nconst _triLine = /* @__PURE__ */ new Line3();\nconst _dir = /* @__PURE__ */ new Vector3();\nconst _triDir = /* @__PURE__ */ new Vector3();\n\n// Returns the portion of the line that is overlapping the triangle when projected\n// TODO: rename this, remove need for tri update, plane\nexport function getProjectedLineOverlap( line, triangle, lineTarget = new Line3() ) {\n\n\t// flatten the shapes\n\t_tri.copy( triangle );\n\t_tri.a.y = 0;\n\t_tri.b.y = 0;\n\t_tri.c.y = 0;\n\t_tri.update();\n\n\t_line.copy( line );\n\t_line.start.y = 0;\n\t_line.end.y = 0;\n\n\t// if the triangle is degenerate then return no overlap\n\tif ( _tri.getArea() <= AREA_EPSILON ) {\n\n\t\treturn null;\n\n\t}\n\n\t_line.delta( _dir ).normalize();\n\t_dir.cross( _tri.plane.normal ).normalize();\n\t_orthoPlane.setFromNormalAndCoplanarPoint( _dir, _line.start );\n\n\t// find the line of intersection of the triangle along the plane if it exists\n\tlet intersectCount = 0;\n\tconst { points } = _tri;\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst p1 = points[ i ];\n\t\tconst p2 = points[ ( i + 1 ) % 3 ];\n\n\t\t_edgeLine.start.copy( p1 );\n\t\t_edgeLine.end.copy( p2 );\n\t\tconst startIntersects = Math.abs( _orthoPlane.distanceToPoint( _edgeLine.start ) ) < DIST_EPSILON;\n\t\tconst endIntersects = Math.abs( _orthoPlane.distanceToPoint( _edgeLine.end ) ) < DIST_EPSILON;\n\t\tconst edgeIntersects = _orthoPlane.intersectLine( _edgeLine, _point );\n\t\tif ( edgeIntersects && ! endIntersects || startIntersects ) {\n\n\t\t\tif ( startIntersects && ! edgeIntersects ) {\n\n\t\t\t\t_point.copy( _edgeLine.start );\n\n\t\t\t}\n\n\t\t\tif ( intersectCount === 0 ) {\n\n\t\t\t\t_triLine.start.copy( _point );\n\n\t\t\t} else {\n\n\t\t\t\t_triLine.end.copy( _point );\n\n\t\t\t}\n\n\t\t\tintersectCount ++;\n\t\t\tif ( intersectCount === 2 ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif ( intersectCount === 2 ) {\n\n\t\t// find the intersect line if any\n\t\t_line.delta( _dir ).normalize();\n\t\t_triLine.delta( _triDir ).normalize();\n\n\t\t// swap edges so they're facing in the same direction\n\t\tif ( _dir.dot( _triDir ) < 0 ) {\n\n\t\t\tlet tmp = _triLine.start;\n\t\t\t_triLine.start = _triLine.end;\n\t\t\t_triLine.end = tmp;\n\n\t\t}\n\n\t\t// check if the edges are overlapping\n\t\tconst s1 = 0;\n\t\tconst e1 = _vec.subVectors( _line.end, _line.start ).dot( _dir );\n\t\tconst s2 = _vec.subVectors( _triLine.start, _line.start ).dot( _dir );\n\t\tconst e2 = _vec.subVectors( _triLine.end, _line.start ).dot( _dir );\n\t\tconst separated1 = e1 <= s2;\n\t\tconst separated2 = e2 <= s1;\n\n\t\tif ( separated1 || separated2 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tline.at(\n\t\t\tMath.max( s1, s2 ) / _line.distance(),\n\t\t\tlineTarget.start,\n\t\t);\n\n\t\tline.at(\n\t\t\tMath.min( e1, e2 ) / _line.distance(),\n\t\t\tlineTarget.end,\n\t\t);\n\n\t\treturn lineTarget;\n\n\t}\n\n\treturn null;\n\n}\n","import { Vector3 } from 'three';\n\nconst DIST_EPSILON = 1e-16;\nconst _dir = /* @__PURE__ */ new Vector3();\nconst _v0 = /* @__PURE__ */ new Vector3();\nconst _v1 = /* @__PURE__ */ new Vector3();\nexport function appendOverlapRange( line, overlapLine, overlapsTarget ) {\n\n\tline.delta( _dir );\n\t_v0.subVectors( overlapLine.start, line.start );\n\t_v1.subVectors( overlapLine.end, line.start );\n\n\tconst length = _dir.length();\n\tlet d0 = _v0.length() / length;\n\tlet d1 = _v1.length() / length;\n\n\td0 = Math.min( Math.max( d0, 0 ), 1 );\n\td1 = Math.min( Math.max( d1, 0 ), 1 );\n\n\tif ( ! ( Math.abs( d0 - d1 ) <= DIST_EPSILON ) ) {\n\n\t\toverlapsTarget.push( new Float32Array( [ d0, d1 ] ) );\n\t\treturn true;\n\n\t}\n\n\treturn false;\n\n}\n","import { Line3 } from 'three';\nimport { ExtendedTriangle } from 'three-mesh-bvh';\nimport { isLineTriangleEdge } from './triangleLineUtils.js';\n\nconst OFFSET_EPSILON = 1e-6;\nconst _tri = new ExtendedTriangle();\nconst _line = new Line3();\nexport function* generateIntersectionEdges( bvh, iterationTime = 30 ) {\n\n\tconst edges = [];\n\tconst geometry = bvh.geometry;\n\tconst index = geometry.index;\n\tconst posAttr = geometry.attributes.position;\n\tconst vertCount = index ? index.count : posAttr;\n\n\tlet time = performance.now();\n\tfor ( let i = 0; i < vertCount; i += 3 ) {\n\n\t\tlet i0 = i + 0;\n\t\tlet i1 = i + 1;\n\t\tlet i2 = i + 2;\n\t\tif ( index ) {\n\n\t\t\ti0 = index.getX( i0 );\n\t\t\ti1 = index.getX( i1 );\n\t\t\ti2 = index.getX( i2 );\n\n\t\t}\n\n\t\tconst { a, b, c } = _tri;\n\t\ta.fromBufferAttribute( posAttr, i0 );\n\t\tb.fromBufferAttribute( posAttr, i1 );\n\t\tc.fromBufferAttribute( posAttr, i2 );\n\t\t_tri.needsUpdate = true;\n\t\t_tri.update();\n\n\t\tbvh.shapecast( {\n\n\t\t\tintersectsBounds: box => {\n\n\t\t\t\treturn box.intersectsTriangle( _tri );\n\n\t\t\t},\n\n\t\t\tintersectsTriangle: tri2 => {\n\n\t\t\t\tif ( _tri.equals( tri2 ) ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tri2.needsUpdate ) {\n\n\t\t\t\t\ttri2.update();\n\n\t\t\t\t}\n\n\t\t\t\tif ( Math.abs( _tri.plane.normal.dot( tri2.plane.normal ) ) > 1 - 1e-6 ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t_tri.intersectsTriangle( tri2, _line, true ) &&\n\t\t\t\t\t! isLineTriangleEdge( _tri, _line ) &&\n\t\t\t\t\t! isLineTriangleEdge( tri2, _line )\n\t\t\t\t) {\n\n\t\t\t\t\t_line.start.y += OFFSET_EPSILON;\n\t\t\t\t\t_line.end.y += OFFSET_EPSILON;\n\t\t\t\t\tedges.push( _line.clone() );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t} );\n\n\t\tconst delta = performance.now() - time;\n\t\tif ( delta > iterationTime ) {\n\n\t\t\tyield;\n\t\t\ttime = performance.now();\n\n\t\t}\n\n\t}\n\n\treturn edges;\n\n}\n"],"names":["$59a851f097f5ef7e$var$_box1","$59a851f097f5ef7e$var$_box2","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","importScripts","$e06gU","$bc798809290ffd6b$export$abef70518a11a6ba","Symbol","$512bf92b30757ce0$export$c56c51fae37b2d63","geo","$512bf92b30757ce0$export$bb010cc24ecaa644","index","count","attributes","position","$512bf92b30757ce0$export$8c9d42783264c26e","triCount","drawRange","start","end","offset","Math","max","floor","min","$512bf92b30757ce0$export$fd7a16c461f5043c","groups","length","ranges","rangeBoundaries","Set","drawRangeStart","drawRangeEnd","group","groupStart","groupEnd","add","sortedBoundaries","Array","from","values","sort","a","b","i","push","$d5323e54f8bf740a$export$40b9a5e446bf11e0","nodeIndex32","array","target","x","y","z","$d5323e54f8bf740a$export$dcdc414399b99746","bounds","splitDimIdx","splitDist","Infinity","dist","$d5323e54f8bf740a$export$a8a7063dce01a911","aVal","bVal","d","d3","$d5323e54f8bf740a$export$c989e53c4b24c2f5","startIndex","triangleBounds","tCenter","tHalf","tMin","tMax","$d5323e54f8bf740a$export$dbf4320364dc239e","d0","d1","d2","$faecb3eca4385fa9$export$becd1e645219fa23","centroidTarget","minx","miny","minz","maxx","maxy","maxz","cminx","cminy","cminz","cmaxx","cmaxy","cmaxz","includeCentroid","cx","hx","lx","rx","cy","hy","ly","ry","cz","hz","lz","rz","$62809835080ba262$var$binsSort","candidate","$62809835080ba262$var$sahBins","fill","map","Float32Array","rightCacheBounds","leftCacheBounds","$62809835080ba262$var$leftBounds","$5f1fa9198ab38bd9$export$6f473cc5f89b0a1c","constructor","$dc07fa3855e86015$export$b29f828819edca8d","indirectBuffer","split","left","right","pos","axisOffset","axis","t0","tb","$aace0473d446b8ef$export$7cee363d477551d0","t","$34f95eced4ec08e7$export$f758e41ecdcd8e69","setFromPointsField","points","field","l","p","val","setFromPoints","dot","isSeparated","other","prototype","setFromBox","Vector3","box","boxMin","boxMax","$1300ab831e41e936$export$479eef7c8f1b846c","dir1","dir2","v02","l1","l2","result","v0","v2","subVectors","d0232","d3210","v32","d3232","d0210","d1010","v10","denom","$1300ab831e41e936$export$b09f296caca7547a","paramResult","Vector2","temp1","temp2","target1","target2","at","closestPointToPoint","p2","closestPoint","distanceToSquared","closestPoint2","copy","$1300ab831e41e936$export$eed3a6606b3adc41","closestPointTemp","projectedPointTemp","planeTemp","Plane","lineTemp","Line3","sphere","triangle","radius","center","c","closestPoint1","distanceTo","closestPoint3","plane","getPlane","dp","abs","distanceToPoint","pp","projectPoint","cp","containsPoint","$277ed51eec8cb2f4$var$isNearZero","value","$277ed51eec8cb2f4$export$a37f7ec1c23dfacf","Triangle","args","isExtendedTriangle","satAxes","satBounds","Sphere","needsUpdate","intersectsSphere","update","axis0","sab0","getNormal","axis1","sab1","axis2","sab2","axis3","sab3","setFromNormalAndCoplanarPoint","closestPointToSegment","point1","point2","edge","segment","distSq","closestDistanceSq","nexti","sqrt","intersectsTriangle","saTri2","arr1","arr2","cachedSatBounds","cachedSatBounds2","cachedAxis","dir","tempDir","edge1","edge2","tempPoint","triIntersectPlane","tri","targetEdge","startPointIntersection","delta","startIntersects","normal","doesIntersect","intersectLine","point","suppressLog","plane1","plane2","satBounds1","satAxes1","sb","sa","satBounds2","satAxes2","sa1","i2","sa2","crossVectors","console","warn","set","count1","count2","tmp","s1","e1","s2","e2","separated1","distanceToTriangle","cornerFields","line1","line2","lineTarget","getCenter","otherVec","thisVec","f11","f12","f21","f22","$2210a8ccded54a38$export$4ccecd8ac6ee0e58","matrix","isOrientedBox","Matrix4","invMatrix","alignedSatBounds","v","applyMatrix4","minVec","pi","invert","intersectsBox","aabbBounds","saTri","pointsArr","triSatBounds","triSatAxes","clamp","distanceToBox","xyzFields","segments1","segments2","threshold","threshold2","i1","nextIndex","nextIndex2","index2","p1","f1","f2","f3","$4a3ee1d4de1c7643$export$bf300c504651112a","getNewPrimitive","_getNewPrimitive","_primitives","getPrimitive","primitives","pop","releasePrimitive","primitive","$a7a12bd8496afd7c$export$2622f4315304edad","$8c79b2483f36f80e$export$bc7cbaf27fbe938e","n16","uint16Array","$8c79b2483f36f80e$export$d61684373eacdf61","$00672725876edc9e$export$7451c73ce907854f","float32Array","uint32Array","stack","prevBuffer","setBuffer","buffer","Uint16Array","Uint32Array","clearBuffer","$59a851f097f5ef7e$var$boxStack","$59a851f097f5ef7e$var$boxPool","Box3","$452345387fe1f65a$var$temp","$452345387fe1f65a$var$temp1","$7db34e138f2585de$var$_vA","$7db34e138f2585de$var$_vB","$7db34e138f2585de$var$_vC","$7db34e138f2585de$var$_uvA","$7db34e138f2585de$var$_uvB","$7db34e138f2585de$var$_uvC","$7db34e138f2585de$var$_normalA","$7db34e138f2585de$var$_normalB","$7db34e138f2585de$var$_normalC","$7db34e138f2585de$var$_intersectionPoint","$7db34e138f2585de$export$1a557053019a130b","side","ray","intersections","triOffset","getX","uv","uv1","intersection","$7db34e138f2585de$var$checkBufferGeometryIntersection","fromBufferAttribute","$7db34e138f2585de$var$checkIntersection","pA","pB","pC","intersect","BackSide","intersectTriangle","DoubleSide","distance","origin","clone","getInterpolation","direction","multiplyScalar","face","materialIndex","faceIndex","$eb6f5960b3eb8549$export$32f7fa781964ae30","ta","tc","i0","getY","getZ","$9474092dcc9c56eb$export$be1391b7aa79c0f6","bvh","intersectsTriangleFunc","contained","depth","geometry","$d6886d66b20a1b65$export$8eb1eda96b2e6d7a","nodeIndices","isArray","indexArr","posAttr","byteOffset","roots","_roots","_traverse","node32Index","force","node16Index","isLeaf","offsetLeft","offsetRight","forceChildren","includesLeft","includesRight","has","traverseLeft","traverseRight","leftChange","rightChange","didChange","lefti","righti","minLeftValue","maxLeftValue","minRightValue","maxRightValue","byteLength","$c6fa00580fc66263$var$_boundingBox","$c6fa00580fc66263$export$d5a069a08bb68982","intersectBox","$06f35bd135b4cbcc$var$_boxIntersection","$06f35bd135b4cbcc$export$630e89aab3ddc1d6","root","intersects","$06f35bd135b4cbcc$var$_raycast","nodeIndex16","n32","_indirectBuffer","leftIndex","rightIndex","$8094198f7e753a2d$var$_boxIntersection","$8094198f7e753a2d$var$_xyzFields","$8094198f7e753a2d$export$1fa457bc72ef1a2a","$8094198f7e753a2d$var$_raycastFirst","res","c1","c2","splitAxis","xyzAxis","rayDir","leftToRight","c1Intersection","c1Result","isOutside","c2Intersection","c2Result","$40028eca76a25282$var$boundingBox","$40028eca76a25282$var$triangle","$40028eca76a25282$var$triangle2","$40028eca76a25282$var$invertedMat","$40028eca76a25282$var$obb","$40028eca76a25282$var$obb2","$40028eca76a25282$export$b2f96b0abaf94e0a","otherGeometry","geometryToBvh","$40028eca76a25282$var$_intersectsGeometry","cachedObb","boundingBox","computeBoundingBox","thisGeometry","thisIndex","thisPos","boundsTree","shapecast","intersectsBounds","leftIntersection","rightIntersection","$c82df4aa752dbd95$var$tempMatrix","$c82df4aa752dbd95$var$obb","$c82df4aa752dbd95$var$obb2","$c82df4aa752dbd95$var$temp1","$c82df4aa752dbd95$var$temp2","$c82df4aa752dbd95$var$temp3","$c82df4aa752dbd95$var$temp4","$c82df4aa752dbd95$export$5912902c175a555e","minThreshold","maxThreshold","otherPos","otherIndex","triangle2","tempTarget2","tempTargetDest2","closestDistance","closestDistanceTriIndex","closestDistanceOtherTriIndex","boundsTraverseOrder","score","intersectsRange","otherBvh","otherOffset","otherCount","tempTargetDest1","sub","$15ccf80f37db9874$var$tempMatrix","$15ccf80f37db9874$var$aabb","$15ccf80f37db9874$var$aabb2","$15ccf80f37db9874$export$a2253c6980b92559","matrixToLocal","callbacks","intersectsRanges","intersectsTriangles","indexAttr","positionAttr","otherIndexAttr","otherPositionAttr","iterateOverDoubleTriangles","offset1","offset2","depth1","index1","depth2","originalIntersectsRanges","getBoundingBox","nodeIndex1","nodeIndex2","$30624a994ba6e57c$export$dae1f8efdced590b","resolveTriangleIndex","$f4d14018db659d90$export$40f4af49b81ca898","j","$c34151c023e22e2c$var$_boxIntersection","$c34151c023e22e2c$export$1999205ebe856279","$c34151c023e22e2c$var$_raycast","$c27191358c129b43$var$_boxIntersection","$c27191358c129b43$var$_xyzFields","$c27191358c129b43$export$44e48d4cf2fe0609","$c27191358c129b43$var$_raycastFirst","$e7beda6ce58ad8bf$var$boundingBox","$e7beda6ce58ad8bf$var$triangle","$e7beda6ce58ad8bf$var$triangle2","$e7beda6ce58ad8bf$var$invertedMat","$e7beda6ce58ad8bf$var$obb","$e7beda6ce58ad8bf$var$obb2","$e7beda6ce58ad8bf$export$80dca0df80ee0084","$e7beda6ce58ad8bf$var$_intersectsGeometry","ti","$525a48157a09a04c$var$tempMatrix","$525a48157a09a04c$var$obb","$525a48157a09a04c$var$obb2","$525a48157a09a04c$var$temp1","$525a48157a09a04c$var$temp2","$525a48157a09a04c$var$temp3","$525a48157a09a04c$var$temp4","$525a48157a09a04c$export$334b669407b5ec06","ti2","$0cb92652a15353e8$var$tempMatrix","$0cb92652a15353e8$var$aabb","$0cb92652a15353e8$var$aabb2","$0cb92652a15353e8$export$4e2970292710be2c","ti1","$d1f63a316b8768c2$var$obb","$d1f63a316b8768c2$var$tempBox","$d1f63a316b8768c2$export$9d614b3bc2c4eacf","serialize","options","cloneBuffers","rootData","indexAttribute","getIndex","slice","deserialize","data","setIndex","indirect","Boolean","newIndex","BufferAttribute","isBufferGeometry","isInterleavedBufferAttribute","Object","assign","strategy","maxDepth","maxLeafTris","verbose","useSharedArrayBuffer","setBoundingBox","onProgress","SharedArrayBuffer","$1b5942106133d63e$var$generateIndirectBuffer","useUint32","byteCount","ArrayBuffer","vertexCount","finalGroup","total","forEach","BufferConstructor","$512bf92b30757ce0$export$62808f0201824da2","$1b5942106133d63e$var$buildTree","indexArray","totalTriangles","reachedMaxDepth","fullBounds","cacheCentroidBoundingData","normalized","posArr","bufferOffset","stride","getters","tri3","tri6","ai","bi","ci","el","halfExtents","el2","partionFunc","range","boundingData","splitNode","triggerProgress","trianglesProcessed","node","centroidBoundingData","nodeBoundingData","$62809835080ba262$var$getAverage","avg","rootSurfaceArea","bestCost","cStart","cEnd","axisLeft","axisRight","axisLength","binWidth","$62809835080ba262$var$BIN_COUNT","truncatedBins","bin","splitCount","splice","leftCount","rightCount","leftBounds","rightBounds","leftProb","rightProb","cost","triCenter","relativeCenter","binIndex","lastBin","source","nextBin","binCount","splitOffset","lcount","rcount","packedRoots","nodeCount","countNodes","populateBuffer","stride4Offset","stride2Offset","nextUnusedPointer","refit","refitFunc","traverse","callback","rootIndex","stopTraversal","raycast","materialOrSide","FrontSide","isMaterial","isArrayMaterial","raycastFunc","materialSide","startCount","jl","raycastFirst","closestResult","raycastFirstFunc","intersectsGeometry","geomToMesh","intersectsGeometryFunc","iterateFunc","originalIntersectsRange","nodeIndex","$59a851f097f5ef7e$var$shapecastTraverse","intersectsBoundsFunc","intersectsRangeFunc","nodeScoreFunc","nodeIndexByteOffset","score1","score2","box1","box2","c1StopTraversal","c2StopTraversal","temp","isC1Leaf","getLeftOffset","getRightEndOffset","isC2Leaf","bvhcast","bvhcastFunc","boxToMesh","closestPointToGeometry","closestPointToGeometryFunc","minThresholdSq","maxThresholdSq","triIndex","makeEmpty","union","$3e2a3abaa10886a8$var$UP_VECTOR","$3e2a3abaa10886a8$var$_dir","$3e2a3abaa10886a8$export$97cada60b6f00a63","$3e2a3abaa10886a8$export$6ce1ecae0cd1cc55","line","triPoints","startMatches","endMatches","tp","$2cd02d3dec669c62$var$UP_VECTOR","$2cd02d3dec669c62$var$_v0","$2cd02d3dec669c62$var$_v1","$2cd02d3dec669c62$var$_normal","$2cd02d3dec669c62$var$_triangle","$627e7388cda991d0$var$_line","$627e7388cda991d0$export$84bed164e326c2f0","overlaps","overlap","prevOverlap","$aab05f562594c8e7$var$UP_VECTOR","$aab05f562594c8e7$var$_plane","$aab05f562594c8e7$var$_planeHit","$aab05f562594c8e7$var$_lineDirection","$485089c6d0563e10$var$_orthoPlane","$485089c6d0563e10$var$_edgeLine","$485089c6d0563e10$var$_point","$485089c6d0563e10$var$_vec","$485089c6d0563e10$var$_tri","$485089c6d0563e10$var$_line","$485089c6d0563e10$var$_triLine","$485089c6d0563e10$var$_dir","$485089c6d0563e10$var$_triDir","$e911a95ad6b2a32e$var$_dir","$e911a95ad6b2a32e$var$_v0","$e911a95ad6b2a32e$var$_v1","$f98ba1c508cee43d$var$_tri","$f98ba1c508cee43d$var$_line","$1481377db44180ba$var$UP_VECTOR","$1481377db44180ba$var$_beneathLine","$1481377db44180ba$var$_ray","Ray","$1481377db44180ba$var$_vec","$1481377db44180ba$var$_overlapLine","$1481377db44180ba$var$EdgeSet","edges","getLineGeometry","edgeArray","edgeGeom","BufferGeometry","edgeBuffer","setAttribute","$1481377db44180ba$export$4776387f3c0e5209","sortEdges","iterationTime","angleThreshold","includeIntersectionEdges","generateAsync","Promise","resolve","reject","signal","task","generate","run","aborted","next","done","requestAnimationFrame","projectionDir","thresholdAngle","thresholdDot","cos","MathUtils","DEG2RAD","getAttribute","indexCount","vertKeys","hashes","edgeData","round","jNext","vecHash0","vecHash1","v1","hash","reverseHash","otherNormal","meetsThreshold","normDot","otherDot","projectionThreshold","sign","index0","key","results","vertCount","time","performance","now","tri2","equals","concat","finalEdges","normalize","lowestLineY","highestLineY","hiddenOverlaps","distanceSq","highestTriangleY","lowestTriangleY","constant","startDist","endDist","isStartOnPlane","isStartBelow","isEndBelow","didHit","getArea","cross","intersectCount","endIntersects","edgeIntersects","overlapLine","overlapsTarget","invOverlaps","invOverlap","lerpVectors","progress","onmessage","prevTime","generator","currTime","postMessage","error","resultLines"],"version":3,"file":"projectionAsync.worker.28971622.js.map"} \ No newline at end of file diff --git a/example/bundle/silhouetteAsync.worker.f555f2b4.js b/example/bundle/silhouetteAsync.worker.f555f2b4.js new file mode 100644 index 0000000..9379647 --- /dev/null +++ b/example/bundle/silhouetteAsync.worker.f555f2b4.js @@ -0,0 +1,2 @@ +(()=>{var t,e,i,s,r,n,o,l,a,h,p,c,u,d,f,x,g,y,v,P,w,L,m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},E={},I={},_=m.parcelRequire6c98;null==_&&((_=function(t){if(t in E)return E[t].exports;if(t in I){var e=I[t];delete I[t];var i={id:t,exports:{}};return E[t]=i,e.call(i.exports,i,i.exports),i.exports}var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(t,e){I[t]=e},m.parcelRequire6c98=_),importScripts("./projectionAsync.worker.15f44cdc.js");var b=_("e06gU");class O{static minkowskiInternal(t,e,i,s){let r=s?0:1,n=t.length,o=e.length,l=[];for(let s of e){let e=[];if(i)for(let i of t)e.push({x:s.x+i.x,y:s.y+i.y});else for(let i of t)e.push({x:s.x-i.x,y:s.y-i.y});l.push(e)}let a=[],h=s?o-1:0,p=n-1;for(let t=r;tMath.abs(t))for(let t of this._groupList)for(let e of t.inPaths)this._solution.push(e);else for(let e of(this._delta=t,this._mitLimSqr=this.MiterLimit<=1?2:2/this.sqr(this.MiterLimit),this._groupList))this.doGroupOffset(e)}}sqr(t){return t*t}execute(t,e){if(e.length=0,this.executeInternal(t),0===this._groupList.length)return;let i=new U;i.preserveCollinear=this.PreserveCollinear,i.reverseSolution=this.ReverseSolution!==this._groupList[0].pathsReversed,i.addSubjectPaths(this._solution),this._groupList[0].pathsReversed?i.execute(v.Union,w.Negative,e):i.execute(v.Union,w.Positive,e)}executePolytree(t,e){if(e.clear(),this.executeInternal(t),0===this._groupList.length)return;let i=new U;i.preserveCollinear=this.PreserveCollinear,i.reverseSolution=this.ReverseSolution!==this._groupList[0].pathsReversed,i.addSubjectPaths(this._solution),this._groupList[0].pathsReversed?i.executePolyTree(v.Union,w.Negative,e):i.executePolyTree(v.Union,w.Positive,e)}static getUnitNormal(t,e){let i=e.x-t.x,s=e.y-t.y;if(0===i&&0===s)return new M(0,0);let r=1/Math.sqrt(i*i+s*s);return i*=r,s*=r,new M(s,-i)}executeCallback(t,e){this.DeltaCallback=t,this.execute(1,e)}static getBoundsAndLowestPolyIdx(t){let e=new G(!1),i=Number.MIN_SAFE_INTEGER,s=-1;for(let r=0;r=e.bottom?(n.y>e.bottom||n.xe.right?e.right=n.x:n.x.01?this.ArcTolerance:Math.log10(2+t)*$.defaultArcTolerance,i=Math.PI/Math.acos(1-e/t);this._stepSin=Math.sin(2*Math.PI/i),this._stepCos=Math.cos(2*Math.PI/i),this._groupDelta<0&&(this._stepSin=-this._stepSin),this._stepsPerRad=i/(2*Math.PI)}let n=e[i],o=new M(this._normals[s].x*this._groupDelta,this._normals[s].y*this._groupDelta);if(i===s&&o.negate(),t.outPath.push(new Y(n.x+o.x,n.y+o.y)),r>-Math.PI+.01){let e=Math.ceil(this._stepsPerRad*Math.abs(r));for(let i=1;i1?n=1:r<-1&&(n=-1),void 0!==this.DeltaCallback&&(this._groupDelta=this.DeltaCallback(e,this._normals,i,s),t.pathsReversed&&(this._groupDelta=-this._groupDelta)),Math.abs(this._groupDelta).999?this.doMiter(t,e,i,s,n):n>-.99&&r*this._groupDelta<0?(t.outPath.push(this.getPerpendic(e[i],this._normals[s])),t.outPath.push(e[i]),t.outPath.push(this.getPerpendic(e[i],this._normals[i]))):this._joinType===c.Miter?n>this._mitLimSqr-1?this.doMiter(t,e,i,s,n):this.doSquare(t,e,i,s):n>.99||this._joinType===c.Square?this.doSquare(t,e,i,s):this.doRound(t,e,i,s,Math.atan2(r,n)),s=i}offsetPolygon(t,e){let i=R.area(e);if(i<0!=this._groupDelta<0){let t=R.getBounds(e);if(2*Math.abs(this._groupDelta)>t.width)return}t.outPath=[];let s=e.length,r=s-1;for(let i=0;i0;t--)this._normals[t]=new M(-this._normals[t-1].x,-this._normals[t-1].y);if(this._normals[0]=this._normals[i],void 0!==this.DeltaCallback&&(this._groupDelta=this.DeltaCallback(e,this._normals,i,i)),Math.abs(this._groupDelta)0;s--)this.offsetPoint(t,e,s,0);t.outPaths.push(t.outPath)}doGroupOffset(t){if(t.endType==u.Polygon){let{index:e}=S.getBoundsAndLowestPolyIdx(t.inPaths);if(e<0)return;let i=R.area(t.inPaths[e]);t.pathsReversed=i<0,t.pathsReversed?this._groupDelta=-this._delta:this._groupDelta=this._delta}else t.pathsReversed=!1,this._groupDelta=.5*Math.abs(this._delta);let e=Math.abs(this._groupDelta);if(this._joinType=t.joinType,this._endType=t.endType,!this.DeltaCallback&&(t.joinType==c.Round||t.endType==u.Round)){let t=this.ArcTolerance>.01?this.ArcTolerance:Math.log10(2+e)*$.defaultArcTolerance,i=Math.PI/Math.acos(1-t/e);this._stepSin=Math.sin(2*Math.PI/i),this._stepCos=Math.cos(2*Math.PI/i),this._groupDelta<0&&(this._stepSin=-this._stepSin),this._stepsPerRad=i/(2*Math.PI)}let i=t.endType==u.Joined||t.endType==u.Polygon;for(let s of t.inPaths){let r=R.stripDuplicates(s,i),n=r.length;if(0!==n&&(!(n<3)||this._endType!=u.Polygon)){if(1==n){if(t.outPath=[],t.endType==u.Round)t.outPath=R.ellipse(r[0],e,e);else{let e=Math.ceil(this._groupDelta),i=new G(r[0].x-e,r[0].y-e,r[0].x-e,r[0].y-e);t.outPath=i.asPath()}t.outPaths.push(t.outPath)}else 2==n&&t.endType==u.Joined&&(t.joinType==c.Round?this._endType=u.Round:this._endType=u.Square),this.buildNormals(r),this._endType==u.Polygon?this.offsetPolygon(t,r):this._endType==u.Joined?this.offsetOpenJoined(t,r):this.offsetOpenPath(t,r)}}this._solution.push(...t.outPaths),t.outPaths=[]}}S.Tolerance=1e-12;class C{constructor(t){this.pt=t,this.ownerIdx=0}}(i=d||(d={}))[i.left=0]="left",i[i.top=1]="top",i[i.right=2]="right",i[i.bottom=3]="bottom",i[i.inside=4]="inside";class k{constructor(t){this.currIdx=-1,this.rect=t,this.mp=t.midPoint(),this.rectPath=t.asPath(),this.results=[],this.edges=Array(8).fill(void 0).map(()=>[])}add(t,e=!1){let i,s=this.results.length;if(0===s||e)i=new C(t),this.results.push(i),i.ownerIdx=s,i.prev=i,i.next=i;else{s--;let e=this.results[s];if(e.pt===t)return e;(i=new C(t)).ownerIdx=s,i.next=e.next,e.next.prev=i,e.next=i,i.prev=e,this.results[s]=i}return i}static path1ContainsPath2(t,e){let i=0;for(let s of e){let e=$.pointInPolygon(s,t);switch(e){case f.IsInside:i--;break;case f.IsOutside:i++}if(Math.abs(i)>1)break}return i<=0}static isClockwise(t,e,i,s,r){return this.areOpposites(t,e)?0>$.crossProduct(i,r,s):this.headingClockwise(t,e)}static areOpposites(t,e){return 2===Math.abs(t-e)}static headingClockwise(t,e){return(t+1)%4===e}static getAdjacentLocation(t,e){return(t+(e?1:3))%4}static unlinkOp(t){if(t.next!==t)return t.prev.next=t.next,t.next.prev=t.prev,t.next}static unlinkOpBack(t){if(t.next!==t)return t.prev.next=t.next,t.next.prev=t.prev,t.prev}static getEdgesForPt(t,e){let i=0;return t.x===e.left?i=1:t.x===e.right&&(i=4),t.y===e.top?i+=2:t.y===e.bottom&&(i+=8),i}static isHeadingClockwise(t,e,i){switch(i){case 0:return e.yt.x;case 2:return e.y>t.y;default:return e.xi.x}static hasVertOverlap(t,e,i,s){return t.yi.y}static addToEdge(t,e){e.edge||(e.edge=t,t.push(e))}static uncoupleEdge(t){if(t.edge){for(let e=0;e=t.top&&e.y<=t.bottom?{success:!1,loc:d.left}:e.x===t.right&&e.y>=t.top&&e.y<=t.bottom?{success:!1,loc:d.right}:e.y===t.top&&e.x>=t.left&&e.x<=t.right?{success:!1,loc:d.top}:e.y===t.bottom&&e.x>=t.left&&e.x<=t.right?{success:!1,loc:d.bottom}:{success:!0,loc:e.xt.right?d.right:e.yt.bottom?d.bottom:d.inside}}static getIntersection(t,e,i,s){let r=new Y;switch(s){case d.left:if($.segsIntersect(e,i,t[0],t[3],!0))r=$.getIntersectPt(e,i,t[0],t[3]).ip;else if(e.yt[1].x&&$.segsIntersect(e,i,t[1],t[2],!0)))return{success:!1,loc:s,ip:r};r=$.getIntersectPt(e,i,t[1],t[2]).ip,s=d.right}break;case d.bottom:if($.segsIntersect(e,i,t[2],t[3],!0))r=$.getIntersectPt(e,i,t[2],t[3]).ip;else if(e.xt[2].x&&$.segsIntersect(e,i,t[1],t[2],!0)))return{success:!1,loc:s,ip:r};r=$.getIntersectPt(e,i,t[1],t[2]).ip,s=d.right}break;case d.inside:if($.segsIntersect(e,i,t[0],t[3],!0))r=$.getIntersectPt(e,i,t[0],t[3]).ip,s=d.left;else if($.segsIntersect(e,i,t[0],t[1],!0))r=$.getIntersectPt(e,i,t[0],t[1]).ip,s=d.top;else if($.segsIntersect(e,i,t[1],t[2],!0))r=$.getIntersectPt(e,i,t[1],t[2]).ip,s=d.right;else{if(!$.segsIntersect(e,i,t[2],t[3],!0))return{success:!1,loc:s,ip:r};r=$.getIntersectPt(e,i,t[2],t[3]).ip,s=d.bottom}}return{success:!0,loc:s,ip:r}}getNextLocation(t,e){switch(e.loc){case d.left:for(;e.i<=e.highI&&t[e.i].x<=this.rect.left;)e.i++;if(e.i>e.highI)break;t[e.i].x>=this.rect.right?e.loc=d.right:t[e.i].y<=this.rect.top?e.loc=d.top:t[e.i].y>=this.rect.bottom?e.loc=d.bottom:e.loc=d.inside;break;case d.top:for(;e.i<=e.highI&&t[e.i].y<=this.rect.top;)e.i++;if(e.i>e.highI)break;t[e.i].y>=this.rect.bottom?e.loc=d.bottom:t[e.i].x<=this.rect.left?e.loc=d.left:t[e.i].x>=this.rect.right?e.loc=d.right:e.loc=d.inside;break;case d.right:for(;e.i<=e.highI&&t[e.i].x>=this.rect.right;)e.i++;if(e.i>e.highI)break;t[e.i].x<=this.rect.left?e.loc=d.left:t[e.i].y<=this.rect.top?e.loc=d.top:t[e.i].y>=this.rect.bottom?e.loc=d.bottom:e.loc=d.inside;break;case d.bottom:for(;e.i<=e.highI&&t[e.i].y>=this.rect.bottom;)e.i++;if(e.i>e.highI)break;t[e.i].y<=this.rect.top?e.loc=d.top:t[e.i].x<=this.rect.left?e.loc=d.left:t[e.i].x>=this.rect.right?e.loc=d.right:e.loc=d.inside;break;case d.inside:for(;e.i<=e.highI;){if(t[e.i].xthis.rect.right)e.loc=d.right;else if(t[e.i].y>this.rect.bottom)e.loc=d.bottom;else if(t[e.i].y=0&&!l.success;)e--,n=(l=k.getLocation(this.rect,t[e])).loc;if(e<0){for(let e of t)this.add(e);return}n==d.inside&&(a=d.inside)}let h=a;for(e=0;e<=o;){n=a;let l=r;if(this.getNextLocation(t,{loc:a,i:e,highI:o}),e>o)break;let h=0==e?t[o]:t[e-1];r=a;let p=k.getIntersection(this.rectPath,t[e],h,r),c=p.ip;if(!p.success){if(l==d.inside){let s=k.isClockwise(n,a,h,t[e],this.mp);do i.push(n),n=k.getAdjacentLocation(n,s);while(n!=a)r=l}else if(n!=d.inside&&n!=a){let i=k.isClockwise(n,a,h,t[e],this.mp);do this.addCornerByRef(n,i);while(n!=a)}++e;continue}if(a==d.inside){if(s==d.inside)s=r,i.push(n);else if(n!=r){let i=k.isClockwise(n,r,h,t[e],this.mp);do this.addCornerByRef(n,i);while(n!=r)}}else if(n!=d.inside){a=n,p=k.getIntersection(this.rectPath,h,t[e],a);let o=p.ip;if(l!=d.inside&&l!=a&&this.addCorner(l,a),s==d.inside&&(s=a,i.push(n)),a=r,this.add(o),c==o){a=k.getLocation(this.rect,t[e]).loc,this.addCorner(r,a),r=a;continue}}else a=r,s==d.inside&&(s=r);this.add(c)}if(s==d.inside){if(h!=d.inside&&this.pathBounds.containsRect(this.rect)&&k.path1ContainsPath2(t,this.rectPath))for(let t=0;t<4;t++)this.add(this.rectPath[t]),k.addToEdge(this.edges[2*t],this.results[0])}else if(a!=d.inside&&(a!=s||i.length>2)){if(i.length>0){for(let t of(n=a,i))n!=t&&(this.addCornerByRef(n,k.headingClockwise(n,t)),n=t);a=n}a!=s&&this.addCornerByRef(a,k.headingClockwise(a,s))}}execute(t){let e=[];if(this.rect.isEmpty())return e;for(let i of t)if(!(i.length<3)){if(this.pathBounds=R.getBounds(i),!this.rect.intersects(this.pathBounds))continue;if(this.rect.containsRect(this.pathBounds)){e.push(i);continue}this.executeInternal(i),this.checkEdges();for(let t=0;t<4;++t)this.tidyEdgePair(t,this.edges[2*t],this.edges[2*t+1]);for(let t of this.results){let i=this.getPath(t);i.length>0&&e.push(i)}this.results.length=0;for(let t=0;t<8;t++)this.edges[t].length=0}return e}checkEdges(){for(let t=0;tl.prev.pt.x,d=a.pt.x>a.prev.pt.x):(t=l.pt.y>l.prev.pt.y,d=a.pt.y>a.prev.pt.y),l.next===l.prev||l.pt===l.prev.pt?d===p?(e[c]=a,i[u++]=void 0):(i[u]=a,e[c++]=void 0):a.next===a.prev||a.pt===a.prev.pt?t===p?(e[c]=l,i[u++]=void 0):(i[u]=l,e[c++]=void 0):t===d?t===p?(e[c]=l,k.uncoupleEdge(a),k.addToEdge(e,a),i[u++]=void 0):(e[c++]=void 0,i[u]=a,k.uncoupleEdge(l),k.addToEdge(i,l),u=0):(t===p?e[c]=l:i[u]=l,d===p?e[c]=a:i[u]=a)}}getPath(t){let e=new W;if(!t||t.prev===t.next)return e;let i=t.next;for(;i&&i!==t;)0===$.crossProduct(i.prev.pt,i.pt,i.next.pt)?(t=i.prev,i=k.unlinkOp(i)):i=i.next;if(!i)return new W;for(e.push(t.pt),i=t.next;i!==t;)e.push(i.pt),i=i.next;return e}}class T extends k{constructor(t){super(t)}execute(t){let e=new Z;if(this.rect.isEmpty())return e;for(let i of t)if(!(i.length<2)&&(this.pathBounds=R.getBounds(i),this.rect.intersects(this.pathBounds))){for(let t of(this.executeInternal(i),this.results)){let i=this.getPath(t);i.length>0&&e.push(i)}this.results.length=0;for(let t=0;t<8;t++)this.edges[t].length=0}return e}getPath(t){let e=new W;if(!t||t===t.next)return e;t=t.next,e.push(t.pt);let i=t.next;for(;i!==t;)e.push(i.pt),i=i.next;return e}executeInternal(t){if(this.results=[],t.length<2||this.rect.isEmpty())return;let e=d.inside,i=1,s=t.length-1,r=T.getLocation(this.rect,t[0]),n=r.loc;if(!r.success){for(;i<=s&&!r.success;)i++,e=(r=T.getLocation(this.rect,t[i])).loc;if(i>s)for(let e of t)this.add(e);e==d.inside&&(n=d.inside),i=1}for(n==d.inside&&this.add(t[0]);i<=s&&(e=n,this.getNextLocation(t,{loc:n,i:i,highI:s}),!(i>s));){let s=t[i-1],r=n,o=T.getIntersection(this.rectPath,t[i],s,r),l=o.ip;if(r=o.loc,!o.success){i++;continue}if(n==d.inside)this.add(l,!0);else if(e!==d.inside){r=e,o=T.getIntersection(this.rectPath,s,t[i],r);let n=o.ip;r=o.loc,this.add(n),this.add(l)}else this.add(l)}}}class R{static get InvalidRect64(){return R.invalidRect64||(R.invalidRect64=new G(!1)),this.invalidRect64}static Intersect(t,e,i){return this.BooleanOp(v.Intersection,t,e,i)}static Union(t,e,i=w.EvenOdd){return this.BooleanOp(v.Union,t,e,i)}static Difference(t,e,i){return this.BooleanOp(v.Difference,t,e,i)}static Xor(t,e,i){return this.BooleanOp(v.Xor,t,e,i)}static BooleanOp(t,e,i,s=w.EvenOdd){let r=new Z;if(!e)return r;let n=new U;return n.addPaths(e,P.Subject),i&&n.addPaths(i,P.Clip),n.execute(t,s,r),r}static InflatePaths(t,e,i,s,r=2){let n=new S(r);n.addPaths(t,i,s);let o=new Z;return n.execute(e,o),o}static RectClipPaths(t,e){if(t.isEmpty()||0===e.length)return new Z;let i=new k(t);return i.execute(e)}static RectClip(t,e){if(t.isEmpty()||0===e.length)return new Z;let i=new Z;return i.push(e),this.RectClipPaths(t,i)}static RectClipLinesPaths(t,e){if(t.isEmpty()||0===e.length)return new Z;let i=new T(t);return i.execute(e)}static RectClipLines(t,e){if(t.isEmpty()||0===e.length)return new Z;let i=new Z;return i.push(e),this.RectClipLinesPaths(t,i)}static MinkowskiSum(t,e,i){return O.sum(t,e,i)}static MinkowskiDiff(t,e,i){return O.diff(t,e,i)}static area(t){let e=0,i=t.length;if(i<3)return 0;let s=t[i-1];for(let i of t)e+=(s.y+i.y)*(s.x-i.x),s=i;return .5*e}static areaPaths(t){let e=0;for(let i of t)e+=this.area(i);return e}static isPositive(t){return this.area(t)>=0}static path64ToString(t){let e="";for(let i of t)e+=i.toString();return e+"\n"}static paths64ToString(t){let e="";for(let i of t)e+=this.path64ToString(i);return e}static offsetPath(t,e,i){let s=new W;for(let r of t)s.push(new Y(r.x+e,r.y+i));return s}static scalePoint64(t,e){let i=new Y(Math.round(t.x*e),Math.round(t.y*e));return i}static scalePath(t,e){if($.isAlmostZero(e-1))return t;let i=[];for(let s of t)i.push({x:s.x*e,y:s.y*e});return i}static scalePaths(t,e){if($.isAlmostZero(e-1))return t;let i=[];for(let s of t)i.push(this.scalePath(s,e));return i}static translatePath(t,e,i){let s=[];for(let r of t)s.push({x:r.x+e,y:r.y+i});return s}static translatePaths(t,e,i){let s=[];for(let r of t)s.push(this.translatePath(r,e,i));return s}static reversePath(t){return[...t].reverse()}static reversePaths(t){let e=[];for(let i of t)e.push(this.reversePath(i));return e}static getBounds(t){let e=R.InvalidRect64;for(let i of t)i.xe.right&&(e.right=i.x),i.ye.bottom&&(e.bottom=i.y);return e.left===Number.MAX_SAFE_INTEGER?new G(0,0,0,0):e}static getBoundsPaths(t){let e=R.InvalidRect64;for(let i of t)for(let t of i)t.xe.right&&(e.right=t.x),t.ye.bottom&&(e.bottom=t.y);return e.left===Number.MAX_SAFE_INTEGER?new G(0,0,0,0):e}static makePath(t){let e=t.length/2,i=new W;for(let s=0;s0&&e.push(t.polygon);for(let i=0;ie&&t[e]===t[i];)r[i--]=!1;for(let s=e+1;se+1&&R.rdp(t,e,n,s,r),n0&&i[t];)t--;if(!i[t])return t;for(t=e;i[t];)t--;return t}static sqr(t){return t*t}static simplifyPath(t,e,i=!1){let s,r,n,o;let l=t.length,a=l-1,h=this.sqr(e);if(l<4)return t;let p=Array(l).fill(!1),c=Array(l).fill(0),u=a,d=0;i?(c[0]=this.perpendicDistFromLineSqrd(t[0],t[a],t[1]),c[a]=this.perpendicDistFromLineSqrd(t[a],t[0],t[a-1])):(c[0]=Number.MAX_VALUE,c[a]=Number.MAX_VALUE);for(let e=1;eh){s=d;do d=this.getNext(d,a,p);while(d!==s&&c[d]>h)if(d===s)break}if(u=this.getPrior(d,a,p),(r=this.getNext(d,a,p))===u)break;c[r]2&&0===$.crossProduct(r[r.length-1],r[r.length-2],r[0]);)r.pop();r.length<3&&r.splice(0,r.length)}return r}static pointInPolygon(t,e){return $.pointInPolygon(t,e)}static ellipse(t,e,i=0,s=0){if(e<=0)return[];i<=0&&(i=e),s<=2&&(s=Math.ceil(Math.PI*Math.sqrt((e+i)/2)));let r=Math.sin(2*Math.PI/s),n=Math.cos(2*Math.PI/s),o=n,l=r,a=[{x:t.x+e,y:t.y}];for(let h=1;hthis.showPolyPathStructure(t,e+1)))}static showPolyTreeStructure(t){console.log("Polytree Root"),t.forEach(t=>this.showPolyPathStructure(t,1))}}(s=f||(f={}))[s.IsOn=0]="IsOn",s[s.IsInside=1]="IsInside",s[s.IsOutside=2]="IsOutside",(r=x||(x={}))[r.None=0]="None",r[r.OpenStart=1]="OpenStart",r[r.OpenEnd=2]="OpenEnd",r[r.LocalMax=4]="LocalMax",r[r.LocalMin=8]="LocalMin";class D{constructor(t,e,i){this.pt=t,this.flags=e,this.next=void 0,this.prev=i}}class N{constructor(t,e,i=!1){this.vertex=t,this.polytype=e,this.isOpen=i}static equals(t,e){return t.vertex===e.vertex}static notEquals(t,e){return t.vertex!==e.vertex}}class H{constructor(t,e,i){this.pt=t,this.edge1=e,this.edge2=i}}class z{constructor(t,e){this.pt=t,this.outrec=e,this.next=this,this.prev=this,this.horz=void 0}}(n=g||(g={}))[n.None=0]="None",n[n.Left=1]="Left",n[n.Right=2]="Right",(o=y||(y={}))[o.Bottom=0]="Bottom",o[o.Middle=1]="Middle",o[o.Top=2]="Top";class X{constructor(t){this.idx=t,this.isOpen=!1}}class B{constructor(t){this.leftOp=t,this.rightOp=void 0,this.leftToRight=!0}}class j{constructor(t,e){this.op1=t,this.op2=e}}class F{constructor(){this.dx=this.windCount=this.windCount2=0,this.isLeftBound=!1,this.joinWith=g.None}}class V{static addLocMin(t,e,i,s){if((t.flags&x.LocalMin)!==x.None)return;t.flags|=x.LocalMin;let r=new N(t,e,i);s.push(r)}static addPathsToVertexList(t,e,i,s,r){let n=0;for(let e of t)n+=e.length;for(let o of t){let t,l,a;for(let e of o)t?l.pt!==e&&(a=new D(e,x.None,l),r.push(a),l.next=a,l=a):(t=new D(e,x.None,void 0),r.push(t),l=t);if(!l||!l.prev||(i||l.pt!==t.pt||(l=l.prev),l.next=t,t.prev=l,!i&&l.next===l))continue;let h=!1;if(i){a=t.next;let i=0;for(;a!==t&&a.pt.y===t.pt.y;)if(a=a.next,i++>n){console.warn("infinite loop detected");break}(h=a.pt.y<=t.pt.y)?(t.flags=x.OpenStart,this.addLocMin(t,e,!0,s)):t.flags=x.OpenStart|x.LocalMax}else{l=t.prev;let e=0;for(;l!==t&&l.pt.y===t.pt.y;)if(l=l.prev,e++>n){console.warn("infinite loop detected");break}if(l===t)continue;h=l.pt.y>t.pt.y}let p=h;l=t,a=t.next;let c=0;for(;a!==t;)if(a.pt.y>l.pt.y&&h?(l.flags|=x.LocalMax,h=!1):a.pt.yn){console.warn("infinite loop detected");break}i?(l.flags|=x.OpenEnd,h?l.flags|=x.LocalMax:this.addLocMin(l,e,i,s)):h!==p&&(p?this.addLocMin(l,e,!1,s):l.flags|=x.LocalMax)}}}class q{constructor(){this.items=[],this.items=[]}clear(){this.items.length=0}isEmpty(){return 0==this.items.length}pollLast(){return this.items.pop()}add(t){this.items.includes(t)||(this.items.push(t),this.items.sort((t,e)=>t-e))}}class J{constructor(){this._cliptype=v.None,this._fillrule=w.EvenOdd,this._currentLocMin=0,this._currentBotY=0,this._isSortedMinimaList=!1,this._hasOpenPaths=!1,this._using_polytree=!1,this._succeeded=!1,this.reverseSolution=!1,this._minimaList=[],this._intersectList=[],this._vertexList=[],this._outrecList=[],this._scanlineList=new q,this._horzSegList=[],this._horzJoinList=[],this.preserveCollinear=!0}static isOdd(t){return(1&t)!=0}static isHotEdgeActive(t){return void 0!==t.outrec}static isOpen(t){return t.localMin.isOpen}static isOpenEndActive(t){return t.localMin.isOpen&&J.isOpenEnd(t.vertexTop)}static isOpenEnd(t){return(t.flags&(x.OpenStart|x.OpenEnd))!==x.None}static getPrevHotEdge(t){let e=t.prevInAEL;for(;e&&(J.isOpen(e)||!J.isHotEdgeActive(e));)e=e.prevInAEL;return e}static isFront(t){return t===t.outrec.frontEdge}static getDx(t,e){let i=e.y-t.y;return 0!==i?(e.x-t.x)/i:e.x>t.x?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}static topX(t,e){return e===t.top.y||t.top.x===t.bot.x?t.top.x:e===t.bot.y?t.bot.x:t.bot.x+Math.round(t.dx*(e-t.bot.y))}static isHorizontal(t){return t.top.y===t.bot.y}static isHeadingRightHorz(t){return Number.NEGATIVE_INFINITY===t.dx}static isHeadingLeftHorz(t){return Number.POSITIVE_INFINITY===t.dx}static swapActives(t,e){[e,t]=[t,e]}static getPolyType(t){return t.localMin.polytype}static isSamePolyType(t,e){return t.localMin.polytype===e.localMin.polytype}static setDx(t){t.dx=J.getDx(t.bot,t.top)}static nextVertex(t){return t.windDx>0?t.vertexTop.next:t.vertexTop.prev}static prevPrevVertex(t){return t.windDx>0?t.vertexTop.prev.prev:t.vertexTop.next.next}static isMaxima(t){return(t.flags&x.LocalMax)!==x.None}static isMaximaActive(t){return J.isMaxima(t.vertexTop)}static getMaximaPair(t){let e=t.nextInAEL;for(;e;){if(e.vertexTop===t.vertexTop)return e;e=e.nextInAEL}}static getCurrYMaximaVertex_Open(t){let e=t.vertexTop;if(t.windDx>0)for(;e.next.pt.y===e.pt.y&&(e.flags&(x.OpenEnd|x.LocalMax))===x.None;)e=e.next;else for(;e.prev.pt.y===e.pt.y&&(e.flags&(x.OpenEnd|x.LocalMax))===x.None;)e=e.prev;return J.isMaxima(e)||(e=void 0),e}static getCurrYMaximaVertex(t){let e=t.vertexTop;if(t.windDx>0)for(;e.next.pt.y===e.pt.y;)e=e.next;else for(;e.prev.pt.y===e.pt.y;)e=e.prev;return J.isMaxima(e)||(e=void 0),e}static setSides(t,e,i){t.frontEdge=e,t.backEdge=i}static swapOutrecs(t,e){let i=t.outrec,s=e.outrec;if(i===s){let t=i.frontEdge;i.frontEdge=i.backEdge,i.backEdge=t;return}i&&(t===i.frontEdge?i.frontEdge=e:i.backEdge=e),s&&(e===s.frontEdge?s.frontEdge=t:s.backEdge=t),t.outrec=s,e.outrec=i}static setOwner(t,e){for(;e.owner&&!e.owner.pts;)e.owner=e.owner.owner;let i=e;for(;i&&i!==t;)i=i.owner;i&&(e.owner=t.owner),t.owner=e}static area(t){let e=0,i=t;do e+=(i.prev.pt.y+i.pt.y)*(i.prev.pt.x-i.pt.x),i=i.next;while(i!==t)return .5*e}static areaTriangle(t,e,i){return(i.y+t.y)*(i.x-t.x)+(t.y+e.y)*(t.x-e.x)+(e.y+i.y)*(e.x-i.x)}static getRealOutRec(t){for(;void 0!==t&&void 0===t.pts;)t=t.owner;return t}static isValidOwner(t,e){for(;void 0!==e&&e!==t;)e=e.owner;return void 0===e}static uncoupleOutRec(t){let e=t.outrec;void 0!==e&&(e.frontEdge.outrec=void 0,e.backEdge.outrec=void 0,e.frontEdge=void 0,e.backEdge=void 0)}static outrecIsAscending(t){return t===t.outrec.frontEdge}static swapFrontBackSides(t){let e=t.frontEdge;t.frontEdge=t.backEdge,t.backEdge=e,t.pts=t.pts.next}static edgesAdjacentInAEL(t){return t.edge1.nextInAEL===t.edge2||t.edge1.prevInAEL===t.edge2}clearSolutionOnly(){for(;this._actives;)this.deleteFromAEL(this._actives);this._scanlineList.clear(),this.disposeIntersectNodes(),this._outrecList.length=0,this._horzSegList.length=0,this._horzJoinList.length=0}clear(){this.clearSolutionOnly(),this._minimaList.length=0,this._vertexList.length=0,this._currentLocMin=0,this._isSortedMinimaList=!1,this._hasOpenPaths=!1}reset(){this._isSortedMinimaList||(this._minimaList.sort((t,e)=>e.vertex.pt.y-t.vertex.pt.y),this._isSortedMinimaList=!0);for(let t=this._minimaList.length-1;t>=0;t--)this._scanlineList.add(this._minimaList[t].vertex.pt.y);this._currentBotY=0,this._currentLocMin=0,this._actives=void 0,this._sel=void 0,this._succeeded=!0}insertScanline(t){this._scanlineList.add(t)}popScanline(){return this._scanlineList.pollLast()}hasLocMinAtY(t){return this._currentLocMin0;case w.Negative:return t.windCount2<0;default:return 0!==t.windCount2}case v.Union:switch(this._fillrule){case w.Positive:return t.windCount2<=0;case w.Negative:return t.windCount2>=0;default:return 0===t.windCount2}case v.Difference:let e=this._fillrule===w.Positive?t.windCount2<=0:this._fillrule===w.Negative?t.windCount2>=0:0===t.windCount2;return J.getPolyType(t)===P.Subject?e:!e;case v.Xor:return!0;default:return!1}}isContributingOpen(t){let e,i;switch(this._fillrule){case w.Positive:i=t.windCount>0,e=t.windCount2>0;break;case w.Negative:i=t.windCount<0,e=t.windCount2<0;break;default:i=0!==t.windCount,e=0!==t.windCount2}switch(this._cliptype){case v.Intersection:return e;case v.Union:return!i&&!e;default:return!e}}setWindCountForClosedPathEdge(t){let e=t.prevInAEL,i=J.getPolyType(t);for(;void 0!==e&&(J.getPolyType(e)!==i||J.isOpen(e));)e=e.prevInAEL;if(void 0===e?(t.windCount=t.windDx,e=this._actives):(this._fillrule===w.EvenOdd?t.windCount=t.windDx:e.windCount*e.windDx<0?Math.abs(e.windCount)>1?e.windDx*t.windDx<0?t.windCount=e.windCount:t.windCount=e.windCount+t.windDx:t.windCount=J.isOpen(t)?1:t.windDx:e.windDx*t.windDx<0?t.windCount=e.windCount:t.windCount=e.windCount+t.windDx,t.windCount2=e.windCount2,e=e.nextInAEL),this._fillrule===w.EvenOdd)for(;e!==t;)J.getPolyType(e)===i||J.isOpen(e)||(t.windCount2=0===t.windCount2?1:0),e=e.nextInAEL;else for(;e!==t;)J.getPolyType(e)===i||J.isOpen(e)||(t.windCount2+=e.windDx),e=e.nextInAEL}setWindCountForOpenPathEdge(t){let e=this._actives;if(this._fillrule===w.EvenOdd){let i=0,s=0;for(;e!==t;)J.getPolyType(e)===P.Clip?s++:!J.isOpen(e)&&i++,e=e.nextInAEL;t.windCount=J.isOdd(i)?1:0,t.windCount2=J.isOdd(s)?1:0}else for(;e!==t;)J.getPolyType(e)===P.Clip?t.windCount2+=e.windDx:J.isOpen(e)||(t.windCount+=e.windDx),e=e.nextInAEL}static isValidAelOrder(t,e){if(e.curX!==t.curX)return e.curX>t.curX;let i=$.crossProduct(t.top,e.bot,e.top);if(0!==i)return i<0;if(!this.isMaximaActive(t)&&t.top.y>e.top.y)return 0>=$.crossProduct(e.bot,t.top,this.nextVertex(t).pt);if(!this.isMaximaActive(e)&&e.top.y>t.top.y)return $.crossProduct(e.bot,e.top,this.nextVertex(e).pt)>=0;let s=e.bot.y,r=e.isLeftBound;return t.bot.y!==s||t.localMin.vertex.pt.y!==s?e.isLeftBound:t.isLeftBound!==r?r:0===$.crossProduct(this.prevPrevVertex(t).pt,t.bot,t.top)||$.crossProduct(this.prevPrevVertex(t).pt,e.bot,this.prevPrevVertex(e).pt)>0===r}insertLeftEdge(t){let e;if(this._actives){if(J.isValidAelOrder(this._actives,t)){for(e=this._actives;e.nextInAEL&&J.isValidAelOrder(e.nextInAEL,t);)e=e.nextInAEL;e.joinWith===g.Right&&(e=e.nextInAEL),t.nextInAEL=e.nextInAEL,e.nextInAEL&&(e.nextInAEL.prevInAEL=t),t.prevInAEL=e,e.nextInAEL=t}else t.prevInAEL=void 0,t.nextInAEL=this._actives,this._actives.prevInAEL=t,this._actives=t}else t.prevInAEL=void 0,t.nextInAEL=void 0,this._actives=t}static insertRightEdge(t,e){e.nextInAEL=t.nextInAEL,t.nextInAEL&&(t.nextInAEL.prevInAEL=e),e.prevInAEL=t,t.nextInAEL=e}insertLocalMinimaIntoAEL(t){let e,i,s;for(;this.hasLocMinAtY(t);){((e=this.popLocalMinima()).vertex.flags&x.OpenStart)!==x.None?i=void 0:((i=new F).bot=e.vertex.pt,i.curX=e.vertex.pt.x,i.windDx=-1,i.vertexTop=e.vertex.prev,i.top=e.vertex.prev.pt,i.outrec=void 0,i.localMin=e,J.setDx(i)),(e.vertex.flags&x.OpenEnd)!==x.None?s=void 0:((s=new F).bot=e.vertex.pt,s.curX=e.vertex.pt.x,s.windDx=1,s.vertexTop=e.vertex.next,s.top=e.vertex.next.pt,s.outrec=void 0,s.localMin=e,J.setDx(s)),i&&s?J.isHorizontal(i)?J.isHeadingRightHorz(i)&&([s,i]=[i,s]):J.isHorizontal(s)?J.isHeadingLeftHorz(s)&&([s,i]=[i,s]):i.dx0?J.setSides(r,t,e):J.setSides(r,e,t);else{r.isOpen=!1;let i=J.getPrevHotEdge(t);i?(this._using_polytree&&J.setOwner(r,i.outrec),r.owner=i.outrec,J.outrecIsAscending(i)===s?J.setSides(r,e,t):J.setSides(r,t,e)):(r.owner=void 0,s?J.setSides(r,t,e):J.setSides(r,e,t))}let n=new z(i,r);return r.pts=n,n}addLocalMaxPoly(t,e,i){if(J.isJoined(t)&&this.split(t,i),J.isJoined(e)&&this.split(e,i),J.isFront(t)===J.isFront(e)){if(J.isOpenEndActive(t))J.swapFrontBackSides(t.outrec);else if(J.isOpenEndActive(e))J.swapFrontBackSides(e.outrec);else{this._succeeded=!1;return}}let s=J.addOutPt(t,i);if(t.outrec===e.outrec){let e=t.outrec;if(e.pts=s,this._using_polytree){let i=J.getPrevHotEdge(t);void 0===i?e.owner=void 0:J.setOwner(e,i.outrec)}J.uncoupleOutRec(t)}else J.isOpen(t)?t.windDx<0?J.joinOutrecPaths(t,e):J.joinOutrecPaths(e,t):t.outrec.idx0?(i.frontEdge=t,i.backEdge=void 0):(i.frontEdge=void 0,i.backEdge=t),t.outrec=i;let s=new z(e,i);return i.pts=s,s}updateEdgeIntoAEL(t){t.bot=t.top,t.vertexTop=J.nextVertex(t),t.top=t.vertexTop.pt,t.curX=t.bot.x,J.setDx(t),J.isJoined(t)&&this.split(t,t.bot),J.isHorizontal(t)||(this.insertScanline(t.top.y),this.checkJoinLeft(t,t.bot),this.checkJoinRight(t,t.bot,!0))}static findEdgeWithMatchingLocMin(t){let e=t.nextInAEL;for(;e;){if(e.localMin===t.localMin)return e;e=J.isHorizontal(e)||t.bot===e.bot?e.nextInAEL:void 0}for(e=t.prevInAEL;e&&e.localMin!==t.localMin;){if(!J.isHorizontal(e)&&t.bot!==e.bot)return;e=e.prevInAEL}return e}intersectEdges(t,e,i){let s,r,n;if(this._hasOpenPaths&&(J.isOpen(t)||J.isOpen(e))){if(J.isOpen(t)&&J.isOpen(e))return;if(J.isOpen(e)&&J.swapActives(t,e),J.isJoined(e)&&this.split(e,i),this._cliptype===v.Union){if(!J.isHotEdgeActive(e))return}else if(e.localMin.polytype===P.Subject)return;switch(this._fillrule){case w.Positive:if(1!==e.windCount)return;break;case w.Negative:if(-1!==e.windCount)return;break;default:if(1!==Math.abs(e.windCount))return}if(J.isHotEdgeActive(t))n=J.addOutPt(t,i),J.isFront(t)?t.outrec.frontEdge=void 0:t.outrec.backEdge=void 0,t.outrec=void 0;else if(i!==t.localMin.vertex.pt||J.isOpenEnd(t.localMin.vertex))n=this.startOpenPath(t,i);else{let e=J.findEdgeWithMatchingLocMin(t);if(e&&J.isHotEdgeActive(e))return t.outrec=e.outrec,t.windDx>0?J.setSides(e.outrec,t,e):J.setSides(e.outrec,e,t),e.outrec.pts;n=this.startOpenPath(t,i)}return n}switch(J.isJoined(t)&&this.split(t,i),J.isJoined(e)&&this.split(e,i),t.localMin.polytype===e.localMin.polytype?this._fillrule===w.EvenOdd?(s=t.windCount,t.windCount=e.windCount,e.windCount=s):(t.windCount+e.windDx===0?t.windCount=-t.windCount:t.windCount+=e.windDx,e.windCount-t.windDx==0?e.windCount=-e.windCount:e.windCount-=t.windDx):(this._fillrule!==w.EvenOdd?t.windCount2+=e.windDx:t.windCount2=0===t.windCount2?1:0,this._fillrule!==w.EvenOdd?e.windCount2-=t.windDx:e.windCount2=0===e.windCount2?1:0),this._fillrule){case w.Positive:s=t.windCount,r=e.windCount;break;case w.Negative:s=-t.windCount,r=-e.windCount;break;default:s=Math.abs(t.windCount),r=Math.abs(e.windCount)}let o=0===s||1===s,l=0===r||1===r;if((J.isHotEdgeActive(t)||o)&&(J.isHotEdgeActive(e)||l)){if(J.isHotEdgeActive(t)&&J.isHotEdgeActive(e))0!==s&&1!==s||0!==r&&1!==r||t.localMin.polytype!==e.localMin.polytype&&this._cliptype!==v.Xor?n=this.addLocalMaxPoly(t,e,i):J.isFront(t)||t.outrec===e.outrec?(n=this.addLocalMaxPoly(t,e,i),this.addLocalMinPoly(t,e,i)):(n=J.addOutPt(t,i),J.addOutPt(e,i),J.swapOutrecs(t,e));else if(J.isHotEdgeActive(t))n=J.addOutPt(t,i),J.swapOutrecs(t,e);else if(J.isHotEdgeActive(e))n=J.addOutPt(e,i),J.swapOutrecs(t,e);else{let o,l;switch(this._fillrule){case w.Positive:o=t.windCount2,l=e.windCount2;break;case w.Negative:o=-t.windCount2,l=-e.windCount2;break;default:o=Math.abs(t.windCount2),l=Math.abs(e.windCount2)}if(J.isSamePolyType(t,e)){if(1===s&&1===r)switch(n=void 0,this._cliptype){case v.Union:if(o>0&&l>0)return;n=this.addLocalMinPoly(t,e,i);break;case v.Difference:(J.getPolyType(t)===P.Clip&&o>0&&l>0||J.getPolyType(t)===P.Subject&&o<=0&&l<=0)&&(n=this.addLocalMinPoly(t,e,i));break;case v.Xor:n=this.addLocalMinPoly(t,e,i);break;default:if(o<=0||l<=0)return;n=this.addLocalMinPoly(t,e,i)}}else n=this.addLocalMinPoly(t,e,i)}return n}}deleteFromAEL(t){let e=t.prevInAEL,i=t.nextInAEL;(e||i||t===this._actives)&&(e?e.nextInAEL=i:this._actives=i,i&&(i.prevInAEL=e))}adjustCurrXAndCopyToSEL(t){let e=this._actives;for(this._sel=e;e;)e.prevInSEL=e.prevInAEL,e.nextInSEL=e.nextInAEL,e.jump=e.nextInSEL,e.joinWith===g.Left?e.curX=e.prevInAEL.curX:e.curX=J.topX(e,t),e=e.nextInAEL}executeInternal(t,e){if(t===v.None)return;this._fillrule=e,this._cliptype=t,this.reset();let i=this.popScanline();if(void 0!==i){for(;this._succeeded;){this.insertLocalMinimaIntoAEL(i);let t=this.popHorz();for(;t;)this.doHorizontal(t),t=this.popHorz();if(this._horzSegList.length>0&&(this.convertHorzSegsToJoins(),this._horzSegList.length=0),this._currentBotY=i,void 0===(i=this.popScanline()))break;for(this.doIntersections(i),this.doTopOfScanbeam(i),t=this.popHorz();t;)this.doHorizontal(t),t=this.popHorz()}this._succeeded&&this.processHorzJoins()}}doIntersections(t){this.buildIntersectList(t)&&(this.processIntersectList(),this.disposeIntersectNodes())}disposeIntersectNodes(){this._intersectList.length=0}addNewIntersectNode(t,e,i){let s=$.getIntersectPt(t.bot,t.top,e.bot,e.top),r=s.ip;if(s.success||(r=new Y(t.curX,i)),r.y>this._currentBotY||r.y100&&n>100?r=s>n?$.getClosestPtOnSegment(r,t.bot,t.top):$.getClosestPtOnSegment(r,e.bot,e.top):s>100?r=$.getClosestPtOnSegment(r,t.bot,t.top):n>100?r=$.getClosestPtOnSegment(r,e.bot,e.top):(r.y0}processIntersectList(){this._intersectList.sort((t,e)=>t.pt.y===e.pt.y?t.pt.x===e.pt.x?0:t.pt.xe.pt.y?-1:1);for(let t=0;tl||!n&&a.curX=e.x||!n&&J.topX(a,e.y)<=e.x)break}else if(n&&J.topX(a,e.y)>e.x||!n&&J.topX(a,e.y)e.y)&&!(s.bot.y>e.y))){if(i){if(R.perpendicDistFromLineSqrd(e,s.bot,s.top)>.25)return}else if(t.curX!==s.curX)return;0===$.crossProduct(t.top,e,s.top)&&(t.outrec.idx===s.outrec.idx?this.addLocalMaxPoly(s,t,e):t.outrec.idxe.y)&&!(s.bot.y>e.y))){if(i){if(R.perpendicDistFromLineSqrd(e,s.bot,s.top)>.25)return}else if(t.curX!==s.curX)return;0===$.crossProduct(t.top,e,s.top)&&(t.outrec.idx===s.outrec.idx?this.addLocalMaxPoly(t,s,e):t.outrec.idxt&&e?t.rightOp?e.rightOp?t.leftOp.pt.x-e.leftOp.pt.x:-1:e.rightOp?1:0:0);for(let e=0;e=i.rightOp.pt.x||t.leftToRight===i.leftToRight||t.rightOp.pt.x<=i.leftOp.pt.x)continue;let e=i.leftOp.pt.y;if(i.leftToRight){for(;i.leftOp.next.pt.y===e&&i.leftOp.next.pt.x<=t.leftOp.pt.x;)i.leftOp=i.leftOp.next;for(;t.leftOp.prev.pt.y===e&&t.leftOp.prev.pt.x<=i.leftOp.pt.x;)t.leftOp=t.leftOp.prev;let s=new j(J.duplicateOp(i.leftOp,!0),J.duplicateOp(t.leftOp,!1));this._horzJoinList.push(s)}else{for(;i.leftOp.prev.pt.y===e&&i.leftOp.prev.pt.x<=t.leftOp.pt.x;)i.leftOp=i.leftOp.prev;for(;t.leftOp.next.pt.y===e&&t.leftOp.next.pt.x<=i.leftOp.pt.x;)t.leftOp=t.leftOp.next;let s=new j(J.duplicateOp(t.leftOp,!0),J.duplicateOp(i.leftOp,!1));this._horzJoinList.push(s)}}}}}static getCleanPath(t){let e=new W,i=t;for(;i.next!==t&&(i.pt.x===i.next.pt.x&&i.pt.x===i.prev.pt.x||i.pt.y===i.next.pt.y&&i.pt.y===i.prev.pt.y);)i=i.next;e.push(i.pt);let s=i;for(i=i.next;i!==t;)(i.pt.x!==i.next.pt.x||i.pt.x!==s.pt.x)&&(i.pt.y!==i.next.pt.y||i.pt.y!==s.pt.y)&&(e.push(i.pt),s=i),i=i.next;return e}static pointInOpPolygon(t,e){if(e===e.next||e.prev===e.next)return f.IsOutside;let i=e;do{if(e.pt.y!==t.y)break;e=e.next}while(e!==i)if(e.pt.y===t.y)return f.IsOutside;let s=e.pt.yt.y;)i=i.next;if(i===e)break;if(i.pt.y===t.y){if(i.pt.x===t.x||i.pt.y===i.prev.pt.y&&t.xMath.abs(s))if(Math.abs(s)>1)return s<0;let n=J.getBoundsPath(this.getCleanPath(t)).midPoint(),o=this.getCleanPath(e);return $.pointInPolygon(n,o)!==f.IsOutside}moveSplits(t,e){if(t.splits){for(let i of(e.splits=e.splits||[],t.splits))e.splits.push(i);t.splits=void 0}}processHorzJoins(){for(let t of this._horzJoinList){let e=J.getRealOutRec(t.op1.outrec),i=J.getRealOutRec(t.op2.outrec),s=t.op1.next,r=t.op2.prev;if(t.op1.next=t.op2,t.op2.prev=t.op1,s.prev=r,r.next=s,e===i){if((i=this.newOutRec()).pts=s,J.fixOutRecPts(i),e.pts.outrec===i&&(e.pts=t.op1,e.pts.outrec=e),this._using_polytree){if(J.path1InsidePath2(e.pts,i.pts)){let t=e.pts;e.pts=i.pts,i.pts=t,J.fixOutRecPts(e),J.fixOutRecPts(i),i.owner=e.owner}else J.path1InsidePath2(i.pts,e.pts)?i.owner=e:i.owner=e.owner;e.splits=e.splits||[],e.splits.push(i.idx)}else i.owner=e}else i.pts=void 0,this._using_polytree?(J.setOwner(i,e),this.moveSplits(i,e)):i.owner=e}}static ptsReallyClose(t,e){return 2>Math.abs(t.x-e.x)&&2>Math.abs(t.y-e.y)}static isVerySmallTriangle(t){return t.next.next===t.prev&&(this.ptsReallyClose(t.prev.pt,t.next.pt)||this.ptsReallyClose(t.pt,t.next.pt)||this.ptsReallyClose(t.pt,t.prev.pt))}static isValidClosedPath(t){return void 0!==t&&t.next!==t&&(t.next!==t.prev||!this.isVerySmallTriangle(t))}static disposeOutPt(t){let e=t.next===t?void 0:t.next;return t.prev.next=t.next,t.next.prev=t.prev,e}cleanCollinear(t){if(void 0===(t=J.getRealOutRec(t))||t.isOpen)return;if(!J.isValidClosedPath(t.pts)){t.pts=void 0;return}let e=t.pts,i=e;for(;;){if(0===$.crossProduct(i.prev.pt,i.pt,i.next.pt)&&(i.pt===i.prev.pt||i.pt===i.next.pt||!this.preserveCollinear||0>$.dotProduct(i.prev.pt,i.pt,i.next.pt))){if(i===t.pts&&(t.pts=i.prev),i=J.disposeOutPt(i),!J.isValidClosedPath(i)){t.pts=void 0;return}e=i;continue}if((i=i.next)===e)break}this.fixSelfIntersects(t)}doSplitOp(t,e){let i=e.prev,s=e.next.next;t.pts=i;let r=$.getIntersectPoint(i.pt,e.pt,e.next.pt,s.pt).ip,n=J.area(i),o=Math.abs(n);if(o<2){t.pts=void 0;return}let l=J.areaTriangle(r,e.pt,e.next.pt),a=Math.abs(l);if(r===i.pt||r===s.pt)s.prev=i,i.next=s;else{let e=new z(r,t);e.prev=i,e.next=s,s.prev=e,i.next=e}if(a>1&&(a>o||l>0==n>0)){let s=this.newOutRec();s.owner=t.owner,e.outrec=s,e.next.outrec=s;let n=new z(r,s);n.prev=e.next,n.next=e,s.pts=n,e.prev=n,e.next.next=n,this._using_polytree&&(J.path1InsidePath2(i,n)?(s.splits=s.splits||[],s.splits.push(t.idx)):(t.splits=t.splits||[],t.splits.push(s.idx)))}}fixSelfIntersects(t){let e=t.pts;for(;e.prev!==e.next.next;){if($.segsIntersect(e.prev.pt,e.pt,e.next.pt,e.next.next.pt)){if(this.doSplitOp(t,e),!t.pts)return;e=t.pts;continue}if((e=e.next)===t.pts)break}}static buildPath(t,e,i,s){let r,n;if(void 0===t||t.next===t||!i&&t.next===t.prev)return!1;for(s.length=0,e?(r=t.pt,n=t.prev):(r=(t=t.next).pt,n=t.next),s.push(r);n!==t;)n.pt!==r&&(r=n.pt,s.push(r)),n=e?n.prev:n.next;return!(3===s.length&&this.isVerySmallTriangle(n))}buildPaths(t,e){t.length=0,e.length=0;let i=0;for(;ie.right&&(e.right=i.x),i.ye.bottom&&(e.bottom=i.y);return e}checkBounds(t){return void 0!==t.pts&&(!t.bounds.isEmpty()||(this.cleanCollinear(t),!!(void 0!==t.pts&&J.buildPath(t.pts,this.reverseSolution,!1,t.path))&&(t.bounds=J.getBoundsPath(t.path),!0)))}checkSplitOwner(t,e){for(let i of e){let e=J.getRealOutRec(this._outrecList[i]);if(void 0!==e&&e!==t&&e.recursiveSplit!==t){if(e.recursiveSplit=t,void 0!==e.splits&&this.checkSplitOwner(t,e.splits))return!0;if(J.isValidOwner(t,e)&&this.checkBounds(e)&&e.bounds.containsRect(t.bounds)&&J.path1InsidePath2(t.pts,e.pts))return t.owner=e,!0}}return!1}recursiveCheckOwners(t,e){if(!(void 0!==t.polypath||t.bounds.isEmpty())){for(;void 0!==t.owner&&!(void 0!==t.owner.splits&&this.checkSplitOwner(t,t.owner.splits))&&!(void 0!==t.owner.pts&&this.checkBounds(t.owner)&&J.path1InsidePath2(t.pts,t.owner.pts));)t.owner=t.owner.owner;void 0!==t.owner?(void 0===t.owner.polypath&&this.recursiveCheckOwners(t.owner,e),t.polypath=t.owner.polypath.addChild(t.path)):t.polypath=e.addChild(t.path)}}buildTree(t,e){t.clear(),e.length=0;let i=0;for(;it.right&&(t.right=i.pt.x),i.pt.yt.bottom&&(t.bottom=i.pt.y),i=i.next;while(i!==e)}return t.isEmpty()?new G(0,0,0,0):t}}class U extends J{addPath(t,e,i=!1){super.addPath(t,e,i)}addReusableData(t){super.addReuseableData(t)}addPaths(t,e,i=!1){super.addPaths(t,e,i)}addSubjectPaths(t){this.addPaths(t,P.Subject)}addOpenSubjectPaths(t){this.addPaths(t,P.Subject,!0)}addClipPaths(t){this.addPaths(t,P.Clip)}execute(t,e,i,s=new Z){i.length=0,s.length=0;try{this.executeInternal(t,e),this.buildPaths(i,s)}catch(t){this._succeeded=!1}return this.clearSolutionOnly(),this._succeeded}executePolyTree(t,e,i,s=new Z){i.clear(),s.length=0,this._using_polytree=!0;try{this.executeInternal(t,e),this.buildTree(i,s)}catch(t){this._succeeded=!1}return this.clearSolutionOnly(),this._succeeded}}(l=v||(v={}))[l.None=0]="None",l[l.Intersection=1]="Intersection",l[l.Union=2]="Union",l[l.Difference=3]="Difference",l[l.Xor=4]="Xor",(a=P||(P={}))[a.Subject=0]="Subject",a[a.Clip=1]="Clip",(h=w||(w={}))[h.EvenOdd=0]="EvenOdd",h[h.NonZero=1]="NonZero",h[h.Positive=2]="Positive",h[h.Negative=3]="Negative",(p=L||(L={}))[p.Inside=0]="Inside",p[p.Outside=1]="Outside",p[p.OnEdge=2]="OnEdge";class W extends Array{}class Z extends Array{}class G{constructor(t,e,i,s){"boolean"==typeof t?t?(this.left=0,this.top=0,this.right=0,this.bottom=0):(this.left=Number.MAX_SAFE_INTEGER,this.top=Number.MAX_SAFE_INTEGER,this.right=Number.MIN_SAFE_INTEGER,this.bottom=Number.MIN_SAFE_INTEGER):"number"==typeof t?(this.left=t,this.top=e,this.right=i,this.bottom=s):(this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom)}get width(){return this.right-this.left}set width(t){this.right=this.left+t}get height(){return this.bottom-this.top}set height(t){this.bottom=this.top+t}isEmpty(){return this.bottom<=this.top||this.right<=this.left}midPoint(){return new Y((this.left+this.right)/2,(this.top+this.bottom)/2)}contains(t){return t.x>this.left&&t.xthis.top&&t.y=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom}intersects(t){return Math.max(this.left,t.left)<=Math.min(this.right,t.right)&&Math.max(this.top,t.top)<=Math.min(this.bottom,t.bottom)}asPath(){let t=new W;return t.push(new Y(this.left,this.top)),t.push(new Y(this.right,this.top)),t.push(new Y(this.right,this.bottom)),t.push(new Y(this.left,this.bottom)),t}}class Y{constructor(t,e){"number"==typeof t&&"number"==typeof e?(this.x=Math.round(t),this.y=Math.round(e)):void 0!==e?(this.x=Math.round(t.x*e),this.y=Math.round(t.y*e)):(this.x=t.x,this.y=t.y)}static equals(t,e){return t.x===e.x&&t.y===e.y}static notEquals(t,e){return t.x!==e.x||t.y!==e.y}static add(t,e){return new Y(t.x+e.x,t.y+e.y)}static subtract(t,e){return new Y(t.x-e.x,t.y-e.y)}toString(){return`${this.x},${this.y} `}equals(t){return t instanceof Y&&Y.equals(this,t)}}class ${static checkPrecision(t){if(t<-8||t>8)throw Error(this.precision_range_error)}static isAlmostZero(t){return Math.abs(t)<=this.floatingPointTolerance}static crossProduct(t,e,i){return(e.x-t.x)*(i.y-e.y)-(e.y-t.y)*(i.x-e.x)}static dotProduct(t,e,i){return(e.x-t.x)*(i.x-e.x)+(e.y-t.y)*(i.y-e.y)}static checkCastInt64(t){return t>=this.max_coord||t<=this.min_coord?this.Invalid64:Math.round(t)}static getIntersectPt(t,e,i,s){let r=e.y-t.y,n=e.x-t.x,o=s.y-i.y,l=s.x-i.x,a=r*l-o*n;if(0===a)return{ip:new Y(0,0),success:!1};let h=((t.x-i.x)*o-(t.y-i.y)*l)/a;return{ip:h<=0?t:h>=1?e:new Y(t.x+h*n,t.y+h*r),success:!0}}static getIntersectPoint(t,e,i,s){let r=e.y-t.y,n=e.x-t.x,o=s.y-i.y,l=s.x-i.x,a=r*l-o*n;if(0===a)return{ip:new Y(0,0),success:!1};let h=((t.x-i.x)*o-(t.y-i.y)*l)/a;return{ip:h<=0?t:h>=1?i:new Y(t.x+h*n,t.y+h*r),success:!0}}static segsIntersect(t,e,i,s,r=!1){if(!r)return $.crossProduct(t,i,s)*$.crossProduct(e,i,s)<0&&$.crossProduct(i,t,e)*$.crossProduct(s,t,e)<0;{let r=$.crossProduct(t,i,s),n=$.crossProduct(e,i,s);if(r*n>0)return!1;let o=$.crossProduct(i,t,e),l=$.crossProduct(s,t,e);return!(o*l>0)&&(0!==r||0!==n||0!==o||0!==l)}}static getClosestPtOnSegment(t,e,i){if(e.x===i.x&&e.y===i.y)return e;let s=i.x-e.x,r=i.y-e.y,n=((t.x-e.x)*s+(t.y-e.y)*r)/(s*s+r*r);return n<0?n=0:n>1&&(n=1),new Y(e.x+Math.round(n*s),e.y+Math.round(n*r))}static pointInPolygon(t,e){let i=e.length,s=0;if(i<3)return f.IsOutside;for(;st.y;)a++;if(a===h)continue}let o=e[a],p=a>0?e[a-1]:e[i-1];if(o.y===t.y){if(o.x===t.x||o.y===p.y&&t.xp.x&&t.x>o.x)l=1-l;else{if(0===(r=$.crossProduct(p,o,t)))return f.IsOn;r<0===n&&(l=1-l)}n=!n,a++}if(n!==o){if(a===i?a=0:r=$.crossProduct(e[a-1],e[a],t),0===r)return f.IsOn;r<0===n&&(l=1-l)}return 0===l?f.IsOutside:f.IsInside}}function K(t,e){e.x=t.x,e.y=t.z}function Q(t,e){return 500>=Math.abs(t-e)}function tt(t,e){return Q(t.x,e.x)&&Q(t.y,e.y)&&Q(t.z,e.z)}function te(t,e){function i(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}let s=t.start,r=t.end,n=e.start,o=e.end;return i(s,n,o)!==i(r,n,o)&&i(s,r,n)!==i(s,r,o)}$.MaxInt64=0x7fffffffffffffff,$.MaxCoord=$.MaxInt64/4,$.max_coord=$.MaxCoord,$.min_coord=-$.MaxCoord,$.Invalid64=$.MaxInt64,$.defaultArcTolerance=.25,$.floatingPointTolerance=1e-12,$.defaultMinimumEdgeLength=.1,$.precision_range_error="Error: Precision is out of range.";var b=(_("e06gU"),_("e06gU"),_("e06gU"));function ti(t){let{index:e}=t,i=t.attributes.position;return e?e.count/3:i.count/3}let ts=new b.Triangle,tr=new b.Vector3(0,1,0),tn=new b.Triangle,to=new b.Vector3,tl=new b.Vector3,ta=new b.Vector3;function th(t,e){let i=t.map(t=>t.flatMap(t=>new b.Vector2(t.x/e,t.y/e))),s=i.filter(t=>(0,b.ShapeUtils).isClockWise(t)).map(t=>new b.Shape(t)),r=i.filter(t=>!(0,b.ShapeUtils).isClockWise(t)).map(t=>{let e=new b.Shape(t);return e.holes=s,e}),n=new(0,b.ShapeGeometry)(r).rotateX(Math.PI/2);return n.index.array.reverse(),n}function tp(t,e){let i=[];t.forEach(t=>{for(let s=0,r=t.length;s{let{signal:r}=e,n=this.generate(t,e);!function t(){r&&r.aborted&&s(Error("SilhouetteGenerator: Process aborted via AbortSignal."));let e=n.next();e.done?i(e.value):requestAnimationFrame(t)}()})}*generate(t,e={}){let{iterationTime:i,intScalar:s,doubleSided:r,output:n,sortTriangles:o}=this,{onProgress:l}=e,a=Math.log10(s),h=Math.pow(10,-(a-2)),p=t.index,c=t.attributes.position,u=ti(t),d=null,f=o?function(t){let e=t.index,i=t.attributes.position,s=ti(t);return Array(s).fill().map((t,s)=>{let r=3*s+0,n=3*s+1,o=3*s+2;return e&&(r=e.getX(r),n=e.getX(n),o=e.getX(o)),ts.a.fromBufferAttribute(i,r),ts.b.fromBufferAttribute(i,n),ts.c.fromBufferAttribute(i,o),ts.a.y=0,ts.b.y=0,ts.c.y=0,{area:ts.getArea(),index:s}}).sort((t,e)=>e.area-t.area).map(t=>t.index)}(t):Array(u).fill().map((t,e)=>e),x={getGeometry:()=>0===n?th(d,s):1===n?tp(d,s):[th(d,s),tp(d,s)]},g=performance.now();for(let t=0;tto.dot(tr))||(y.y=0,v.y=0,P.y=0,1e-8>tn.getArea()))continue;tl.copy(y).add(v).add(P).multiplyScalar(1/3),ta.subVectors(y,tl).normalize(),y.addScaledVector(ta,h),ta.subVectors(v,tl).normalize(),v.addScaledVector(ta,h),ta.subVectors(P,tl).normalize(),P.addScaledVector(ta,h);let L=new W;if(L.push(R.makePath([y.x*s,y.z*s,v.x*s,v.z*s,P.x*s,P.z*s])),y.multiplyScalar(s),v.multiplyScalar(s),P.multiplyScalar(s),d&&function(t,e){let i=["a","b","c"],s=[new b.Line3,new b.Line3,new b.Line3],r=new b.Line3,n=new b.Line3;n.start.set(0,0,0).addScaledVector(t.a,1/3).addScaledVector(t.b,1/3).addScaledVector(t.c,1/3),K(n.start,n.start),n.end.copy(n.start),n.end.y+=1e10;for(let e=0;e<3;e++){let r=(e+1)%3,n=t[i[e]],o=t[i[r]],l=s[e];K(n,l.start),K(o,l.end)}let o=0;for(let t=0,i=e.length;t(function(t){for(let i=0;ir&&(e=t[r],s.x===e.x&&s.y===e.y||function(t,e){let i=e.x-t.x,s=e.y-t.y;return 100>Math.sqrt(i*i+s*s)}(s,t[r])))t.splice(r,1);else break}for(;;){let e=i+1,r=i+2;if(t.length>r&&function(t,e,i){let s=e.x-t.x,r=e.y-t.y,n=i.x-e.x,o=i.y-e.y;return .001>Math.abs(s/r-n/o)}(s,t[e],t[r]))t.splice(i+1,1);else break}}})(t));let m=performance.now()-g;if(m>i){if(l){let e=t/u;l(e,x)}yield,g=performance.now()}}return x.getGeometry()}}onmessage=function({data:t}){let e=performance.now();try{let i,s;let{index:r,position:n,options:o}=t,l=new b.BufferGeometry;l.setIndex(new b.BufferAttribute(r,1,!1)),l.setAttribute("position",new b.BufferAttribute(n,3,!1));let a=new tc;a.doubleSided=o.doubleSided??a.doubleSided,a.output=o.output??a.output,a.intScalar=o.intScalar??a.intScalar,a.sortTriangles=o.sortTriangles??a.sortTriangles;let h=a.generate(l,{onProgress:function(t){let i=performance.now();(i-e>=10||1===t)&&(postMessage({error:null,progress:t}),e=i)}}),p=h.next();for(;!p.done;)p=h.next();if(2===a.output)i=[],s=[],p.value.forEach(t=>{console.log(t);let e=t.attributes.position.array,r=t.index?.array||null;s.push({position:e,index:r}),i.push(e.buffer,r?.buffer)});else{let t=p.value.attributes.position.array,e=p.value.index.array;s={position:t,index:e},i=[t.buffer,e.buffer]}postMessage({result:s,error:null,progress:1},i.filter(t=>!!t))}catch(t){postMessage({error:t,progress:1})}}})(); +//# sourceMappingURL=silhouetteAsync.worker.f555f2b4.js.map diff --git a/example/bundle/silhouetteAsync.worker.f555f2b4.js.map b/example/bundle/silhouetteAsync.worker.f555f2b4.js.map new file mode 100644 index 0000000..a0c5adc --- /dev/null +++ b/example/bundle/silhouetteAsync.worker.f555f2b4.js.map @@ -0,0 +1 @@ +{"mappings":"A,C,K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AAa,IAAb,CAAa,IAE9C,YAAa,CAEZ,MAAO,KACP,SAAA,CAED,GACA,EAAW,EAIb,CAgBC,GAEI,EAAS,EAAK,IAAlB,GACA,KAAQ,CAAE,EAAO,IAAA,EAEhB,EAAS,EAAK,IAFf,GAOA,GAAK,ACuBoB,IDvBpB,EAAU,MAAA,CAEd,EAAU,EAAE,CACZ,EAAS,EAAE,CACX,EAAO,KAAA,CAAM,OAAA,CAAS,AAAA,IAErB,QAAQ,GAAA,CAAK,GACb,IAAM,EAAS,EAAE,UAAA,CAAW,QAAA,CAAS,KAArC,CACM,EAAW,EAAE,KAAA,EAAO,OAAS,KACnC,EAAO,IAAA,CAAM,CACZ,SAAU,EACV,MAAO,CACR,GACA,EAAQ,IAAA,CACP,EAAO,MAAA,CACP,GAAU,OAGZ,OAEM,CAEN,IAAM,EAAS,EAAO,KAAA,CAAM,UAAA,CAAW,QAAA,CAAS,KAAhD,CACM,EAAW,EAAO,KAAA,CAAM,KAAA,CAAM,KAApC,CACA,EAAS,CACR,SAAU,EACV,MAAO,CACR,EACA,EAAU,CAAE,EAAO,MAAP,CAAe,EAAS,MAAT,CAAiB,AAE7C,CAEA,YAAa,CAEZ,OAAQ,EACR,MAAO,KACP,SAAU,CAEX,EAAG,EAAQ,MAAA,CAAQ,AAAA,GAAK,CAAE,CAAE,GAE7B,CAAE,MAAQ,EAAQ,CAEjB,YAAa,CAEZ,MAAA,EACA,SAAU,CAEX,EAED,CAED,C,C","sources":["","src/worker/silhouetteAsync.worker.js","src/SilhouetteGenerator.js","node_modules/clipper2-js/fesm2015/clipper2-js.mjs","projects/clipper2-js/src/lib/minkowski.ts","projects/clipper2-js/src/lib/offset.ts","projects/clipper2-js/src/lib/rectclip.ts","projects/clipper2-js/src/lib/clipper.ts","projects/clipper2-js/src/lib/engine.ts","projects/clipper2-js/src/lib/core.ts","projects/clipper2-js/src/public-api.ts","projects/clipper2-js/src/clipper2-js.ts","src/utils/compressPoints.js","src/utils/triangleIsInsidePaths.js","src/utils/getSizeSortedTriList.js","src/utils/geometryUtils.js"],"sourcesContent":["(() => {\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nimportScripts(\"./projectionAsync.worker.15f44cdc.js\");\nvar $9cb1892ec9b43230$exports = {};\n\nvar $e06gU = parcelRequire(\"e06gU\");\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $0b6dbf71c0c0eea1$export$d7b4df78e16216b1 {\n static minkowskiInternal(pattern, path, isSum, isClosed) {\n const delta = isClosed ? 0 : 1;\n const patLen = pattern.length;\n const pathLen = path.length;\n const tmp = [];\n for (const pathPt of path){\n const path2 = [];\n if (isSum) for (const basePt of pattern)path2.push({\n x: pathPt.x + basePt.x,\n y: pathPt.y + basePt.y\n });\n else for (const basePt of pattern)path2.push({\n x: pathPt.x - basePt.x,\n y: pathPt.y - basePt.y\n });\n tmp.push(path2);\n }\n const result = [];\n let g = isClosed ? pathLen - 1 : 0;\n let h = patLen - 1;\n for(let i = delta; i < pathLen; i++){\n for(let j = 0; j < patLen; j++){\n const quad = [\n tmp[g][h],\n tmp[i][h],\n tmp[i][j],\n tmp[g][j]\n ];\n if (!$0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.isPositive(quad)) result.push($0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.reversePath(quad));\n else result.push(quad);\n h = j;\n }\n g = i;\n }\n return result;\n }\n static sum(pattern, path, isClosed) {\n return $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.NonZero);\n }\n static diff(pattern, path, isClosed) {\n return $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.NonZero);\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nvar $0b6dbf71c0c0eea1$export$738d8b3921c27063;\n(function(JoinType) {\n JoinType[JoinType[\"Square\"] = 0] = \"Square\";\n JoinType[JoinType[\"Round\"] = 1] = \"Round\";\n JoinType[JoinType[\"Miter\"] = 2] = \"Miter\";\n})($0b6dbf71c0c0eea1$export$738d8b3921c27063 || ($0b6dbf71c0c0eea1$export$738d8b3921c27063 = {}));\nvar $0b6dbf71c0c0eea1$export$38f58f6965412d86;\n(function(EndType) {\n EndType[EndType[\"Polygon\"] = 0] = \"Polygon\";\n EndType[EndType[\"Joined\"] = 1] = \"Joined\";\n EndType[EndType[\"Butt\"] = 2] = \"Butt\";\n EndType[EndType[\"Square\"] = 3] = \"Square\";\n EndType[EndType[\"Round\"] = 4] = \"Round\";\n})($0b6dbf71c0c0eea1$export$38f58f6965412d86 || ($0b6dbf71c0c0eea1$export$38f58f6965412d86 = {}));\nclass $0b6dbf71c0c0eea1$var$Group {\n constructor(paths, joinType, endType = $0b6dbf71c0c0eea1$export$38f58f6965412d86.Polygon){\n this.inPaths = [\n ...paths\n ]; // creates a shallow copy of paths\n this.joinType = joinType;\n this.endType = endType;\n this.outPath = [];\n this.outPaths = [];\n this.pathsReversed = false;\n }\n}\nclass $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad {\n constructor(xOrPt, yOrScale){\n if (typeof xOrPt === \"number\" && typeof yOrScale === \"number\") {\n this.x = xOrPt;\n this.y = yOrScale;\n } else if (xOrPt instanceof $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad) {\n if (yOrScale !== undefined) {\n this.x = xOrPt.x * yOrScale;\n this.y = xOrPt.y * yOrScale;\n } else {\n this.x = xOrPt.x;\n this.y = xOrPt.y;\n }\n } else {\n this.x = xOrPt.x * (yOrScale || 1);\n this.y = xOrPt.y * (yOrScale || 1);\n }\n }\n toString(precision = 2) {\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\n }\n static equals(lhs, rhs) {\n return $0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(lhs.x - rhs.x) && $0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(lhs.y - rhs.y);\n }\n static notEquals(lhs, rhs) {\n return !$0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(lhs.x - rhs.x) || !$0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(lhs.y - rhs.y);\n }\n equals(obj) {\n if (obj instanceof $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad) return $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad.equals(this, obj);\n return false;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n }\n}\nclass $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24 {\n constructor(miterLimit = 2.0, arcTolerance = 0.0, preserveCollinear = false, reverseSolution = false){\n this._groupList = [];\n this._normals = [];\n this._solution = [];\n this.MiterLimit = miterLimit;\n this.ArcTolerance = arcTolerance;\n this.MergeGroups = true;\n this.PreserveCollinear = preserveCollinear;\n this.ReverseSolution = reverseSolution;\n }\n clear() {\n this._groupList = [];\n }\n addPath(path, joinType, endType) {\n if (path.length === 0) return;\n const pp = [\n path\n ];\n this.addPaths(pp, joinType, endType);\n }\n addPaths(paths, joinType, endType) {\n if (paths.length === 0) return;\n this._groupList.push(new $0b6dbf71c0c0eea1$var$Group(paths, joinType, endType));\n }\n executeInternal(delta) {\n this._solution = [];\n if (this._groupList.length === 0) return;\n if (Math.abs(delta) < 0.5) {\n for (const group of this._groupList)for (const path of group.inPaths)this._solution.push(path);\n } else {\n this._delta = delta;\n this._mitLimSqr = this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit);\n for (const group of this._groupList)this.doGroupOffset(group);\n }\n }\n sqr(value) {\n return value * value;\n }\n execute(delta, solution) {\n solution.length = 0;\n this.executeInternal(delta);\n if (this._groupList.length === 0) return;\n // clean up self-intersections ...\n const c = new $0b6dbf71c0c0eea1$export$389255fe4ace408b();\n c.preserveCollinear = this.PreserveCollinear;\n // the solution should retain the orientation of the input\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\n c.addSubjectPaths(this._solution);\n if (this._groupList[0].pathsReversed) c.execute($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative, solution);\n else c.execute($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive, solution);\n }\n executePolytree(delta, polytree) {\n polytree.clear();\n this.executeInternal(delta);\n if (this._groupList.length === 0) return;\n // clean up self-intersections ...\n const c = new $0b6dbf71c0c0eea1$export$389255fe4ace408b();\n c.preserveCollinear = this.PreserveCollinear;\n // the solution should retain the orientation of the input\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\n c.addSubjectPaths(this._solution);\n if (this._groupList[0].pathsReversed) c.executePolyTree($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative, polytree);\n else c.executePolyTree($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive, polytree);\n }\n static getUnitNormal(pt1, pt2) {\n let dx = pt2.x - pt1.x;\n let dy = pt2.y - pt1.y;\n if (dx === 0 && dy === 0) return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(0, 0);\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\n dx *= f;\n dy *= f;\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(dy, -dx);\n }\n executeCallback(deltaCallback, solution) {\n this.DeltaCallback = deltaCallback;\n this.execute(1.0, solution);\n }\n static getBoundsAndLowestPolyIdx(paths) {\n const rec = new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(false); // ie invalid rect\n let lpX = Number.MIN_SAFE_INTEGER;\n let index = -1;\n for(let i = 0; i < paths.length; i++)for (const pt of paths[i]){\n if (pt.y >= rec.bottom) {\n if (pt.y > rec.bottom || pt.x < lpX) {\n index = i;\n lpX = pt.x;\n rec.bottom = pt.y;\n }\n } else if (pt.y < rec.top) rec.top = pt.y;\n if (pt.x > rec.right) rec.right = pt.x;\n else if (pt.x < rec.left) rec.left = pt.x;\n }\n return {\n index: index,\n rec: rec\n };\n }\n static translatePoint(pt, dx, dy) {\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pt.x + dx, pt.y + dy);\n }\n static reflectPoint(pt, pivot) {\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\n }\n static almostZero(value, epsilon = 0.001) {\n return Math.abs(value) < epsilon;\n }\n static hypotenuse(x, y) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n }\n static normalizeVector(vec) {\n const h = this.hypotenuse(vec.x, vec.y);\n if (this.almostZero(h)) return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(0, 0);\n const inverseHypot = 1 / h;\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(vec.x * inverseHypot, vec.y * inverseHypot);\n }\n static getAvgUnitVector(vec1, vec2) {\n return this.normalizeVector(new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(vec1.x + vec2.x, vec1.y + vec2.y));\n }\n static intersectPoint(pt1a, pt1b, pt2a, pt2b) {\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(pt1a.x - pt1b.x)) {\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(pt2a.x - pt2b.x)) return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(0, 0);\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\n const b2 = pt2a.y - m2 * pt2a.x;\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pt1a.x, m2 * pt1a.x + b2);\n }\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(pt2a.x - pt2b.x)) {\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\n const b1 = pt1a.y - m1 * pt1a.x;\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pt2a.x, m1 * pt2a.x + b1);\n } else {\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\n const b1 = pt1a.y - m1 * pt1a.x;\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\n const b2 = pt2a.y - m2 * pt2a.x;\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(m1 - m2)) return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(0, 0);\n const x = (b2 - b1) / (m1 - m2);\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(x, m1 * x + b1);\n }\n }\n getPerpendic(pt, norm) {\n return new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\n }\n getPerpendicD(pt, norm) {\n return new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\n }\n doSquare(group, path, j, k) {\n let vec;\n if (j === k) vec = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(this._normals[j].y, -this._normals[j].x);\n else vec = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.getAvgUnitVector(new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(-this._normals[k].y, this._normals[k].x), new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(this._normals[j].y, -this._normals[j].x));\n const absDelta = Math.abs(this._groupDelta);\n // now offset the original vertex delta units along unit vector\n let ptQ = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(path[j].x, path[j].y);\n ptQ = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\n // get perpendicular vertices\n const pt1 = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\n const pt2 = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\n // get 2 vertices along one edge offset\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\n if (j === k) {\n const pt4 = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\n const pt = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.intersectPoint(pt1, pt2, pt3, pt4);\n //get the second intersect point through reflection\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f($0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).x, $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).y));\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x, pt.y));\n } else {\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\n const pt = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.intersectPoint(pt1, pt2, pt3, pt4);\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x, pt.y));\n //get the second intersect point through reflection\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f($0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).x, $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).y));\n }\n }\n doMiter(group, path, j, k, cosA) {\n const q = this._groupDelta / (cosA + 1);\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(path[j].x + (this._normals[k].x + this._normals[j].x) * q, path[j].y + (this._normals[k].y + this._normals[j].y) * q));\n }\n doRound(group, path, j, k, angle) {\n if (typeof this.DeltaCallback !== \"undefined\") {\n const absDelta = Math.abs(this._groupDelta);\n const arcTol = this.ArcTolerance > 0.01 ? this.ArcTolerance : Math.log10(2 + absDelta) * $0b6dbf71c0c0eea1$export$9bad362b29d84293.defaultArcTolerance;\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\n this._stepSin = Math.sin(2 * Math.PI / stepsPer360);\n this._stepCos = Math.cos(2 * Math.PI / stepsPer360);\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\n }\n const pt = path[j];\n let offsetVec = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\n if (j === k) offsetVec.negate();\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x + offsetVec.x, pt.y + offsetVec.y));\n if (angle > -Math.PI + 0.01) {\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\n for(let i = 1; i < steps; i++){\n offsetVec = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(offsetVec.x * this._stepCos - this._stepSin * offsetVec.y, offsetVec.x * this._stepSin + offsetVec.y * this._stepCos);\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x + offsetVec.x, pt.y + offsetVec.y));\n }\n }\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\n }\n buildNormals(path) {\n const cnt = path.length;\n this._normals = [];\n this._normals.length = cnt;\n for(let i = 0; i < cnt - 1; i++)this._normals.push($0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.getUnitNormal(path[i], path[i + 1]));\n this._normals.push($0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.getUnitNormal(path[cnt - 1], path[0]));\n }\n crossProduct(vec1, vec2) {\n return vec1.y * vec2.x - vec2.y * vec1.x;\n }\n dotProduct(vec1, vec2) {\n return vec1.x * vec2.x + vec1.y * vec2.y;\n }\n offsetPoint(group, path, j, k) {\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\n if (sinA > 1.0) cosA = 1.0;\n else if (sinA < -1) cosA = -1;\n if (typeof this.DeltaCallback !== \"undefined\") {\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\n if (group.pathsReversed) this._groupDelta = -this._groupDelta;\n }\n if (Math.abs(this._groupDelta) < $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.Tolerance) {\n group.outPath.push(path[j]);\n return;\n }\n if (cosA > 0.999) this.doMiter(group, path, j, k, cosA);\n else if (cosA > -0.99 && sinA * this._groupDelta < 0) {\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\n group.outPath.push(path[j]);\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\n } else if (this._joinType === $0b6dbf71c0c0eea1$export$738d8b3921c27063.Miter) {\n if (cosA > this._mitLimSqr - 1) this.doMiter(group, path, j, k, cosA);\n else this.doSquare(group, path, j, k);\n } else if (cosA > 0.99 || this._joinType === $0b6dbf71c0c0eea1$export$738d8b3921c27063.Square) this.doSquare(group, path, j, k);\n else this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\n k = j;\n }\n offsetPolygon(group, path) {\n const area = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.area(path);\n if (area < 0 !== this._groupDelta < 0) {\n const rect = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.getBounds(path);\n if (Math.abs(this._groupDelta) * 2 > rect.width) return;\n }\n group.outPath = [];\n const cnt = path.length;\n const prev = cnt - 1;\n for(let i = 0; i < cnt; i++)this.offsetPoint(group, path, i, prev);\n group.outPaths.push(group.outPath);\n }\n offsetOpenJoined(group, path) {\n this.offsetPolygon(group, path);\n path = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.reversePath(path);\n this.buildNormals(path);\n this.offsetPolygon(group, path);\n }\n offsetOpenPath(group, path) {\n group.outPath = [];\n const highI = path.length - 1;\n if (typeof this.DeltaCallback !== \"undefined\") this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\n if (Math.abs(this._groupDelta) < $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.Tolerance) group.outPath.push(path[0]);\n else switch(this._endType){\n case $0b6dbf71c0c0eea1$export$38f58f6965412d86.Butt:\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(path[0].x - this._normals[0].x * this._groupDelta, path[0].y - this._normals[0].y * this._groupDelta));\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\n break;\n case $0b6dbf71c0c0eea1$export$38f58f6965412d86.Round:\n this.doRound(group, path, 0, 0, Math.PI);\n break;\n default:\n this.doSquare(group, path, 0, 0);\n break;\n }\n for(let i = 1, k = 0; i < highI; i++)this.offsetPoint(group, path, i, k);\n for(let i = highI; i > 0; i--)this._normals[i] = new $0b6dbf71c0c0eea1$export$f7b22d527d83f4ad(-this._normals[i - 1].x, -this._normals[i - 1].y);\n this._normals[0] = this._normals[highI];\n if (typeof this.DeltaCallback !== \"undefined\") this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\n if (Math.abs(this._groupDelta) < $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.Tolerance) group.outPath.push(path[highI]);\n else switch(this._endType){\n case $0b6dbf71c0c0eea1$export$38f58f6965412d86.Butt:\n group.outPath.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(path[highI].x - this._normals[highI].x * this._groupDelta, path[highI].y - this._normals[highI].y * this._groupDelta));\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\n break;\n case $0b6dbf71c0c0eea1$export$38f58f6965412d86.Round:\n this.doRound(group, path, highI, highI, Math.PI);\n break;\n default:\n this.doSquare(group, path, highI, highI);\n break;\n }\n for(let i = highI, k = 0; i > 0; i--)this.offsetPoint(group, path, i, k);\n group.outPaths.push(group.outPath);\n }\n doGroupOffset(group) {\n if (group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Polygon) {\n const { index: index } = $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.getBoundsAndLowestPolyIdx(group.inPaths);\n if (index < 0) return;\n const area = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.area(group.inPaths[index]);\n group.pathsReversed = area < 0;\n if (group.pathsReversed) this._groupDelta = -this._delta;\n else this._groupDelta = this._delta;\n } else {\n group.pathsReversed = false;\n this._groupDelta = Math.abs(this._delta) * 0.5;\n }\n const absDelta = Math.abs(this._groupDelta);\n this._joinType = group.joinType;\n this._endType = group.endType;\n if (!this.DeltaCallback && (group.joinType == $0b6dbf71c0c0eea1$export$738d8b3921c27063.Round || group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Round)) {\n const arcTol = this.ArcTolerance > 0.01 ? this.ArcTolerance : Math.log10(2 + absDelta) * $0b6dbf71c0c0eea1$export$9bad362b29d84293.defaultArcTolerance;\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\n this._stepSin = Math.sin(2 * Math.PI / stepsPer360);\n this._stepCos = Math.cos(2 * Math.PI / stepsPer360);\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\n }\n const isJoined = group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Joined || group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Polygon;\n for (const p of group.inPaths){\n const path = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.stripDuplicates(p, isJoined);\n const cnt = path.length;\n if (cnt === 0 || cnt < 3 && this._endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Polygon) continue;\n if (cnt == 1) {\n group.outPath = [];\n if (group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Round) {\n const r = absDelta;\n group.outPath = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.ellipse(path[0], r, r);\n } else {\n const d = Math.ceil(this._groupDelta);\n const r = new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\n group.outPath = r.asPath();\n }\n group.outPaths.push(group.outPath);\n } else {\n if (cnt == 2 && group.endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Joined) {\n if (group.joinType == $0b6dbf71c0c0eea1$export$738d8b3921c27063.Round) this._endType = $0b6dbf71c0c0eea1$export$38f58f6965412d86.Round;\n else this._endType = $0b6dbf71c0c0eea1$export$38f58f6965412d86.Square;\n }\n this.buildNormals(path);\n if (this._endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Polygon) this.offsetPolygon(group, path);\n else if (this._endType == $0b6dbf71c0c0eea1$export$38f58f6965412d86.Joined) this.offsetOpenJoined(group, path);\n else this.offsetOpenPath(group, path);\n }\n }\n this._solution.push(...group.outPaths);\n group.outPaths = [];\n }\n}\n$0b6dbf71c0c0eea1$export$8cbc02e4273c0b24.Tolerance = 1.0E-12;\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $0b6dbf71c0c0eea1$export$a6dea2fac1e0b407 {\n constructor(pt){\n this.pt = pt;\n this.ownerIdx = 0;\n }\n}\nvar $0b6dbf71c0c0eea1$var$Location;\n(function(Location) {\n Location[Location[\"left\"] = 0] = \"left\";\n Location[Location[\"top\"] = 1] = \"top\";\n Location[Location[\"right\"] = 2] = \"right\";\n Location[Location[\"bottom\"] = 3] = \"bottom\";\n Location[Location[\"inside\"] = 4] = \"inside\";\n})($0b6dbf71c0c0eea1$var$Location || ($0b6dbf71c0c0eea1$var$Location = {}));\nclass $0b6dbf71c0c0eea1$export$ada4127871f05d7b {\n constructor(rect){\n this.currIdx = -1;\n this.rect = rect;\n this.mp = rect.midPoint();\n this.rectPath = rect.asPath();\n this.results = [];\n this.edges = Array(8).fill(undefined).map(()=>[]);\n }\n add(pt, startingNewPath = false) {\n let currIdx = this.results.length;\n let result;\n if (currIdx === 0 || startingNewPath) {\n result = new $0b6dbf71c0c0eea1$export$a6dea2fac1e0b407(pt);\n this.results.push(result);\n result.ownerIdx = currIdx;\n result.prev = result;\n result.next = result;\n } else {\n currIdx--;\n const prevOp = this.results[currIdx];\n if (prevOp.pt === pt) return prevOp;\n result = new $0b6dbf71c0c0eea1$export$a6dea2fac1e0b407(pt);\n result.ownerIdx = currIdx;\n result.next = prevOp.next;\n prevOp.next.prev = result;\n prevOp.next = result;\n result.prev = prevOp;\n this.results[currIdx] = result;\n }\n return result;\n }\n static path1ContainsPath2(path1, path2) {\n let ioCount = 0;\n for (const pt of path2){\n const pip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.pointInPolygon(pt, path1);\n switch(pip){\n case $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsInside:\n ioCount--;\n break;\n case $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside:\n ioCount++;\n break;\n }\n if (Math.abs(ioCount) > 1) break;\n }\n return ioCount <= 0;\n }\n static isClockwise(prev, curr, prevPt, currPt, rectMidPoint) {\n if (this.areOpposites(prev, curr)) return $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(prevPt, rectMidPoint, currPt) < 0;\n else return this.headingClockwise(prev, curr);\n }\n static areOpposites(prev, curr) {\n return Math.abs(prev - curr) === 2;\n }\n static headingClockwise(prev, curr) {\n return (prev + 1) % 4 === curr;\n }\n static getAdjacentLocation(loc, isClockwise) {\n const delta = isClockwise ? 1 : 3;\n return (loc + delta) % 4;\n }\n static unlinkOp(op) {\n if (op.next === op) return undefined;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return op.next;\n }\n static unlinkOpBack(op) {\n if (op.next === op) return undefined;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return op.prev;\n }\n static getEdgesForPt(pt, rec) {\n let result = 0;\n if (pt.x === rec.left) result = 1;\n else if (pt.x === rec.right) result = 4;\n if (pt.y === rec.top) result += 2;\n else if (pt.y === rec.bottom) result += 8;\n return result;\n }\n static isHeadingClockwise(pt1, pt2, edgeIdx) {\n switch(edgeIdx){\n case 0:\n return pt2.y < pt1.y;\n case 1:\n return pt2.x > pt1.x;\n case 2:\n return pt2.y > pt1.y;\n default:\n return pt2.x < pt1.x;\n }\n }\n static hasHorzOverlap(left1, right1, left2, right2) {\n return left1.x < right2.x && right1.x > left2.x;\n }\n static hasVertOverlap(top1, bottom1, top2, bottom2) {\n return top1.y < bottom2.y && bottom1.y > top2.y;\n }\n static addToEdge(edge, op) {\n if (op.edge) return;\n op.edge = edge;\n edge.push(op);\n }\n static uncoupleEdge(op) {\n if (!op.edge) return;\n for(let i = 0; i < op.edge.length; i++){\n const op2 = op.edge[i];\n if (op2 === op) {\n op.edge[i] = undefined;\n break;\n }\n }\n op.edge = undefined;\n }\n static setNewOwner(op, newIdx) {\n op.ownerIdx = newIdx;\n let op2 = op.next;\n while(op2 !== op){\n op2.ownerIdx = newIdx;\n op2 = op2.next;\n }\n }\n addCorner(prev, curr) {\n if ($0b6dbf71c0c0eea1$export$ada4127871f05d7b.headingClockwise(prev, curr)) this.add(this.rectPath[prev]);\n else this.add(this.rectPath[curr]);\n }\n addCornerByRef(loc, isClockwise) {\n if (isClockwise) {\n this.add(this.rectPath[loc]);\n loc = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getAdjacentLocation(loc, true);\n } else {\n loc = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getAdjacentLocation(loc, false);\n this.add(this.rectPath[loc]);\n }\n }\n static getLocation(rec, pt) {\n let loc;\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\n loc = $0b6dbf71c0c0eea1$var$Location.left; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\n loc = $0b6dbf71c0c0eea1$var$Location.right; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\n loc = $0b6dbf71c0c0eea1$var$Location.top; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\n loc = $0b6dbf71c0c0eea1$var$Location.bottom; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.x < rec.left) loc = $0b6dbf71c0c0eea1$var$Location.left;\n else if (pt.x > rec.right) loc = $0b6dbf71c0c0eea1$var$Location.right;\n else if (pt.y < rec.top) loc = $0b6dbf71c0c0eea1$var$Location.top;\n else if (pt.y > rec.bottom) loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n else loc = $0b6dbf71c0c0eea1$var$Location.inside;\n return {\n success: true,\n loc: loc\n };\n }\n static getIntersection(rectPath, p, p2, loc) {\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\n // when result == false, loc will remain unchanged\n let ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f();\n switch(loc){\n case $0b6dbf71c0c0eea1$var$Location.left:\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n else if (p.y < rectPath[0].y && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.top;\n } else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $0b6dbf71c0c0eea1$var$Location.right:\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n else if (p.y < rectPath[0].y && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.top;\n } else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $0b6dbf71c0c0eea1$var$Location.top:\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n else if (p.x < rectPath[0].x && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.left;\n } else if (p.x > rectPath[1].x && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.right;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $0b6dbf71c0c0eea1$var$Location.bottom:\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n else if (p.x < rectPath[3].x && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.left;\n } else if (p.x > rectPath[2].x && $0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.right;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $0b6dbf71c0c0eea1$var$Location.inside:\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.left;\n } else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.top;\n } else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.right;\n } else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n }\n return {\n success: true,\n loc: loc,\n ip: ip\n };\n }\n getNextLocation(path, context) {\n switch(context.loc){\n case $0b6dbf71c0c0eea1$var$Location.left:\n while(context.i <= context.highI && path[context.i].x <= this.rect.left)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].x >= this.rect.right) context.loc = $0b6dbf71c0c0eea1$var$Location.right;\n else if (path[context.i].y <= this.rect.top) context.loc = $0b6dbf71c0c0eea1$var$Location.top;\n else if (path[context.i].y >= this.rect.bottom) context.loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n else context.loc = $0b6dbf71c0c0eea1$var$Location.inside;\n break;\n case $0b6dbf71c0c0eea1$var$Location.top:\n while(context.i <= context.highI && path[context.i].y <= this.rect.top)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].y >= this.rect.bottom) context.loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n else if (path[context.i].x <= this.rect.left) context.loc = $0b6dbf71c0c0eea1$var$Location.left;\n else if (path[context.i].x >= this.rect.right) context.loc = $0b6dbf71c0c0eea1$var$Location.right;\n else context.loc = $0b6dbf71c0c0eea1$var$Location.inside;\n break;\n case $0b6dbf71c0c0eea1$var$Location.right:\n while(context.i <= context.highI && path[context.i].x >= this.rect.right)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].x <= this.rect.left) context.loc = $0b6dbf71c0c0eea1$var$Location.left;\n else if (path[context.i].y <= this.rect.top) context.loc = $0b6dbf71c0c0eea1$var$Location.top;\n else if (path[context.i].y >= this.rect.bottom) context.loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n else context.loc = $0b6dbf71c0c0eea1$var$Location.inside;\n break;\n case $0b6dbf71c0c0eea1$var$Location.bottom:\n while(context.i <= context.highI && path[context.i].y >= this.rect.bottom)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].y <= this.rect.top) context.loc = $0b6dbf71c0c0eea1$var$Location.top;\n else if (path[context.i].x <= this.rect.left) context.loc = $0b6dbf71c0c0eea1$var$Location.left;\n else if (path[context.i].x >= this.rect.right) context.loc = $0b6dbf71c0c0eea1$var$Location.right;\n else context.loc = $0b6dbf71c0c0eea1$var$Location.inside;\n break;\n case $0b6dbf71c0c0eea1$var$Location.inside:\n while(context.i <= context.highI){\n if (path[context.i].x < this.rect.left) context.loc = $0b6dbf71c0c0eea1$var$Location.left;\n else if (path[context.i].x > this.rect.right) context.loc = $0b6dbf71c0c0eea1$var$Location.right;\n else if (path[context.i].y > this.rect.bottom) context.loc = $0b6dbf71c0c0eea1$var$Location.bottom;\n else if (path[context.i].y < this.rect.top) context.loc = $0b6dbf71c0c0eea1$var$Location.top;\n else {\n this.add(path[context.i]);\n context.i++;\n continue;\n }\n break;\n }\n break;\n }\n }\n executeInternal(path) {\n if (path.length < 3 || this.rect.isEmpty()) return;\n const startLocs = [];\n let firstCross = $0b6dbf71c0c0eea1$var$Location.inside;\n let crossingLoc = firstCross, prev = firstCross;\n let i;\n const highI = path.length - 1;\n let result = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getLocation(this.rect, path[highI]);\n let loc = result.loc;\n if (!result.success) {\n i = highI - 1;\n while(i >= 0 && !result.success){\n i--;\n result = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getLocation(this.rect, path[i]);\n prev = result.loc;\n }\n if (i < 0) {\n for (const pt of path)this.add(pt);\n return;\n }\n if (prev == $0b6dbf71c0c0eea1$var$Location.inside) loc = $0b6dbf71c0c0eea1$var$Location.inside;\n }\n const startingLoc = loc;\n ///////////////////////////////////////////////////\n i = 0;\n while(i <= highI){\n prev = loc;\n const prevCrossLoc = crossingLoc;\n this.getNextLocation(path, {\n loc: loc,\n i: i,\n highI: highI\n });\n if (i > highI) break;\n const prevPt = i == 0 ? path[highI] : path[i - 1];\n crossingLoc = loc;\n let result = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\n const ip = result.ip;\n if (!result.success) {\n if (prevCrossLoc == $0b6dbf71c0c0eea1$var$Location.inside) {\n const isClockw = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.isClockwise(prev, loc, prevPt, path[i], this.mp);\n do {\n startLocs.push(prev);\n prev = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getAdjacentLocation(prev, isClockw);\n }while (prev != loc);\n crossingLoc = prevCrossLoc;\n } else if (prev != $0b6dbf71c0c0eea1$var$Location.inside && prev != loc) {\n const isClockw = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.isClockwise(prev, loc, prevPt, path[i], this.mp);\n do this.addCornerByRef(prev, isClockw);\n while (prev != loc);\n }\n ++i;\n continue;\n }\n ////////////////////////////////////////////////////\n // we must be crossing the rect boundary to get here\n ////////////////////////////////////////////////////\n if (loc == $0b6dbf71c0c0eea1$var$Location.inside) {\n if (firstCross == $0b6dbf71c0c0eea1$var$Location.inside) {\n firstCross = crossingLoc;\n startLocs.push(prev);\n } else if (prev != crossingLoc) {\n const isClockw = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\n do this.addCornerByRef(prev, isClockw);\n while (prev != crossingLoc);\n }\n } else if (prev != $0b6dbf71c0c0eea1$var$Location.inside) {\n // passing right through rect. 'ip' here will be the second\n // intersect pt but we'll also need the first intersect pt (ip2)\n loc = prev;\n result = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getIntersection(this.rectPath, prevPt, path[i], loc);\n const ip2 = result.ip;\n if (prevCrossLoc != $0b6dbf71c0c0eea1$var$Location.inside && prevCrossLoc != loc) this.addCorner(prevCrossLoc, loc);\n if (firstCross == $0b6dbf71c0c0eea1$var$Location.inside) {\n firstCross = loc;\n startLocs.push(prev);\n }\n loc = crossingLoc;\n this.add(ip2);\n if (ip == ip2) {\n loc = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getLocation(this.rect, path[i]).loc;\n this.addCorner(crossingLoc, loc);\n crossingLoc = loc;\n continue;\n }\n } else {\n loc = crossingLoc;\n if (firstCross == $0b6dbf71c0c0eea1$var$Location.inside) firstCross = crossingLoc;\n }\n this.add(ip);\n } //while i <= highI\n ///////////////////////////////////////////////////\n if (firstCross == $0b6dbf71c0c0eea1$var$Location.inside) {\n if (startingLoc != $0b6dbf71c0c0eea1$var$Location.inside) {\n if (this.pathBounds.containsRect(this.rect) && $0b6dbf71c0c0eea1$export$ada4127871f05d7b.path1ContainsPath2(path, this.rectPath)) for(let j = 0; j < 4; j++){\n this.add(this.rectPath[j]);\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.addToEdge(this.edges[j * 2], this.results[0]);\n }\n }\n } else if (loc != $0b6dbf71c0c0eea1$var$Location.inside && (loc != firstCross || startLocs.length > 2)) {\n if (startLocs.length > 0) {\n prev = loc;\n for (const loc2 of startLocs){\n if (prev == loc2) continue;\n this.addCornerByRef(prev, $0b6dbf71c0c0eea1$export$ada4127871f05d7b.headingClockwise(prev, loc2));\n prev = loc2;\n }\n loc = prev;\n }\n if (loc != firstCross) this.addCornerByRef(loc, $0b6dbf71c0c0eea1$export$ada4127871f05d7b.headingClockwise(loc, firstCross));\n }\n }\n execute(paths) {\n const result = [];\n if (this.rect.isEmpty()) return result;\n for (const path of paths){\n if (path.length < 3) continue;\n this.pathBounds = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.getBounds(path);\n if (!this.rect.intersects(this.pathBounds)) continue;\n else if (this.rect.containsRect(this.pathBounds)) {\n result.push(path);\n continue;\n }\n this.executeInternal(path);\n this.checkEdges();\n for(let i = 0; i < 4; ++i)this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\n for (const op of this.results){\n const tmp = this.getPath(op);\n if (tmp.length > 0) result.push(tmp);\n }\n this.results.length = 0;\n for(let i = 0; i < 8; i++)this.edges[i].length = 0;\n }\n return result;\n }\n checkEdges() {\n for(let i = 0; i < this.results.length; i++){\n let op = this.results[i];\n let op2 = op;\n if (op === undefined) continue;\n do if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\n if (op2 === op) {\n op2 = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.unlinkOpBack(op2);\n if (op2 === undefined) break;\n op = op2.prev;\n } else {\n op2 = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.unlinkOpBack(op2);\n if (op2 === undefined) break;\n }\n } else op2 = op2.next;\n while (op2 !== op);\n if (op2 === undefined) {\n this.results[i] = undefined;\n continue;\n }\n this.results[i] = op2;\n let edgeSet1 = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getEdgesForPt(op.prev.pt, this.rect);\n op2 = op;\n do {\n const edgeSet2 = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.getEdgesForPt(op2.pt, this.rect);\n if (edgeSet2 !== 0 && op2.edge === undefined) {\n const combinedSet = edgeSet1 & edgeSet2;\n for(let j = 0; j < 4; ++j)if ((combinedSet & 1 << j) !== 0) {\n if ($0b6dbf71c0c0eea1$export$ada4127871f05d7b.isHeadingClockwise(op2.prev.pt, op2.pt, j)) $0b6dbf71c0c0eea1$export$ada4127871f05d7b.addToEdge(this.edges[j * 2], op2);\n else $0b6dbf71c0c0eea1$export$ada4127871f05d7b.addToEdge(this.edges[j * 2 + 1], op2);\n }\n }\n edgeSet1 = edgeSet2;\n op2 = op2.next;\n }while (op2 !== op);\n }\n }\n tidyEdgePair(idx, cw, ccw) {\n if (ccw.length === 0) return;\n const isHorz = idx === 1 || idx === 3;\n const cwIsTowardLarger = idx === 1 || idx === 2;\n let i = 0, j = 0;\n let p1, p2, p1a, p2a, op, op2;\n while(i < cw.length){\n p1 = cw[i];\n if (!p1 || p1.next === p1.prev) {\n cw[i++] = undefined;\n j = 0;\n continue;\n }\n const jLim = ccw.length;\n while(j < jLim && (!ccw[j] || ccw[j].next === ccw[j].prev))++j;\n if (j === jLim) {\n ++i;\n j = 0;\n continue;\n }\n if (cwIsTowardLarger) {\n p1 = cw[i].prev;\n p1a = cw[i];\n p2 = ccw[j];\n p2a = ccw[j].prev;\n } else {\n p1 = cw[i];\n p1a = cw[i].prev;\n p2 = ccw[j].prev;\n p2a = ccw[j];\n }\n if (isHorz && !$0b6dbf71c0c0eea1$export$ada4127871f05d7b.hasHorzOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt) || !isHorz && !$0b6dbf71c0c0eea1$export$ada4127871f05d7b.hasVertOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt)) {\n ++j;\n continue;\n }\n const isRejoining = cw[i].ownerIdx !== ccw[j].ownerIdx;\n if (isRejoining) {\n this.results[p2.ownerIdx] = undefined;\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.setNewOwner(p2, p1.ownerIdx);\n }\n if (cwIsTowardLarger) {\n // p1 >> | >> p1a;\n // p2 << | << p2a;\n p1.next = p2;\n p2.prev = p1;\n p1a.prev = p2a;\n p2a.next = p1a;\n } else {\n // p1 << | << p1a;\n // p2 >> | >> p2a;\n p1.prev = p2;\n p2.next = p1;\n p1a.next = p2a;\n p2a.prev = p1a;\n }\n if (!isRejoining) {\n const new_idx = this.results.length;\n this.results.push(p1a);\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.setNewOwner(p1a, new_idx);\n }\n if (cwIsTowardLarger) {\n op = p2;\n op2 = p1a;\n } else {\n op = p1;\n op2 = p2a;\n }\n this.results[op.ownerIdx] = op;\n this.results[op2.ownerIdx] = op2;\n // and now lots of work to get ready for the next loop\n let opIsLarger, op2IsLarger;\n if (isHorz) {\n opIsLarger = op.pt.x > op.prev.pt.x;\n op2IsLarger = op2.pt.x > op2.prev.pt.x;\n } else {\n opIsLarger = op.pt.y > op.prev.pt.y;\n op2IsLarger = op2.pt.y > op2.prev.pt.y;\n }\n if (op.next === op.prev || op.pt === op.prev.pt) {\n if (op2IsLarger === cwIsTowardLarger) {\n cw[i] = op2;\n ccw[j++] = undefined;\n } else {\n ccw[j] = op2;\n cw[i++] = undefined;\n }\n } else if (op2.next === op2.prev || op2.pt === op2.prev.pt) {\n if (opIsLarger === cwIsTowardLarger) {\n cw[i] = op;\n ccw[j++] = undefined;\n } else {\n ccw[j] = op;\n cw[i++] = undefined;\n }\n } else if (opIsLarger === op2IsLarger) {\n if (opIsLarger === cwIsTowardLarger) {\n cw[i] = op;\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.uncoupleEdge(op2);\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.addToEdge(cw, op2);\n ccw[j++] = undefined;\n } else {\n cw[i++] = undefined;\n ccw[j] = op2;\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.uncoupleEdge(op);\n $0b6dbf71c0c0eea1$export$ada4127871f05d7b.addToEdge(ccw, op);\n j = 0;\n }\n } else {\n if (opIsLarger === cwIsTowardLarger) cw[i] = op;\n else ccw[j] = op;\n if (op2IsLarger === cwIsTowardLarger) cw[i] = op2;\n else ccw[j] = op2;\n }\n }\n }\n getPath(op) {\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n if (!op || op.prev === op.next) return result;\n let op2 = op.next;\n while(op2 && op2 !== op)if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\n op = op2.prev;\n op2 = $0b6dbf71c0c0eea1$export$ada4127871f05d7b.unlinkOp(op2);\n } else op2 = op2.next;\n if (!op2) return new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n result.push(op.pt);\n op2 = op.next;\n while(op2 !== op){\n result.push(op2.pt);\n op2 = op2.next;\n }\n return result;\n }\n}\nclass $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2 extends $0b6dbf71c0c0eea1$export$ada4127871f05d7b {\n constructor(rect){\n super(rect);\n }\n execute(paths) {\n const result = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n if (this.rect.isEmpty()) return result;\n for (const path of paths){\n if (path.length < 2) continue;\n this.pathBounds = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.getBounds(path);\n if (!this.rect.intersects(this.pathBounds)) continue;\n this.executeInternal(path);\n for (const op of this.results){\n const tmp = this.getPath(op);\n if (tmp.length > 0) result.push(tmp);\n }\n // Clean up after every loop\n this.results.length = 0; // Clear the array\n for(let i = 0; i < 8; i++)this.edges[i].length = 0; // Clear each array\n }\n return result;\n }\n getPath(op) {\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n if (!op || op === op.next) return result;\n op = op.next; // starting at path beginning \n result.push(op.pt);\n let op2 = op.next;\n while(op2 !== op){\n result.push(op2.pt);\n op2 = op2.next;\n }\n return result;\n }\n executeInternal(path) {\n this.results = [];\n if (path.length < 2 || this.rect.isEmpty()) return;\n let prev = $0b6dbf71c0c0eea1$var$Location.inside;\n let i = 1;\n const highI = path.length - 1;\n let result = $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2.getLocation(this.rect, path[0]);\n let loc = result.loc;\n if (!result.success) {\n while(i <= highI && !result.success){\n i++;\n result = $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2.getLocation(this.rect, path[i]);\n prev = result.loc;\n }\n if (i > highI) for (const pt of path)this.add(pt);\n if (prev == $0b6dbf71c0c0eea1$var$Location.inside) loc = $0b6dbf71c0c0eea1$var$Location.inside;\n i = 1;\n }\n if (loc == $0b6dbf71c0c0eea1$var$Location.inside) this.add(path[0]);\n while(i <= highI){\n prev = loc;\n this.getNextLocation(path, {\n loc: loc,\n i: i,\n highI: highI\n });\n if (i > highI) break;\n const prevPt = path[i - 1];\n let crossingLoc = loc;\n let result = $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\n const ip = result.ip;\n crossingLoc = result.loc;\n if (!result.success) {\n i++;\n continue;\n }\n if (loc == $0b6dbf71c0c0eea1$var$Location.inside) this.add(ip, true);\n else if (prev !== $0b6dbf71c0c0eea1$var$Location.inside) {\n crossingLoc = prev;\n result = $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\n const ip2 = result.ip;\n crossingLoc = result.loc;\n this.add(ip2);\n this.add(ip);\n } else this.add(ip);\n }\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908 {\n static get InvalidRect64() {\n if (!$0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.invalidRect64) $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.invalidRect64 = new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(false);\n return this.invalidRect64;\n }\n static Intersect(subject, clip, fillRule) {\n return this.BooleanOp($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Intersection, subject, clip, fillRule);\n }\n static Union(subject, clip, fillRule = $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) {\n return this.BooleanOp($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union, subject, clip, fillRule);\n }\n static Difference(subject, clip, fillRule) {\n return this.BooleanOp($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Difference, subject, clip, fillRule);\n }\n static Xor(subject, clip, fillRule) {\n return this.BooleanOp($0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Xor, subject, clip, fillRule);\n }\n static BooleanOp(clipType, subject, clip, fillRule = $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) {\n const solution = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n if (!subject) return solution;\n const c = new $0b6dbf71c0c0eea1$export$389255fe4ace408b();\n c.addPaths(subject, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject);\n if (clip) c.addPaths(clip, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip);\n c.execute(clipType, fillRule, solution);\n return solution;\n }\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\n // if (!subject) return;\n // const c: Clipper64 = new Clipper64();\n // c.addPaths(subject, PathType.Subject);\n // if (clip)\n // c.addPaths(clip, PathType.Clip);\n // c.execute(clipType, fillRule, polytree);\n //}\n static InflatePaths(paths, delta, joinType, endType, miterLimit = 2.0) {\n const co = new $0b6dbf71c0c0eea1$export$8cbc02e4273c0b24(miterLimit);\n co.addPaths(paths, joinType, endType);\n const solution = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n co.execute(delta, solution);\n return solution;\n }\n static RectClipPaths(rect, paths) {\n if (rect.isEmpty() || paths.length === 0) return new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n const rc = new $0b6dbf71c0c0eea1$export$ada4127871f05d7b(rect);\n return rc.execute(paths);\n }\n static RectClip(rect, path) {\n if (rect.isEmpty() || path.length === 0) return new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n const tmp = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n tmp.push(path);\n return this.RectClipPaths(rect, tmp);\n }\n static RectClipLinesPaths(rect, paths) {\n if (rect.isEmpty() || paths.length === 0) return new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n const rc = new $0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2(rect);\n return rc.execute(paths);\n }\n static RectClipLines(rect, path) {\n if (rect.isEmpty() || path.length === 0) return new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n const tmp = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n tmp.push(path);\n return this.RectClipLinesPaths(rect, tmp);\n }\n static MinkowskiSum(pattern, path, isClosed) {\n return $0b6dbf71c0c0eea1$export$d7b4df78e16216b1.sum(pattern, path, isClosed);\n }\n static MinkowskiDiff(pattern, path, isClosed) {\n return $0b6dbf71c0c0eea1$export$d7b4df78e16216b1.diff(pattern, path, isClosed);\n }\n static area(path) {\n // https://en.wikipedia.org/wiki/Shoelace_formula\n let a = 0.0;\n const cnt = path.length;\n if (cnt < 3) return 0.0;\n let prevPt = path[cnt - 1];\n for (const pt of path){\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\n prevPt = pt;\n }\n return a * 0.5;\n }\n static areaPaths(paths) {\n let a = 0.0;\n for (const path of paths)a += this.area(path);\n return a;\n }\n static isPositive(poly) {\n return this.area(poly) >= 0;\n }\n static path64ToString(path) {\n let result = \"\";\n for (const pt of path)result += pt.toString();\n return result + \"\\n\";\n }\n static paths64ToString(paths) {\n let result = \"\";\n for (const path of paths)result += this.path64ToString(path);\n return result;\n }\n static offsetPath(path, dx, dy) {\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n for (const pt of path)result.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(pt.x + dx, pt.y + dy));\n return result;\n }\n static scalePoint64(pt, scale) {\n const result = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(Math.round(pt.x * scale), Math.round(pt.y * scale));\n return result;\n }\n static scalePath(path, scale) {\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(scale - 1)) return path;\n const result = [];\n for (const pt of path)result.push({\n x: pt.x * scale,\n y: pt.y * scale\n });\n return result;\n }\n static scalePaths(paths, scale) {\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.isAlmostZero(scale - 1)) return paths;\n const result = [];\n for (const path of paths)result.push(this.scalePath(path, scale));\n return result;\n }\n static translatePath(path, dx, dy) {\n const result = [];\n for (const pt of path)result.push({\n x: pt.x + dx,\n y: pt.y + dy\n });\n return result;\n }\n static translatePaths(paths, dx, dy) {\n const result = [];\n for (const path of paths)result.push(this.translatePath(path, dx, dy));\n return result;\n }\n static reversePath(path) {\n return [\n ...path\n ].reverse();\n }\n static reversePaths(paths) {\n const result = [];\n for (const t of paths)result.push(this.reversePath(t));\n return result;\n }\n static getBounds(path) {\n const result = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.InvalidRect64;\n for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result.left === Number.MAX_SAFE_INTEGER ? new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : result;\n }\n static getBoundsPaths(paths) {\n const result = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.InvalidRect64;\n for (const path of paths)for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result.left === Number.MAX_SAFE_INTEGER ? new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : result;\n }\n static makePath(arr) {\n const len = arr.length / 2;\n const p = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n for(let i = 0; i < len; i++)p.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(arr[i * 2], arr[i * 2 + 1]));\n return p;\n }\n static stripDuplicates(path, isClosedPath) {\n const cnt = path.length;\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n if (cnt === 0) return result;\n let lastPt = path[0];\n result.push(lastPt);\n for(let i = 1; i < cnt; i++)if (lastPt !== path[i]) {\n lastPt = path[i];\n result.push(lastPt);\n }\n if (isClosedPath && lastPt === result[0]) result.pop();\n return result;\n }\n static addPolyNodeToPaths(polyPath, paths) {\n if (polyPath.polygon && polyPath.polygon.length > 0) paths.push(polyPath.polygon);\n for(let i = 0; i < polyPath.count; i++)this.addPolyNodeToPaths(polyPath.children[i], paths);\n }\n static polyTreeToPaths64(polyTree) {\n const result = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9();\n for(let i = 0; i < polyTree.count; i++)$0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.addPolyNodeToPaths(polyTree.children[i], result);\n return result;\n }\n static perpendicDistFromLineSqrd(pt, line1, line2) {\n const a = pt.x - line1.x;\n const b = pt.y - line1.y;\n const c = line2.x - line1.x;\n const d = line2.y - line1.y;\n if (c === 0 && d === 0) return 0;\n return $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.sqr(a * d - c * b) / (c * c + d * d);\n }\n static rdp(path, begin, end, epsSqrd, flags) {\n let idx = 0;\n let max_d = 0;\n while(end > begin && path[begin] === path[end])flags[end--] = false;\n for(let i = begin + 1; i < end; i++){\n const d = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\n if (d <= max_d) continue;\n max_d = d;\n idx = i;\n }\n if (max_d <= epsSqrd) return;\n flags[idx] = true;\n if (idx > begin + 1) $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.rdp(path, begin, idx, epsSqrd, flags);\n if (idx < end - 1) $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.rdp(path, idx, end, epsSqrd, flags);\n }\n static ramerDouglasPeucker(path, epsilon) {\n const len = path.length;\n if (len < 5) return path;\n const flags = new Array(len).fill(false);\n flags[0] = true;\n flags[len - 1] = true;\n $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.rdp(path, 0, len - 1, $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.sqr(epsilon), flags);\n const result = [];\n for(let i = 0; i < len; i++)if (flags[i]) result.push(path[i]);\n return result;\n }\n static ramerDouglasPeuckerPaths(paths, epsilon) {\n const result = [];\n for (const path of paths)result.push($0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.ramerDouglasPeucker(path, epsilon));\n return result;\n }\n static getNext(current, high, flags) {\n current++;\n while(current <= high && flags[current])current++;\n if (current <= high) return current;\n current = 0;\n while(flags[current])current++;\n return current;\n }\n static getPrior(current, high, flags) {\n if (current === 0) current = high;\n else current--;\n while(current > 0 && flags[current])current--;\n if (!flags[current]) return current;\n current = high;\n while(flags[current])current--;\n return current;\n }\n static sqr(value) {\n return value * value;\n }\n static simplifyPath(path, epsilon, isClosedPath = false) {\n const len = path.length;\n const high = len - 1;\n const epsSqr = this.sqr(epsilon);\n if (len < 4) return path;\n const flags = new Array(len).fill(false);\n const dsq = new Array(len).fill(0);\n let prev = high;\n let curr = 0;\n let start, next, prior2, next2;\n if (isClosedPath) {\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\n } else {\n dsq[0] = Number.MAX_VALUE;\n dsq[high] = Number.MAX_VALUE;\n }\n for(let i = 1; i < high; i++)dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\n for(;;){\n if (dsq[curr] > epsSqr) {\n start = curr;\n do curr = this.getNext(curr, high, flags);\n while (curr !== start && dsq[curr] > epsSqr);\n if (curr === start) break;\n }\n prev = this.getPrior(curr, high, flags);\n next = this.getNext(curr, high, flags);\n if (next === prev) break;\n if (dsq[next] < dsq[curr]) {\n flags[next] = true;\n next = this.getNext(next, high, flags);\n next2 = this.getNext(next, high, flags);\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\n if (next !== high || isClosedPath) dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\n curr = next;\n } else {\n flags[curr] = true;\n curr = next;\n next = this.getNext(next, high, flags);\n prior2 = this.getPrior(prev, high, flags);\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\n if (prev !== 0 || isClosedPath) dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\n }\n }\n const result = [];\n for(let i = 0; i < len; i++)if (!flags[i]) result.push(path[i]);\n return result;\n }\n static simplifyPaths(paths, epsilon, isClosedPaths = false) {\n const result = [];\n for (const path of paths)result.push(this.simplifyPath(path, epsilon, isClosedPaths));\n return result;\n }\n //private static getNext(current: number, high: number, flags: boolean[]): number {\n // current++;\n // while (current <= high && flags[current]) current++;\n // return current;\n //}\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\n // if (current === 0) return high;\n // current--;\n // while (current > 0 && flags[current]) current--;\n // return current;\n //}\n static trimCollinear(path, isOpen = false) {\n let len = path.length;\n let i = 0;\n if (!isOpen) {\n while(i < len - 1 && $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(path[len - 1], path[i], path[i + 1]) === 0)i++;\n while(i < len - 1 && $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(path[len - 2], path[len - 1], path[i]) === 0)len--;\n }\n if (len - i < 3) {\n if (!isOpen || len < 2 || path[0] === path[1]) return [];\n return path;\n }\n const result = [];\n let last = path[i];\n result.push(last);\n for(i++; i < len - 1; i++){\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(last, path[i], path[i + 1]) === 0) continue;\n last = path[i];\n result.push(last);\n }\n if (isOpen) result.push(path[len - 1]);\n else if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(last, path[len - 1], result[0]) !== 0) result.push(path[len - 1]);\n else {\n while(result.length > 2 && $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0)result.pop();\n if (result.length < 3) result.splice(0, result.length);\n }\n return result;\n }\n static pointInPolygon(pt, polygon) {\n return $0b6dbf71c0c0eea1$export$9bad362b29d84293.pointInPolygon(pt, polygon);\n }\n static ellipse(center, radiusX, radiusY = 0, steps = 0) {\n if (radiusX <= 0) return [];\n if (radiusY <= 0) radiusY = radiusX;\n if (steps <= 2) steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\n const si = Math.sin(2 * Math.PI / steps);\n const co = Math.cos(2 * Math.PI / steps);\n let dx = co, dy = si;\n const result = [\n {\n x: center.x + radiusX,\n y: center.y\n }\n ];\n for(let i = 1; i < steps; ++i){\n result.push({\n x: center.x + radiusX * dx,\n y: center.y + radiusY * dy\n });\n const x = dx * co - dy * si;\n dy = dy * co + dx * si;\n dx = x;\n }\n return result;\n }\n static showPolyPathStructure(pp, level) {\n const spaces = \" \".repeat(level * 2);\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\n if (pp.count === 0) console.log(spaces + caption);\n else {\n console.log(spaces + caption + `(${pp.count})`);\n pp.forEach((child)=>this.showPolyPathStructure(child, level + 1));\n }\n }\n static showPolyTreeStructure(polytree) {\n console.log(\"Polytree Root\");\n polytree.forEach((child)=>this.showPolyPathStructure(child, 1));\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nvar $0b6dbf71c0c0eea1$export$20896d302a4e5029;\n(function(PointInPolygonResult) {\n PointInPolygonResult[PointInPolygonResult[\"IsOn\"] = 0] = \"IsOn\";\n PointInPolygonResult[PointInPolygonResult[\"IsInside\"] = 1] = \"IsInside\";\n PointInPolygonResult[PointInPolygonResult[\"IsOutside\"] = 2] = \"IsOutside\";\n})($0b6dbf71c0c0eea1$export$20896d302a4e5029 || ($0b6dbf71c0c0eea1$export$20896d302a4e5029 = {}));\nvar $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5;\n(function(VertexFlags) {\n VertexFlags[VertexFlags[\"None\"] = 0] = \"None\";\n VertexFlags[VertexFlags[\"OpenStart\"] = 1] = \"OpenStart\";\n VertexFlags[VertexFlags[\"OpenEnd\"] = 2] = \"OpenEnd\";\n VertexFlags[VertexFlags[\"LocalMax\"] = 4] = \"LocalMax\";\n VertexFlags[VertexFlags[\"LocalMin\"] = 8] = \"LocalMin\";\n})($0b6dbf71c0c0eea1$export$6bbe4490a892c1c5 || ($0b6dbf71c0c0eea1$export$6bbe4490a892c1c5 = {}));\nclass $0b6dbf71c0c0eea1$var$Vertex {\n constructor(pt, flags, prev){\n this.pt = pt;\n this.flags = flags;\n this.next = undefined;\n this.prev = prev;\n }\n}\nclass $0b6dbf71c0c0eea1$var$LocalMinima {\n constructor(vertex, polytype, isOpen = false){\n this.vertex = vertex;\n this.polytype = polytype;\n this.isOpen = isOpen;\n }\n static equals(lm1, lm2) {\n return lm1.vertex === lm2.vertex;\n }\n static notEquals(lm1, lm2) {\n return lm1.vertex !== lm2.vertex;\n }\n}\nclass $0b6dbf71c0c0eea1$var$IntersectNode {\n constructor(pt, edge1, edge2){\n this.pt = pt;\n this.edge1 = edge1;\n this.edge2 = edge2;\n }\n}\nclass $0b6dbf71c0c0eea1$var$OutPt {\n constructor(pt, outrec){\n this.pt = pt;\n this.outrec = outrec;\n this.next = this;\n this.prev = this;\n this.horz = undefined;\n }\n}\nvar $0b6dbf71c0c0eea1$export$290b84559c467a5c;\n(function(JoinWith) {\n JoinWith[JoinWith[\"None\"] = 0] = \"None\";\n JoinWith[JoinWith[\"Left\"] = 1] = \"Left\";\n JoinWith[JoinWith[\"Right\"] = 2] = \"Right\";\n})($0b6dbf71c0c0eea1$export$290b84559c467a5c || ($0b6dbf71c0c0eea1$export$290b84559c467a5c = {}));\nvar $0b6dbf71c0c0eea1$export$c8278727b7a5228b;\n(function(HorzPosition) {\n HorzPosition[HorzPosition[\"Bottom\"] = 0] = \"Bottom\";\n HorzPosition[HorzPosition[\"Middle\"] = 1] = \"Middle\";\n HorzPosition[HorzPosition[\"Top\"] = 2] = \"Top\";\n})($0b6dbf71c0c0eea1$export$c8278727b7a5228b || ($0b6dbf71c0c0eea1$export$c8278727b7a5228b = {}));\nclass $0b6dbf71c0c0eea1$export$1e0666df669b1ceb {\n constructor(idx){\n this.idx = idx;\n this.isOpen = false;\n }\n}\nclass $0b6dbf71c0c0eea1$var$HorzSegment {\n constructor(op){\n this.leftOp = op;\n this.rightOp = undefined;\n this.leftToRight = true;\n }\n}\nclass $0b6dbf71c0c0eea1$var$HorzJoin {\n constructor(ltor, rtol){\n this.op1 = ltor;\n this.op2 = rtol;\n }\n}\n///////////////////////////////////////////////////////////////////\n// Important: UP and DOWN here are premised on Y-axis positive down\n// displays, which is the orientation used in Clipper's development.\n///////////////////////////////////////////////////////////////////\nclass $0b6dbf71c0c0eea1$export$c3c7cbf43a3f0561 {\n constructor(){\n this.dx = this.windCount = this.windCount2 = 0;\n this.isLeftBound = false;\n this.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n }\n}\nclass $0b6dbf71c0c0eea1$export$467e9e338ef38141 {\n static addLocMin(vert, polytype, isOpen, minimaList) {\n // make sure the vertex is added only once ...\n if ((vert.flags & $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMin) !== $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None) return;\n vert.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMin;\n const lm = new $0b6dbf71c0c0eea1$var$LocalMinima(vert, polytype, isOpen);\n minimaList.push(lm);\n }\n static addPathsToVertexList(paths, polytype, isOpen, minimaList, vertexList) {\n let totalVertCnt = 0;\n for (const path of paths)totalVertCnt += path.length;\n for (const path of paths){\n let v0 = undefined;\n let prev_v = undefined;\n let curr_v = undefined;\n for (const pt of path){\n if (!v0) {\n v0 = new $0b6dbf71c0c0eea1$var$Vertex(pt, $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None, undefined);\n vertexList.push(v0);\n prev_v = v0;\n } else if (prev_v.pt !== pt) {\n curr_v = new $0b6dbf71c0c0eea1$var$Vertex(pt, $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None, prev_v);\n vertexList.push(curr_v);\n prev_v.next = curr_v;\n prev_v = curr_v;\n }\n }\n if (!prev_v || !prev_v.prev) continue;\n if (!isOpen && prev_v.pt === v0.pt) prev_v = prev_v.prev;\n prev_v.next = v0;\n v0.prev = prev_v;\n if (!isOpen && prev_v.next === prev_v) continue;\n // OK, we have a valid path\n let going_up = false;\n if (isOpen) {\n curr_v = v0.next;\n let count = 0;\n while(curr_v !== v0 && curr_v.pt.y === v0.pt.y){\n curr_v = curr_v.next;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n going_up = curr_v.pt.y <= v0.pt.y;\n if (going_up) {\n v0.flags = $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenStart;\n this.addLocMin(v0, polytype, true, minimaList);\n } else v0.flags = $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenStart | $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax;\n } else {\n prev_v = v0.prev;\n let count = 0;\n while(prev_v !== v0 && prev_v.pt.y === v0.pt.y){\n prev_v = prev_v.prev;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n if (prev_v === v0) continue; // only open paths can be completely flat\n going_up = prev_v.pt.y > v0.pt.y;\n }\n const going_up0 = going_up;\n prev_v = v0;\n curr_v = v0.next;\n let count = 0;\n while(curr_v !== v0){\n if (curr_v.pt.y > prev_v.pt.y && going_up) {\n prev_v.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax;\n going_up = false;\n } else if (curr_v.pt.y < prev_v.pt.y && !going_up) {\n going_up = true;\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\n }\n prev_v = curr_v;\n curr_v = curr_v.next;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n if (isOpen) {\n prev_v.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenEnd;\n if (going_up) prev_v.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax;\n else this.addLocMin(prev_v, polytype, isOpen, minimaList);\n } else if (going_up !== going_up0) {\n if (going_up0) this.addLocMin(prev_v, polytype, false, minimaList);\n else prev_v.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax;\n }\n }\n }\n}\nclass $0b6dbf71c0c0eea1$export$c17ed8035d0de27b {\n constructor(){\n this._minimaList = [];\n this._vertexList = [];\n }\n clear() {\n this._minimaList.length = 0;\n this._vertexList.length = 0;\n }\n addPaths(paths, pt, isOpen) {\n $0b6dbf71c0c0eea1$export$467e9e338ef38141.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\n }\n}\nclass $0b6dbf71c0c0eea1$var$SimpleNavigableSet {\n constructor(){\n this.items = [];\n this.items = [];\n }\n clear() {\n this.items.length = 0;\n }\n isEmpty() {\n return this.items.length == 0;\n }\n pollLast() {\n return this.items.pop();\n }\n add(item) {\n if (!this.items.includes(item)) {\n this.items.push(item);\n this.items.sort((a, b)=>a - b);\n }\n }\n}\nclass $0b6dbf71c0c0eea1$export$33da2edff2b544f3 {\n constructor(){\n this._cliptype = $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.None;\n this._fillrule = $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd;\n this._currentLocMin = 0;\n this._currentBotY = 0;\n this._isSortedMinimaList = false;\n this._hasOpenPaths = false;\n this._using_polytree = false;\n this._succeeded = false;\n this.reverseSolution = false;\n this._minimaList = [];\n this._intersectList = [];\n this._vertexList = [];\n this._outrecList = [];\n this._scanlineList = new $0b6dbf71c0c0eea1$var$SimpleNavigableSet();\n this._horzSegList = [];\n this._horzJoinList = [];\n this.preserveCollinear = true;\n }\n static isOdd(val) {\n return (val & 1) !== 0;\n }\n static isHotEdgeActive(ae) {\n return ae.outrec !== undefined;\n }\n static isOpen(ae) {\n return ae.localMin.isOpen;\n }\n static isOpenEndActive(ae) {\n return ae.localMin.isOpen && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEnd(ae.vertexTop);\n }\n static isOpenEnd(v) {\n return (v.flags & ($0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenStart | $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenEnd)) !== $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None;\n }\n static getPrevHotEdge(ae) {\n let prev = ae.prevInAEL;\n while(prev && ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(prev) || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(prev)))prev = prev.prevInAEL;\n return prev;\n }\n static isFront(ae) {\n return ae === ae.outrec.frontEdge;\n }\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/ static getDx(pt1, pt2) {\n const dy = pt2.y - pt1.y;\n if (dy !== 0) return (pt2.x - pt1.x) / dy;\n if (pt2.x > pt1.x) return Number.NEGATIVE_INFINITY;\n return Number.POSITIVE_INFINITY;\n }\n static topX(ae, currentY) {\n if (currentY === ae.top.y || ae.top.x === ae.bot.x) return ae.top.x;\n if (currentY === ae.bot.y) return ae.bot.x;\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\n }\n static isHorizontal(ae) {\n return ae.top.y === ae.bot.y;\n }\n static isHeadingRightHorz(ae) {\n return Number.NEGATIVE_INFINITY === ae.dx;\n }\n static isHeadingLeftHorz(ae) {\n return Number.POSITIVE_INFINITY === ae.dx;\n }\n static swapActives(ae1, ae2) {\n [ae2, ae1] = [\n ae1,\n ae2\n ];\n }\n static getPolyType(ae) {\n return ae.localMin.polytype;\n }\n static isSamePolyType(ae1, ae2) {\n return ae1.localMin.polytype === ae2.localMin.polytype;\n }\n static setDx(ae) {\n ae.dx = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getDx(ae.bot, ae.top);\n }\n static nextVertex(ae) {\n if (ae.windDx > 0) return ae.vertexTop.next;\n return ae.vertexTop.prev;\n }\n static prevPrevVertex(ae) {\n if (ae.windDx > 0) return ae.vertexTop.prev.prev;\n return ae.vertexTop.next.next;\n }\n static isMaxima(vertex) {\n return (vertex.flags & $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax) !== $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None;\n }\n static isMaximaActive(ae) {\n return $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isMaxima(ae.vertexTop);\n }\n static getMaximaPair(ae) {\n let ae2 = ae.nextInAEL;\n while(ae2){\n if (ae2.vertexTop === ae.vertexTop) return ae2; // Found!\n ae2 = ae2.nextInAEL;\n }\n return undefined;\n }\n static getCurrYMaximaVertex_Open(ae) {\n let result = ae.vertexTop;\n if (ae.windDx > 0) while(result.next.pt.y === result.pt.y && (result.flags & ($0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenEnd | $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax)) === $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None)result = result.next;\n else while(result.prev.pt.y === result.pt.y && (result.flags & ($0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenEnd | $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMax)) === $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None)result = result.prev;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isMaxima(result)) result = undefined; // not a maxima\n return result;\n }\n static getCurrYMaximaVertex(ae) {\n let result = ae.vertexTop;\n if (ae.windDx > 0) while(result.next.pt.y === result.pt.y)result = result.next;\n else while(result.prev.pt.y === result.pt.y)result = result.prev;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isMaxima(result)) result = undefined; // not a maxima\n return result;\n }\n static setSides(outrec, startEdge, endEdge) {\n outrec.frontEdge = startEdge;\n outrec.backEdge = endEdge;\n }\n static swapOutrecs(ae1, ae2) {\n const or1 = ae1.outrec;\n const or2 = ae2.outrec;\n if (or1 === or2) {\n const ae = or1.frontEdge;\n or1.frontEdge = or1.backEdge;\n or1.backEdge = ae;\n return;\n }\n if (or1) {\n if (ae1 === or1.frontEdge) or1.frontEdge = ae2;\n else or1.backEdge = ae2;\n }\n if (or2) {\n if (ae2 === or2.frontEdge) or2.frontEdge = ae1;\n else or2.backEdge = ae1;\n }\n ae1.outrec = or2;\n ae2.outrec = or1;\n }\n static setOwner(outrec, newOwner) {\n while(newOwner.owner && !newOwner.owner.pts)newOwner.owner = newOwner.owner.owner;\n //make sure that outrec isn't an owner of newOwner\n let tmp = newOwner;\n while(tmp && tmp !== outrec)tmp = tmp.owner;\n if (tmp) newOwner.owner = outrec.owner;\n outrec.owner = newOwner;\n }\n static area(op) {\n // https://en.wikipedia.org/wiki/Shoelace_formula\n let area = 0.0;\n let op2 = op;\n do {\n area += (op2.prev.pt.y + op2.pt.y) * (op2.prev.pt.x - op2.pt.x);\n op2 = op2.next;\n }while (op2 !== op);\n return area * 0.5;\n }\n static areaTriangle(pt1, pt2, pt3) {\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) + (pt1.y + pt2.y) * (pt1.x - pt2.x) + (pt2.y + pt3.y) * (pt2.x - pt3.x);\n }\n static getRealOutRec(outRec) {\n while(outRec !== undefined && outRec.pts === undefined)outRec = outRec.owner;\n return outRec;\n }\n static isValidOwner(outRec, testOwner) {\n while(testOwner !== undefined && testOwner !== outRec)testOwner = testOwner.owner;\n return testOwner === undefined;\n }\n static uncoupleOutRec(ae) {\n const outrec = ae.outrec;\n if (outrec === undefined) return;\n outrec.frontEdge.outrec = undefined;\n outrec.backEdge.outrec = undefined;\n outrec.frontEdge = undefined;\n outrec.backEdge = undefined;\n }\n static outrecIsAscending(hotEdge) {\n return hotEdge === hotEdge.outrec.frontEdge;\n }\n static swapFrontBackSides(outrec) {\n // while this proc. is needed for open paths\n // it's almost never needed for closed paths\n const ae2 = outrec.frontEdge;\n outrec.frontEdge = outrec.backEdge;\n outrec.backEdge = ae2;\n outrec.pts = outrec.pts.next;\n }\n static edgesAdjacentInAEL(inode) {\n return inode.edge1.nextInAEL === inode.edge2 || inode.edge1.prevInAEL === inode.edge2;\n }\n clearSolutionOnly() {\n while(this._actives)this.deleteFromAEL(this._actives);\n this._scanlineList.clear();\n this.disposeIntersectNodes();\n this._outrecList.length = 0;\n this._horzSegList.length = 0;\n this._horzJoinList.length = 0;\n }\n clear() {\n this.clearSolutionOnly();\n this._minimaList.length = 0;\n this._vertexList.length = 0;\n this._currentLocMin = 0;\n this._isSortedMinimaList = false;\n this._hasOpenPaths = false;\n }\n reset() {\n if (!this._isSortedMinimaList) {\n this._minimaList.sort((locMin1, locMin2)=>locMin2.vertex.pt.y - locMin1.vertex.pt.y);\n this._isSortedMinimaList = true;\n }\n for(let i = this._minimaList.length - 1; i >= 0; i--)this._scanlineList.add(this._minimaList[i].vertex.pt.y);\n this._currentBotY = 0;\n this._currentLocMin = 0;\n this._actives = undefined;\n this._sel = undefined;\n this._succeeded = true;\n }\n insertScanline(y) {\n this._scanlineList.add(y);\n }\n popScanline() {\n return this._scanlineList.pollLast();\n }\n hasLocMinAtY(y) {\n return this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y;\n }\n popLocalMinima() {\n return this._minimaList[this._currentLocMin++];\n }\n addLocMin(vert, polytype, isOpen) {\n // make sure the vertex is added only once ...\n if ((vert.flags & $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMin) != $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None) return;\n vert.flags |= $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.LocalMin;\n const lm = new $0b6dbf71c0c0eea1$var$LocalMinima(vert, polytype, isOpen);\n this._minimaList.push(lm);\n }\n addSubject(path) {\n this.addPath(path, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject);\n }\n addOpenSubject(path) {\n this.addPath(path, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject, true);\n }\n addClip(path) {\n this.addPath(path, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip);\n }\n addPath(path, polytype, isOpen = false) {\n const tmp = [\n path\n ];\n this.addPaths(tmp, polytype, isOpen);\n }\n addPaths(paths, polytype, isOpen = false) {\n if (isOpen) this._hasOpenPaths = true;\n this._isSortedMinimaList = false;\n $0b6dbf71c0c0eea1$export$467e9e338ef38141.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\n }\n addReuseableData(reuseableData) {\n if (reuseableData._minimaList.length === 0) return;\n this._isSortedMinimaList = false;\n for (const lm of reuseableData._minimaList){\n this._minimaList.push(new $0b6dbf71c0c0eea1$var$LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\n if (lm.isOpen) this._hasOpenPaths = true;\n }\n }\n isContributingClosed(ae) {\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n if (ae.windCount !== 1) return false;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n if (ae.windCount !== -1) return false;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.NonZero:\n if (Math.abs(ae.windCount) !== 1) return false;\n break;\n }\n switch(this._cliptype){\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Intersection:\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n return ae.windCount2 > 0;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n return ae.windCount2 < 0;\n default:\n return ae.windCount2 !== 0;\n }\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union:\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n return ae.windCount2 <= 0;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n return ae.windCount2 >= 0;\n default:\n return ae.windCount2 === 0;\n }\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Difference:\n const result = this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive ? ae.windCount2 <= 0 : this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative ? ae.windCount2 >= 0 : ae.windCount2 === 0;\n return $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae) === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject ? result : !result;\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Xor:\n return true;\n default:\n return false;\n }\n }\n isContributingOpen(ae) {\n let isInClip, isInSubj;\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n isInSubj = ae.windCount > 0;\n isInClip = ae.windCount2 > 0;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n isInSubj = ae.windCount < 0;\n isInClip = ae.windCount2 < 0;\n break;\n default:\n isInSubj = ae.windCount !== 0;\n isInClip = ae.windCount2 !== 0;\n break;\n }\n switch(this._cliptype){\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Intersection:\n return isInClip;\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union:\n return !isInSubj && !isInClip;\n default:\n return !isInClip;\n }\n }\n setWindCountForClosedPathEdge(ae) {\n let ae2 = ae.prevInAEL;\n const pt = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae);\n while(ae2 !== undefined && ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae2) !== pt || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)))ae2 = ae2.prevInAEL;\n if (ae2 === undefined) {\n ae.windCount = ae.windDx;\n ae2 = this._actives;\n } else if (this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) {\n ae.windCount = ae.windDx;\n ae.windCount2 = ae2.windCount2;\n ae2 = ae2.nextInAEL;\n } else {\n // NonZero, positive, or negative filling here ...\n // when e2's WindCnt is in the SAME direction as its WindDx,\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\n if (ae2.windCount * ae2.windDx < 0) {\n // opposite directions so 'ae' is outside 'ae2' ...\n if (Math.abs(ae2.windCount) > 1) {\n // outside prev poly but still inside another.\n if (ae2.windDx * ae.windDx < 0) // reversing direction so use the same WC\n ae.windCount = ae2.windCount;\n else // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\n ae.windCount = ae2.windCount + ae.windDx;\n } else // now outside all polys of same polytype so set own WC ...\n ae.windCount = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae) ? 1 : ae.windDx;\n } else // 'ae' must be inside 'ae2'\n if (ae2.windDx * ae.windDx < 0) // reversing direction so use the same WC\n ae.windCount = ae2.windCount;\n else // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\n ae.windCount = ae2.windCount + ae.windDx;\n ae.windCount2 = ae2.windCount2;\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\n }\n if (this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) while(ae2 !== ae){\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae2) !== pt && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount2 = ae.windCount2 === 0 ? 1 : 0;\n ae2 = ae2.nextInAEL;\n }\n else while(ae2 !== ae){\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae2) !== pt && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount2 += ae2.windDx;\n ae2 = ae2.nextInAEL;\n }\n }\n setWindCountForOpenPathEdge(ae) {\n let ae2 = this._actives;\n if (this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) {\n let cnt1 = 0, cnt2 = 0;\n while(ae2 !== ae){\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae2) === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip) cnt2++;\n else if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) cnt1++;\n ae2 = ae2.nextInAEL;\n }\n ae.windCount = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOdd(cnt1) ? 1 : 0;\n ae.windCount2 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOdd(cnt2) ? 1 : 0;\n } else while(ae2 !== ae){\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae2) === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip) ae.windCount2 += ae2.windDx;\n else if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount += ae2.windDx;\n ae2 = ae2.nextInAEL;\n }\n }\n static isValidAelOrder(resident, newcomer) {\n if (newcomer.curX !== resident.curX) return newcomer.curX > resident.curX;\n // get the turning direction a1.top, a2.bot, a2.top\n const d = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(resident.top, newcomer.bot, newcomer.top);\n if (d !== 0.0) return d < 0;\n // edges must be collinear to get here\n // for starting open paths, place them according to\n // the direction they're about to turn\n if (!this.isMaximaActive(resident) && resident.top.y > newcomer.top.y) return $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(newcomer.bot, resident.top, this.nextVertex(resident).pt) <= 0;\n if (!this.isMaximaActive(newcomer) && newcomer.top.y > resident.top.y) return $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(newcomer.bot, newcomer.top, this.nextVertex(newcomer).pt) >= 0;\n const y = newcomer.bot.y;\n const newcomerIsLeft = newcomer.isLeftBound;\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y) return newcomer.isLeftBound;\n // resident must also have just been inserted\n if (resident.isLeftBound !== newcomerIsLeft) return newcomerIsLeft;\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(this.prevPrevVertex(resident).pt, resident.bot, resident.top) === 0) return true;\n // compare turning direction of the alternate bound\n return $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(this.prevPrevVertex(resident).pt, newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0 === newcomerIsLeft;\n }\n insertLeftEdge(ae) {\n let ae2;\n if (!this._actives) {\n ae.prevInAEL = undefined;\n ae.nextInAEL = undefined;\n this._actives = ae;\n } else if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidAelOrder(this._actives, ae)) {\n ae.prevInAEL = undefined;\n ae.nextInAEL = this._actives;\n this._actives.prevInAEL = ae;\n this._actives = ae;\n } else {\n ae2 = this._actives;\n while(ae2.nextInAEL && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidAelOrder(ae2.nextInAEL, ae))ae2 = ae2.nextInAEL;\n //don't separate joined edges\n if (ae2.joinWith === $0b6dbf71c0c0eea1$export$290b84559c467a5c.Right) ae2 = ae2.nextInAEL;\n ae.nextInAEL = ae2.nextInAEL;\n if (ae2.nextInAEL) ae2.nextInAEL.prevInAEL = ae;\n ae.prevInAEL = ae2;\n ae2.nextInAEL = ae;\n }\n }\n static insertRightEdge(ae, ae2) {\n ae2.nextInAEL = ae.nextInAEL;\n if (ae.nextInAEL) ae.nextInAEL.prevInAEL = ae2;\n ae2.prevInAEL = ae;\n ae.nextInAEL = ae2;\n }\n insertLocalMinimaIntoAEL(botY) {\n let localMinima;\n let leftBound;\n let rightBound;\n // Add any local minima (if any) at BotY ...\n // NB horizontal local minima edges should contain locMin.vertex.prev\n while(this.hasLocMinAtY(botY)){\n localMinima = this.popLocalMinima();\n if ((localMinima.vertex.flags & $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenStart) !== $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None) leftBound = undefined;\n else {\n leftBound = new $0b6dbf71c0c0eea1$export$c3c7cbf43a3f0561();\n leftBound.bot = localMinima.vertex.pt;\n leftBound.curX = localMinima.vertex.pt.x;\n leftBound.windDx = -1;\n leftBound.vertexTop = localMinima.vertex.prev;\n leftBound.top = localMinima.vertex.prev.pt;\n leftBound.outrec = undefined;\n leftBound.localMin = localMinima;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setDx(leftBound);\n }\n if ((localMinima.vertex.flags & $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.OpenEnd) !== $0b6dbf71c0c0eea1$export$6bbe4490a892c1c5.None) rightBound = undefined;\n else {\n rightBound = new $0b6dbf71c0c0eea1$export$c3c7cbf43a3f0561();\n rightBound.bot = localMinima.vertex.pt;\n rightBound.curX = localMinima.vertex.pt.x;\n rightBound.windDx = 1;\n rightBound.vertexTop = localMinima.vertex.next;\n rightBound.top = localMinima.vertex.next.pt;\n rightBound.outrec = undefined;\n rightBound.localMin = localMinima;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setDx(rightBound);\n }\n if (leftBound && rightBound) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(leftBound)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHeadingRightHorz(leftBound)) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(rightBound)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHeadingLeftHorz(rightBound)) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n } else if (leftBound.dx < rightBound.dx) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n //so when leftBound has windDx == 1, the polygon will be oriented\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\n } else if (leftBound === undefined) {\n leftBound = rightBound;\n rightBound = undefined;\n }\n let contributing = false;\n leftBound.isLeftBound = true;\n this.insertLeftEdge(leftBound);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(leftBound)) {\n this.setWindCountForOpenPathEdge(leftBound);\n contributing = this.isContributingOpen(leftBound);\n } else {\n this.setWindCountForClosedPathEdge(leftBound);\n contributing = this.isContributingClosed(leftBound);\n }\n if (rightBound) {\n rightBound.windCount = leftBound.windCount;\n rightBound.windCount2 = leftBound.windCount2;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.insertRightEdge(leftBound, rightBound);\n if (contributing) {\n this.addLocalMinPoly(leftBound, rightBound, leftBound.bot, true);\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(leftBound)) this.checkJoinLeft(leftBound, leftBound.bot);\n }\n while(rightBound.nextInAEL && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidAelOrder(rightBound.nextInAEL, rightBound)){\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\n }\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(rightBound)) this.pushHorz(rightBound);\n else {\n this.checkJoinRight(rightBound, rightBound.bot);\n this.insertScanline(rightBound.top.y);\n }\n } else if (contributing) this.startOpenPath(leftBound, leftBound.bot);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(leftBound)) this.pushHorz(leftBound);\n else this.insertScanline(leftBound.top.y);\n }\n }\n pushHorz(ae) {\n ae.nextInSEL = this._sel;\n this._sel = ae;\n }\n popHorz() {\n const ae = this._sel;\n if (this._sel === undefined) return undefined;\n this._sel = this._sel.nextInSEL;\n return ae;\n }\n addLocalMinPoly(ae1, ae2, pt, isNew = false) {\n const outrec = this.newOutRec();\n ae1.outrec = outrec;\n ae2.outrec = outrec;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae1)) {\n outrec.owner = undefined;\n outrec.isOpen = true;\n if (ae1.windDx > 0) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n } else {\n outrec.isOpen = false;\n const prevHotEdge = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPrevHotEdge(ae1);\n // e.windDx is the winding direction of the **input** paths\n // and unrelated to the winding direction of output polygons.\n // Output orientation is determined by e.outrec.frontE which is\n // the ascending edge (see AddLocalMinPoly).\n if (prevHotEdge) {\n if (this._using_polytree) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setOwner(outrec, prevHotEdge.outrec);\n outrec.owner = prevHotEdge.outrec;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.outrecIsAscending(prevHotEdge) === isNew) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n } else {\n outrec.owner = undefined;\n if (isNew) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n }\n }\n const op = new $0b6dbf71c0c0eea1$var$OutPt(pt, outrec);\n outrec.pts = op;\n return op;\n }\n addLocalMaxPoly(ae1, ae2, pt) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae1)) this.split(ae1, pt);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae1) === $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae2)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(ae1)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapFrontBackSides(ae1.outrec);\n else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(ae2)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapFrontBackSides(ae2.outrec);\n else {\n this._succeeded = false;\n return undefined;\n }\n }\n const result = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae1, pt);\n if (ae1.outrec === ae2.outrec) {\n const outrec = ae1.outrec;\n outrec.pts = result;\n if (this._using_polytree) {\n const e = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPrevHotEdge(ae1);\n if (e === undefined) outrec.owner = undefined;\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setOwner(outrec, e.outrec);\n }\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.uncoupleOutRec(ae1);\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae1)) {\n if (ae1.windDx < 0) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(ae1, ae2);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(ae2, ae1);\n } else if (ae1.outrec.idx < ae2.outrec.idx) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(ae1, ae2);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(ae2, ae1);\n return result;\n }\n static joinOutrecPaths(ae1, ae2) {\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\n const p1Start = ae1.outrec.pts;\n const p2Start = ae2.outrec.pts;\n const p1End = p1Start.next;\n const p2End = p2Start.next;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae1)) {\n p2End.prev = p1Start;\n p1Start.next = p2End;\n p2Start.next = p1End;\n p1End.prev = p2Start;\n ae1.outrec.pts = p2Start;\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\n ae1.outrec.frontEdge = ae2.outrec.frontEdge;\n if (ae1.outrec.frontEdge) ae1.outrec.frontEdge.outrec = ae1.outrec;\n } else {\n p1End.prev = p2Start;\n p2Start.next = p1End;\n p1Start.next = p2End;\n p2End.prev = p1Start;\n ae1.outrec.backEdge = ae2.outrec.backEdge;\n if (ae1.outrec.backEdge) ae1.outrec.backEdge.outrec = ae1.outrec;\n }\n // after joining, the ae2.OutRec must contains no vertices ...\n ae2.outrec.frontEdge = undefined;\n ae2.outrec.backEdge = undefined;\n ae2.outrec.pts = undefined;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setOwner(ae2.outrec, ae1.outrec);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(ae1)) {\n ae2.outrec.pts = ae1.outrec.pts;\n ae1.outrec.pts = undefined;\n }\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\n ae1.outrec = undefined;\n ae2.outrec = undefined;\n }\n static addOutPt(ae, pt) {\n const outrec = ae.outrec;\n const toFront = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae);\n const opFront = outrec.pts;\n const opBack = opFront.next;\n if (toFront && pt == opFront.pt) return opFront;\n else if (!toFront && pt == opBack.pt) return opBack;\n const newOp = new $0b6dbf71c0c0eea1$var$OutPt(pt, outrec);\n opBack.prev = newOp;\n newOp.prev = opFront;\n newOp.next = opBack;\n opFront.next = newOp;\n if (toFront) outrec.pts = newOp;\n return newOp;\n }\n newOutRec() {\n const result = new $0b6dbf71c0c0eea1$export$1e0666df669b1ceb(this._outrecList.length);\n this._outrecList.push(result);\n return result;\n }\n startOpenPath(ae, pt) {\n const outrec = this.newOutRec();\n outrec.isOpen = true;\n if (ae.windDx > 0) {\n outrec.frontEdge = ae;\n outrec.backEdge = undefined;\n } else {\n outrec.frontEdge = undefined;\n outrec.backEdge = ae;\n }\n ae.outrec = outrec;\n const op = new $0b6dbf71c0c0eea1$var$OutPt(pt, outrec);\n outrec.pts = op;\n return op;\n }\n updateEdgeIntoAEL(ae) {\n ae.bot = ae.top;\n ae.vertexTop = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(ae);\n ae.top = ae.vertexTop.pt;\n ae.curX = ae.bot.x;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setDx(ae);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.bot);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(ae)) return;\n this.insertScanline(ae.top.y);\n this.checkJoinLeft(ae, ae.bot);\n this.checkJoinRight(ae, ae.bot, true);\n }\n static findEdgeWithMatchingLocMin(e) {\n let result = e.nextInAEL;\n while(result){\n if (result.localMin === e.localMin) return result;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(result) && e.bot !== result.bot) result = undefined;\n else result = result.nextInAEL;\n }\n result = e.prevInAEL;\n while(result){\n if (result.localMin === e.localMin) return result;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(result) && e.bot !== result.bot) return undefined;\n result = result.prevInAEL;\n }\n return result;\n }\n intersectEdges(ae1, ae2, pt) {\n let resultOp = undefined;\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\n if (this._hasOpenPaths && ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae1) || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2))) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae1) && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) return undefined;\n // the following line avoids duplicating quite a bit of code\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae2)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapActives(ae1, ae2);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n if (this._cliptype === $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union) {\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae2)) return undefined;\n } else if (ae2.localMin.polytype === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject) return undefined;\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n if (ae2.windCount !== 1) return undefined;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n if (ae2.windCount !== -1) return undefined;\n break;\n default:\n if (Math.abs(ae2.windCount) !== 1) return undefined;\n break;\n }\n // toggle contribution ...\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae1)) {\n resultOp = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae1, pt);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae1)) ae1.outrec.frontEdge = undefined;\n else ae1.outrec.backEdge = undefined;\n ae1.outrec = undefined;\n // horizontal edges can pass under open paths at a LocMins\n } else if (pt === ae1.localMin.vertex.pt && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEnd(ae1.localMin.vertex)) {\n // find the other side of the LocMin and\n // if it's 'hot' join up with it ...\n const ae3 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.findEdgeWithMatchingLocMin(ae1);\n if (ae3 && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae3)) {\n ae1.outrec = ae3.outrec;\n if (ae1.windDx > 0) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(ae3.outrec, ae1, ae3);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setSides(ae3.outrec, ae3, ae1);\n return ae3.outrec.pts;\n }\n resultOp = this.startOpenPath(ae1, pt);\n } else resultOp = this.startOpenPath(ae1, pt);\n return resultOp;\n }\n // MANAGING CLOSED PATHS FROM HERE ON\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae1)) this.split(ae1, pt);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n // UPDATE WINDING COUNTS...\n let oldE1WindCount;\n let oldE2WindCount;\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\n if (this._fillrule === $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) {\n oldE1WindCount = ae1.windCount;\n ae1.windCount = ae2.windCount;\n ae2.windCount = oldE1WindCount;\n } else {\n if (ae1.windCount + ae2.windDx === 0) ae1.windCount = -ae1.windCount;\n else ae1.windCount += ae2.windDx;\n if (ae2.windCount - ae1.windDx === 0) ae2.windCount = -ae2.windCount;\n else ae2.windCount -= ae1.windDx;\n }\n } else {\n if (this._fillrule !== $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) ae1.windCount2 += ae2.windDx;\n else ae1.windCount2 = ae1.windCount2 === 0 ? 1 : 0;\n if (this._fillrule !== $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.EvenOdd) ae2.windCount2 -= ae1.windDx;\n else ae2.windCount2 = ae2.windCount2 === 0 ? 1 : 0;\n }\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n oldE1WindCount = ae1.windCount;\n oldE2WindCount = ae2.windCount;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n oldE1WindCount = -ae1.windCount;\n oldE2WindCount = -ae2.windCount;\n break;\n default:\n oldE1WindCount = Math.abs(ae1.windCount);\n oldE2WindCount = Math.abs(ae2.windCount);\n break;\n }\n const e1WindCountIs0or1 = oldE1WindCount === 0 || oldE1WindCount === 1;\n const e2WindCountIs0or1 = oldE2WindCount === 0 || oldE2WindCount === 1;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae1) && !e1WindCountIs0or1 || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae2) && !e2WindCountIs0or1) return undefined;\n // NOW PROCESS THE INTERSECTION ...\n // if both edges are 'hot' ...\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae1) && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae2)) {\n if (oldE1WindCount !== 0 && oldE1WindCount !== 1 || oldE2WindCount !== 0 && oldE2WindCount !== 1 || ae1.localMin.polytype !== ae2.localMin.polytype && this._cliptype !== $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Xor) resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\n else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae1) || ae1.outrec === ae2.outrec) {\n // this 'else if' condition isn't strictly needed but\n // it's sensible to split polygons that only touch at\n // a common vertex (not at common edges).\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\n this.addLocalMinPoly(ae1, ae2, pt);\n } else {\n // can't treat as maxima & minima\n resultOp = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae1, pt);\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae2, pt);\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n }\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae1)) {\n resultOp = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae1, pt);\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae2)) {\n resultOp = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae2, pt);\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n } else {\n let e1Wc2;\n let e2Wc2;\n switch(this._fillrule){\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Positive:\n e1Wc2 = ae1.windCount2;\n e2Wc2 = ae2.windCount2;\n break;\n case $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95.Negative:\n e1Wc2 = -ae1.windCount2;\n e2Wc2 = -ae2.windCount2;\n break;\n default:\n e1Wc2 = Math.abs(ae1.windCount2);\n e2Wc2 = Math.abs(ae2.windCount2);\n break;\n }\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isSamePolyType(ae1, ae2)) resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\n resultOp = undefined;\n switch(this._cliptype){\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Union:\n if (e1Wc2 > 0 && e2Wc2 > 0) return undefined;\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Difference:\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae1) === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip && e1Wc2 > 0 && e2Wc2 > 0 || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getPolyType(ae1) === $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject && e1Wc2 <= 0 && e2Wc2 <= 0) resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n case $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.Xor:\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n default:\n if (e1Wc2 <= 0 || e2Wc2 <= 0) return undefined;\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n }\n }\n }\n return resultOp;\n }\n deleteFromAEL(ae) {\n const prev = ae.prevInAEL;\n const next = ae.nextInAEL;\n if (!prev && !next && ae !== this._actives) return; // already deleted\n if (prev) prev.nextInAEL = next;\n else this._actives = next;\n if (next) next.prevInAEL = prev;\n }\n adjustCurrXAndCopyToSEL(topY) {\n let ae = this._actives;\n this._sel = ae;\n while(ae){\n ae.prevInSEL = ae.prevInAEL;\n ae.nextInSEL = ae.nextInAEL;\n ae.jump = ae.nextInSEL;\n if (ae.joinWith === $0b6dbf71c0c0eea1$export$290b84559c467a5c.Left) ae.curX = ae.prevInAEL.curX; // This also avoids complications\n else ae.curX = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, topY);\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\n ae = ae.nextInAEL;\n }\n }\n executeInternal(ct, fillRule) {\n if (ct === $0b6dbf71c0c0eea1$export$9e3ecdefb2438757.None) return;\n this._fillrule = fillRule;\n this._cliptype = ct;\n this.reset();\n let y = this.popScanline();\n if (y === undefined) return;\n while(this._succeeded){\n this.insertLocalMinimaIntoAEL(y);\n let ae = this.popHorz();\n while(ae){\n this.doHorizontal(ae);\n ae = this.popHorz();\n }\n if (this._horzSegList.length > 0) {\n this.convertHorzSegsToJoins();\n this._horzSegList.length = 0;\n }\n this._currentBotY = y; // bottom of scanbeam\n y = this.popScanline();\n if (y === undefined) break; // y new top of scanbeam\n this.doIntersections(y);\n this.doTopOfScanbeam(y);\n ae = this.popHorz();\n while(ae){\n this.doHorizontal(ae);\n ae = this.popHorz();\n }\n }\n if (this._succeeded) this.processHorzJoins();\n }\n doIntersections(topY) {\n if (this.buildIntersectList(topY)) {\n this.processIntersectList();\n this.disposeIntersectNodes();\n }\n }\n disposeIntersectNodes() {\n this._intersectList.length = 0;\n }\n addNewIntersectNode(ae1, ae2, topY) {\n const result = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top);\n let ip = result.ip;\n if (!result.success) ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(ae1.curX, topY);\n if (ip.y > this._currentBotY || ip.y < topY) {\n const absDx1 = Math.abs(ae1.dx);\n const absDx2 = Math.abs(ae2.dx);\n if (absDx1 > 100 && absDx2 > 100) {\n if (absDx1 > absDx2) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\n else ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\n } else if (absDx1 > 100) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\n else if (absDx2 > 100) ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\n else {\n if (ip.y < topY) ip.y = topY;\n else ip.y = this._currentBotY;\n if (absDx1 < absDx2) ip.x = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae1, ip.y);\n else ip.x = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae2, ip.y);\n }\n }\n const node = new $0b6dbf71c0c0eea1$var$IntersectNode(ip, ae1, ae2);\n this._intersectList.push(node);\n }\n static extractFromSEL(ae) {\n const res = ae.nextInSEL;\n if (res) res.prevInSEL = ae.prevInSEL;\n ae.prevInSEL.nextInSEL = res;\n return res;\n }\n static insert1Before2InSEL(ae1, ae2) {\n ae1.prevInSEL = ae2.prevInSEL;\n if (ae1.prevInSEL) ae1.prevInSEL.nextInSEL = ae1;\n ae1.nextInSEL = ae2;\n ae2.prevInSEL = ae1;\n }\n buildIntersectList(topY) {\n if (!this._actives || !this._actives.nextInAEL) return false;\n // Calculate edge positions at the top of the current scanbeam, and from this\n // we will determine the intersections required to reach these new positions.\n this.adjustCurrXAndCopyToSEL(topY);\n // Find all edge intersections in the current scanbeam using a stable merge\n // sort that ensures only adjacent edges are intersecting. Intersect info is\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\n let left = this._sel, right, lEnd, rEnd, currBase, prevBase, tmp;\n while(left.jump){\n prevBase = undefined;\n while(left && left.jump){\n currBase = left;\n right = left.jump;\n lEnd = right;\n rEnd = right.jump;\n left.jump = rEnd;\n while(left !== lEnd && right !== rEnd)if (right.curX < left.curX) {\n tmp = right.prevInSEL;\n for(;;){\n this.addNewIntersectNode(tmp, right, topY);\n if (tmp === left) break;\n tmp = tmp.prevInSEL;\n }\n tmp = right;\n right = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.extractFromSEL(tmp);\n lEnd = right;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.insert1Before2InSEL(tmp, left);\n if (left === currBase) {\n currBase = tmp;\n currBase.jump = rEnd;\n if (prevBase === undefined) this._sel = currBase;\n else prevBase.jump = currBase;\n }\n } else left = left.nextInSEL;\n prevBase = currBase;\n left = rEnd;\n }\n left = this._sel;\n }\n return this._intersectList.length > 0;\n }\n processIntersectList() {\n // We now have a list of intersections required so that edges will be\n // correctly positioned at the top of the scanbeam. However, it's important\n // that edge intersections are processed from the bottom up, but it's also\n // crucial that intersections only occur between adjacent edges.\n // First we do a quicksort so intersections proceed in a bottom up order ...\n this._intersectList.sort((a, b)=>{\n if (a.pt.y === b.pt.y) {\n if (a.pt.x === b.pt.x) return 0;\n return a.pt.x < b.pt.x ? -1 : 1;\n }\n return a.pt.y > b.pt.y ? -1 : 1;\n });\n // Now as we process these intersections, we must sometimes adjust the order\n // to ensure that intersecting edges are always adjacent ...\n for(let i = 0; i < this._intersectList.length; ++i){\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.edgesAdjacentInAEL(this._intersectList[i])) {\n let j = i + 1;\n while(!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.edgesAdjacentInAEL(this._intersectList[j]))j++;\n // swap\n [this._intersectList[j], this._intersectList[i]] = [\n this._intersectList[i],\n this._intersectList[j]\n ];\n }\n const node = this._intersectList[i];\n this.intersectEdges(node.edge1, node.edge2, node.pt);\n this.swapPositionsInAEL(node.edge1, node.edge2);\n node.edge1.curX = node.pt.x;\n node.edge2.curX = node.pt.x;\n this.checkJoinLeft(node.edge2, node.pt, true);\n this.checkJoinRight(node.edge1, node.pt, true);\n }\n }\n swapPositionsInAEL(ae1, ae2) {\n // preconditon: ae1 must be immediately to the left of ae2\n const next = ae2.nextInAEL;\n if (next) next.prevInAEL = ae1;\n const prev = ae1.prevInAEL;\n if (prev) prev.nextInAEL = ae2;\n ae2.prevInAEL = prev;\n ae2.nextInAEL = ae1;\n ae1.prevInAEL = ae2;\n ae1.nextInAEL = next;\n if (!ae2.prevInAEL) this._actives = ae2;\n }\n static resetHorzDirection(horz, vertexMax) {\n let leftX, rightX;\n if (horz.bot.x === horz.top.x) {\n // the horizontal edge is going nowhere ...\n leftX = horz.curX;\n rightX = horz.curX;\n let ae = horz.nextInAEL;\n while(ae && ae.vertexTop !== vertexMax)ae = ae.nextInAEL;\n return {\n isLeftToRight: ae !== undefined,\n leftX: leftX,\n rightX: rightX\n };\n }\n if (horz.curX < horz.top.x) {\n leftX = horz.curX;\n rightX = horz.top.x;\n return {\n isLeftToRight: true,\n leftX: leftX,\n rightX: rightX\n };\n }\n leftX = horz.top.x;\n rightX = horz.curX;\n return {\n isLeftToRight: false,\n leftX: leftX,\n rightX: rightX\n }; // right to left\n }\n static horzIsSpike(horz) {\n const nextPt = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horz).pt;\n return horz.bot.x < horz.top.x !== horz.top.x < nextPt.x;\n }\n static trimHorz(horzEdge, preserveCollinear) {\n let wasTrimmed = false;\n let pt = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horzEdge).pt;\n while(pt.y === horzEdge.top.y){\n // always trim 180 deg. spikes (in closed paths)\n // but otherwise break if preserveCollinear = true\n if (preserveCollinear && pt.x < horzEdge.top.x !== horzEdge.bot.x < horzEdge.top.x) break;\n horzEdge.vertexTop = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horzEdge);\n horzEdge.top = pt;\n wasTrimmed = true;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isMaximaActive(horzEdge)) break;\n pt = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horzEdge).pt;\n }\n if (wasTrimmed) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setDx(horzEdge); // +/-infinity\n }\n addToHorzSegList(op) {\n if (op.outrec.isOpen) return;\n this._horzSegList.push(new $0b6dbf71c0c0eea1$var$HorzSegment(op));\n }\n getLastOp(hotEdge) {\n const outrec = hotEdge.outrec;\n return hotEdge === outrec.frontEdge ? outrec.pts : outrec.pts.next;\n }\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/ doHorizontal(horz) {\n let pt;\n const horzIsOpen = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(horz);\n const Y = horz.bot.y;\n const vertex_max = horzIsOpen ? $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getCurrYMaximaVertex_Open(horz) : $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getCurrYMaximaVertex(horz);\n // remove 180 deg.spikes and also simplify\n // consecutive horizontals when PreserveCollinear = true\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.trimHorz(horz, this.preserveCollinear);\n let { isLeftToRight: isLeftToRight, leftX: leftX, rightX: rightX } = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.resetHorzDirection(horz, vertex_max);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n const op = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(horz, new $0b6dbf71c0c0eea1$export$d379afd9763b528f(horz.curX, Y));\n this.addToHorzSegList(op);\n }\n for(;;){\n // loops through consec. horizontal edges (if open)\n let ae = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\n while(ae){\n if (ae.vertexTop === vertex_max) {\n // do this first!!\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz) && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.top);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n while(horz.vertexTop !== vertex_max){\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.updateEdgeIntoAEL(horz);\n }\n if (isLeftToRight) this.addLocalMaxPoly(horz, ae, horz.top);\n else this.addLocalMaxPoly(ae, horz, horz.top);\n }\n this.deleteFromAEL(ae);\n this.deleteFromAEL(horz);\n return;\n }\n // if horzEdge is a maxima, keep going until we reach\n // its maxima pair, otherwise check for break conditions\n if (vertex_max !== horz.vertexTop || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(horz)) {\n // otherwise stop when 'ae' is beyond the end of the horizontal line\n if (isLeftToRight && ae.curX > rightX || !isLeftToRight && ae.curX < leftX) break;\n if (ae.curX === horz.top.x && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(ae)) {\n pt = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horz).pt;\n // to maximize the possibility of putting open edges into\n // solutions, we'll only break if it's past HorzEdge's end\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae) && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isSamePolyType(ae, horz) && !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) {\n if (isLeftToRight && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, pt.y) > pt.x || !isLeftToRight && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, pt.y) < pt.x) break;\n } else if (isLeftToRight && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, pt.y) >= pt.x || !isLeftToRight && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, pt.y) <= pt.x) break;\n }\n }\n pt = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(ae.curX, Y);\n if (isLeftToRight) {\n this.intersectEdges(horz, ae, pt);\n this.swapPositionsInAEL(horz, ae);\n horz.curX = ae.curX;\n ae = horz.nextInAEL;\n } else {\n this.intersectEdges(ae, horz, pt);\n this.swapPositionsInAEL(ae, horz);\n horz.curX = ae.curX;\n ae = horz.prevInAEL;\n }\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) this.addToHorzSegList(this.getLastOp(horz));\n } // we've reached the end of this horizontal\n // check if we've finished looping\n // through consecutive horizontals\n if (horzIsOpen && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(horz)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(horz)) horz.outrec.frontEdge = undefined;\n else horz.outrec.backEdge = undefined;\n horz.outrec = undefined;\n }\n this.deleteFromAEL(horz);\n return;\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.nextVertex(horz).pt.y !== horz.top.y) break;\n // still more horizontals in bound to process ...\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.updateEdgeIntoAEL(horz);\n if (this.preserveCollinear && !horzIsOpen && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.horzIsSpike(horz)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.trimHorz(horz, true);\n const result = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.resetHorzDirection(horz, vertex_max);\n isLeftToRight = result.isLeftToRight;\n leftX = result.leftX;\n rightX = result.rightX;\n }\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n const op = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.addToHorzSegList(op);\n }\n this.updateEdgeIntoAEL(horz);\n }\n doTopOfScanbeam(y) {\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\n let ae = this._actives;\n while(ae){\n // NB 'ae' will never be horizontal here\n if (ae.top.y === y) {\n ae.curX = ae.top.x;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isMaximaActive(ae)) {\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\n continue;\n }\n // INTERMEDIATE VERTEX ...\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae, ae.top);\n this.updateEdgeIntoAEL(ae);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(ae)) this.pushHorz(ae); // horizontals are processed later\n } else ae.curX = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.topX(ae, y);\n ae = ae.nextInAEL;\n }\n }\n doMaxima(ae) {\n const prevE = ae.prevInAEL;\n let nextE = ae.nextInAEL;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpenEndActive(ae)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.addOutPt(ae, ae.top);\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHorizontal(ae)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isFront(ae)) ae.outrec.frontEdge = undefined;\n else ae.outrec.backEdge = undefined;\n ae.outrec = undefined;\n }\n this.deleteFromAEL(ae);\n }\n return nextE;\n }\n const maxPair = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getMaximaPair(ae);\n if (!maxPair) return nextE; // eMaxPair is horizontal\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.top);\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(maxPair)) this.split(maxPair, maxPair.top);\n // only non-horizontal maxima here.\n // process any edges between maxima pair ...\n while(nextE !== maxPair){\n this.intersectEdges(ae, nextE, ae.top);\n this.swapPositionsInAEL(ae, nextE);\n nextE = ae.nextInAEL;\n }\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(ae)) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) this.addLocalMaxPoly(ae, maxPair, ae.top);\n this.deleteFromAEL(maxPair);\n this.deleteFromAEL(ae);\n return prevE ? prevE.nextInAEL : this._actives;\n }\n // here ae.nextInAel == ENext == EMaxPair ...\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(ae)) this.addLocalMaxPoly(ae, maxPair, ae.top);\n this.deleteFromAEL(ae);\n this.deleteFromAEL(maxPair);\n return prevE ? prevE.nextInAEL : this._actives;\n }\n static isJoined(e) {\n return e.joinWith !== $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n }\n split(e, currPt) {\n if (e.joinWith === $0b6dbf71c0c0eea1$export$290b84559c467a5c.Right) {\n e.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n e.nextInAEL.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n this.addLocalMinPoly(e, e.nextInAEL, currPt, true);\n } else {\n e.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n e.prevInAEL.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.None;\n this.addLocalMinPoly(e.prevInAEL, e, currPt, true);\n }\n }\n checkJoinLeft(e, pt, checkCurrX = false) {\n const prev = e.prevInAEL;\n if (!prev || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(e) || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(prev) || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(e) || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(prev)) return;\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\n (e.bot.y > pt.y || prev.bot.y > pt.y)) return; // (#490)\n if (checkCurrX) {\n if ($0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25) return;\n } else if (e.curX !== prev.curX) return;\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(e.top, pt, prev.top) !== 0) return;\n if (e.outrec.idx === prev.outrec.idx) this.addLocalMaxPoly(prev, e, pt);\n else if (e.outrec.idx < prev.outrec.idx) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(e, prev);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(prev, e);\n prev.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.Right;\n e.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.Left;\n }\n checkJoinRight(e, pt, checkCurrX = false) {\n const next = e.nextInAEL;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(e) || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(e) || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isJoined(e) || !next || $0b6dbf71c0c0eea1$export$33da2edff2b544f3.isOpen(next) || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isHotEdgeActive(next)) return;\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\n (e.bot.y > pt.y || next.bot.y > pt.y)) return; // (#490)\n if (checkCurrX) {\n if ($0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25) return;\n } else if (e.curX !== next.curX) return;\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(e.top, pt, next.top) !== 0) return;\n if (e.outrec.idx === next.outrec.idx) this.addLocalMaxPoly(e, next, pt);\n else if (e.outrec.idx < next.outrec.idx) $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(e, next);\n else $0b6dbf71c0c0eea1$export$33da2edff2b544f3.joinOutrecPaths(next, e);\n e.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.Right;\n next.joinWith = $0b6dbf71c0c0eea1$export$290b84559c467a5c.Left;\n }\n static fixOutRecPts(outrec) {\n let op = outrec.pts;\n do {\n op.outrec = outrec;\n op = op.next;\n }while (op !== outrec.pts);\n }\n static setHorzSegHeadingForward(hs, opP, opN) {\n if (opP.pt.x === opN.pt.x) return false;\n if (opP.pt.x < opN.pt.x) {\n hs.leftOp = opP;\n hs.rightOp = opN;\n hs.leftToRight = true;\n } else {\n hs.leftOp = opN;\n hs.rightOp = opP;\n hs.leftToRight = false;\n }\n return true;\n }\n static updateHorzSegment(hs) {\n const op = hs.leftOp;\n const outrec = this.getRealOutRec(op.outrec);\n const outrecHasEdges = outrec.frontEdge !== undefined;\n const curr_y = op.pt.y;\n let opP = op, opN = op;\n if (outrecHasEdges) {\n const opA = outrec.pts, opZ = opA.next;\n while(opP !== opZ && opP.prev.pt.y === curr_y)opP = opP.prev;\n while(opN !== opA && opN.next.pt.y === curr_y)opN = opN.next;\n } else {\n while(opP.prev !== opN && opP.prev.pt.y === curr_y)opP = opP.prev;\n while(opN.next !== opP && opN.next.pt.y === curr_y)opN = opN.next;\n }\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp.horz === undefined;\n if (result) hs.leftOp.horz = hs;\n else hs.rightOp = undefined; // (for sorting)\n return result;\n }\n static duplicateOp(op, insert_after) {\n const result = new $0b6dbf71c0c0eea1$var$OutPt(op.pt, op.outrec);\n if (insert_after) {\n result.next = op.next;\n result.next.prev = result;\n result.prev = op;\n op.next = result;\n } else {\n result.prev = op.prev;\n result.prev.next = result;\n result.next = op;\n op.prev = result;\n }\n return result;\n }\n convertHorzSegsToJoins() {\n let k = 0;\n for (const hs of this._horzSegList)if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.updateHorzSegment(hs)) k++;\n if (k < 2) return;\n this._horzSegList.sort((hs1, hs2)=>{\n if (!hs1 || !hs2) return 0;\n if (!hs1.rightOp) return !hs2.rightOp ? 0 : 1;\n else if (!hs2.rightOp) return -1;\n else return hs1.leftOp.pt.x - hs2.leftOp.pt.x;\n });\n for(let i = 0; i < k - 1; i++){\n const hs1 = this._horzSegList[i];\n // for each HorzSegment, find others that overlap\n for(let j = i + 1; j < k; j++){\n const hs2 = this._horzSegList[j];\n if (hs2.leftOp.pt.x >= hs1.rightOp.pt.x || hs2.leftToRight === hs1.leftToRight || hs2.rightOp.pt.x <= hs1.leftOp.pt.x) continue;\n const curr_y = hs1.leftOp.pt.y;\n if (hs1.leftToRight) {\n while(hs1.leftOp.next.pt.y === curr_y && hs1.leftOp.next.pt.x <= hs2.leftOp.pt.x)hs1.leftOp = hs1.leftOp.next;\n while(hs2.leftOp.prev.pt.y === curr_y && hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x)hs2.leftOp = hs2.leftOp.prev;\n const join = new $0b6dbf71c0c0eea1$var$HorzJoin($0b6dbf71c0c0eea1$export$33da2edff2b544f3.duplicateOp(hs1.leftOp, true), $0b6dbf71c0c0eea1$export$33da2edff2b544f3.duplicateOp(hs2.leftOp, false));\n this._horzJoinList.push(join);\n } else {\n while(hs1.leftOp.prev.pt.y === curr_y && hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x)hs1.leftOp = hs1.leftOp.prev;\n while(hs2.leftOp.next.pt.y === curr_y && hs2.leftOp.next.pt.x <= hs1.leftOp.pt.x)hs2.leftOp = hs2.leftOp.next;\n const join = new $0b6dbf71c0c0eea1$var$HorzJoin($0b6dbf71c0c0eea1$export$33da2edff2b544f3.duplicateOp(hs2.leftOp, true), $0b6dbf71c0c0eea1$export$33da2edff2b544f3.duplicateOp(hs1.leftOp, false));\n this._horzJoinList.push(join);\n }\n }\n }\n }\n static getCleanPath(op) {\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n let op2 = op;\n while(op2.next !== op && (op2.pt.x === op2.next.pt.x && op2.pt.x === op2.prev.pt.x || op2.pt.y === op2.next.pt.y && op2.pt.y === op2.prev.pt.y))op2 = op2.next;\n result.push(op2.pt);\n let prevOp = op2;\n op2 = op2.next;\n while(op2 !== op){\n if ((op2.pt.x !== op2.next.pt.x || op2.pt.x !== prevOp.pt.x) && (op2.pt.y !== op2.next.pt.y || op2.pt.y !== prevOp.pt.y)) {\n result.push(op2.pt);\n prevOp = op2;\n }\n op2 = op2.next;\n }\n return result;\n }\n static pointInOpPolygon(pt, op) {\n if (op === op.next || op.prev === op.next) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n let op2 = op;\n do {\n if (op.pt.y !== pt.y) break;\n op = op.next;\n }while (op !== op2);\n if (op.pt.y === pt.y) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n let isAbove = op.pt.y < pt.y;\n const startingAbove = isAbove;\n let val = 0;\n op2 = op.next;\n while(op2 !== op){\n if (isAbove) while(op2 !== op && op2.pt.y < pt.y)op2 = op2.next;\n else while(op2 !== op && op2.pt.y > pt.y)op2 = op2.next;\n if (op2 === op) break;\n if (op2.pt.y === pt.y) {\n if (op2.pt.x === pt.x || op2.pt.y === op2.prev.pt.y && pt.x < op2.prev.pt.x !== pt.x < op2.pt.x) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n op2 = op2.next;\n if (op2 === op) break;\n continue;\n }\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x) val = 1 - val;\n else {\n const d = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, pt);\n if (d === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n }\n isAbove = !isAbove;\n op2 = op2.next;\n }\n if (isAbove !== startingAbove) {\n const d = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, pt);\n if (d === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n if (val === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n else return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsInside;\n }\n static path1InsidePath2(op1, op2) {\n let result;\n let outside_cnt = 0;\n let op = op1;\n do {\n result = this.pointInOpPolygon(op.pt, op2);\n if (result === $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside) ++outside_cnt;\n else if (result === $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsInside) --outside_cnt;\n op = op.next;\n }while (op !== op1 && Math.abs(outside_cnt) < 2);\n if (Math.abs(outside_cnt) > 1) return outside_cnt < 0;\n const mp = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getBoundsPath(this.getCleanPath(op1)).midPoint();\n const path2 = this.getCleanPath(op2);\n return $0b6dbf71c0c0eea1$export$9bad362b29d84293.pointInPolygon(mp, path2) !== $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n }\n moveSplits(fromOr, toOr) {\n if (!fromOr.splits) return;\n toOr.splits = toOr.splits || [];\n for (const i of fromOr.splits)toOr.splits.push(i);\n fromOr.splits = undefined;\n }\n processHorzJoins() {\n for (const j of this._horzJoinList){\n const or1 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getRealOutRec(j.op1.outrec);\n let or2 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getRealOutRec(j.op2.outrec);\n const op1b = j.op1.next;\n const op2b = j.op2.prev;\n j.op1.next = j.op2;\n j.op2.prev = j.op1;\n op1b.prev = op2b;\n op2b.next = op1b;\n if (or1 === or2) {\n or2 = this.newOutRec();\n or2.pts = op1b;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.fixOutRecPts(or2);\n if (or1.pts.outrec === or2) {\n or1.pts = j.op1;\n or1.pts.outrec = or1;\n }\n if (this._using_polytree) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.path1InsidePath2(or1.pts, or2.pts)) {\n const tmp = or1.pts;\n or1.pts = or2.pts;\n or2.pts = tmp;\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.fixOutRecPts(or1);\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.fixOutRecPts(or2);\n or2.owner = or1.owner;\n } else if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.path1InsidePath2(or2.pts, or1.pts)) or2.owner = or1;\n else or2.owner = or1.owner;\n or1.splits = or1.splits || [];\n or1.splits.push(or2.idx);\n } else or2.owner = or1;\n } else {\n or2.pts = undefined;\n if (this._using_polytree) {\n $0b6dbf71c0c0eea1$export$33da2edff2b544f3.setOwner(or2, or1);\n this.moveSplits(or2, or1);\n } else or2.owner = or1;\n }\n }\n }\n static ptsReallyClose(pt1, pt2) {\n return Math.abs(pt1.x - pt2.x) < 2 && Math.abs(pt1.y - pt2.y) < 2;\n }\n static isVerySmallTriangle(op) {\n return op.next.next === op.prev && (this.ptsReallyClose(op.prev.pt, op.next.pt) || this.ptsReallyClose(op.pt, op.next.pt) || this.ptsReallyClose(op.pt, op.prev.pt));\n }\n static isValidClosedPath(op) {\n return op !== undefined && op.next !== op && (op.next !== op.prev || !this.isVerySmallTriangle(op));\n }\n static disposeOutPt(op) {\n const result = op.next === op ? undefined : op.next;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return result;\n }\n cleanCollinear(outrec) {\n outrec = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getRealOutRec(outrec);\n if (outrec === undefined || outrec.isOpen) return;\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidClosedPath(outrec.pts)) {\n outrec.pts = undefined;\n return;\n }\n let startOp = outrec.pts;\n let op2 = startOp;\n for(;;){\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0 && (op2.pt === op2.prev.pt || op2.pt === op2.next.pt || !this.preserveCollinear || $0b6dbf71c0c0eea1$export$9bad362b29d84293.dotProduct(op2.prev.pt, op2.pt, op2.next.pt) < 0)) {\n if (op2 === outrec.pts) outrec.pts = op2.prev;\n op2 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.disposeOutPt(op2);\n if (!$0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidClosedPath(op2)) {\n outrec.pts = undefined;\n return;\n }\n startOp = op2;\n continue;\n }\n op2 = op2.next;\n if (op2 === startOp) break;\n }\n this.fixSelfIntersects(outrec);\n }\n doSplitOp(outrec, splitOp) {\n // splitOp.prev <=> splitOp &&\n // splitOp.next <=> splitOp.next.next are intersecting\n const prevOp = splitOp.prev;\n const nextNextOp = splitOp.next.next;\n outrec.pts = prevOp;\n const ip = $0b6dbf71c0c0eea1$export$9bad362b29d84293.getIntersectPoint(prevOp.pt, splitOp.pt, splitOp.next.pt, nextNextOp.pt).ip;\n const area1 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.area(prevOp);\n const absArea1 = Math.abs(area1);\n if (absArea1 < 2) {\n outrec.pts = undefined;\n return;\n }\n const area2 = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.areaTriangle(ip, splitOp.pt, splitOp.next.pt);\n const absArea2 = Math.abs(area2);\n // de-link splitOp and splitOp.next from the path\n // while inserting the intersection point\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\n nextNextOp.prev = prevOp;\n prevOp.next = nextNextOp;\n } else {\n const newOp2 = new $0b6dbf71c0c0eea1$var$OutPt(ip, outrec);\n newOp2.prev = prevOp;\n newOp2.next = nextNextOp;\n nextNextOp.prev = newOp2;\n prevOp.next = newOp2;\n }\n // nb: area1 is the path's area *before* splitting, whereas area2 is\n // the area of the triangle containing splitOp & splitOp.next.\n // So the only way for these areas to have the same sign is if\n // the split triangle is larger than the path containing prevOp or\n // if there's more than one self=intersection.\n if (absArea2 > 1 && (absArea2 > absArea1 || area2 > 0 === area1 > 0)) {\n const newOutRec = this.newOutRec();\n newOutRec.owner = outrec.owner;\n splitOp.outrec = newOutRec;\n splitOp.next.outrec = newOutRec;\n const newOp = new $0b6dbf71c0c0eea1$var$OutPt(ip, newOutRec);\n newOp.prev = splitOp.next;\n newOp.next = splitOp;\n newOutRec.pts = newOp;\n splitOp.prev = newOp;\n splitOp.next.next = newOp;\n if (this._using_polytree) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.path1InsidePath2(prevOp, newOp)) {\n newOutRec.splits = newOutRec.splits || [];\n newOutRec.splits.push(outrec.idx);\n } else {\n outrec.splits = outrec.splits || [];\n outrec.splits.push(newOutRec.idx);\n }\n }\n }\n // else { splitOp = undefined; splitOp.next = undefined; }\n }\n fixSelfIntersects(outrec) {\n let op2 = outrec.pts;\n for(;;){\n if (op2.prev === op2.next.next) break;\n if ($0b6dbf71c0c0eea1$export$9bad362b29d84293.segsIntersect(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt)) {\n this.doSplitOp(outrec, op2);\n if (!outrec.pts) return;\n op2 = outrec.pts;\n continue;\n } else op2 = op2.next;\n if (op2 === outrec.pts) break;\n }\n }\n static buildPath(op, reverse, isOpen, path) {\n if (op === undefined || op.next === op || !isOpen && op.next === op.prev) return false;\n path.length = 0;\n let lastPt;\n let op2;\n if (reverse) {\n lastPt = op.pt;\n op2 = op.prev;\n } else {\n op = op.next;\n lastPt = op.pt;\n op2 = op.next;\n }\n path.push(lastPt);\n while(op2 !== op){\n if (op2.pt !== lastPt) {\n lastPt = op2.pt;\n path.push(lastPt);\n }\n if (reverse) op2 = op2.prev;\n else op2 = op2.next;\n }\n if (path.length === 3 && this.isVerySmallTriangle(op2)) return false;\n else return true;\n }\n buildPaths(solutionClosed, solutionOpen) {\n solutionClosed.length = 0;\n solutionOpen.length = 0;\n let i = 0;\n while(i < this._outrecList.length){\n const outrec = this._outrecList[i++];\n if (!outrec.pts) continue;\n const path = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n if (outrec.isOpen) {\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, true, path)) solutionOpen.push(path);\n } else {\n this.cleanCollinear(outrec);\n // closed paths should always return a Positive orientation\n // except when reverseSolution == true\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, false, path)) solutionClosed.push(path);\n }\n }\n return true;\n }\n static getBoundsPath(path) {\n if (path.length === 0) return new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f();\n const result = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.InvalidRect64;\n for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result;\n }\n checkBounds(outrec) {\n if (outrec.pts === undefined) return false;\n if (!outrec.bounds.isEmpty()) return true;\n this.cleanCollinear(outrec);\n if (outrec.pts === undefined || !$0b6dbf71c0c0eea1$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, false, outrec.path)) return false;\n outrec.bounds = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getBoundsPath(outrec.path);\n return true;\n }\n checkSplitOwner(outrec, splits) {\n for (const i of splits){\n const split = $0b6dbf71c0c0eea1$export$33da2edff2b544f3.getRealOutRec(this._outrecList[i]);\n if (split === undefined || split === outrec || split.recursiveSplit === outrec) continue;\n split.recursiveSplit = outrec; //#599\n if (split.splits !== undefined && this.checkSplitOwner(outrec, split.splits)) return true;\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.isValidOwner(outrec, split) && this.checkBounds(split) && split.bounds.containsRect(outrec.bounds) && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.path1InsidePath2(outrec.pts, split.pts)) {\n outrec.owner = split; //found in split\n return true;\n }\n }\n return false;\n }\n recursiveCheckOwners(outrec, polypath) {\n // pre-condition: outrec will have valid bounds\n // post-condition: if a valid path, outrec will have a polypath\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty()) return;\n while(outrec.owner !== undefined){\n if (outrec.owner.splits !== undefined && this.checkSplitOwner(outrec, outrec.owner.splits)) break;\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) && $0b6dbf71c0c0eea1$export$33da2edff2b544f3.path1InsidePath2(outrec.pts, outrec.owner.pts)) break;\n outrec.owner = outrec.owner.owner;\n }\n if (outrec.owner !== undefined) {\n if (outrec.owner.polypath === undefined) this.recursiveCheckOwners(outrec.owner, polypath);\n outrec.polypath = outrec.owner.polypath.addChild(outrec.path);\n } else outrec.polypath = polypath.addChild(outrec.path);\n }\n buildTree(polytree, solutionOpen) {\n polytree.clear();\n solutionOpen.length = 0;\n let i = 0;\n while(i < this._outrecList.length){\n const outrec = this._outrecList[i++];\n if (outrec.pts === undefined) continue;\n if (outrec.isOpen) {\n const open_path = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n if ($0b6dbf71c0c0eea1$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, true, open_path)) solutionOpen.push(open_path);\n continue;\n }\n if (this.checkBounds(outrec)) this.recursiveCheckOwners(outrec, polytree);\n }\n }\n getBounds() {\n const bounds = $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.InvalidRect64;\n for (const t of this._vertexList){\n let v = t;\n do {\n if (v.pt.x < bounds.left) bounds.left = v.pt.x;\n if (v.pt.x > bounds.right) bounds.right = v.pt.x;\n if (v.pt.y < bounds.top) bounds.top = v.pt.y;\n if (v.pt.y > bounds.bottom) bounds.bottom = v.pt.y;\n v = v.next;\n }while (v !== t);\n }\n return bounds.isEmpty() ? new $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : bounds;\n }\n}\nclass $0b6dbf71c0c0eea1$export$389255fe4ace408b extends $0b6dbf71c0c0eea1$export$33da2edff2b544f3 {\n addPath(path, polytype, isOpen = false) {\n super.addPath(path, polytype, isOpen);\n }\n addReusableData(reusableData) {\n super.addReuseableData(reusableData);\n }\n addPaths(paths, polytype, isOpen = false) {\n super.addPaths(paths, polytype, isOpen);\n }\n addSubjectPaths(paths) {\n this.addPaths(paths, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject);\n }\n addOpenSubjectPaths(paths) {\n this.addPaths(paths, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Subject, true);\n }\n addClipPaths(paths) {\n this.addPaths(paths, $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19.Clip);\n }\n execute(clipType, fillRule, solutionClosed, solutionOpen = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9()) {\n solutionClosed.length = 0;\n solutionOpen.length = 0;\n try {\n this.executeInternal(clipType, fillRule);\n this.buildPaths(solutionClosed, solutionOpen);\n } catch (error) {\n this._succeeded = false;\n }\n this.clearSolutionOnly();\n return this._succeeded;\n }\n executePolyTree(clipType, fillRule, polytree, openPaths = new $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9()) {\n polytree.clear();\n openPaths.length = 0;\n this._using_polytree = true;\n try {\n this.executeInternal(clipType, fillRule);\n this.buildTree(polytree, openPaths);\n } catch (error) {\n this._succeeded = false;\n }\n this.clearSolutionOnly();\n return this._succeeded;\n }\n}\nclass $0b6dbf71c0c0eea1$export$106ec032583e753f {\n get isHole() {\n return this.getIsHole();\n }\n constructor(parent){\n this.children = [];\n this.forEach = this.children.forEach;\n this._parent = parent;\n }\n getLevel() {\n let result = 0;\n let pp = this._parent;\n while(pp !== undefined){\n ++result;\n pp = pp._parent;\n }\n return result;\n }\n get level() {\n return this.getLevel();\n }\n getIsHole() {\n const lvl = this.getLevel();\n return lvl !== 0 && (lvl & 1) === 0;\n }\n get count() {\n return this.children.length;\n }\n clear() {\n this.children.length = 0;\n }\n} // end of PolyPathBase class\nclass $0b6dbf71c0c0eea1$export$da0488db9930c0ed extends $0b6dbf71c0c0eea1$export$106ec032583e753f {\n constructor(parent){\n super(parent);\n }\n addChild(p) {\n const newChild = new $0b6dbf71c0c0eea1$export$da0488db9930c0ed(this);\n newChild.polygon = p;\n this.children.push(newChild);\n return newChild;\n }\n get(index) {\n if (index < 0 || index >= this.children.length) throw new Error(\"InvalidOperationException\");\n return this.children[index];\n }\n child(index) {\n if (index < 0 || index >= this.children.length) throw new Error(\"InvalidOperationException\");\n return this.children[index];\n }\n area() {\n let result = this.polygon ? $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908.area(this.polygon) : 0;\n for (const polyPathBase of this.children){\n const child = polyPathBase;\n result += child.area();\n }\n return result;\n }\n}\nclass $0b6dbf71c0c0eea1$export$a6691aab770c5bdb extends $0b6dbf71c0c0eea1$export$da0488db9930c0ed {\n}\nclass $0b6dbf71c0c0eea1$export$d4a89d8e4fb761df extends Error {\n constructor(description){\n super(description);\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\n// Note: all clipping operations except for Difference are commutative.\nvar $0b6dbf71c0c0eea1$export$9e3ecdefb2438757;\n(function(ClipType) {\n ClipType[ClipType[\"None\"] = 0] = \"None\";\n ClipType[ClipType[\"Intersection\"] = 1] = \"Intersection\";\n ClipType[ClipType[\"Union\"] = 2] = \"Union\";\n ClipType[ClipType[\"Difference\"] = 3] = \"Difference\";\n ClipType[ClipType[\"Xor\"] = 4] = \"Xor\";\n})($0b6dbf71c0c0eea1$export$9e3ecdefb2438757 || ($0b6dbf71c0c0eea1$export$9e3ecdefb2438757 = {}));\nvar $0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19;\n(function(PathType) {\n PathType[PathType[\"Subject\"] = 0] = \"Subject\";\n PathType[PathType[\"Clip\"] = 1] = \"Clip\";\n})($0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19 || ($0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19 = {}));\n// By far the most widely used filling rules for polygons are EvenOdd\n// and NonZero, sometimes called Alternate and Winding respectively.\n// https://en.wikipedia.org/wiki/Nonzero-rule\nvar $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95;\n(function(FillRule) {\n FillRule[FillRule[\"EvenOdd\"] = 0] = \"EvenOdd\";\n FillRule[FillRule[\"NonZero\"] = 1] = \"NonZero\";\n FillRule[FillRule[\"Positive\"] = 2] = \"Positive\";\n FillRule[FillRule[\"Negative\"] = 3] = \"Negative\";\n})($0b6dbf71c0c0eea1$export$f26b42c94e8a4f95 || ($0b6dbf71c0c0eea1$export$f26b42c94e8a4f95 = {}));\n// PointInPolygon\nvar $0b6dbf71c0c0eea1$export$6a3f4acf2fce52a0;\n(function(PipResult) {\n PipResult[PipResult[\"Inside\"] = 0] = \"Inside\";\n PipResult[PipResult[\"Outside\"] = 1] = \"Outside\";\n PipResult[PipResult[\"OnEdge\"] = 2] = \"OnEdge\";\n})($0b6dbf71c0c0eea1$export$6a3f4acf2fce52a0 || ($0b6dbf71c0c0eea1$export$6a3f4acf2fce52a0 = {}));\nclass $0b6dbf71c0c0eea1$export$b12670b10302a8b7 extends Array {\n}\nclass $0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9 extends Array {\n}\nclass $0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f {\n constructor(lOrIsValidOrRec, t, r, b){\n if (typeof lOrIsValidOrRec === \"boolean\") {\n if (lOrIsValidOrRec) {\n this.left = 0;\n this.top = 0;\n this.right = 0;\n this.bottom = 0;\n } else {\n this.left = Number.MAX_SAFE_INTEGER;\n this.top = Number.MAX_SAFE_INTEGER;\n this.right = Number.MIN_SAFE_INTEGER;\n this.bottom = Number.MIN_SAFE_INTEGER;\n }\n } else if (typeof lOrIsValidOrRec === \"number\") {\n this.left = lOrIsValidOrRec;\n this.top = t;\n this.right = r;\n this.bottom = b;\n } else {\n this.left = lOrIsValidOrRec.left;\n this.top = lOrIsValidOrRec.top;\n this.right = lOrIsValidOrRec.right;\n this.bottom = lOrIsValidOrRec.bottom;\n }\n }\n get width() {\n return this.right - this.left;\n }\n set width(value) {\n this.right = this.left + value;\n }\n get height() {\n return this.bottom - this.top;\n }\n set height(value) {\n this.bottom = this.top + value;\n }\n isEmpty() {\n return this.bottom <= this.top || this.right <= this.left;\n }\n midPoint() {\n return new $0b6dbf71c0c0eea1$export$d379afd9763b528f((this.left + this.right) / 2, (this.top + this.bottom) / 2);\n }\n contains(pt) {\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\n }\n containsRect(rec) {\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\n }\n intersects(rec) {\n return Math.max(this.left, rec.left) <= Math.min(this.right, rec.right) && Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom);\n }\n asPath() {\n const result = new $0b6dbf71c0c0eea1$export$b12670b10302a8b7();\n result.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(this.left, this.top));\n result.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(this.right, this.top));\n result.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(this.right, this.bottom));\n result.push(new $0b6dbf71c0c0eea1$export$d379afd9763b528f(this.left, this.bottom));\n return result;\n }\n}\nclass $0b6dbf71c0c0eea1$export$d379afd9763b528f {\n constructor(xOrPt, yOrScale){\n if (typeof xOrPt === \"number\" && typeof yOrScale === \"number\") {\n this.x = Math.round(xOrPt);\n this.y = Math.round(yOrScale);\n } else {\n const pt = xOrPt;\n if (yOrScale !== undefined) {\n this.x = Math.round(pt.x * yOrScale);\n this.y = Math.round(pt.y * yOrScale);\n } else {\n this.x = pt.x;\n this.y = pt.y;\n }\n //} else {\n // const pt = xOrPt as Point64\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\n }\n }\n static equals(lhs, rhs) {\n return lhs.x === rhs.x && lhs.y === rhs.y;\n }\n static notEquals(lhs, rhs) {\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\n }\n static add(lhs, rhs) {\n return new $0b6dbf71c0c0eea1$export$d379afd9763b528f(lhs.x + rhs.x, lhs.y + rhs.y);\n }\n static subtract(lhs, rhs) {\n return new $0b6dbf71c0c0eea1$export$d379afd9763b528f(lhs.x - rhs.x, lhs.y - rhs.y);\n }\n toString() {\n return `${this.x},${this.y} `;\n }\n equals(obj) {\n if (obj instanceof $0b6dbf71c0c0eea1$export$d379afd9763b528f) return $0b6dbf71c0c0eea1$export$d379afd9763b528f.equals(this, obj);\n return false;\n }\n}\nclass $0b6dbf71c0c0eea1$export$9bad362b29d84293 {\n static checkPrecision(precision) {\n if (precision < -8 || precision > 8) throw new Error(this.precision_range_error);\n }\n static isAlmostZero(value) {\n return Math.abs(value) <= this.floatingPointTolerance;\n }\n static crossProduct(pt1, pt2, pt3) {\n return (pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x);\n }\n static dotProduct(pt1, pt2, pt3) {\n return (pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y);\n }\n static checkCastInt64(val) {\n if (val >= this.max_coord || val <= this.min_coord) return this.Invalid64;\n return Math.round(val);\n }\n static getIntersectPt(ln1a, ln1b, ln2a, ln2b) {\n const dy1 = ln1b.y - ln1a.y;\n const dx1 = ln1b.x - ln1a.x;\n const dy2 = ln2b.y - ln2a.y;\n const dx2 = ln2b.x - ln2a.x;\n const det = dy1 * dx2 - dy2 * dx1;\n let ip;\n if (det === 0.0) {\n ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(0, 0);\n return {\n ip: ip,\n success: false\n };\n }\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\n if (t <= 0.0) ip = ln1a;\n else if (t >= 1.0) ip = ln1b;\n else ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(ln1a.x + t * dx1, ln1a.y + t * dy1);\n return {\n ip: ip,\n success: true\n };\n }\n static getIntersectPoint(ln1a, ln1b, ln2a, ln2b) {\n const dy1 = ln1b.y - ln1a.y;\n const dx1 = ln1b.x - ln1a.x;\n const dy2 = ln2b.y - ln2a.y;\n const dx2 = ln2b.x - ln2a.x;\n const det = dy1 * dx2 - dy2 * dx1;\n let ip;\n if (det === 0.0) {\n ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(0, 0);\n return {\n ip: ip,\n success: false\n };\n }\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\n if (t <= 0.0) ip = ln1a;\n else if (t >= 1.0) ip = ln2a;\n else ip = new $0b6dbf71c0c0eea1$export$d379afd9763b528f(ln1a.x + t * dx1, ln1a.y + t * dy1);\n return {\n ip: ip,\n success: true\n };\n }\n static segsIntersect(seg1a, seg1b, seg2a, seg2b, inclusive = false) {\n if (inclusive) {\n const res1 = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg1a, seg2a, seg2b);\n const res2 = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg1b, seg2a, seg2b);\n if (res1 * res2 > 0) return false;\n const res3 = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg2a, seg1a, seg1b);\n const res4 = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg2b, seg1a, seg1b);\n if (res3 * res4 > 0) return false;\n return res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0;\n } else return $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg1a, seg2a, seg2b) * $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg1b, seg2a, seg2b) < 0 && $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg2a, seg1a, seg1b) * $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(seg2b, seg1a, seg1b) < 0;\n }\n static getClosestPtOnSegment(offPt, seg1, seg2) {\n if (seg1.x === seg2.x && seg1.y === seg2.y) return seg1;\n const dx = seg2.x - seg1.x;\n const dy = seg2.y - seg1.y;\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / (dx * dx + dy * dy);\n if (q < 0) q = 0;\n else if (q > 1) q = 1;\n return new $0b6dbf71c0c0eea1$export$d379afd9763b528f(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\n }\n static pointInPolygon(pt, polygon) {\n const len = polygon.length;\n let start = 0;\n if (len < 3) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n while(start < len && polygon[start].y === pt.y)start++;\n if (start === len) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n let d = 0;\n let isAbove = polygon[start].y < pt.y;\n const startingAbove = isAbove;\n let val = 0;\n let i = start + 1;\n let end = len;\n for(;;){\n if (i === end) {\n if (end === 0 || start === 0) break;\n end = start;\n i = 0;\n }\n if (isAbove) {\n while(i < end && polygon[i].y < pt.y)i++;\n if (i === end) continue;\n } else {\n while(i < end && polygon[i].y > pt.y)i++;\n if (i === end) continue;\n }\n const curr = polygon[i];\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\n if (curr.y === pt.y) {\n if (curr.x === pt.x || curr.y === prev.y && pt.x < prev.x !== pt.x < curr.x) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n i++;\n if (i === start) break;\n continue;\n }\n if (pt.x < curr.x && pt.x < prev.x) ;\n else if (pt.x > prev.x && pt.x > curr.x) val = 1 - val; // toggle val\n else {\n d = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(prev, curr, pt);\n if (d === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n isAbove = !isAbove;\n i++;\n }\n if (isAbove !== startingAbove) {\n if (i === len) i = 0;\n else d = $0b6dbf71c0c0eea1$export$9bad362b29d84293.crossProduct(polygon[i - 1], polygon[i], pt);\n if (d === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n if (val === 0) return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsOutside;\n return $0b6dbf71c0c0eea1$export$20896d302a4e5029.IsInside;\n }\n}\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxInt64 = 9223372036854775807;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxCoord = $0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxInt64 / 4;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.max_coord = $0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxCoord;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.min_coord = -$0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxCoord;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.Invalid64 = $0b6dbf71c0c0eea1$export$9bad362b29d84293.MaxInt64;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.defaultArcTolerance = 0.25;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.floatingPointTolerance = 1E-12;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.defaultMinimumEdgeLength = 0.1;\n$0b6dbf71c0c0eea1$export$9bad362b29d84293.precision_range_error = \"Error: Precision is out of range.\";\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nconst $00adfa846be5871c$var$DIRECTION_EPSILON = 1e-3;\nconst $00adfa846be5871c$var$DIST_EPSILON = 1e2;\nfunction $00adfa846be5871c$var$sameDirection(p0, p1, p2) {\n const dx1 = p1.x - p0.x;\n const dy1 = p1.y - p0.y;\n const dx2 = p2.x - p1.x;\n const dy2 = p2.y - p1.y;\n const s1 = dx1 / dy1;\n const s2 = dx2 / dy2;\n return Math.abs(s1 - s2) < $00adfa846be5871c$var$DIRECTION_EPSILON;\n}\nfunction $00adfa846be5871c$var$areClose(p0, p1) {\n const dx = p1.x - p0.x;\n const dy = p1.y - p0.y;\n return Math.sqrt(dx * dx + dy * dy) < $00adfa846be5871c$var$DIST_EPSILON;\n}\nfunction $00adfa846be5871c$var$areEqual(p0, p1) {\n return p0.x === p1.x && p0.y === p1.y;\n}\nfunction $00adfa846be5871c$export$a1384fe5bb05e0aa(points) {\n for(let k = 0; k < points.length; k++){\n // remove points that are equal or very close to each other\n const v = points[k];\n while(true){\n const k1 = k + 1;\n if (points.length > k1 && ($00adfa846be5871c$var$areEqual(v, points[k1]) || $00adfa846be5871c$var$areClose(v, points[k1]))) points.splice(k1, 1);\n else break;\n }\n // join lines that are almost the same direction\n while(true){\n const k1 = k + 1;\n const k2 = k + 2;\n if (points.length > k2 && $00adfa846be5871c$var$sameDirection(v, points[k1], points[k2])) points.splice(k + 1, 1);\n else break;\n }\n }\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nfunction $60fc547e70fa748b$var$xzToXzCopy(v, target) {\n target.x = v.x;\n target.y = v.z;\n}\nfunction $60fc547e70fa748b$var$epsEquals(a, b) {\n return Math.abs(a - b) <= 500;\n}\nfunction $60fc547e70fa748b$var$vectorEpsEquals(v0, v1) {\n return $60fc547e70fa748b$var$epsEquals(v0.x, v1.x) && $60fc547e70fa748b$var$epsEquals(v0.y, v1.y) && $60fc547e70fa748b$var$epsEquals(v0.z, v1.z);\n}\nfunction $60fc547e70fa748b$export$a4592ad7ee5e85f(tri, paths) {\n const indices = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const edges = [\n new (0, $e06gU.Line3)(),\n new (0, $e06gU.Line3)(),\n new (0, $e06gU.Line3)()\n ];\n const line = new (0, $e06gU.Line3)();\n const ray = new (0, $e06gU.Line3)();\n ray.start.set(0, 0, 0).addScaledVector(tri.a, 1 / 3).addScaledVector(tri.b, 1 / 3).addScaledVector(tri.c, 1 / 3);\n $60fc547e70fa748b$var$xzToXzCopy(ray.start, ray.start);\n ray.end.copy(ray.start);\n ray.end.y += 1e10;\n // get all triangle edges\n for(let i = 0; i < 3; i++){\n const i1 = (i + 1) % 3;\n const p0 = tri[indices[i]];\n const p1 = tri[indices[i1]];\n const edge = edges[i];\n $60fc547e70fa748b$var$xzToXzCopy(p0, edge.start);\n $60fc547e70fa748b$var$xzToXzCopy(p1, edge.end);\n }\n let crossCount = 0;\n for(let p = 0, pl = paths.length; p < pl; p++){\n const points = paths[p];\n for(let i = 0, l = points.length; i < l; i++){\n const i1 = (i + 1) % l;\n line.start.copy(points[i]);\n line.start.z = 0;\n line.end.copy(points[i1]);\n line.end.z = 0;\n if ($60fc547e70fa748b$var$lineCrossesLine(ray, line)) crossCount++;\n for(let e = 0; e < 3; e++){\n const edge = edges[e];\n if ($60fc547e70fa748b$var$lineCrossesLine(edge, line) || $60fc547e70fa748b$var$vectorEpsEquals(edge.start, line.start) || $60fc547e70fa748b$var$vectorEpsEquals(edge.end, line.end) || $60fc547e70fa748b$var$vectorEpsEquals(edge.end, line.start) || $60fc547e70fa748b$var$vectorEpsEquals(edge.start, line.end)) return false;\n }\n }\n }\n return crossCount % 2 === 1;\n}\n// https://stackoverflow.com/questions/3838329/how-can-i-check-if-two-segments-intersect\nfunction $60fc547e70fa748b$var$lineCrossesLine(l1, l2) {\n function ccw(A, B, C) {\n return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);\n }\n const A = l1.start;\n const B = l1.end;\n const C = l2.start;\n const D = l2.end;\n return ccw(A, C, D) !== ccw(B, C, D) && ccw(A, B, C) !== ccw(A, B, D);\n}\n\n\n\nvar $e06gU = parcelRequire(\"e06gU\");\nfunction $2683a3650d27fd1c$export$c56c51fae37b2d63(geometry) {\n const { index: index } = geometry;\n const posAttr = geometry.attributes.position;\n return index ? index.count / 3 : posAttr.count / 3;\n}\n\n\nconst $00d3e1a2b175655e$var$_tri = new (0, $e06gU.Triangle)();\nfunction $00d3e1a2b175655e$export$22df3f56fb458152(geometry) {\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const triCount = (0, $2683a3650d27fd1c$export$c56c51fae37b2d63)(geometry);\n return new Array(triCount).fill().map((v, i)=>{\n let i0 = i * 3 + 0;\n let i1 = i * 3 + 1;\n let i2 = i * 3 + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n $00d3e1a2b175655e$var$_tri.a.fromBufferAttribute(posAttr, i0);\n $00d3e1a2b175655e$var$_tri.b.fromBufferAttribute(posAttr, i1);\n $00d3e1a2b175655e$var$_tri.c.fromBufferAttribute(posAttr, i2);\n $00d3e1a2b175655e$var$_tri.a.y = 0;\n $00d3e1a2b175655e$var$_tri.b.y = 0;\n $00d3e1a2b175655e$var$_tri.c.y = 0;\n // get the projected area of the triangle to sort largest triangles first\n return {\n area: $00d3e1a2b175655e$var$_tri.getArea(),\n index: i\n };\n }).sort((a, b)=>{\n // sort the triangles largest to smallest\n return b.area - a.area;\n }).map((o)=>{\n // map to the triangle index\n return o.index;\n });\n}\n\n\n\nconst $b7cc2dc72cc279b6$var$AREA_EPSILON = 1e-8;\nconst $b7cc2dc72cc279b6$var$UP_VECTOR = /* @__PURE__ */ new (0, $e06gU.Vector3)(0, 1, 0);\nconst $b7cc2dc72cc279b6$var$_tri = /* @__PURE__ */ new (0, $e06gU.Triangle)();\nconst $b7cc2dc72cc279b6$var$_normal = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $b7cc2dc72cc279b6$var$_center = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nconst $b7cc2dc72cc279b6$var$_vec = /* @__PURE__ */ new (0, $e06gU.Vector3)();\nfunction $b7cc2dc72cc279b6$var$convertPathToGeometry(path, scale) {\n const vector2s = path.map((points)=>{\n return points.flatMap((v)=>new (0, $e06gU.Vector2)(v.x / scale, v.y / scale));\n });\n const holesShapes = vector2s.filter((p)=>(0, $e06gU.ShapeUtils).isClockWise(p)).map((p)=>new (0, $e06gU.Shape)(p));\n const solidShapes = vector2s.filter((p)=>!(0, $e06gU.ShapeUtils).isClockWise(p)).map((p)=>{\n const shape = new (0, $e06gU.Shape)(p);\n shape.holes = holesShapes;\n return shape;\n });\n // flip the triangles so they're facing in the right direction\n const result = new (0, $e06gU.ShapeGeometry)(solidShapes).rotateX(Math.PI / 2);\n result.index.array.reverse();\n return result;\n}\nfunction $b7cc2dc72cc279b6$var$convertPathToLineSegments(path, scale) {\n const arr = [];\n path.forEach((points)=>{\n for(let i = 0, l = points.length; i < l; i++){\n const i1 = (i + 1) % points.length;\n const p0 = points[i];\n const p1 = points[i1];\n arr.push(new (0, $e06gU.Vector3)(p0.x / scale, 0, p0.y / scale), new (0, $e06gU.Vector3)(p1.x / scale, 0, p1.y / scale));\n }\n });\n const result = new (0, $e06gU.BufferGeometry)();\n result.setFromPoints(arr);\n return result;\n}\nconst $b7cc2dc72cc279b6$export$1d778cb9e99a63d0 = 0;\nconst $b7cc2dc72cc279b6$export$b1968b297e0facc4 = 1;\nconst $b7cc2dc72cc279b6$export$d2881bb52ea2a3ff = 2;\nclass $b7cc2dc72cc279b6$export$8f233aafe78e44af {\n constructor(){\n this.iterationTime = 30;\n this.intScalar = 1e9;\n this.doubleSided = false;\n this.sortTriangles = false;\n this.output = $b7cc2dc72cc279b6$export$1d778cb9e99a63d0;\n }\n generateAsync(geometry, options = {}) {\n return new Promise((resolve, reject)=>{\n const { signal: signal } = options;\n const task = this.generate(geometry, options);\n run();\n function run() {\n if (signal && signal.aborted) reject(new Error(\"SilhouetteGenerator: Process aborted via AbortSignal.\"));\n const result = task.next();\n if (result.done) resolve(result.value);\n else requestAnimationFrame(run);\n }\n });\n }\n *generate(geometry, options = {}) {\n const { iterationTime: iterationTime, intScalar: intScalar, doubleSided: doubleSided, output: output, sortTriangles: sortTriangles } = this;\n const { onProgress: onProgress } = options;\n const power = Math.log10(intScalar);\n const extendMultiplier = Math.pow(10, -(power - 2));\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const triCount = (0, $2683a3650d27fd1c$export$c56c51fae37b2d63)(geometry);\n let overallPath = null;\n const triList = sortTriangles ? (0, $00d3e1a2b175655e$export$22df3f56fb458152)(geometry) : new Array(triCount).fill().map((v, i)=>i);\n const handle = {\n getGeometry () {\n if (output === $b7cc2dc72cc279b6$export$1d778cb9e99a63d0) return $b7cc2dc72cc279b6$var$convertPathToGeometry(overallPath, intScalar);\n else if (output === $b7cc2dc72cc279b6$export$b1968b297e0facc4) return $b7cc2dc72cc279b6$var$convertPathToLineSegments(overallPath, intScalar);\n else return [\n $b7cc2dc72cc279b6$var$convertPathToGeometry(overallPath, intScalar),\n $b7cc2dc72cc279b6$var$convertPathToLineSegments(overallPath, intScalar)\n ];\n }\n };\n let time = performance.now();\n for(let ti = 0; ti < triCount; ti++){\n const i = triList[ti] * 3;\n let i0 = i + 0;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n // get the triangle\n const { a: a, b: b, c: c } = $b7cc2dc72cc279b6$var$_tri;\n a.fromBufferAttribute(posAttr, i0);\n b.fromBufferAttribute(posAttr, i1);\n c.fromBufferAttribute(posAttr, i2);\n if (!doubleSided) {\n $b7cc2dc72cc279b6$var$_tri.getNormal($b7cc2dc72cc279b6$var$_normal);\n if ($b7cc2dc72cc279b6$var$_normal.dot($b7cc2dc72cc279b6$var$UP_VECTOR) < 0) continue;\n }\n // flatten the triangle\n a.y = 0;\n b.y = 0;\n c.y = 0;\n if ($b7cc2dc72cc279b6$var$_tri.getArea() < $b7cc2dc72cc279b6$var$AREA_EPSILON) continue;\n // expand the triangle by a small degree to ensure overlap\n $b7cc2dc72cc279b6$var$_center.copy(a).add(b).add(c).multiplyScalar(1 / 3);\n $b7cc2dc72cc279b6$var$_vec.subVectors(a, $b7cc2dc72cc279b6$var$_center).normalize();\n a.addScaledVector($b7cc2dc72cc279b6$var$_vec, extendMultiplier);\n $b7cc2dc72cc279b6$var$_vec.subVectors(b, $b7cc2dc72cc279b6$var$_center).normalize();\n b.addScaledVector($b7cc2dc72cc279b6$var$_vec, extendMultiplier);\n $b7cc2dc72cc279b6$var$_vec.subVectors(c, $b7cc2dc72cc279b6$var$_center).normalize();\n c.addScaledVector($b7cc2dc72cc279b6$var$_vec, extendMultiplier);\n // create the path\n const path = new (0, $0b6dbf71c0c0eea1$export$b12670b10302a8b7)();\n path.push((0, $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908).makePath([\n a.x * intScalar,\n a.z * intScalar,\n b.x * intScalar,\n b.z * intScalar,\n c.x * intScalar,\n c.z * intScalar\n ]));\n a.multiplyScalar(intScalar);\n b.multiplyScalar(intScalar);\n c.multiplyScalar(intScalar);\n if (overallPath && (0, $60fc547e70fa748b$export$a4592ad7ee5e85f)($b7cc2dc72cc279b6$var$_tri, overallPath)) continue;\n // perform union\n if (overallPath === null) overallPath = path;\n else {\n overallPath = (0, $0b6dbf71c0c0eea1$export$47d6d5d06ccbc908).Union(overallPath, path, (0, $0b6dbf71c0c0eea1$export$f26b42c94e8a4f95).NonZero);\n overallPath.forEach((path)=>(0, $00adfa846be5871c$export$a1384fe5bb05e0aa)(path));\n }\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n if (onProgress) {\n const progress = ti / triCount;\n onProgress(progress, handle);\n }\n yield;\n time = performance.now();\n }\n }\n return handle.getGeometry();\n }\n}\n\n\nonmessage = function({ data: data }) {\n let prevTime = performance.now();\n function onProgressCallback(progress) {\n const currTime = performance.now();\n if (currTime - prevTime >= 10 || progress === 1.0) {\n postMessage({\n error: null,\n progress: progress\n });\n prevTime = currTime;\n }\n }\n try {\n const { index: index, position: position, options: options } = data;\n const geometry = new (0, $e06gU.BufferGeometry)();\n geometry.setIndex(new (0, $e06gU.BufferAttribute)(index, 1, false));\n geometry.setAttribute(\"position\", new (0, $e06gU.BufferAttribute)(position, 3, false));\n const generator = new (0, $b7cc2dc72cc279b6$export$8f233aafe78e44af)();\n generator.doubleSided = options.doubleSided ?? generator.doubleSided;\n generator.output = options.output ?? generator.output;\n generator.intScalar = options.intScalar ?? generator.intScalar;\n generator.sortTriangles = options.sortTriangles ?? generator.sortTriangles;\n const task = generator.generate(geometry, {\n onProgress: onProgressCallback\n });\n let result = task.next();\n while(!result.done)result = task.next();\n let buffers, output;\n if (generator.output === (0, $b7cc2dc72cc279b6$export$d2881bb52ea2a3ff)) {\n buffers = [];\n output = [];\n result.value.forEach((g)=>{\n console.log(g);\n const posArr = g.attributes.position.array;\n const indexArr = g.index?.array || null;\n output.push({\n position: posArr,\n index: indexArr\n });\n buffers.push(posArr.buffer, indexArr?.buffer);\n });\n } else {\n const posArr = result.value.attributes.position.array;\n const indexArr = result.value.index.array;\n output = {\n position: posArr,\n index: indexArr\n };\n buffers = [\n posArr.buffer,\n indexArr.buffer\n ];\n }\n postMessage({\n result: output,\n error: null,\n progress: 1\n }, buffers.filter((b)=>!!b));\n } catch (error) {\n postMessage({\n error: error,\n progress: 1\n });\n }\n};\n\n})();\n//# sourceMappingURL=silhouetteAsync.worker.f555f2b4.js.map\n","import { BufferAttribute, BufferGeometry } from 'three';\nimport { OUTPUT_BOTH, SilhouetteGenerator } from '../SilhouetteGenerator.js';\n\nonmessage = function ( { data } ) {\n\n\tlet prevTime = performance.now();\n\tfunction onProgressCallback( progress ) {\n\n\t\tconst currTime = performance.now();\n\t\tif ( currTime - prevTime >= 10 || progress === 1.0 ) {\n\n\t\t\tpostMessage( {\n\n\t\t\t\terror: null,\n\t\t\t\tprogress,\n\n\t\t\t} );\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t}\n\n\ttry {\n\n\t\tconst { index, position, options } = data;\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( index, 1, false ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( position, 3, false ) );\n\n\t\tconst generator = new SilhouetteGenerator();\n\t\tgenerator.doubleSided = options.doubleSided ?? generator.doubleSided;\n\t\tgenerator.output = options.output ?? generator.output;\n\t\tgenerator.intScalar = options.intScalar ?? generator.intScalar;\n\t\tgenerator.sortTriangles = options.sortTriangles ?? generator.sortTriangles;\n\t\tconst task = generator.generate( geometry, {\n\t\t\tonProgress: onProgressCallback,\n\t\t} );\n\n\t\tlet result = task.next();\n\t\twhile ( ! result.done ) {\n\n\t\t\tresult = task.next();\n\n\t\t}\n\n\t\tlet buffers, output;\n\t\tif ( generator.output === OUTPUT_BOTH ) {\n\n\t\t\tbuffers = [];\n\t\t\toutput = [];\n\t\t\tresult.value.forEach( g => {\n\n\t\t\t\tconsole.log( g );\n\t\t\t\tconst posArr = g.attributes.position.array;\n\t\t\t\tconst indexArr = g.index?.array || null;\n\t\t\t\toutput.push( {\n\t\t\t\t\tposition: posArr,\n\t\t\t\t\tindex: indexArr,\n\t\t\t\t} );\n\t\t\t\tbuffers.push(\n\t\t\t\t\tposArr.buffer,\n\t\t\t\t\tindexArr?.buffer,\n\t\t\t\t);\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\tconst posArr = result.value.attributes.position.array;\n\t\t\tconst indexArr = result.value.index.array;\n\t\t\toutput = {\n\t\t\t\tposition: posArr,\n\t\t\t\tindex: indexArr,\n\t\t\t};\n\t\t\tbuffers = [ posArr.buffer, indexArr.buffer ];\n\n\t\t}\n\n\t\tpostMessage( {\n\n\t\t\tresult: output,\n\t\t\terror: null,\n\t\t\tprogress: 1,\n\n\t\t}, buffers.filter( b => ! ! b ) );\n\n\t} catch ( error ) {\n\n\t\tpostMessage( {\n\n\t\t\terror,\n\t\t\tprogress: 1,\n\n\t\t} );\n\n\t}\n\n};\n","import { Path64, Clipper, FillRule } from 'clipper2-js';\nimport { ShapeGeometry, Vector3, Shape, Vector2, Triangle, ShapeUtils, BufferGeometry } from 'three';\nimport { compressPoints } from './utils/compressPoints.js';\nimport { triangleIsInsidePaths } from './utils/triangleIsInsidePaths.js';\nimport { getSizeSortedTriList } from './utils/getSizeSortedTriList.js';\nimport { getTriCount } from './utils/geometryUtils.js';\n\nconst AREA_EPSILON = 1e-8;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _tri = /* @__PURE__ */ new Triangle();\nconst _normal = /* @__PURE__ */ new Vector3();\nconst _center = /* @__PURE__ */ new Vector3();\nconst _vec = /* @__PURE__ */ new Vector3();\n\nfunction convertPathToGeometry( path, scale ) {\n\n\tconst vector2s = path.map( points => {\n\n\t\treturn points.flatMap( v => new Vector2( v.x / scale, v.y / scale ) );\n\n\t} );\n\n\tconst holesShapes = vector2s\n\t\t.filter( p => ShapeUtils.isClockWise( p ) )\n\t\t.map( p => new Shape( p ) );\n\n\tconst solidShapes = vector2s\n\t\t.filter( p => ! ShapeUtils.isClockWise( p ) )\n\t\t.map( p => {\n\n\t\t\tconst shape = new Shape( p );\n\t\t\tshape.holes = holesShapes;\n\t\t\treturn shape;\n\n\t\t} );\n\n\t// flip the triangles so they're facing in the right direction\n\tconst result = new ShapeGeometry( solidShapes ).rotateX( Math.PI / 2 );\n\tresult.index.array.reverse();\n\treturn result;\n\n}\n\nfunction convertPathToLineSegments( path, scale ) {\n\n\tconst arr = [];\n\tpath.forEach( points => {\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst i1 = ( i + 1 ) % points.length;\n\t\t\tconst p0 = points[ i ];\n\t\t\tconst p1 = points[ i1 ];\n\t\t\tarr.push(\n\t\t\t\tnew Vector3( p0.x / scale, 0, p0.y / scale ),\n\t\t\t\tnew Vector3( p1.x / scale, 0, p1.y / scale )\n\t\t\t);\n\n\t\t}\n\n\t} );\n\n\tconst result = new BufferGeometry();\n\tresult.setFromPoints( arr );\n\treturn result;\n\n}\n\nexport const OUTPUT_MESH = 0;\nexport const OUTPUT_LINE_SEGMENTS = 1;\nexport const OUTPUT_BOTH = 2;\nexport class SilhouetteGenerator {\n\n\tconstructor() {\n\n\t\tthis.iterationTime = 30;\n\t\tthis.intScalar = 1e9;\n\t\tthis.doubleSided = false;\n\t\tthis.sortTriangles = false;\n\t\tthis.output = OUTPUT_MESH;\n\n\t}\n\n\tgenerateAsync( geometry, options = {} ) {\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tconst { signal } = options;\n\t\t\tconst task = this.generate( geometry, options );\n\t\t\trun();\n\n\t\t\tfunction run() {\n\n\t\t\t\tif ( signal && signal.aborted ) {\n\n\t\t\t\t\treject( new Error( 'SilhouetteGenerator: Process aborted via AbortSignal.' ) );\n\n\t\t\t\t}\n\n\t\t\t\tconst result = task.next();\n\t\t\t\tif ( result.done ) {\n\n\t\t\t\t\tresolve( result.value );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trequestAnimationFrame( run );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t} );\n\n\t}\n\n\t*generate( geometry, options = {} ) {\n\n\t\tconst { iterationTime, intScalar, doubleSided, output, sortTriangles } = this;\n\t\tconst { onProgress } = options;\n\t\tconst power = Math.log10( intScalar );\n\t\tconst extendMultiplier = Math.pow( 10, - ( power - 2 ) );\n\n\t\tconst index = geometry.index;\n\t\tconst posAttr = geometry.attributes.position;\n\t\tconst triCount = getTriCount( geometry );\n\t\tlet overallPath = null;\n\n\t\tconst triList = sortTriangles ?\n\t\t\tgetSizeSortedTriList( geometry ) :\n\t\t\tnew Array( triCount ).fill().map( ( v, i ) => i );\n\n\t\tconst handle = {\n\n\t\t\tgetGeometry() {\n\n\t\t\t\tif ( output === OUTPUT_MESH ) {\n\n\t\t\t\t\treturn convertPathToGeometry( overallPath, intScalar );\n\n\t\t\t\t} else if ( output === OUTPUT_LINE_SEGMENTS ) {\n\n\t\t\t\t\treturn convertPathToLineSegments( overallPath, intScalar );\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn [\n\t\t\t\t\t\tconvertPathToGeometry( overallPath, intScalar ),\n\t\t\t\t\t\tconvertPathToLineSegments( overallPath, intScalar ),\n\t\t\t\t\t];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tlet time = performance.now();\n\t\tfor ( let ti = 0; ti < triCount; ti ++ ) {\n\n\t\t\tconst i = triList[ ti ] * 3;\n\t\t\tlet i0 = i + 0;\n\t\t\tlet i1 = i + 1;\n\t\t\tlet i2 = i + 2;\n\t\t\tif ( index ) {\n\n\t\t\t\ti0 = index.getX( i0 );\n\t\t\t\ti1 = index.getX( i1 );\n\t\t\t\ti2 = index.getX( i2 );\n\n\t\t\t}\n\n\t\t\t// get the triangle\n\t\t\tconst { a, b, c } = _tri;\n\t\t\ta.fromBufferAttribute( posAttr, i0 );\n\t\t\tb.fromBufferAttribute( posAttr, i1 );\n\t\t\tc.fromBufferAttribute( posAttr, i2 );\n\t\t\tif ( ! doubleSided ) {\n\n\t\t\t\t_tri.getNormal( _normal );\n\t\t\t\tif ( _normal.dot( UP_VECTOR ) < 0 ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// flatten the triangle\n\t\t\ta.y = 0;\n\t\t\tb.y = 0;\n\t\t\tc.y = 0;\n\n\t\t\tif ( _tri.getArea() < AREA_EPSILON ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// expand the triangle by a small degree to ensure overlap\n\t\t\t_center\n\t\t\t\t.copy( a )\n\t\t\t\t.add( b )\n\t\t\t\t.add( c )\n\t\t\t\t.multiplyScalar( 1 / 3 );\n\n\t\t\t_vec.subVectors( a, _center ).normalize();\n\t\t\ta.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t_vec.subVectors( b, _center ).normalize();\n\t\t\tb.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t_vec.subVectors( c, _center ).normalize();\n\t\t\tc.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t// create the path\n\t\t\tconst path = new Path64();\n\t\t\tpath.push( Clipper.makePath( [\n\t\t\t\ta.x * intScalar, a.z * intScalar,\n\t\t\t\tb.x * intScalar, b.z * intScalar,\n\t\t\t\tc.x * intScalar, c.z * intScalar,\n\t\t\t] ) );\n\n\t\t\ta.multiplyScalar( intScalar );\n\t\t\tb.multiplyScalar( intScalar );\n\t\t\tc.multiplyScalar( intScalar );\n\t\t\tif ( overallPath && triangleIsInsidePaths( _tri, overallPath ) ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// perform union\n\t\t\tif ( overallPath === null ) {\n\n\t\t\t\toverallPath = path;\n\n\t\t\t} else {\n\n\t\t\t\toverallPath = Clipper.Union( overallPath, path, FillRule.NonZero );\n\t\t\t\toverallPath.forEach( path => compressPoints( path ) );\n\n\t\t\t}\n\n\t\t\tconst delta = performance.now() - time;\n\t\t\tif ( delta > iterationTime ) {\n\n\t\t\t\tif ( onProgress ) {\n\n\t\t\t\t\tconst progress = ti / triCount;\n\t\t\t\t\tonProgress( progress, handle );\n\n\t\t\t\t}\n\n\t\t\t\tyield;\n\t\t\t\ttime = performance.now();\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn handle.getGeometry();\n\n\t}\n\n}\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass Minkowski {\r\n static minkowskiInternal(pattern, path, isSum, isClosed) {\r\n const delta = isClosed ? 0 : 1;\r\n const patLen = pattern.length;\r\n const pathLen = path.length;\r\n const tmp = [];\r\n for (const pathPt of path) {\r\n const path2 = [];\r\n if (isSum) {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x + basePt.x, y: pathPt.y + basePt.y });\r\n }\r\n else {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x - basePt.x, y: pathPt.y - basePt.y });\r\n }\r\n tmp.push(path2);\r\n }\r\n const result = [];\r\n let g = isClosed ? pathLen - 1 : 0;\r\n let h = patLen - 1;\r\n for (let i = delta; i < pathLen; i++) {\r\n for (let j = 0; j < patLen; j++) {\r\n const quad = [tmp[g][h], tmp[i][h], tmp[i][j], tmp[g][j]];\r\n if (!Clipper.isPositive(quad))\r\n result.push(Clipper.reversePath(quad));\r\n else\r\n result.push(quad);\r\n h = j;\r\n }\r\n g = i;\r\n }\r\n return result;\r\n }\r\n static sum(pattern, path, isClosed) {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, FillRule.NonZero);\r\n }\r\n static diff(pattern, path, isClosed) {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, FillRule.NonZero);\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nvar JoinType;\r\n(function (JoinType) {\r\n JoinType[JoinType[\"Square\"] = 0] = \"Square\";\r\n JoinType[JoinType[\"Round\"] = 1] = \"Round\";\r\n JoinType[JoinType[\"Miter\"] = 2] = \"Miter\";\r\n})(JoinType || (JoinType = {}));\r\nvar EndType;\r\n(function (EndType) {\r\n EndType[EndType[\"Polygon\"] = 0] = \"Polygon\";\r\n EndType[EndType[\"Joined\"] = 1] = \"Joined\";\r\n EndType[EndType[\"Butt\"] = 2] = \"Butt\";\r\n EndType[EndType[\"Square\"] = 3] = \"Square\";\r\n EndType[EndType[\"Round\"] = 4] = \"Round\";\r\n})(EndType || (EndType = {}));\r\nclass Group {\r\n constructor(paths, joinType, endType = EndType.Polygon) {\r\n this.inPaths = [...paths]; // creates a shallow copy of paths\r\n this.joinType = joinType;\r\n this.endType = endType;\r\n this.outPath = [];\r\n this.outPaths = [];\r\n this.pathsReversed = false;\r\n }\r\n}\r\nclass PointD {\r\n constructor(xOrPt, yOrScale) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = xOrPt;\r\n this.y = yOrScale;\r\n }\r\n else if (xOrPt instanceof PointD) {\r\n if (yOrScale !== undefined) {\r\n this.x = xOrPt.x * yOrScale;\r\n this.y = xOrPt.y * yOrScale;\r\n }\r\n else {\r\n this.x = xOrPt.x;\r\n this.y = xOrPt.y;\r\n }\r\n }\r\n else {\r\n this.x = xOrPt.x * (yOrScale || 1);\r\n this.y = xOrPt.y * (yOrScale || 1);\r\n }\r\n }\r\n toString(precision = 2) {\r\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\r\n }\r\n static equals(lhs, rhs) {\r\n return InternalClipper.isAlmostZero(lhs.x - rhs.x) &&\r\n InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n static notEquals(lhs, rhs) {\r\n return !InternalClipper.isAlmostZero(lhs.x - rhs.x) ||\r\n !InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n equals(obj) {\r\n if (obj instanceof PointD) {\r\n return PointD.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n negate() {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n }\r\n}\r\nclass ClipperOffset {\r\n constructor(miterLimit = 2.0, arcTolerance = 0.0, preserveCollinear = false, reverseSolution = false) {\r\n this._groupList = [];\r\n this._normals = [];\r\n this._solution = [];\r\n this.MiterLimit = miterLimit;\r\n this.ArcTolerance = arcTolerance;\r\n this.MergeGroups = true;\r\n this.PreserveCollinear = preserveCollinear;\r\n this.ReverseSolution = reverseSolution;\r\n }\r\n clear() {\r\n this._groupList = [];\r\n }\r\n addPath(path, joinType, endType) {\r\n if (path.length === 0)\r\n return;\r\n const pp = [path];\r\n this.addPaths(pp, joinType, endType);\r\n }\r\n addPaths(paths, joinType, endType) {\r\n if (paths.length === 0)\r\n return;\r\n this._groupList.push(new Group(paths, joinType, endType));\r\n }\r\n executeInternal(delta) {\r\n this._solution = [];\r\n if (this._groupList.length === 0)\r\n return;\r\n if (Math.abs(delta) < 0.5) {\r\n for (const group of this._groupList) {\r\n for (const path of group.inPaths) {\r\n this._solution.push(path);\r\n }\r\n }\r\n }\r\n else {\r\n this._delta = delta;\r\n this._mitLimSqr = (this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit));\r\n for (const group of this._groupList) {\r\n this.doGroupOffset(group);\r\n }\r\n }\r\n }\r\n sqr(value) {\r\n return value * value;\r\n }\r\n execute(delta, solution) {\r\n solution.length = 0;\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0)\r\n return;\r\n // clean up self-intersections ...\r\n const c = new Clipper64();\r\n c.preserveCollinear = this.PreserveCollinear;\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.execute(ClipType.Union, FillRule.Negative, solution);\r\n else\r\n c.execute(ClipType.Union, FillRule.Positive, solution);\r\n }\r\n executePolytree(delta, polytree) {\r\n polytree.clear();\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0)\r\n return;\r\n // clean up self-intersections ...\r\n const c = new Clipper64();\r\n c.preserveCollinear = this.PreserveCollinear;\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.executePolyTree(ClipType.Union, FillRule.Negative, polytree);\r\n else\r\n c.executePolyTree(ClipType.Union, FillRule.Positive, polytree);\r\n }\r\n static getUnitNormal(pt1, pt2) {\r\n let dx = pt2.x - pt1.x;\r\n let dy = pt2.y - pt1.y;\r\n if (dx === 0 && dy === 0)\r\n return new PointD(0, 0);\r\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\r\n dx *= f;\r\n dy *= f;\r\n return new PointD(dy, -dx);\r\n }\r\n executeCallback(deltaCallback, solution) {\r\n this.DeltaCallback = deltaCallback;\r\n this.execute(1.0, solution);\r\n }\r\n static getBoundsAndLowestPolyIdx(paths) {\r\n const rec = new Rect64(false); // ie invalid rect\r\n let lpX = Number.MIN_SAFE_INTEGER;\r\n let index = -1;\r\n for (let i = 0; i < paths.length; i++) {\r\n for (const pt of paths[i]) {\r\n if (pt.y >= rec.bottom) {\r\n if (pt.y > rec.bottom || pt.x < lpX) {\r\n index = i;\r\n lpX = pt.x;\r\n rec.bottom = pt.y;\r\n }\r\n }\r\n else if (pt.y < rec.top)\r\n rec.top = pt.y;\r\n if (pt.x > rec.right)\r\n rec.right = pt.x;\r\n else if (pt.x < rec.left)\r\n rec.left = pt.x;\r\n }\r\n }\r\n return { index, rec };\r\n }\r\n static translatePoint(pt, dx, dy) {\r\n return new PointD(pt.x + dx, pt.y + dy);\r\n }\r\n static reflectPoint(pt, pivot) {\r\n return new PointD(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\r\n }\r\n static almostZero(value, epsilon = 0.001) {\r\n return Math.abs(value) < epsilon;\r\n }\r\n static hypotenuse(x, y) {\r\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\r\n }\r\n static normalizeVector(vec) {\r\n const h = this.hypotenuse(vec.x, vec.y);\r\n if (this.almostZero(h))\r\n return new PointD(0, 0);\r\n const inverseHypot = 1 / h;\r\n return new PointD(vec.x * inverseHypot, vec.y * inverseHypot);\r\n }\r\n static getAvgUnitVector(vec1, vec2) {\r\n return this.normalizeVector(new PointD(vec1.x + vec2.x, vec1.y + vec2.y));\r\n }\r\n static intersectPoint(pt1a, pt1b, pt2a, pt2b) {\r\n if (InternalClipper.isAlmostZero(pt1a.x - pt1b.x)) { //vertical\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x))\r\n return new PointD(0, 0);\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n return new PointD(pt1a.x, m2 * pt1a.x + b2);\r\n }\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) { //vertical\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n return new PointD(pt2a.x, m1 * pt2a.x + b1);\r\n }\r\n else {\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n if (InternalClipper.isAlmostZero(m1 - m2))\r\n return new PointD(0, 0);\r\n const x = (b2 - b1) / (m1 - m2);\r\n return new PointD(x, m1 * x + b1);\r\n }\r\n }\r\n getPerpendic(pt, norm) {\r\n return new Point64(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n getPerpendicD(pt, norm) {\r\n return new PointD(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n doSquare(group, path, j, k) {\r\n let vec;\r\n if (j === k) {\r\n vec = new PointD(this._normals[j].y, -this._normals[j].x);\r\n }\r\n else {\r\n vec = ClipperOffset.getAvgUnitVector(new PointD(-this._normals[k].y, this._normals[k].x), new PointD(this._normals[j].y, -this._normals[j].x));\r\n }\r\n const absDelta = Math.abs(this._groupDelta);\r\n // now offset the original vertex delta units along unit vector\r\n let ptQ = new PointD(path[j].x, path[j].y);\r\n ptQ = ClipperOffset.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\r\n // get perpendicular vertices\r\n const pt1 = ClipperOffset.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\r\n const pt2 = ClipperOffset.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\r\n // get 2 vertices along one edge offset\r\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\r\n if (j === k) {\r\n const pt4 = new PointD(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n }\r\n else {\r\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n }\r\n }\r\n doMiter(group, path, j, k, cosA) {\r\n const q = this._groupDelta / (cosA + 1);\r\n group.outPath.push(new Point64(path[j].x + (this._normals[k].x + this._normals[j].x) * q, path[j].y + (this._normals[k].y + this._normals[j].y) * q));\r\n }\r\n doRound(group, path, j, k, angle) {\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n const absDelta = Math.abs(this._groupDelta);\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0)\r\n this._stepSin = -this._stepSin;\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n const pt = path[j];\r\n let offsetVec = new PointD(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\r\n if (j === k)\r\n offsetVec.negate();\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n if (angle > -Math.PI + 0.01) {\r\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\r\n for (let i = 1; i < steps; i++) {\r\n offsetVec = new PointD(offsetVec.x * this._stepCos - this._stepSin * offsetVec.y, offsetVec.x * this._stepSin + offsetVec.y * this._stepCos);\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n }\r\n }\r\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\r\n }\r\n buildNormals(path) {\r\n const cnt = path.length;\r\n this._normals = [];\r\n this._normals.length = cnt;\r\n for (let i = 0; i < cnt - 1; i++) {\r\n this._normals.push(ClipperOffset.getUnitNormal(path[i], path[i + 1]));\r\n }\r\n this._normals.push(ClipperOffset.getUnitNormal(path[cnt - 1], path[0]));\r\n }\r\n crossProduct(vec1, vec2) {\r\n return (vec1.y * vec2.x - vec2.y * vec1.x);\r\n }\r\n dotProduct(vec1, vec2) {\r\n return (vec1.x * vec2.x + vec1.y * vec2.y);\r\n }\r\n offsetPoint(group, path, j, k) {\r\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\r\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\r\n if (sinA > 1.0)\r\n cosA = 1.0;\r\n else if (sinA < -1.0)\r\n cosA = -1.0;\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\r\n if (group.pathsReversed)\r\n this._groupDelta = -this._groupDelta;\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[j]);\r\n return;\r\n }\r\n if (cosA > 0.999) {\r\n this.doMiter(group, path, j, k, cosA);\r\n }\r\n else if (cosA > -0.99 && (sinA * this._groupDelta < 0)) {\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\r\n group.outPath.push(path[j]);\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\r\n }\r\n else if (this._joinType === JoinType.Miter) {\r\n if (cosA > this._mitLimSqr - 1) {\r\n this.doMiter(group, path, j, k, cosA);\r\n }\r\n else {\r\n this.doSquare(group, path, j, k);\r\n }\r\n }\r\n else if (cosA > 0.99 || this._joinType === JoinType.Square) {\r\n this.doSquare(group, path, j, k);\r\n }\r\n else {\r\n this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\r\n }\r\n k = j;\r\n }\r\n offsetPolygon(group, path) {\r\n const area = Clipper.area(path);\r\n if ((area < 0) !== (this._groupDelta < 0)) {\r\n const rect = Clipper.getBounds(path);\r\n if (Math.abs(this._groupDelta) * 2 > rect.width)\r\n return;\r\n }\r\n group.outPath = [];\r\n const cnt = path.length;\r\n const prev = cnt - 1;\r\n for (let i = 0; i < cnt; i++) {\r\n this.offsetPoint(group, path, i, prev);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n offsetOpenJoined(group, path) {\r\n this.offsetPolygon(group, path);\r\n path = Clipper.reversePath(path);\r\n this.buildNormals(path);\r\n this.offsetPolygon(group, path);\r\n }\r\n offsetOpenPath(group, path) {\r\n group.outPath = [];\r\n const highI = path.length - 1;\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[0]);\r\n }\r\n else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(path[0].x - this._normals[0].x * this._groupDelta, path[0].y - this._normals[0].y * this._groupDelta));\r\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, 0, 0, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, 0, 0);\r\n break;\r\n }\r\n }\r\n for (let i = 1, k = 0; i < highI; i++) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n for (let i = highI; i > 0; i--) {\r\n this._normals[i] = new PointD(-this._normals[i - 1].x, -this._normals[i - 1].y);\r\n }\r\n this._normals[0] = this._normals[highI];\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[highI]);\r\n }\r\n else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(path[highI].x - this._normals[highI].x * this._groupDelta, path[highI].y - this._normals[highI].y * this._groupDelta));\r\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, highI, highI, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, highI, highI);\r\n break;\r\n }\r\n }\r\n for (let i = highI, k = 0; i > 0; i--) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n doGroupOffset(group) {\r\n if (group.endType == EndType.Polygon) {\r\n const { index } = ClipperOffset.getBoundsAndLowestPolyIdx(group.inPaths);\r\n if (index < 0)\r\n return;\r\n const area = Clipper.area(group.inPaths[index]);\r\n group.pathsReversed = area < 0;\r\n if (group.pathsReversed) {\r\n this._groupDelta = -this._delta;\r\n }\r\n else {\r\n this._groupDelta = this._delta;\r\n }\r\n }\r\n else {\r\n group.pathsReversed = false;\r\n this._groupDelta = Math.abs(this._delta) * 0.5;\r\n }\r\n const absDelta = Math.abs(this._groupDelta);\r\n this._joinType = group.joinType;\r\n this._endType = group.endType;\r\n if (!this.DeltaCallback &&\r\n (group.joinType == JoinType.Round || group.endType == EndType.Round)) {\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0) {\r\n this._stepSin = -this._stepSin;\r\n }\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n const isJoined = group.endType == EndType.Joined || group.endType == EndType.Polygon;\r\n for (const p of group.inPaths) {\r\n const path = Clipper.stripDuplicates(p, isJoined);\r\n const cnt = path.length;\r\n if (cnt === 0 || (cnt < 3 && this._endType == EndType.Polygon)) {\r\n continue;\r\n }\r\n if (cnt == 1) {\r\n group.outPath = [];\r\n if (group.endType == EndType.Round) {\r\n const r = absDelta;\r\n group.outPath = Clipper.ellipse(path[0], r, r);\r\n }\r\n else {\r\n const d = Math.ceil(this._groupDelta);\r\n const r = new Rect64(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\r\n group.outPath = r.asPath();\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n else {\r\n if (cnt == 2 && group.endType == EndType.Joined) {\r\n if (group.joinType == JoinType.Round) {\r\n this._endType = EndType.Round;\r\n }\r\n else {\r\n this._endType = EndType.Square;\r\n }\r\n }\r\n this.buildNormals(path);\r\n if (this._endType == EndType.Polygon) {\r\n this.offsetPolygon(group, path);\r\n }\r\n else if (this._endType == EndType.Joined) {\r\n this.offsetOpenJoined(group, path);\r\n }\r\n else {\r\n this.offsetOpenPath(group, path);\r\n }\r\n }\r\n }\r\n this._solution.push(...group.outPaths);\r\n group.outPaths = [];\r\n }\r\n}\r\nClipperOffset.Tolerance = 1.0E-12;\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass OutPt2 {\r\n constructor(pt) {\r\n this.pt = pt;\r\n this.ownerIdx = 0;\r\n }\r\n}\r\nvar Location;\r\n(function (Location) {\r\n Location[Location[\"left\"] = 0] = \"left\";\r\n Location[Location[\"top\"] = 1] = \"top\";\r\n Location[Location[\"right\"] = 2] = \"right\";\r\n Location[Location[\"bottom\"] = 3] = \"bottom\";\r\n Location[Location[\"inside\"] = 4] = \"inside\";\r\n})(Location || (Location = {}));\r\nclass RectClip64 {\r\n constructor(rect) {\r\n this.currIdx = -1;\r\n this.rect = rect;\r\n this.mp = rect.midPoint();\r\n this.rectPath = rect.asPath();\r\n this.results = [];\r\n this.edges = Array(8).fill(undefined).map(() => []);\r\n }\r\n add(pt, startingNewPath = false) {\r\n let currIdx = this.results.length;\r\n let result;\r\n if (currIdx === 0 || startingNewPath) {\r\n result = new OutPt2(pt);\r\n this.results.push(result);\r\n result.ownerIdx = currIdx;\r\n result.prev = result;\r\n result.next = result;\r\n }\r\n else {\r\n currIdx--;\r\n const prevOp = this.results[currIdx];\r\n if (prevOp.pt === pt)\r\n return prevOp;\r\n result = new OutPt2(pt);\r\n result.ownerIdx = currIdx;\r\n result.next = prevOp.next;\r\n prevOp.next.prev = result;\r\n prevOp.next = result;\r\n result.prev = prevOp;\r\n this.results[currIdx] = result;\r\n }\r\n return result;\r\n }\r\n static path1ContainsPath2(path1, path2) {\r\n let ioCount = 0;\r\n for (const pt of path2) {\r\n const pip = InternalClipper.pointInPolygon(pt, path1);\r\n switch (pip) {\r\n case PointInPolygonResult.IsInside:\r\n ioCount--;\r\n break;\r\n case PointInPolygonResult.IsOutside:\r\n ioCount++;\r\n break;\r\n }\r\n if (Math.abs(ioCount) > 1)\r\n break;\r\n }\r\n return ioCount <= 0;\r\n }\r\n static isClockwise(prev, curr, prevPt, currPt, rectMidPoint) {\r\n if (this.areOpposites(prev, curr))\r\n return InternalClipper.crossProduct(prevPt, rectMidPoint, currPt) < 0;\r\n else\r\n return this.headingClockwise(prev, curr);\r\n }\r\n static areOpposites(prev, curr) {\r\n return Math.abs(prev - curr) === 2;\r\n }\r\n static headingClockwise(prev, curr) {\r\n return (prev + 1) % 4 === curr;\r\n }\r\n static getAdjacentLocation(loc, isClockwise) {\r\n const delta = isClockwise ? 1 : 3;\r\n return (loc + delta) % 4;\r\n }\r\n static unlinkOp(op) {\r\n if (op.next === op)\r\n return undefined;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return op.next;\r\n }\r\n static unlinkOpBack(op) {\r\n if (op.next === op)\r\n return undefined;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return op.prev;\r\n }\r\n static getEdgesForPt(pt, rec) {\r\n let result = 0;\r\n if (pt.x === rec.left)\r\n result = 1;\r\n else if (pt.x === rec.right)\r\n result = 4;\r\n if (pt.y === rec.top)\r\n result += 2;\r\n else if (pt.y === rec.bottom)\r\n result += 8;\r\n return result;\r\n }\r\n static isHeadingClockwise(pt1, pt2, edgeIdx) {\r\n switch (edgeIdx) {\r\n case 0: return pt2.y < pt1.y;\r\n case 1: return pt2.x > pt1.x;\r\n case 2: return pt2.y > pt1.y;\r\n default: return pt2.x < pt1.x;\r\n }\r\n }\r\n static hasHorzOverlap(left1, right1, left2, right2) {\r\n return (left1.x < right2.x) && (right1.x > left2.x);\r\n }\r\n static hasVertOverlap(top1, bottom1, top2, bottom2) {\r\n return (top1.y < bottom2.y) && (bottom1.y > top2.y);\r\n }\r\n static addToEdge(edge, op) {\r\n if (op.edge)\r\n return;\r\n op.edge = edge;\r\n edge.push(op);\r\n }\r\n static uncoupleEdge(op) {\r\n if (!op.edge)\r\n return;\r\n for (let i = 0; i < op.edge.length; i++) {\r\n const op2 = op.edge[i];\r\n if (op2 === op) {\r\n op.edge[i] = undefined;\r\n break;\r\n }\r\n }\r\n op.edge = undefined;\r\n }\r\n static setNewOwner(op, newIdx) {\r\n op.ownerIdx = newIdx;\r\n let op2 = op.next;\r\n while (op2 !== op) {\r\n op2.ownerIdx = newIdx;\r\n op2 = op2.next;\r\n }\r\n }\r\n addCorner(prev, curr) {\r\n if (RectClip64.headingClockwise(prev, curr))\r\n this.add(this.rectPath[prev]);\r\n else\r\n this.add(this.rectPath[curr]);\r\n }\r\n addCornerByRef(loc, isClockwise) {\r\n if (isClockwise) {\r\n this.add(this.rectPath[loc]);\r\n loc = RectClip64.getAdjacentLocation(loc, true);\r\n }\r\n else {\r\n loc = RectClip64.getAdjacentLocation(loc, false);\r\n this.add(this.rectPath[loc]);\r\n }\r\n }\r\n static getLocation(rec, pt) {\r\n let loc;\r\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.left; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.right; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.top; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.bottom; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x < rec.left)\r\n loc = Location.left;\r\n else if (pt.x > rec.right)\r\n loc = Location.right;\r\n else if (pt.y < rec.top)\r\n loc = Location.top;\r\n else if (pt.y > rec.bottom)\r\n loc = Location.bottom;\r\n else\r\n loc = Location.inside;\r\n return { success: true, loc };\r\n }\r\n static getIntersection(rectPath, p, p2, loc) {\r\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\r\n // when result == false, loc will remain unchanged\r\n let ip = new Point64();\r\n switch (loc) {\r\n case Location.left:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n }\r\n else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.right:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n }\r\n else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.top:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n }\r\n else if (p.x < rectPath[0].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (p.x > rectPath[1].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.bottom:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n }\r\n else if (p.x < rectPath[3].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (p.x > rectPath[2].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.inside:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n }\r\n return { success: true, loc, ip };\r\n }\r\n getNextLocation(path, context) {\r\n switch (context.loc) {\r\n case Location.left:\r\n while (context.i <= context.highI && path[context.i].x <= this.rect.left)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.top:\r\n while (context.i <= context.highI && path[context.i].y <= this.rect.top)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.right:\r\n while (context.i <= context.highI && path[context.i].x >= this.rect.right)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.bottom:\r\n while (context.i <= context.highI && path[context.i].y >= this.rect.bottom)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.inside:\r\n while (context.i <= context.highI) {\r\n if (path[context.i].x < this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x > this.rect.right)\r\n context.loc = Location.right;\r\n else if (path[context.i].y > this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else if (path[context.i].y < this.rect.top)\r\n context.loc = Location.top;\r\n else {\r\n this.add(path[context.i]);\r\n context.i++;\r\n continue;\r\n }\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n executeInternal(path) {\r\n if (path.length < 3 || this.rect.isEmpty())\r\n return;\r\n const startLocs = [];\r\n let firstCross = Location.inside;\r\n let crossingLoc = firstCross, prev = firstCross;\r\n let i;\r\n const highI = path.length - 1;\r\n let result = RectClip64.getLocation(this.rect, path[highI]);\r\n let loc = result.loc;\r\n if (!result.success) {\r\n i = highI - 1;\r\n while (i >= 0 && !result.success) {\r\n i--;\r\n result = RectClip64.getLocation(this.rect, path[i]);\r\n prev = result.loc;\r\n }\r\n if (i < 0) {\r\n for (const pt of path) {\r\n this.add(pt);\r\n }\r\n return;\r\n }\r\n if (prev == Location.inside)\r\n loc = Location.inside;\r\n }\r\n const startingLoc = loc;\r\n ///////////////////////////////////////////////////\r\n i = 0;\r\n while (i <= highI) {\r\n prev = loc;\r\n const prevCrossLoc = crossingLoc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI)\r\n break;\r\n const prevPt = (i == 0) ? path[highI] : path[i - 1];\r\n crossingLoc = loc;\r\n let result = RectClip64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\r\n const ip = result.ip;\r\n if (!result.success) {\r\n if (prevCrossLoc == Location.inside) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n startLocs.push(prev);\r\n prev = RectClip64.getAdjacentLocation(prev, isClockw);\r\n } while (prev != loc);\r\n crossingLoc = prevCrossLoc;\r\n }\r\n else if (prev != Location.inside && prev != loc) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != loc);\r\n }\r\n ++i;\r\n continue;\r\n }\r\n ////////////////////////////////////////////////////\r\n // we must be crossing the rect boundary to get here\r\n ////////////////////////////////////////////////////\r\n if (loc == Location.inside) {\r\n if (firstCross == Location.inside) {\r\n firstCross = crossingLoc;\r\n startLocs.push(prev);\r\n }\r\n else if (prev != crossingLoc) {\r\n const isClockw = RectClip64.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != crossingLoc);\r\n }\r\n }\r\n else if (prev != Location.inside) {\r\n // passing right through rect. 'ip' here will be the second\r\n // intersect pt but we'll also need the first intersect pt (ip2)\r\n loc = prev;\r\n result = RectClip64.getIntersection(this.rectPath, prevPt, path[i], loc);\r\n const ip2 = result.ip;\r\n if (prevCrossLoc != Location.inside && prevCrossLoc != loc)\r\n this.addCorner(prevCrossLoc, loc);\r\n if (firstCross == Location.inside) {\r\n firstCross = loc;\r\n startLocs.push(prev);\r\n }\r\n loc = crossingLoc;\r\n this.add(ip2);\r\n if (ip == ip2) {\r\n loc = RectClip64.getLocation(this.rect, path[i]).loc;\r\n this.addCorner(crossingLoc, loc);\r\n crossingLoc = loc;\r\n continue;\r\n }\r\n }\r\n else {\r\n loc = crossingLoc;\r\n if (firstCross == Location.inside)\r\n firstCross = crossingLoc;\r\n }\r\n this.add(ip);\r\n } //while i <= highI\r\n ///////////////////////////////////////////////////\r\n if (firstCross == Location.inside) {\r\n if (startingLoc != Location.inside) {\r\n if (this.pathBounds.containsRect(this.rect) && RectClip64.path1ContainsPath2(path, this.rectPath)) {\r\n for (let j = 0; j < 4; j++) {\r\n this.add(this.rectPath[j]);\r\n RectClip64.addToEdge(this.edges[j * 2], this.results[0]);\r\n }\r\n }\r\n }\r\n }\r\n else if (loc != Location.inside && (loc != firstCross || startLocs.length > 2)) {\r\n if (startLocs.length > 0) {\r\n prev = loc;\r\n for (const loc2 of startLocs) {\r\n if (prev == loc2)\r\n continue;\r\n this.addCornerByRef(prev, RectClip64.headingClockwise(prev, loc2));\r\n prev = loc2;\r\n }\r\n loc = prev;\r\n }\r\n if (loc != firstCross)\r\n this.addCornerByRef(loc, RectClip64.headingClockwise(loc, firstCross));\r\n }\r\n }\r\n execute(paths) {\r\n const result = [];\r\n if (this.rect.isEmpty())\r\n return result;\r\n for (const path of paths) {\r\n if (path.length < 3)\r\n continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds))\r\n continue;\r\n else if (this.rect.containsRect(this.pathBounds)) {\r\n result.push(path);\r\n continue;\r\n }\r\n this.executeInternal(path);\r\n this.checkEdges();\r\n for (let i = 0; i < 4; ++i)\r\n this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0)\r\n result.push(tmp);\r\n }\r\n this.results.length = 0;\r\n for (let i = 0; i < 8; i++)\r\n this.edges[i].length = 0;\r\n }\r\n return result;\r\n }\r\n checkEdges() {\r\n for (let i = 0; i < this.results.length; i++) {\r\n let op = this.results[i];\r\n let op2 = op;\r\n if (op === undefined)\r\n continue;\r\n do {\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\r\n if (op2 === op) {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined)\r\n break;\r\n op = op2.prev;\r\n }\r\n else {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined)\r\n break;\r\n }\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n } while (op2 !== op);\r\n if (op2 === undefined) {\r\n this.results[i] = undefined;\r\n continue;\r\n }\r\n this.results[i] = op2;\r\n let edgeSet1 = RectClip64.getEdgesForPt(op.prev.pt, this.rect);\r\n op2 = op;\r\n do {\r\n const edgeSet2 = RectClip64.getEdgesForPt(op2.pt, this.rect);\r\n if (edgeSet2 !== 0 && op2.edge === undefined) {\r\n const combinedSet = (edgeSet1 & edgeSet2);\r\n for (let j = 0; j < 4; ++j) {\r\n if ((combinedSet & (1 << j)) !== 0) {\r\n if (RectClip64.isHeadingClockwise(op2.prev.pt, op2.pt, j))\r\n RectClip64.addToEdge(this.edges[j * 2], op2);\r\n else\r\n RectClip64.addToEdge(this.edges[j * 2 + 1], op2);\r\n }\r\n }\r\n }\r\n edgeSet1 = edgeSet2;\r\n op2 = op2.next;\r\n } while (op2 !== op);\r\n }\r\n }\r\n tidyEdgePair(idx, cw, ccw) {\r\n if (ccw.length === 0)\r\n return;\r\n const isHorz = (idx === 1 || idx === 3);\r\n const cwIsTowardLarger = (idx === 1 || idx === 2);\r\n let i = 0, j = 0;\r\n let p1, p2, p1a, p2a, op, op2;\r\n while (i < cw.length) {\r\n p1 = cw[i];\r\n if (!p1 || p1.next === p1.prev) {\r\n cw[i++] = undefined;\r\n j = 0;\r\n continue;\r\n }\r\n const jLim = ccw.length;\r\n while (j < jLim && (!ccw[j] || ccw[j].next === ccw[j].prev))\r\n ++j;\r\n if (j === jLim) {\r\n ++i;\r\n j = 0;\r\n continue;\r\n }\r\n if (cwIsTowardLarger) {\r\n p1 = cw[i].prev;\r\n p1a = cw[i];\r\n p2 = ccw[j];\r\n p2a = ccw[j].prev;\r\n }\r\n else {\r\n p1 = cw[i];\r\n p1a = cw[i].prev;\r\n p2 = ccw[j].prev;\r\n p2a = ccw[j];\r\n }\r\n if ((isHorz && !RectClip64.hasHorzOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt)) ||\r\n (!isHorz && !RectClip64.hasVertOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt))) {\r\n ++j;\r\n continue;\r\n }\r\n const isRejoining = cw[i].ownerIdx !== ccw[j].ownerIdx;\r\n if (isRejoining) {\r\n this.results[p2.ownerIdx] = undefined;\r\n RectClip64.setNewOwner(p2, p1.ownerIdx);\r\n }\r\n if (cwIsTowardLarger) {\r\n // p1 >> | >> p1a;\r\n // p2 << | << p2a;\r\n p1.next = p2;\r\n p2.prev = p1;\r\n p1a.prev = p2a;\r\n p2a.next = p1a;\r\n }\r\n else {\r\n // p1 << | << p1a;\r\n // p2 >> | >> p2a;\r\n p1.prev = p2;\r\n p2.next = p1;\r\n p1a.next = p2a;\r\n p2a.prev = p1a;\r\n }\r\n if (!isRejoining) {\r\n const new_idx = this.results.length;\r\n this.results.push(p1a);\r\n RectClip64.setNewOwner(p1a, new_idx);\r\n }\r\n if (cwIsTowardLarger) {\r\n op = p2;\r\n op2 = p1a;\r\n }\r\n else {\r\n op = p1;\r\n op2 = p2a;\r\n }\r\n this.results[op.ownerIdx] = op;\r\n this.results[op2.ownerIdx] = op2;\r\n // and now lots of work to get ready for the next loop\r\n let opIsLarger, op2IsLarger;\r\n if (isHorz) { // X\r\n opIsLarger = op.pt.x > op.prev.pt.x;\r\n op2IsLarger = op2.pt.x > op2.prev.pt.x;\r\n }\r\n else { // Y\r\n opIsLarger = op.pt.y > op.prev.pt.y;\r\n op2IsLarger = op2.pt.y > op2.prev.pt.y;\r\n }\r\n if ((op.next === op.prev) || (op.pt === op.prev.pt)) {\r\n if (op2IsLarger === cwIsTowardLarger) {\r\n cw[i] = op2;\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n ccw[j] = op2;\r\n cw[i++] = undefined;\r\n }\r\n }\r\n else if ((op2.next === op2.prev) || (op2.pt === op2.prev.pt)) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n ccw[j] = op;\r\n cw[i++] = undefined;\r\n }\r\n }\r\n else if (opIsLarger === op2IsLarger) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n RectClip64.uncoupleEdge(op2);\r\n RectClip64.addToEdge(cw, op2);\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n cw[i++] = undefined;\r\n ccw[j] = op2;\r\n RectClip64.uncoupleEdge(op);\r\n RectClip64.addToEdge(ccw, op);\r\n j = 0;\r\n }\r\n }\r\n else {\r\n if (opIsLarger === cwIsTowardLarger)\r\n cw[i] = op;\r\n else\r\n ccw[j] = op;\r\n if (op2IsLarger === cwIsTowardLarger)\r\n cw[i] = op2;\r\n else\r\n ccw[j] = op2;\r\n }\r\n }\r\n }\r\n getPath(op) {\r\n const result = new Path64();\r\n if (!op || op.prev === op.next)\r\n return result;\r\n let op2 = op.next;\r\n while (op2 && op2 !== op) {\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\r\n op = op2.prev;\r\n op2 = RectClip64.unlinkOp(op2);\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n }\r\n if (!op2)\r\n return new Path64();\r\n result.push(op.pt);\r\n op2 = op.next;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n}\r\nclass RectClipLines64 extends RectClip64 {\r\n constructor(rect) {\r\n super(rect);\r\n }\r\n execute(paths) {\r\n const result = new Paths64();\r\n if (this.rect.isEmpty())\r\n return result;\r\n for (const path of paths) {\r\n if (path.length < 2)\r\n continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds))\r\n continue;\r\n this.executeInternal(path);\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0)\r\n result.push(tmp);\r\n }\r\n // Clean up after every loop\r\n this.results.length = 0; // Clear the array\r\n for (let i = 0; i < 8; i++) {\r\n this.edges[i].length = 0; // Clear each array\r\n }\r\n }\r\n return result;\r\n }\r\n getPath(op) {\r\n const result = new Path64();\r\n if (!op || op === op.next)\r\n return result;\r\n op = op.next; // starting at path beginning \r\n result.push(op.pt);\r\n let op2 = op.next;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n executeInternal(path) {\r\n this.results = [];\r\n if (path.length < 2 || this.rect.isEmpty())\r\n return;\r\n let prev = Location.inside;\r\n let i = 1;\r\n const highI = path.length - 1;\r\n let result = RectClipLines64.getLocation(this.rect, path[0]);\r\n let loc = result.loc;\r\n if (!result.success) {\r\n while (i <= highI && !result.success) {\r\n i++;\r\n result = RectClipLines64.getLocation(this.rect, path[i]);\r\n prev = result.loc;\r\n }\r\n if (i > highI) {\r\n for (const pt of path)\r\n this.add(pt);\r\n }\r\n if (prev == Location.inside)\r\n loc = Location.inside;\r\n i = 1;\r\n }\r\n if (loc == Location.inside)\r\n this.add(path[0]);\r\n while (i <= highI) {\r\n prev = loc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI)\r\n break;\r\n const prevPt = path[i - 1];\r\n let crossingLoc = loc;\r\n let result = RectClipLines64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\r\n const ip = result.ip;\r\n crossingLoc = result.loc;\r\n if (!result.success) {\r\n i++;\r\n continue;\r\n }\r\n if (loc == Location.inside) {\r\n this.add(ip, true);\r\n }\r\n else if (prev !== Location.inside) {\r\n crossingLoc = prev;\r\n result = RectClipLines64.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\r\n const ip2 = result.ip;\r\n crossingLoc = result.loc;\r\n this.add(ip2);\r\n this.add(ip);\r\n }\r\n else {\r\n this.add(ip);\r\n }\r\n }\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass Clipper {\r\n static get InvalidRect64() {\r\n if (!Clipper.invalidRect64)\r\n Clipper.invalidRect64 = new Rect64(false);\r\n return this.invalidRect64;\r\n }\r\n static Intersect(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Intersection, subject, clip, fillRule);\r\n }\r\n static Union(subject, clip, fillRule = FillRule.EvenOdd) {\r\n return this.BooleanOp(ClipType.Union, subject, clip, fillRule);\r\n }\r\n static Difference(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Difference, subject, clip, fillRule);\r\n }\r\n static Xor(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Xor, subject, clip, fillRule);\r\n }\r\n static BooleanOp(clipType, subject, clip, fillRule = FillRule.EvenOdd) {\r\n const solution = new Paths64();\r\n if (!subject)\r\n return solution;\r\n const c = new Clipper64();\r\n c.addPaths(subject, PathType.Subject);\r\n if (clip)\r\n c.addPaths(clip, PathType.Clip);\r\n c.execute(clipType, fillRule, solution);\r\n return solution;\r\n }\r\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\r\n // if (!subject) return;\r\n // const c: Clipper64 = new Clipper64();\r\n // c.addPaths(subject, PathType.Subject);\r\n // if (clip)\r\n // c.addPaths(clip, PathType.Clip);\r\n // c.execute(clipType, fillRule, polytree);\r\n //}\r\n static InflatePaths(paths, delta, joinType, endType, miterLimit = 2.0) {\r\n const co = new ClipperOffset(miterLimit);\r\n co.addPaths(paths, joinType, endType);\r\n const solution = new Paths64();\r\n co.execute(delta, solution);\r\n return solution;\r\n }\r\n static RectClipPaths(rect, paths) {\r\n if (rect.isEmpty() || paths.length === 0)\r\n return new Paths64();\r\n const rc = new RectClip64(rect);\r\n return rc.execute(paths);\r\n }\r\n static RectClip(rect, path) {\r\n if (rect.isEmpty() || path.length === 0)\r\n return new Paths64();\r\n const tmp = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipPaths(rect, tmp);\r\n }\r\n static RectClipLinesPaths(rect, paths) {\r\n if (rect.isEmpty() || paths.length === 0)\r\n return new Paths64();\r\n const rc = new RectClipLines64(rect);\r\n return rc.execute(paths);\r\n }\r\n static RectClipLines(rect, path) {\r\n if (rect.isEmpty() || path.length === 0)\r\n return new Paths64();\r\n const tmp = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipLinesPaths(rect, tmp);\r\n }\r\n static MinkowskiSum(pattern, path, isClosed) {\r\n return Minkowski.sum(pattern, path, isClosed);\r\n }\r\n static MinkowskiDiff(pattern, path, isClosed) {\r\n return Minkowski.diff(pattern, path, isClosed);\r\n }\r\n static area(path) {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let a = 0.0;\r\n const cnt = path.length;\r\n if (cnt < 3)\r\n return 0.0;\r\n let prevPt = path[cnt - 1];\r\n for (const pt of path) {\r\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\r\n prevPt = pt;\r\n }\r\n return a * 0.5;\r\n }\r\n static areaPaths(paths) {\r\n let a = 0.0;\r\n for (const path of paths)\r\n a += this.area(path);\r\n return a;\r\n }\r\n static isPositive(poly) {\r\n return this.area(poly) >= 0;\r\n }\r\n static path64ToString(path) {\r\n let result = \"\";\r\n for (const pt of path)\r\n result += pt.toString();\r\n return result + '\\n';\r\n }\r\n static paths64ToString(paths) {\r\n let result = \"\";\r\n for (const path of paths)\r\n result += this.path64ToString(path);\r\n return result;\r\n }\r\n static offsetPath(path, dx, dy) {\r\n const result = new Path64();\r\n for (const pt of path)\r\n result.push(new Point64(pt.x + dx, pt.y + dy));\r\n return result;\r\n }\r\n static scalePoint64(pt, scale) {\r\n const result = new Point64(Math.round(pt.x * scale), Math.round(pt.y * scale));\r\n return result;\r\n }\r\n static scalePath(path, scale) {\r\n if (InternalClipper.isAlmostZero(scale - 1))\r\n return path;\r\n const result = [];\r\n for (const pt of path)\r\n result.push({ x: pt.x * scale, y: pt.y * scale });\r\n return result;\r\n }\r\n static scalePaths(paths, scale) {\r\n if (InternalClipper.isAlmostZero(scale - 1))\r\n return paths;\r\n const result = [];\r\n for (const path of paths)\r\n result.push(this.scalePath(path, scale));\r\n return result;\r\n }\r\n static translatePath(path, dx, dy) {\r\n const result = [];\r\n for (const pt of path) {\r\n result.push({ x: pt.x + dx, y: pt.y + dy });\r\n }\r\n return result;\r\n }\r\n static translatePaths(paths, dx, dy) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(this.translatePath(path, dx, dy));\r\n }\r\n return result;\r\n }\r\n static reversePath(path) {\r\n return [...path].reverse();\r\n }\r\n static reversePaths(paths) {\r\n const result = [];\r\n for (const t of paths) {\r\n result.push(this.reversePath(t));\r\n }\r\n return result;\r\n }\r\n static getBounds(path) {\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n static getBoundsPaths(paths) {\r\n const result = Clipper.InvalidRect64;\r\n for (const path of paths) {\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n static makePath(arr) {\r\n const len = arr.length / 2;\r\n const p = new Path64();\r\n for (let i = 0; i < len; i++)\r\n p.push(new Point64(arr[i * 2], arr[i * 2 + 1]));\r\n return p;\r\n }\r\n static stripDuplicates(path, isClosedPath) {\r\n const cnt = path.length;\r\n const result = new Path64();\r\n if (cnt === 0)\r\n return result;\r\n let lastPt = path[0];\r\n result.push(lastPt);\r\n for (let i = 1; i < cnt; i++)\r\n if (lastPt !== path[i]) {\r\n lastPt = path[i];\r\n result.push(lastPt);\r\n }\r\n if (isClosedPath && lastPt === result[0])\r\n result.pop();\r\n return result;\r\n }\r\n static addPolyNodeToPaths(polyPath, paths) {\r\n if (polyPath.polygon && polyPath.polygon.length > 0)\r\n paths.push(polyPath.polygon);\r\n for (let i = 0; i < polyPath.count; i++)\r\n this.addPolyNodeToPaths(polyPath.children[i], paths);\r\n }\r\n static polyTreeToPaths64(polyTree) {\r\n const result = new Paths64();\r\n for (let i = 0; i < polyTree.count; i++) {\r\n Clipper.addPolyNodeToPaths(polyTree.children[i], result);\r\n }\r\n return result;\r\n }\r\n static perpendicDistFromLineSqrd(pt, line1, line2) {\r\n const a = pt.x - line1.x;\r\n const b = pt.y - line1.y;\r\n const c = line2.x - line1.x;\r\n const d = line2.y - line1.y;\r\n if (c === 0 && d === 0)\r\n return 0;\r\n return Clipper.sqr(a * d - c * b) / (c * c + d * d);\r\n }\r\n static rdp(path, begin, end, epsSqrd, flags) {\r\n let idx = 0;\r\n let max_d = 0;\r\n while (end > begin && path[begin] === path[end]) {\r\n flags[end--] = false;\r\n }\r\n for (let i = begin + 1; i < end; i++) {\r\n const d = Clipper.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\r\n if (d <= max_d)\r\n continue;\r\n max_d = d;\r\n idx = i;\r\n }\r\n if (max_d <= epsSqrd)\r\n return;\r\n flags[idx] = true;\r\n if (idx > begin + 1)\r\n Clipper.rdp(path, begin, idx, epsSqrd, flags);\r\n if (idx < end - 1)\r\n Clipper.rdp(path, idx, end, epsSqrd, flags);\r\n }\r\n static ramerDouglasPeucker(path, epsilon) {\r\n const len = path.length;\r\n if (len < 5)\r\n return path;\r\n const flags = new Array(len).fill(false);\r\n flags[0] = true;\r\n flags[len - 1] = true;\r\n Clipper.rdp(path, 0, len - 1, Clipper.sqr(epsilon), flags);\r\n const result = [];\r\n for (let i = 0; i < len; i++) {\r\n if (flags[i])\r\n result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n static ramerDouglasPeuckerPaths(paths, epsilon) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(Clipper.ramerDouglasPeucker(path, epsilon));\r\n }\r\n return result;\r\n }\r\n static getNext(current, high, flags) {\r\n current++;\r\n while (current <= high && flags[current])\r\n current++;\r\n if (current <= high)\r\n return current;\r\n current = 0;\r\n while (flags[current])\r\n current++;\r\n return current;\r\n }\r\n static getPrior(current, high, flags) {\r\n if (current === 0)\r\n current = high;\r\n else\r\n current--;\r\n while (current > 0 && flags[current])\r\n current--;\r\n if (!flags[current])\r\n return current;\r\n current = high;\r\n while (flags[current])\r\n current--;\r\n return current;\r\n }\r\n static sqr(value) {\r\n return value * value;\r\n }\r\n static simplifyPath(path, epsilon, isClosedPath = false) {\r\n const len = path.length;\r\n const high = len - 1;\r\n const epsSqr = this.sqr(epsilon);\r\n if (len < 4)\r\n return path;\r\n const flags = new Array(len).fill(false);\r\n const dsq = new Array(len).fill(0);\r\n let prev = high;\r\n let curr = 0;\r\n let start, next, prior2, next2;\r\n if (isClosedPath) {\r\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\r\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\r\n }\r\n else {\r\n dsq[0] = Number.MAX_VALUE;\r\n dsq[high] = Number.MAX_VALUE;\r\n }\r\n for (let i = 1; i < high; i++) {\r\n dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\r\n }\r\n for (;;) {\r\n if (dsq[curr] > epsSqr) {\r\n start = curr;\r\n do {\r\n curr = this.getNext(curr, high, flags);\r\n } while (curr !== start && dsq[curr] > epsSqr);\r\n if (curr === start)\r\n break;\r\n }\r\n prev = this.getPrior(curr, high, flags);\r\n next = this.getNext(curr, high, flags);\r\n if (next === prev)\r\n break;\r\n if (dsq[next] < dsq[curr]) {\r\n flags[next] = true;\r\n next = this.getNext(next, high, flags);\r\n next2 = this.getNext(next, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (next !== high || isClosedPath) {\r\n dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\r\n }\r\n curr = next;\r\n }\r\n else {\r\n flags[curr] = true;\r\n curr = next;\r\n next = this.getNext(next, high, flags);\r\n prior2 = this.getPrior(prev, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (prev !== 0 || isClosedPath) {\r\n dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\r\n }\r\n }\r\n }\r\n const result = [];\r\n for (let i = 0; i < len; i++) {\r\n if (!flags[i])\r\n result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n static simplifyPaths(paths, epsilon, isClosedPaths = false) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(this.simplifyPath(path, epsilon, isClosedPaths));\r\n }\r\n return result;\r\n }\r\n //private static getNext(current: number, high: number, flags: boolean[]): number {\r\n // current++;\r\n // while (current <= high && flags[current]) current++;\r\n // return current;\r\n //}\r\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n // if (current === 0) return high;\r\n // current--;\r\n // while (current > 0 && flags[current]) current--;\r\n // return current;\r\n //}\r\n static trimCollinear(path, isOpen = false) {\r\n let len = path.length;\r\n let i = 0;\r\n if (!isOpen) {\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 1], path[i], path[i + 1]) === 0)\r\n i++;\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 2], path[len - 1], path[i]) === 0)\r\n len--;\r\n }\r\n if (len - i < 3) {\r\n if (!isOpen || len < 2 || path[0] === path[1]) {\r\n return [];\r\n }\r\n return path;\r\n }\r\n const result = [];\r\n let last = path[i];\r\n result.push(last);\r\n for (i++; i < len - 1; i++) {\r\n if (InternalClipper.crossProduct(last, path[i], path[i + 1]) === 0)\r\n continue;\r\n last = path[i];\r\n result.push(last);\r\n }\r\n if (isOpen) {\r\n result.push(path[len - 1]);\r\n }\r\n else if (InternalClipper.crossProduct(last, path[len - 1], result[0]) !== 0) {\r\n result.push(path[len - 1]);\r\n }\r\n else {\r\n while (result.length > 2 && InternalClipper.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0) {\r\n result.pop();\r\n }\r\n if (result.length < 3)\r\n result.splice(0, result.length);\r\n }\r\n return result;\r\n }\r\n static pointInPolygon(pt, polygon) {\r\n return InternalClipper.pointInPolygon(pt, polygon);\r\n }\r\n static ellipse(center, radiusX, radiusY = 0, steps = 0) {\r\n if (radiusX <= 0)\r\n return [];\r\n if (radiusY <= 0)\r\n radiusY = radiusX;\r\n if (steps <= 2)\r\n steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\r\n const si = Math.sin(2 * Math.PI / steps);\r\n const co = Math.cos(2 * Math.PI / steps);\r\n let dx = co, dy = si;\r\n const result = [{ x: center.x + radiusX, y: center.y }];\r\n for (let i = 1; i < steps; ++i) {\r\n result.push({ x: center.x + radiusX * dx, y: center.y + radiusY * dy });\r\n const x = dx * co - dy * si;\r\n dy = dy * co + dx * si;\r\n dx = x;\r\n }\r\n return result;\r\n }\r\n static showPolyPathStructure(pp, level) {\r\n const spaces = ' '.repeat(level * 2);\r\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\r\n if (pp.count === 0) {\r\n console.log(spaces + caption);\r\n }\r\n else {\r\n console.log(spaces + caption + `(${pp.count})`);\r\n pp.forEach(child => this.showPolyPathStructure(child, level + 1));\r\n }\r\n }\r\n static showPolyTreeStructure(polytree) {\r\n console.log(\"Polytree Root\");\r\n polytree.forEach(child => this.showPolyPathStructure(child, 1));\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nvar PointInPolygonResult;\r\n(function (PointInPolygonResult) {\r\n PointInPolygonResult[PointInPolygonResult[\"IsOn\"] = 0] = \"IsOn\";\r\n PointInPolygonResult[PointInPolygonResult[\"IsInside\"] = 1] = \"IsInside\";\r\n PointInPolygonResult[PointInPolygonResult[\"IsOutside\"] = 2] = \"IsOutside\";\r\n})(PointInPolygonResult || (PointInPolygonResult = {}));\r\nvar VertexFlags;\r\n(function (VertexFlags) {\r\n VertexFlags[VertexFlags[\"None\"] = 0] = \"None\";\r\n VertexFlags[VertexFlags[\"OpenStart\"] = 1] = \"OpenStart\";\r\n VertexFlags[VertexFlags[\"OpenEnd\"] = 2] = \"OpenEnd\";\r\n VertexFlags[VertexFlags[\"LocalMax\"] = 4] = \"LocalMax\";\r\n VertexFlags[VertexFlags[\"LocalMin\"] = 8] = \"LocalMin\";\r\n})(VertexFlags || (VertexFlags = {}));\r\nclass Vertex {\r\n constructor(pt, flags, prev) {\r\n this.pt = pt;\r\n this.flags = flags;\r\n this.next = undefined;\r\n this.prev = prev;\r\n }\r\n}\r\nclass LocalMinima {\r\n constructor(vertex, polytype, isOpen = false) {\r\n this.vertex = vertex;\r\n this.polytype = polytype;\r\n this.isOpen = isOpen;\r\n }\r\n static equals(lm1, lm2) {\r\n return lm1.vertex === lm2.vertex;\r\n }\r\n static notEquals(lm1, lm2) {\r\n return lm1.vertex !== lm2.vertex;\r\n }\r\n}\r\nclass IntersectNode {\r\n constructor(pt, edge1, edge2) {\r\n this.pt = pt;\r\n this.edge1 = edge1;\r\n this.edge2 = edge2;\r\n }\r\n}\r\nclass OutPt {\r\n constructor(pt, outrec) {\r\n this.pt = pt;\r\n this.outrec = outrec;\r\n this.next = this;\r\n this.prev = this;\r\n this.horz = undefined;\r\n }\r\n}\r\nvar JoinWith;\r\n(function (JoinWith) {\r\n JoinWith[JoinWith[\"None\"] = 0] = \"None\";\r\n JoinWith[JoinWith[\"Left\"] = 1] = \"Left\";\r\n JoinWith[JoinWith[\"Right\"] = 2] = \"Right\";\r\n})(JoinWith || (JoinWith = {}));\r\nvar HorzPosition;\r\n(function (HorzPosition) {\r\n HorzPosition[HorzPosition[\"Bottom\"] = 0] = \"Bottom\";\r\n HorzPosition[HorzPosition[\"Middle\"] = 1] = \"Middle\";\r\n HorzPosition[HorzPosition[\"Top\"] = 2] = \"Top\";\r\n})(HorzPosition || (HorzPosition = {}));\r\nclass OutRec {\r\n constructor(idx) {\r\n this.idx = idx;\r\n this.isOpen = false;\r\n }\r\n}\r\nclass HorzSegment {\r\n constructor(op) {\r\n this.leftOp = op;\r\n this.rightOp = undefined;\r\n this.leftToRight = true;\r\n }\r\n}\r\nclass HorzJoin {\r\n constructor(ltor, rtol) {\r\n this.op1 = ltor;\r\n this.op2 = rtol;\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////\r\n// Important: UP and DOWN here are premised on Y-axis positive down\r\n// displays, which is the orientation used in Clipper's development.\r\n///////////////////////////////////////////////////////////////////\r\nclass Active {\r\n constructor() {\r\n this.dx = this.windCount = this.windCount2 = 0;\r\n this.isLeftBound = false;\r\n this.joinWith = JoinWith.None;\r\n }\r\n}\r\nclass ClipperEngine {\r\n static addLocMin(vert, polytype, isOpen, minimaList) {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) !== VertexFlags.None)\r\n return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n minimaList.push(lm);\r\n }\r\n static addPathsToVertexList(paths, polytype, isOpen, minimaList, vertexList) {\r\n let totalVertCnt = 0;\r\n for (const path of paths)\r\n totalVertCnt += path.length;\r\n for (const path of paths) {\r\n let v0 = undefined;\r\n let prev_v = undefined;\r\n let curr_v = undefined;\r\n for (const pt of path) {\r\n if (!v0) {\r\n v0 = new Vertex(pt, VertexFlags.None, undefined);\r\n vertexList.push(v0);\r\n prev_v = v0;\r\n }\r\n else if (prev_v.pt !== pt) { // i.e., skips duplicates\r\n curr_v = new Vertex(pt, VertexFlags.None, prev_v);\r\n vertexList.push(curr_v);\r\n prev_v.next = curr_v;\r\n prev_v = curr_v;\r\n }\r\n }\r\n if (!prev_v || !prev_v.prev)\r\n continue;\r\n if (!isOpen && prev_v.pt === v0.pt)\r\n prev_v = prev_v.prev;\r\n prev_v.next = v0;\r\n v0.prev = prev_v;\r\n if (!isOpen && prev_v.next === prev_v)\r\n continue;\r\n // OK, we have a valid path\r\n let going_up = false;\r\n if (isOpen) {\r\n curr_v = v0.next;\r\n let count = 0;\r\n while (curr_v !== v0 && curr_v.pt.y === v0.pt.y) {\r\n curr_v = curr_v.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n going_up = curr_v.pt.y <= v0.pt.y;\r\n if (going_up) {\r\n v0.flags = VertexFlags.OpenStart;\r\n this.addLocMin(v0, polytype, true, minimaList);\r\n }\r\n else {\r\n v0.flags = VertexFlags.OpenStart | VertexFlags.LocalMax;\r\n }\r\n }\r\n else { // closed path\r\n prev_v = v0.prev;\r\n let count = 0;\r\n while (prev_v !== v0 && prev_v.pt.y === v0.pt.y) {\r\n prev_v = prev_v.prev;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n if (prev_v === v0) {\r\n continue; // only open paths can be completely flat\r\n }\r\n going_up = prev_v.pt.y > v0.pt.y;\r\n }\r\n const going_up0 = going_up;\r\n prev_v = v0;\r\n curr_v = v0.next;\r\n let count = 0;\r\n while (curr_v !== v0) {\r\n if (curr_v.pt.y > prev_v.pt.y && going_up) {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n going_up = false;\r\n }\r\n else if (curr_v.pt.y < prev_v.pt.y && !going_up) {\r\n going_up = true;\r\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\r\n }\r\n prev_v = curr_v;\r\n curr_v = curr_v.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n if (isOpen) {\r\n prev_v.flags |= VertexFlags.OpenEnd;\r\n if (going_up) {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n }\r\n else {\r\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\r\n }\r\n }\r\n else if (going_up !== going_up0) {\r\n if (going_up0) {\r\n this.addLocMin(prev_v, polytype, false, minimaList);\r\n }\r\n else {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n }\r\n }\r\n }\r\n }\r\n}\r\nclass ReuseableDataContainer64 {\r\n constructor() {\r\n this._minimaList = [];\r\n this._vertexList = [];\r\n }\r\n clear() {\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n }\r\n addPaths(paths, pt, isOpen) {\r\n ClipperEngine.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\r\n }\r\n}\r\nclass SimpleNavigableSet {\r\n constructor() {\r\n this.items = [];\r\n this.items = [];\r\n }\r\n clear() { this.items.length = 0; }\r\n isEmpty() { return this.items.length == 0; }\r\n pollLast() {\r\n return this.items.pop();\r\n }\r\n add(item) {\r\n if (!this.items.includes(item)) {\r\n this.items.push(item);\r\n this.items.sort((a, b) => a - b);\r\n }\r\n }\r\n}\r\nclass ClipperBase {\r\n constructor() {\r\n this._cliptype = ClipType.None;\r\n this._fillrule = FillRule.EvenOdd;\r\n this._currentLocMin = 0;\r\n this._currentBotY = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n this._using_polytree = false;\r\n this._succeeded = false;\r\n this.reverseSolution = false;\r\n this._minimaList = [];\r\n this._intersectList = [];\r\n this._vertexList = [];\r\n this._outrecList = [];\r\n this._scanlineList = new SimpleNavigableSet();\r\n this._horzSegList = [];\r\n this._horzJoinList = [];\r\n this.preserveCollinear = true;\r\n }\r\n static isOdd(val) {\r\n return ((val & 1) !== 0);\r\n }\r\n static isHotEdgeActive(ae) {\r\n return ae.outrec !== undefined;\r\n }\r\n static isOpen(ae) {\r\n return ae.localMin.isOpen;\r\n }\r\n static isOpenEndActive(ae) {\r\n return ae.localMin.isOpen && ClipperBase.isOpenEnd(ae.vertexTop);\r\n }\r\n static isOpenEnd(v) {\r\n return (v.flags & (VertexFlags.OpenStart | VertexFlags.OpenEnd)) !== VertexFlags.None;\r\n }\r\n static getPrevHotEdge(ae) {\r\n let prev = ae.prevInAEL;\r\n while (prev && (ClipperBase.isOpen(prev) || !ClipperBase.isHotEdgeActive(prev)))\r\n prev = prev.prevInAEL;\r\n return prev;\r\n }\r\n static isFront(ae) {\r\n return ae === ae.outrec.frontEdge;\r\n }\r\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/\r\n static getDx(pt1, pt2) {\r\n const dy = pt2.y - pt1.y;\r\n if (dy !== 0)\r\n return (pt2.x - pt1.x) / dy;\r\n if (pt2.x > pt1.x)\r\n return Number.NEGATIVE_INFINITY;\r\n return Number.POSITIVE_INFINITY;\r\n }\r\n static topX(ae, currentY) {\r\n if ((currentY === ae.top.y) || (ae.top.x === ae.bot.x))\r\n return ae.top.x;\r\n if (currentY === ae.bot.y)\r\n return ae.bot.x;\r\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\r\n }\r\n static isHorizontal(ae) {\r\n return (ae.top.y === ae.bot.y);\r\n }\r\n static isHeadingRightHorz(ae) {\r\n return (Number.NEGATIVE_INFINITY === ae.dx);\r\n }\r\n static isHeadingLeftHorz(ae) {\r\n return (Number.POSITIVE_INFINITY === ae.dx);\r\n }\r\n static swapActives(ae1, ae2) {\r\n [ae2, ae1] = [ae1, ae2];\r\n }\r\n static getPolyType(ae) {\r\n return ae.localMin.polytype;\r\n }\r\n static isSamePolyType(ae1, ae2) {\r\n return ae1.localMin.polytype === ae2.localMin.polytype;\r\n }\r\n static setDx(ae) {\r\n ae.dx = ClipperBase.getDx(ae.bot, ae.top);\r\n }\r\n static nextVertex(ae) {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop.next;\r\n return ae.vertexTop.prev;\r\n }\r\n static prevPrevVertex(ae) {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop.prev.prev;\r\n return ae.vertexTop.next.next;\r\n }\r\n static isMaxima(vertex) {\r\n return (vertex.flags & VertexFlags.LocalMax) !== VertexFlags.None;\r\n }\r\n static isMaximaActive(ae) {\r\n return ClipperBase.isMaxima(ae.vertexTop);\r\n }\r\n static getMaximaPair(ae) {\r\n let ae2 = ae.nextInAEL;\r\n while (ae2) {\r\n if (ae2.vertexTop === ae.vertexTop)\r\n return ae2; // Found!\r\n ae2 = ae2.nextInAEL;\r\n }\r\n return undefined;\r\n }\r\n static getCurrYMaximaVertex_Open(ae) {\r\n let result = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result.next.pt.y === result.pt.y &&\r\n ((result.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result.next;\r\n }\r\n else {\r\n while (result.prev.pt.y === result.pt.y &&\r\n ((result.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result))\r\n result = undefined; // not a maxima\r\n return result;\r\n }\r\n static getCurrYMaximaVertex(ae) {\r\n let result = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result.next.pt.y === result.pt.y)\r\n result = result.next;\r\n }\r\n else {\r\n while (result.prev.pt.y === result.pt.y)\r\n result = result.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result))\r\n result = undefined; // not a maxima\r\n return result;\r\n }\r\n static setSides(outrec, startEdge, endEdge) {\r\n outrec.frontEdge = startEdge;\r\n outrec.backEdge = endEdge;\r\n }\r\n static swapOutrecs(ae1, ae2) {\r\n const or1 = ae1.outrec;\r\n const or2 = ae2.outrec;\r\n if (or1 === or2) {\r\n const ae = or1.frontEdge;\r\n or1.frontEdge = or1.backEdge;\r\n or1.backEdge = ae;\r\n return;\r\n }\r\n if (or1) {\r\n if (ae1 === or1.frontEdge)\r\n or1.frontEdge = ae2;\r\n else\r\n or1.backEdge = ae2;\r\n }\r\n if (or2) {\r\n if (ae2 === or2.frontEdge)\r\n or2.frontEdge = ae1;\r\n else\r\n or2.backEdge = ae1;\r\n }\r\n ae1.outrec = or2;\r\n ae2.outrec = or1;\r\n }\r\n static setOwner(outrec, newOwner) {\r\n while (newOwner.owner && !newOwner.owner.pts) {\r\n newOwner.owner = newOwner.owner.owner;\r\n }\r\n //make sure that outrec isn't an owner of newOwner\r\n let tmp = newOwner;\r\n while (tmp && tmp !== outrec)\r\n tmp = tmp.owner;\r\n if (tmp)\r\n newOwner.owner = outrec.owner;\r\n outrec.owner = newOwner;\r\n }\r\n static area(op) {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let area = 0.0;\r\n let op2 = op;\r\n do {\r\n area += (op2.prev.pt.y + op2.pt.y) *\r\n (op2.prev.pt.x - op2.pt.x);\r\n op2 = op2.next;\r\n } while (op2 !== op);\r\n return area * 0.5;\r\n }\r\n static areaTriangle(pt1, pt2, pt3) {\r\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) +\r\n (pt1.y + pt2.y) * (pt1.x - pt2.x) +\r\n (pt2.y + pt3.y) * (pt2.x - pt3.x);\r\n }\r\n static getRealOutRec(outRec) {\r\n while (outRec !== undefined && outRec.pts === undefined) {\r\n outRec = outRec.owner;\r\n }\r\n return outRec;\r\n }\r\n static isValidOwner(outRec, testOwner) {\r\n while (testOwner !== undefined && testOwner !== outRec)\r\n testOwner = testOwner.owner;\r\n return testOwner === undefined;\r\n }\r\n static uncoupleOutRec(ae) {\r\n const outrec = ae.outrec;\r\n if (outrec === undefined)\r\n return;\r\n outrec.frontEdge.outrec = undefined;\r\n outrec.backEdge.outrec = undefined;\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = undefined;\r\n }\r\n static outrecIsAscending(hotEdge) {\r\n return (hotEdge === hotEdge.outrec.frontEdge);\r\n }\r\n static swapFrontBackSides(outrec) {\r\n // while this proc. is needed for open paths\r\n // it's almost never needed for closed paths\r\n const ae2 = outrec.frontEdge;\r\n outrec.frontEdge = outrec.backEdge;\r\n outrec.backEdge = ae2;\r\n outrec.pts = outrec.pts.next;\r\n }\r\n static edgesAdjacentInAEL(inode) {\r\n return (inode.edge1.nextInAEL === inode.edge2) || (inode.edge1.prevInAEL === inode.edge2);\r\n }\r\n clearSolutionOnly() {\r\n while (this._actives)\r\n this.deleteFromAEL(this._actives);\r\n this._scanlineList.clear();\r\n this.disposeIntersectNodes();\r\n this._outrecList.length = 0;\r\n this._horzSegList.length = 0;\r\n this._horzJoinList.length = 0;\r\n }\r\n clear() {\r\n this.clearSolutionOnly();\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n this._currentLocMin = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n }\r\n reset() {\r\n if (!this._isSortedMinimaList) {\r\n this._minimaList.sort((locMin1, locMin2) => locMin2.vertex.pt.y - locMin1.vertex.pt.y);\r\n this._isSortedMinimaList = true;\r\n }\r\n for (let i = this._minimaList.length - 1; i >= 0; i--) {\r\n this._scanlineList.add(this._minimaList[i].vertex.pt.y);\r\n }\r\n this._currentBotY = 0;\r\n this._currentLocMin = 0;\r\n this._actives = undefined;\r\n this._sel = undefined;\r\n this._succeeded = true;\r\n }\r\n insertScanline(y) {\r\n this._scanlineList.add(y);\r\n }\r\n popScanline() {\r\n return this._scanlineList.pollLast();\r\n }\r\n hasLocMinAtY(y) {\r\n return (this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y);\r\n }\r\n popLocalMinima() {\r\n return this._minimaList[this._currentLocMin++];\r\n }\r\n addLocMin(vert, polytype, isOpen) {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) != VertexFlags.None)\r\n return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n this._minimaList.push(lm);\r\n }\r\n addSubject(path) {\r\n this.addPath(path, PathType.Subject);\r\n }\r\n addOpenSubject(path) {\r\n this.addPath(path, PathType.Subject, true);\r\n }\r\n addClip(path) {\r\n this.addPath(path, PathType.Clip);\r\n }\r\n addPath(path, polytype, isOpen = false) {\r\n const tmp = [path];\r\n this.addPaths(tmp, polytype, isOpen);\r\n }\r\n addPaths(paths, polytype, isOpen = false) {\r\n if (isOpen)\r\n this._hasOpenPaths = true;\r\n this._isSortedMinimaList = false;\r\n ClipperEngine.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\r\n }\r\n addReuseableData(reuseableData) {\r\n if (reuseableData._minimaList.length === 0)\r\n return;\r\n this._isSortedMinimaList = false;\r\n for (const lm of reuseableData._minimaList) {\r\n this._minimaList.push(new LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\r\n if (lm.isOpen)\r\n this._hasOpenPaths = true;\r\n }\r\n }\r\n isContributingClosed(ae) {\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae.windCount !== 1)\r\n return false;\r\n break;\r\n case FillRule.Negative:\r\n if (ae.windCount !== -1)\r\n return false;\r\n break;\r\n case FillRule.NonZero:\r\n if (Math.abs(ae.windCount) !== 1)\r\n return false;\r\n break;\r\n }\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 > 0;\r\n case FillRule.Negative: return ae.windCount2 < 0;\r\n default: return ae.windCount2 !== 0;\r\n }\r\n case ClipType.Union:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 <= 0;\r\n case FillRule.Negative: return ae.windCount2 >= 0;\r\n default: return ae.windCount2 === 0;\r\n }\r\n case ClipType.Difference:\r\n const result = this._fillrule === FillRule.Positive ? (ae.windCount2 <= 0) :\r\n this._fillrule === FillRule.Negative ? (ae.windCount2 >= 0) :\r\n (ae.windCount2 === 0);\r\n return ClipperBase.getPolyType(ae) === PathType.Subject ? result : !result;\r\n case ClipType.Xor:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n isContributingOpen(ae) {\r\n let isInClip, isInSubj;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n isInSubj = ae.windCount > 0;\r\n isInClip = ae.windCount2 > 0;\r\n break;\r\n case FillRule.Negative:\r\n isInSubj = ae.windCount < 0;\r\n isInClip = ae.windCount2 < 0;\r\n break;\r\n default:\r\n isInSubj = ae.windCount !== 0;\r\n isInClip = ae.windCount2 !== 0;\r\n break;\r\n }\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n return isInClip;\r\n case ClipType.Union:\r\n return !isInSubj && !isInClip;\r\n default:\r\n return !isInClip;\r\n }\r\n }\r\n setWindCountForClosedPathEdge(ae) {\r\n let ae2 = ae.prevInAEL;\r\n const pt = ClipperBase.getPolyType(ae);\r\n while (ae2 !== undefined && (ClipperBase.getPolyType(ae2) !== pt || ClipperBase.isOpen(ae2))) {\r\n ae2 = ae2.prevInAEL;\r\n }\r\n if (ae2 === undefined) {\r\n ae.windCount = ae.windDx;\r\n ae2 = this._actives;\r\n }\r\n else if (this._fillrule === FillRule.EvenOdd) {\r\n ae.windCount = ae.windDx;\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n else {\r\n // NonZero, positive, or negative filling here ...\r\n // when e2's WindCnt is in the SAME direction as its WindDx,\r\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\r\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\r\n if (ae2.windCount * ae2.windDx < 0) {\r\n // opposite directions so 'ae' is outside 'ae2' ...\r\n if (Math.abs(ae2.windCount) > 1) {\r\n // outside prev poly but still inside another.\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n else {\r\n // now outside all polys of same polytype so set own WC ...\r\n ae.windCount = (ClipperBase.isOpen(ae) ? 1 : ae.windDx);\r\n }\r\n }\r\n else {\r\n // 'ae' must be inside 'ae2'\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\r\n }\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) !== pt && !ClipperBase.isOpen(ae2)) {\r\n ae.windCount2 = (ae.windCount2 === 0 ? 1 : 0);\r\n }\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) !== pt && !ClipperBase.isOpen(ae2)) {\r\n ae.windCount2 += ae2.windDx;\r\n }\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n }\r\n setWindCountForOpenPathEdge(ae) {\r\n let ae2 = this._actives;\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n let cnt1 = 0, cnt2 = 0;\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) === PathType.Clip)\r\n cnt2++;\r\n else if (!ClipperBase.isOpen(ae2))\r\n cnt1++;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n ae.windCount = (ClipperBase.isOdd(cnt1) ? 1 : 0);\r\n ae.windCount2 = (ClipperBase.isOdd(cnt2) ? 1 : 0);\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) === PathType.Clip)\r\n ae.windCount2 += ae2.windDx;\r\n else if (!ClipperBase.isOpen(ae2))\r\n ae.windCount += ae2.windDx;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n }\r\n static isValidAelOrder(resident, newcomer) {\r\n if (newcomer.curX !== resident.curX)\r\n return newcomer.curX > resident.curX;\r\n // get the turning direction a1.top, a2.bot, a2.top\r\n const d = InternalClipper.crossProduct(resident.top, newcomer.bot, newcomer.top);\r\n if (d !== 0.0)\r\n return (d < 0);\r\n // edges must be collinear to get here\r\n // for starting open paths, place them according to\r\n // the direction they're about to turn\r\n if (!this.isMaximaActive(resident) && (resident.top.y > newcomer.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot, resident.top, this.nextVertex(resident).pt) <= 0;\r\n }\r\n if (!this.isMaximaActive(newcomer) && (newcomer.top.y > resident.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot, newcomer.top, this.nextVertex(newcomer).pt) >= 0;\r\n }\r\n const y = newcomer.bot.y;\r\n const newcomerIsLeft = newcomer.isLeftBound;\r\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y)\r\n return newcomer.isLeftBound;\r\n // resident must also have just been inserted\r\n if (resident.isLeftBound !== newcomerIsLeft)\r\n return newcomerIsLeft;\r\n if (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt, resident.bot, resident.top) === 0)\r\n return true;\r\n // compare turning direction of the alternate bound\r\n return (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt, newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0) === newcomerIsLeft;\r\n }\r\n insertLeftEdge(ae) {\r\n let ae2;\r\n if (!this._actives) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = undefined;\r\n this._actives = ae;\r\n }\r\n else if (!ClipperBase.isValidAelOrder(this._actives, ae)) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = this._actives;\r\n this._actives.prevInAEL = ae;\r\n this._actives = ae;\r\n }\r\n else {\r\n ae2 = this._actives;\r\n while (ae2.nextInAEL && ClipperBase.isValidAelOrder(ae2.nextInAEL, ae))\r\n ae2 = ae2.nextInAEL;\r\n //don't separate joined edges\r\n if (ae2.joinWith === JoinWith.Right)\r\n ae2 = ae2.nextInAEL;\r\n ae.nextInAEL = ae2.nextInAEL;\r\n if (ae2.nextInAEL)\r\n ae2.nextInAEL.prevInAEL = ae;\r\n ae.prevInAEL = ae2;\r\n ae2.nextInAEL = ae;\r\n }\r\n }\r\n static insertRightEdge(ae, ae2) {\r\n ae2.nextInAEL = ae.nextInAEL;\r\n if (ae.nextInAEL)\r\n ae.nextInAEL.prevInAEL = ae2;\r\n ae2.prevInAEL = ae;\r\n ae.nextInAEL = ae2;\r\n }\r\n insertLocalMinimaIntoAEL(botY) {\r\n let localMinima;\r\n let leftBound;\r\n let rightBound;\r\n // Add any local minima (if any) at BotY ...\r\n // NB horizontal local minima edges should contain locMin.vertex.prev\r\n while (this.hasLocMinAtY(botY)) {\r\n localMinima = this.popLocalMinima();\r\n if ((localMinima.vertex.flags & VertexFlags.OpenStart) !== VertexFlags.None) {\r\n leftBound = undefined;\r\n }\r\n else {\r\n leftBound = new Active();\r\n leftBound.bot = localMinima.vertex.pt;\r\n leftBound.curX = localMinima.vertex.pt.x;\r\n leftBound.windDx = -1;\r\n leftBound.vertexTop = localMinima.vertex.prev;\r\n leftBound.top = localMinima.vertex.prev.pt;\r\n leftBound.outrec = undefined;\r\n leftBound.localMin = localMinima;\r\n ClipperBase.setDx(leftBound);\r\n }\r\n if ((localMinima.vertex.flags & VertexFlags.OpenEnd) !== VertexFlags.None) {\r\n rightBound = undefined;\r\n }\r\n else {\r\n rightBound = new Active();\r\n rightBound.bot = localMinima.vertex.pt;\r\n rightBound.curX = localMinima.vertex.pt.x;\r\n rightBound.windDx = 1;\r\n rightBound.vertexTop = localMinima.vertex.next;\r\n rightBound.top = localMinima.vertex.next.pt;\r\n rightBound.outrec = undefined;\r\n rightBound.localMin = localMinima;\r\n ClipperBase.setDx(rightBound);\r\n }\r\n if (leftBound && rightBound) {\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n if (ClipperBase.isHeadingRightHorz(leftBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n }\r\n else if (ClipperBase.isHorizontal(rightBound)) {\r\n if (ClipperBase.isHeadingLeftHorz(rightBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n }\r\n else if (leftBound.dx < rightBound.dx) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n //so when leftBound has windDx == 1, the polygon will be oriented\r\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\r\n }\r\n else if (leftBound === undefined) {\r\n leftBound = rightBound;\r\n rightBound = undefined;\r\n }\r\n let contributing = false;\r\n leftBound.isLeftBound = true;\r\n this.insertLeftEdge(leftBound);\r\n if (ClipperBase.isOpen(leftBound)) {\r\n this.setWindCountForOpenPathEdge(leftBound);\r\n contributing = this.isContributingOpen(leftBound);\r\n }\r\n else {\r\n this.setWindCountForClosedPathEdge(leftBound);\r\n contributing = this.isContributingClosed(leftBound);\r\n }\r\n if (rightBound) {\r\n rightBound.windCount = leftBound.windCount;\r\n rightBound.windCount2 = leftBound.windCount2;\r\n ClipperBase.insertRightEdge(leftBound, rightBound);\r\n if (contributing) {\r\n this.addLocalMinPoly(leftBound, rightBound, leftBound.bot, true);\r\n if (!ClipperBase.isHorizontal(leftBound)) {\r\n this.checkJoinLeft(leftBound, leftBound.bot);\r\n }\r\n }\r\n while (rightBound.nextInAEL &&\r\n ClipperBase.isValidAelOrder(rightBound.nextInAEL, rightBound)) {\r\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\r\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\r\n }\r\n if (ClipperBase.isHorizontal(rightBound)) {\r\n this.pushHorz(rightBound);\r\n }\r\n else {\r\n this.checkJoinRight(rightBound, rightBound.bot);\r\n this.insertScanline(rightBound.top.y);\r\n }\r\n }\r\n else if (contributing) {\r\n this.startOpenPath(leftBound, leftBound.bot);\r\n }\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n this.pushHorz(leftBound);\r\n }\r\n else {\r\n this.insertScanline(leftBound.top.y);\r\n }\r\n }\r\n }\r\n pushHorz(ae) {\r\n ae.nextInSEL = this._sel;\r\n this._sel = ae;\r\n }\r\n popHorz() {\r\n const ae = this._sel;\r\n if (this._sel === undefined)\r\n return undefined;\r\n this._sel = this._sel.nextInSEL;\r\n return ae;\r\n }\r\n addLocalMinPoly(ae1, ae2, pt, isNew = false) {\r\n const outrec = this.newOutRec();\r\n ae1.outrec = outrec;\r\n ae2.outrec = outrec;\r\n if (ClipperBase.isOpen(ae1)) {\r\n outrec.owner = undefined;\r\n outrec.isOpen = true;\r\n if (ae1.windDx > 0)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n else {\r\n outrec.isOpen = false;\r\n const prevHotEdge = ClipperBase.getPrevHotEdge(ae1);\r\n // e.windDx is the winding direction of the **input** paths\r\n // and unrelated to the winding direction of output polygons.\r\n // Output orientation is determined by e.outrec.frontE which is\r\n // the ascending edge (see AddLocalMinPoly).\r\n if (prevHotEdge) {\r\n if (this._using_polytree)\r\n ClipperBase.setOwner(outrec, prevHotEdge.outrec);\r\n outrec.owner = prevHotEdge.outrec;\r\n if (ClipperBase.outrecIsAscending(prevHotEdge) === isNew)\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n else\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n }\r\n else {\r\n outrec.owner = undefined;\r\n if (isNew)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n }\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n addLocalMaxPoly(ae1, ae2, pt) {\r\n if (ClipperBase.isJoined(ae1))\r\n this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n if (ClipperBase.isFront(ae1) === ClipperBase.isFront(ae2)) {\r\n if (ClipperBase.isOpenEndActive(ae1))\r\n ClipperBase.swapFrontBackSides(ae1.outrec);\r\n else if (ClipperBase.isOpenEndActive(ae2))\r\n ClipperBase.swapFrontBackSides(ae2.outrec);\r\n else {\r\n this._succeeded = false;\r\n return undefined;\r\n }\r\n }\r\n const result = ClipperBase.addOutPt(ae1, pt);\r\n if (ae1.outrec === ae2.outrec) {\r\n const outrec = ae1.outrec;\r\n outrec.pts = result;\r\n if (this._using_polytree) {\r\n const e = ClipperBase.getPrevHotEdge(ae1);\r\n if (e === undefined)\r\n outrec.owner = undefined;\r\n else\r\n ClipperBase.setOwner(outrec, e.outrec);\r\n }\r\n ClipperBase.uncoupleOutRec(ae1);\r\n }\r\n else if (ClipperBase.isOpen(ae1)) {\r\n if (ae1.windDx < 0)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n }\r\n else if (ae1.outrec.idx < ae2.outrec.idx)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n return result;\r\n }\r\n static joinOutrecPaths(ae1, ae2) {\r\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\r\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\r\n const p1Start = ae1.outrec.pts;\r\n const p2Start = ae2.outrec.pts;\r\n const p1End = p1Start.next;\r\n const p2End = p2Start.next;\r\n if (ClipperBase.isFront(ae1)) {\r\n p2End.prev = p1Start;\r\n p1Start.next = p2End;\r\n p2Start.next = p1End;\r\n p1End.prev = p2Start;\r\n ae1.outrec.pts = p2Start;\r\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\r\n ae1.outrec.frontEdge = ae2.outrec.frontEdge;\r\n if (ae1.outrec.frontEdge)\r\n ae1.outrec.frontEdge.outrec = ae1.outrec;\r\n }\r\n else {\r\n p1End.prev = p2Start;\r\n p2Start.next = p1End;\r\n p1Start.next = p2End;\r\n p2End.prev = p1Start;\r\n ae1.outrec.backEdge = ae2.outrec.backEdge;\r\n if (ae1.outrec.backEdge)\r\n ae1.outrec.backEdge.outrec = ae1.outrec;\r\n }\r\n // after joining, the ae2.OutRec must contains no vertices ...\r\n ae2.outrec.frontEdge = undefined;\r\n ae2.outrec.backEdge = undefined;\r\n ae2.outrec.pts = undefined;\r\n ClipperBase.setOwner(ae2.outrec, ae1.outrec);\r\n if (ClipperBase.isOpenEndActive(ae1)) {\r\n ae2.outrec.pts = ae1.outrec.pts;\r\n ae1.outrec.pts = undefined;\r\n }\r\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\r\n ae1.outrec = undefined;\r\n ae2.outrec = undefined;\r\n }\r\n static addOutPt(ae, pt) {\r\n const outrec = ae.outrec;\r\n const toFront = ClipperBase.isFront(ae);\r\n const opFront = outrec.pts;\r\n const opBack = opFront.next;\r\n if (toFront && (pt == opFront.pt))\r\n return opFront;\r\n else if (!toFront && (pt == opBack.pt))\r\n return opBack;\r\n const newOp = new OutPt(pt, outrec);\r\n opBack.prev = newOp;\r\n newOp.prev = opFront;\r\n newOp.next = opBack;\r\n opFront.next = newOp;\r\n if (toFront)\r\n outrec.pts = newOp;\r\n return newOp;\r\n }\r\n newOutRec() {\r\n const result = new OutRec(this._outrecList.length);\r\n this._outrecList.push(result);\r\n return result;\r\n }\r\n startOpenPath(ae, pt) {\r\n const outrec = this.newOutRec();\r\n outrec.isOpen = true;\r\n if (ae.windDx > 0) {\r\n outrec.frontEdge = ae;\r\n outrec.backEdge = undefined;\r\n }\r\n else {\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = ae;\r\n }\r\n ae.outrec = outrec;\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n updateEdgeIntoAEL(ae) {\r\n ae.bot = ae.top;\r\n ae.vertexTop = ClipperBase.nextVertex(ae);\r\n ae.top = ae.vertexTop.pt;\r\n ae.curX = ae.bot.x;\r\n ClipperBase.setDx(ae);\r\n if (ClipperBase.isJoined(ae))\r\n this.split(ae, ae.bot);\r\n if (ClipperBase.isHorizontal(ae))\r\n return;\r\n this.insertScanline(ae.top.y);\r\n this.checkJoinLeft(ae, ae.bot);\r\n this.checkJoinRight(ae, ae.bot, true);\r\n }\r\n static findEdgeWithMatchingLocMin(e) {\r\n let result = e.nextInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin)\r\n return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot)\r\n result = undefined;\r\n else\r\n result = result.nextInAEL;\r\n }\r\n result = e.prevInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin)\r\n return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot)\r\n return undefined;\r\n result = result.prevInAEL;\r\n }\r\n return result;\r\n }\r\n intersectEdges(ae1, ae2, pt) {\r\n let resultOp = undefined;\r\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\r\n if (this._hasOpenPaths && (ClipperBase.isOpen(ae1) || ClipperBase.isOpen(ae2))) {\r\n if (ClipperBase.isOpen(ae1) && ClipperBase.isOpen(ae2))\r\n return undefined;\r\n // the following line avoids duplicating quite a bit of code\r\n if (ClipperBase.isOpen(ae2))\r\n ClipperBase.swapActives(ae1, ae2);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n if (this._cliptype === ClipType.Union) {\r\n if (!ClipperBase.isHotEdgeActive(ae2))\r\n return undefined;\r\n }\r\n else if (ae2.localMin.polytype === PathType.Subject)\r\n return undefined;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae2.windCount !== 1)\r\n return undefined;\r\n break;\r\n case FillRule.Negative:\r\n if (ae2.windCount !== -1)\r\n return undefined;\r\n break;\r\n default:\r\n if (Math.abs(ae2.windCount) !== 1)\r\n return undefined;\r\n break;\r\n }\r\n // toggle contribution ...\r\n if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n if (ClipperBase.isFront(ae1)) {\r\n ae1.outrec.frontEdge = undefined;\r\n }\r\n else {\r\n ae1.outrec.backEdge = undefined;\r\n }\r\n ae1.outrec = undefined;\r\n // horizontal edges can pass under open paths at a LocMins\r\n }\r\n else if (pt === ae1.localMin.vertex.pt && !ClipperBase.isOpenEnd(ae1.localMin.vertex)) {\r\n // find the other side of the LocMin and\r\n // if it's 'hot' join up with it ...\r\n const ae3 = ClipperBase.findEdgeWithMatchingLocMin(ae1);\r\n if (ae3 && ClipperBase.isHotEdgeActive(ae3)) {\r\n ae1.outrec = ae3.outrec;\r\n if (ae1.windDx > 0) {\r\n ClipperBase.setSides(ae3.outrec, ae1, ae3);\r\n }\r\n else {\r\n ClipperBase.setSides(ae3.outrec, ae3, ae1);\r\n }\r\n return ae3.outrec.pts;\r\n }\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n else {\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n return resultOp;\r\n }\r\n // MANAGING CLOSED PATHS FROM HERE ON\r\n if (ClipperBase.isJoined(ae1))\r\n this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n // UPDATE WINDING COUNTS...\r\n let oldE1WindCount;\r\n let oldE2WindCount;\r\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n oldE1WindCount = ae1.windCount;\r\n ae1.windCount = ae2.windCount;\r\n ae2.windCount = oldE1WindCount;\r\n }\r\n else {\r\n if (ae1.windCount + ae2.windDx === 0)\r\n ae1.windCount = -ae1.windCount;\r\n else\r\n ae1.windCount += ae2.windDx;\r\n if (ae2.windCount - ae1.windDx === 0)\r\n ae2.windCount = -ae2.windCount;\r\n else\r\n ae2.windCount -= ae1.windDx;\r\n }\r\n }\r\n else {\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae1.windCount2 += ae2.windDx;\r\n else\r\n ae1.windCount2 = (ae1.windCount2 === 0 ? 1 : 0);\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae2.windCount2 -= ae1.windDx;\r\n else\r\n ae2.windCount2 = (ae2.windCount2 === 0 ? 1 : 0);\r\n }\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n oldE1WindCount = ae1.windCount;\r\n oldE2WindCount = ae2.windCount;\r\n break;\r\n case FillRule.Negative:\r\n oldE1WindCount = -ae1.windCount;\r\n oldE2WindCount = -ae2.windCount;\r\n break;\r\n default:\r\n oldE1WindCount = Math.abs(ae1.windCount);\r\n oldE2WindCount = Math.abs(ae2.windCount);\r\n break;\r\n }\r\n const e1WindCountIs0or1 = oldE1WindCount === 0 || oldE1WindCount === 1;\r\n const e2WindCountIs0or1 = oldE2WindCount === 0 || oldE2WindCount === 1;\r\n if ((!ClipperBase.isHotEdgeActive(ae1) && !e1WindCountIs0or1) || (!ClipperBase.isHotEdgeActive(ae2) && !e2WindCountIs0or1))\r\n return undefined;\r\n // NOW PROCESS THE INTERSECTION ...\r\n // if both edges are 'hot' ...\r\n if (ClipperBase.isHotEdgeActive(ae1) && ClipperBase.isHotEdgeActive(ae2)) {\r\n if ((oldE1WindCount !== 0 && oldE1WindCount !== 1) ||\r\n (oldE2WindCount !== 0 && oldE2WindCount !== 1) ||\r\n (ae1.localMin.polytype !== ae2.localMin.polytype &&\r\n this._cliptype !== ClipType.Xor)) {\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n }\r\n else if (ClipperBase.isFront(ae1) || (ae1.outrec === ae2.outrec)) {\r\n // this 'else if' condition isn't strictly needed but\r\n // it's sensible to split polygons that only touch at\r\n // a common vertex (not at common edges).\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n else {\r\n // can't treat as maxima & minima\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n }\r\n // if one or the other edge is 'hot' ...\r\n else if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n else if (ClipperBase.isHotEdgeActive(ae2)) {\r\n resultOp = ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n // neither edge is 'hot'\r\n else {\r\n let e1Wc2;\r\n let e2Wc2;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n e1Wc2 = ae1.windCount2;\r\n e2Wc2 = ae2.windCount2;\r\n break;\r\n case FillRule.Negative:\r\n e1Wc2 = -ae1.windCount2;\r\n e2Wc2 = -ae2.windCount2;\r\n break;\r\n default:\r\n e1Wc2 = Math.abs(ae1.windCount2);\r\n e2Wc2 = Math.abs(ae2.windCount2);\r\n break;\r\n }\r\n if (!ClipperBase.isSamePolyType(ae1, ae2)) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\r\n resultOp = undefined;\r\n switch (this._cliptype) {\r\n case ClipType.Union:\r\n if (e1Wc2 > 0 && e2Wc2 > 0)\r\n return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n case ClipType.Difference:\r\n if (((ClipperBase.getPolyType(ae1) === PathType.Clip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||\r\n ((ClipperBase.getPolyType(ae1) === PathType.Subject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n break;\r\n case ClipType.Xor:\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n default: // ClipType.Intersection:\r\n if (e1Wc2 <= 0 || e2Wc2 <= 0)\r\n return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n }\r\n }\r\n }\r\n return resultOp;\r\n }\r\n deleteFromAEL(ae) {\r\n const prev = ae.prevInAEL;\r\n const next = ae.nextInAEL;\r\n if (!prev && !next && ae !== this._actives)\r\n return; // already deleted\r\n if (prev)\r\n prev.nextInAEL = next;\r\n else\r\n this._actives = next;\r\n if (next)\r\n next.prevInAEL = prev;\r\n }\r\n adjustCurrXAndCopyToSEL(topY) {\r\n let ae = this._actives;\r\n this._sel = ae;\r\n while (ae) {\r\n ae.prevInSEL = ae.prevInAEL;\r\n ae.nextInSEL = ae.nextInAEL;\r\n ae.jump = ae.nextInSEL;\r\n if (ae.joinWith === JoinWith.Left)\r\n ae.curX = ae.prevInAEL.curX; // This also avoids complications\r\n else\r\n ae.curX = ClipperBase.topX(ae, topY);\r\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n executeInternal(ct, fillRule) {\r\n if (ct === ClipType.None)\r\n return;\r\n this._fillrule = fillRule;\r\n this._cliptype = ct;\r\n this.reset();\r\n let y = this.popScanline();\r\n if (y === undefined)\r\n return;\r\n while (this._succeeded) {\r\n this.insertLocalMinimaIntoAEL(y);\r\n let ae = this.popHorz();\r\n while (ae) {\r\n this.doHorizontal(ae);\r\n ae = this.popHorz();\r\n }\r\n if (this._horzSegList.length > 0) {\r\n this.convertHorzSegsToJoins();\r\n this._horzSegList.length = 0;\r\n }\r\n this._currentBotY = y; // bottom of scanbeam\r\n y = this.popScanline();\r\n if (y === undefined)\r\n break; // y new top of scanbeam\r\n this.doIntersections(y);\r\n this.doTopOfScanbeam(y);\r\n ae = this.popHorz();\r\n while (ae) {\r\n this.doHorizontal(ae);\r\n ae = this.popHorz();\r\n }\r\n }\r\n if (this._succeeded)\r\n this.processHorzJoins();\r\n }\r\n doIntersections(topY) {\r\n if (this.buildIntersectList(topY)) {\r\n this.processIntersectList();\r\n this.disposeIntersectNodes();\r\n }\r\n }\r\n disposeIntersectNodes() {\r\n this._intersectList.length = 0;\r\n }\r\n addNewIntersectNode(ae1, ae2, topY) {\r\n const result = InternalClipper.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top);\r\n let ip = result.ip;\r\n if (!result.success) {\r\n ip = new Point64(ae1.curX, topY);\r\n }\r\n if (ip.y > this._currentBotY || ip.y < topY) {\r\n const absDx1 = Math.abs(ae1.dx);\r\n const absDx2 = Math.abs(ae2.dx);\r\n if (absDx1 > 100 && absDx2 > 100) {\r\n if (absDx1 > absDx2) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n }\r\n else {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n }\r\n else if (absDx1 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n }\r\n else if (absDx2 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n else {\r\n if (ip.y < topY) {\r\n ip.y = topY;\r\n }\r\n else {\r\n ip.y = this._currentBotY;\r\n }\r\n if (absDx1 < absDx2) {\r\n ip.x = ClipperBase.topX(ae1, ip.y);\r\n }\r\n else {\r\n ip.x = ClipperBase.topX(ae2, ip.y);\r\n }\r\n }\r\n }\r\n const node = new IntersectNode(ip, ae1, ae2);\r\n this._intersectList.push(node);\r\n }\r\n static extractFromSEL(ae) {\r\n const res = ae.nextInSEL;\r\n if (res) {\r\n res.prevInSEL = ae.prevInSEL;\r\n }\r\n ae.prevInSEL.nextInSEL = res;\r\n return res;\r\n }\r\n static insert1Before2InSEL(ae1, ae2) {\r\n ae1.prevInSEL = ae2.prevInSEL;\r\n if (ae1.prevInSEL) {\r\n ae1.prevInSEL.nextInSEL = ae1;\r\n }\r\n ae1.nextInSEL = ae2;\r\n ae2.prevInSEL = ae1;\r\n }\r\n buildIntersectList(topY) {\r\n if (!this._actives || !this._actives.nextInAEL)\r\n return false;\r\n // Calculate edge positions at the top of the current scanbeam, and from this\r\n // we will determine the intersections required to reach these new positions.\r\n this.adjustCurrXAndCopyToSEL(topY);\r\n // Find all edge intersections in the current scanbeam using a stable merge\r\n // sort that ensures only adjacent edges are intersecting. Intersect info is\r\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\r\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\r\n let left = this._sel, right, lEnd, rEnd, currBase, prevBase, tmp;\r\n while (left.jump) {\r\n prevBase = undefined;\r\n while (left && left.jump) {\r\n currBase = left;\r\n right = left.jump;\r\n lEnd = right;\r\n rEnd = right.jump;\r\n left.jump = rEnd;\r\n while (left !== lEnd && right !== rEnd) {\r\n if (right.curX < left.curX) {\r\n tmp = right.prevInSEL;\r\n for (;;) {\r\n this.addNewIntersectNode(tmp, right, topY);\r\n if (tmp === left)\r\n break;\r\n tmp = tmp.prevInSEL;\r\n }\r\n tmp = right;\r\n right = ClipperBase.extractFromSEL(tmp);\r\n lEnd = right;\r\n ClipperBase.insert1Before2InSEL(tmp, left);\r\n if (left === currBase) {\r\n currBase = tmp;\r\n currBase.jump = rEnd;\r\n if (prevBase === undefined)\r\n this._sel = currBase;\r\n else\r\n prevBase.jump = currBase;\r\n }\r\n }\r\n else {\r\n left = left.nextInSEL;\r\n }\r\n }\r\n prevBase = currBase;\r\n left = rEnd;\r\n }\r\n left = this._sel;\r\n }\r\n return this._intersectList.length > 0;\r\n }\r\n processIntersectList() {\r\n // We now have a list of intersections required so that edges will be\r\n // correctly positioned at the top of the scanbeam. However, it's important\r\n // that edge intersections are processed from the bottom up, but it's also\r\n // crucial that intersections only occur between adjacent edges.\r\n // First we do a quicksort so intersections proceed in a bottom up order ...\r\n this._intersectList.sort((a, b) => {\r\n if (a.pt.y === b.pt.y) {\r\n if (a.pt.x === b.pt.x)\r\n return 0;\r\n return (a.pt.x < b.pt.x) ? -1 : 1;\r\n }\r\n return (a.pt.y > b.pt.y) ? -1 : 1;\r\n });\r\n // Now as we process these intersections, we must sometimes adjust the order\r\n // to ensure that intersecting edges are always adjacent ...\r\n for (let i = 0; i < this._intersectList.length; ++i) {\r\n if (!ClipperBase.edgesAdjacentInAEL(this._intersectList[i])) {\r\n let j = i + 1;\r\n while (!ClipperBase.edgesAdjacentInAEL(this._intersectList[j]))\r\n j++;\r\n // swap\r\n [this._intersectList[j], this._intersectList[i]] =\r\n [this._intersectList[i], this._intersectList[j]];\r\n }\r\n const node = this._intersectList[i];\r\n this.intersectEdges(node.edge1, node.edge2, node.pt);\r\n this.swapPositionsInAEL(node.edge1, node.edge2);\r\n node.edge1.curX = node.pt.x;\r\n node.edge2.curX = node.pt.x;\r\n this.checkJoinLeft(node.edge2, node.pt, true);\r\n this.checkJoinRight(node.edge1, node.pt, true);\r\n }\r\n }\r\n swapPositionsInAEL(ae1, ae2) {\r\n // preconditon: ae1 must be immediately to the left of ae2\r\n const next = ae2.nextInAEL;\r\n if (next)\r\n next.prevInAEL = ae1;\r\n const prev = ae1.prevInAEL;\r\n if (prev)\r\n prev.nextInAEL = ae2;\r\n ae2.prevInAEL = prev;\r\n ae2.nextInAEL = ae1;\r\n ae1.prevInAEL = ae2;\r\n ae1.nextInAEL = next;\r\n if (!ae2.prevInAEL)\r\n this._actives = ae2;\r\n }\r\n static resetHorzDirection(horz, vertexMax) {\r\n let leftX, rightX;\r\n if (horz.bot.x === horz.top.x) {\r\n // the horizontal edge is going nowhere ...\r\n leftX = horz.curX;\r\n rightX = horz.curX;\r\n let ae = horz.nextInAEL;\r\n while (ae && ae.vertexTop !== vertexMax)\r\n ae = ae.nextInAEL;\r\n return { isLeftToRight: ae !== undefined, leftX, rightX };\r\n }\r\n if (horz.curX < horz.top.x) {\r\n leftX = horz.curX;\r\n rightX = horz.top.x;\r\n return { isLeftToRight: true, leftX, rightX };\r\n }\r\n leftX = horz.top.x;\r\n rightX = horz.curX;\r\n return { isLeftToRight: false, leftX, rightX }; // right to left\r\n }\r\n static horzIsSpike(horz) {\r\n const nextPt = ClipperBase.nextVertex(horz).pt;\r\n return (horz.bot.x < horz.top.x) !== (horz.top.x < nextPt.x);\r\n }\r\n static trimHorz(horzEdge, preserveCollinear) {\r\n let wasTrimmed = false;\r\n let pt = ClipperBase.nextVertex(horzEdge).pt;\r\n while (pt.y === horzEdge.top.y) {\r\n // always trim 180 deg. spikes (in closed paths)\r\n // but otherwise break if preserveCollinear = true\r\n if (preserveCollinear &&\r\n (pt.x < horzEdge.top.x) !== (horzEdge.bot.x < horzEdge.top.x)) {\r\n break;\r\n }\r\n horzEdge.vertexTop = ClipperBase.nextVertex(horzEdge);\r\n horzEdge.top = pt;\r\n wasTrimmed = true;\r\n if (ClipperBase.isMaximaActive(horzEdge))\r\n break;\r\n pt = ClipperBase.nextVertex(horzEdge).pt;\r\n }\r\n if (wasTrimmed)\r\n ClipperBase.setDx(horzEdge); // +/-infinity\r\n }\r\n addToHorzSegList(op) {\r\n if (op.outrec.isOpen)\r\n return;\r\n this._horzSegList.push(new HorzSegment(op));\r\n }\r\n getLastOp(hotEdge) {\r\n const outrec = hotEdge.outrec;\r\n return (hotEdge === outrec.frontEdge) ?\r\n outrec.pts : outrec.pts.next;\r\n }\r\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/\r\n doHorizontal(horz) {\r\n let pt;\r\n const horzIsOpen = ClipperBase.isOpen(horz);\r\n const Y = horz.bot.y;\r\n const vertex_max = horzIsOpen ?\r\n ClipperBase.getCurrYMaximaVertex_Open(horz) :\r\n ClipperBase.getCurrYMaximaVertex(horz);\r\n // remove 180 deg.spikes and also simplify\r\n // consecutive horizontals when PreserveCollinear = true\r\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop)\r\n ClipperBase.trimHorz(horz, this.preserveCollinear);\r\n let { isLeftToRight, leftX, rightX } = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, new Point64(horz.curX, Y));\r\n this.addToHorzSegList(op);\r\n }\r\n for (;;) {\r\n // loops through consec. horizontal edges (if open)\r\n let ae = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\r\n while (ae) {\r\n if (ae.vertexTop === vertex_max) {\r\n // do this first!!\r\n if (ClipperBase.isHotEdgeActive(horz) && ClipperBase.isJoined(ae))\r\n this.split(ae, ae.top);\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n while (horz.vertexTop !== vertex_max) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n if (isLeftToRight)\r\n this.addLocalMaxPoly(horz, ae, horz.top);\r\n else\r\n this.addLocalMaxPoly(ae, horz, horz.top);\r\n }\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n // if horzEdge is a maxima, keep going until we reach\r\n // its maxima pair, otherwise check for break conditions\r\n if (vertex_max !== horz.vertexTop || ClipperBase.isOpenEndActive(horz)) {\r\n // otherwise stop when 'ae' is beyond the end of the horizontal line\r\n if ((isLeftToRight && ae.curX > rightX) || (!isLeftToRight && ae.curX < leftX))\r\n break;\r\n if (ae.curX === horz.top.x && !ClipperBase.isHorizontal(ae)) {\r\n pt = ClipperBase.nextVertex(horz).pt;\r\n // to maximize the possibility of putting open edges into\r\n // solutions, we'll only break if it's past HorzEdge's end\r\n if (ClipperBase.isOpen(ae) && !ClipperBase.isSamePolyType(ae, horz) && !ClipperBase.isHotEdgeActive(ae)) {\r\n if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) > pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) < pt.x)))\r\n break;\r\n }\r\n // otherwise for edges at horzEdge's end, only stop when horzEdge's\r\n // outslope is greater than e's slope when heading right or when\r\n // horzEdge's outslope is less than e's slope when heading left.\r\n else if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) >= pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) <= pt.x)))\r\n break;\r\n }\r\n }\r\n pt = new Point64(ae.curX, Y);\r\n if (isLeftToRight) {\r\n this.intersectEdges(horz, ae, pt);\r\n this.swapPositionsInAEL(horz, ae);\r\n horz.curX = ae.curX;\r\n ae = horz.nextInAEL;\r\n }\r\n else {\r\n this.intersectEdges(ae, horz, pt);\r\n this.swapPositionsInAEL(ae, horz);\r\n horz.curX = ae.curX;\r\n ae = horz.prevInAEL;\r\n }\r\n if (ClipperBase.isHotEdgeActive(horz))\r\n this.addToHorzSegList(this.getLastOp(horz));\r\n } // we've reached the end of this horizontal\r\n // check if we've finished looping\r\n // through consecutive horizontals\r\n if (horzIsOpen && ClipperBase.isOpenEndActive(horz)) { // ie open at top\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n if (ClipperBase.isFront(horz))\r\n horz.outrec.frontEdge = undefined;\r\n else\r\n horz.outrec.backEdge = undefined;\r\n horz.outrec = undefined;\r\n }\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n else if (ClipperBase.nextVertex(horz).pt.y !== horz.top.y)\r\n break;\r\n // still more horizontals in bound to process ...\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n }\r\n this.updateEdgeIntoAEL(horz);\r\n if (this.preserveCollinear && !horzIsOpen && ClipperBase.horzIsSpike(horz)) {\r\n ClipperBase.trimHorz(horz, true);\r\n }\r\n const result = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n isLeftToRight = result.isLeftToRight;\r\n leftX = result.leftX;\r\n rightX = result.rightX;\r\n }\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, horz.top);\r\n this.addToHorzSegList(op);\r\n }\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n doTopOfScanbeam(y) {\r\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\r\n let ae = this._actives;\r\n while (ae) {\r\n // NB 'ae' will never be horizontal here\r\n if (ae.top.y === y) {\r\n ae.curX = ae.top.x;\r\n if (ClipperBase.isMaximaActive(ae)) {\r\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\r\n continue;\r\n }\r\n // INTERMEDIATE VERTEX ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n this.updateEdgeIntoAEL(ae);\r\n if (ClipperBase.isHorizontal(ae))\r\n this.pushHorz(ae); // horizontals are processed later\r\n }\r\n else { // i.e. not the top of the edge\r\n ae.curX = ClipperBase.topX(ae, y);\r\n }\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n doMaxima(ae) {\r\n const prevE = ae.prevInAEL;\r\n let nextE = ae.nextInAEL;\r\n if (ClipperBase.isOpenEndActive(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n if (!ClipperBase.isHorizontal(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) {\r\n if (ClipperBase.isFront(ae))\r\n ae.outrec.frontEdge = undefined;\r\n else\r\n ae.outrec.backEdge = undefined;\r\n ae.outrec = undefined;\r\n }\r\n this.deleteFromAEL(ae);\r\n }\r\n return nextE;\r\n }\r\n const maxPair = ClipperBase.getMaximaPair(ae);\r\n if (!maxPair)\r\n return nextE; // eMaxPair is horizontal\r\n if (ClipperBase.isJoined(ae))\r\n this.split(ae, ae.top);\r\n if (ClipperBase.isJoined(maxPair))\r\n this.split(maxPair, maxPair.top);\r\n // only non-horizontal maxima here.\r\n // process any edges between maxima pair ...\r\n while (nextE !== maxPair) {\r\n this.intersectEdges(ae, nextE, ae.top);\r\n this.swapPositionsInAEL(ae, nextE);\r\n nextE = ae.nextInAEL;\r\n }\r\n if (ClipperBase.isOpen(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(maxPair);\r\n this.deleteFromAEL(ae);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n // here ae.nextInAel == ENext == EMaxPair ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(maxPair);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n static isJoined(e) {\r\n return e.joinWith !== JoinWith.None;\r\n }\r\n split(e, currPt) {\r\n if (e.joinWith === JoinWith.Right) {\r\n e.joinWith = JoinWith.None;\r\n e.nextInAEL.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e, e.nextInAEL, currPt, true);\r\n }\r\n else {\r\n e.joinWith = JoinWith.None;\r\n e.prevInAEL.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e.prevInAEL, e, currPt, true);\r\n }\r\n }\r\n checkJoinLeft(e, pt, checkCurrX = false) {\r\n const prev = e.prevInAEL;\r\n if (!prev || ClipperBase.isOpen(e) || ClipperBase.isOpen(prev) ||\r\n !ClipperBase.isHotEdgeActive(e) || !ClipperBase.isHotEdgeActive(prev))\r\n return;\r\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (prev.bot.y > pt.y)))\r\n return; // (#490)\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25)\r\n return;\r\n }\r\n else if (e.curX !== prev.curX)\r\n return;\r\n if (InternalClipper.crossProduct(e.top, pt, prev.top) !== 0)\r\n return;\r\n if (e.outrec.idx === prev.outrec.idx)\r\n this.addLocalMaxPoly(prev, e, pt);\r\n else if (e.outrec.idx < prev.outrec.idx)\r\n ClipperBase.joinOutrecPaths(e, prev);\r\n else\r\n ClipperBase.joinOutrecPaths(prev, e);\r\n prev.joinWith = JoinWith.Right;\r\n e.joinWith = JoinWith.Left;\r\n }\r\n checkJoinRight(e, pt, checkCurrX = false) {\r\n const next = e.nextInAEL;\r\n if (ClipperBase.isOpen(e) || !ClipperBase.isHotEdgeActive(e) || ClipperBase.isJoined(e) ||\r\n !next || ClipperBase.isOpen(next) || !ClipperBase.isHotEdgeActive(next))\r\n return;\r\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (next.bot.y > pt.y)))\r\n return; // (#490)\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25)\r\n return;\r\n }\r\n else if (e.curX !== next.curX)\r\n return;\r\n if (InternalClipper.crossProduct(e.top, pt, next.top) !== 0)\r\n return;\r\n if (e.outrec.idx === next.outrec.idx)\r\n this.addLocalMaxPoly(e, next, pt);\r\n else if (e.outrec.idx < next.outrec.idx)\r\n ClipperBase.joinOutrecPaths(e, next);\r\n else\r\n ClipperBase.joinOutrecPaths(next, e);\r\n e.joinWith = JoinWith.Right;\r\n next.joinWith = JoinWith.Left;\r\n }\r\n static fixOutRecPts(outrec) {\r\n let op = outrec.pts;\r\n do {\r\n op.outrec = outrec;\r\n op = op.next;\r\n } while (op !== outrec.pts);\r\n }\r\n static setHorzSegHeadingForward(hs, opP, opN) {\r\n if (opP.pt.x === opN.pt.x)\r\n return false;\r\n if (opP.pt.x < opN.pt.x) {\r\n hs.leftOp = opP;\r\n hs.rightOp = opN;\r\n hs.leftToRight = true;\r\n }\r\n else {\r\n hs.leftOp = opN;\r\n hs.rightOp = opP;\r\n hs.leftToRight = false;\r\n }\r\n return true;\r\n }\r\n static updateHorzSegment(hs) {\r\n const op = hs.leftOp;\r\n const outrec = this.getRealOutRec(op.outrec);\r\n const outrecHasEdges = outrec.frontEdge !== undefined;\r\n const curr_y = op.pt.y;\r\n let opP = op, opN = op;\r\n if (outrecHasEdges) {\r\n const opA = outrec.pts, opZ = opA.next;\r\n while (opP !== opZ && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN !== opA && opN.next.pt.y === curr_y)\r\n opN = opN.next;\r\n }\r\n else {\r\n while (opP.prev !== opN && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN.next !== opP && opN.next.pt.y === curr_y)\r\n opN = opN.next;\r\n }\r\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp.horz === undefined;\r\n if (result)\r\n hs.leftOp.horz = hs;\r\n else\r\n hs.rightOp = undefined; // (for sorting)\r\n return result;\r\n }\r\n static duplicateOp(op, insert_after) {\r\n const result = new OutPt(op.pt, op.outrec);\r\n if (insert_after) {\r\n result.next = op.next;\r\n result.next.prev = result;\r\n result.prev = op;\r\n op.next = result;\r\n }\r\n else {\r\n result.prev = op.prev;\r\n result.prev.next = result;\r\n result.next = op;\r\n op.prev = result;\r\n }\r\n return result;\r\n }\r\n convertHorzSegsToJoins() {\r\n let k = 0;\r\n for (const hs of this._horzSegList) {\r\n if (ClipperBase.updateHorzSegment(hs))\r\n k++;\r\n }\r\n if (k < 2)\r\n return;\r\n this._horzSegList.sort((hs1, hs2) => {\r\n if (!hs1 || !hs2)\r\n return 0;\r\n if (!hs1.rightOp) {\r\n return !hs2.rightOp ? 0 : 1;\r\n }\r\n else if (!hs2.rightOp)\r\n return -1;\r\n else\r\n return hs1.leftOp.pt.x - hs2.leftOp.pt.x;\r\n });\r\n for (let i = 0; i < k - 1; i++) {\r\n const hs1 = this._horzSegList[i];\r\n // for each HorzSegment, find others that overlap\r\n for (let j = i + 1; j < k; j++) {\r\n const hs2 = this._horzSegList[j];\r\n if (hs2.leftOp.pt.x >= hs1.rightOp.pt.x ||\r\n hs2.leftToRight === hs1.leftToRight ||\r\n hs2.rightOp.pt.x <= hs1.leftOp.pt.x)\r\n continue;\r\n const curr_y = hs1.leftOp.pt.y;\r\n if (hs1.leftToRight) {\r\n while (hs1.leftOp.next.pt.y === curr_y &&\r\n hs1.leftOp.next.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.next;\r\n }\r\n while (hs2.leftOp.prev.pt.y === curr_y &&\r\n hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.prev;\r\n }\r\n const join = new HorzJoin(ClipperBase.duplicateOp(hs1.leftOp, true), ClipperBase.duplicateOp(hs2.leftOp, false));\r\n this._horzJoinList.push(join);\r\n }\r\n else {\r\n while (hs1.leftOp.prev.pt.y === curr_y &&\r\n hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.prev;\r\n }\r\n while (hs2.leftOp.next.pt.y === curr_y &&\r\n hs2.leftOp.next.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.next;\r\n }\r\n const join = new HorzJoin(ClipperBase.duplicateOp(hs2.leftOp, true), ClipperBase.duplicateOp(hs1.leftOp, false));\r\n this._horzJoinList.push(join);\r\n }\r\n }\r\n }\r\n }\r\n static getCleanPath(op) {\r\n const result = new Path64();\r\n let op2 = op;\r\n while (op2.next !== op &&\r\n ((op2.pt.x === op2.next.pt.x && op2.pt.x === op2.prev.pt.x) ||\r\n (op2.pt.y === op2.next.pt.y && op2.pt.y === op2.prev.pt.y))) {\r\n op2 = op2.next;\r\n }\r\n result.push(op2.pt);\r\n let prevOp = op2;\r\n op2 = op2.next;\r\n while (op2 !== op) {\r\n if ((op2.pt.x !== op2.next.pt.x || op2.pt.x !== prevOp.pt.x) &&\r\n (op2.pt.y !== op2.next.pt.y || op2.pt.y !== prevOp.pt.y)) {\r\n result.push(op2.pt);\r\n prevOp = op2;\r\n }\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n static pointInOpPolygon(pt, op) {\r\n if (op === op.next || op.prev === op.next)\r\n return PointInPolygonResult.IsOutside;\r\n let op2 = op;\r\n do {\r\n if (op.pt.y !== pt.y)\r\n break;\r\n op = op.next;\r\n } while (op !== op2);\r\n if (op.pt.y === pt.y) // not a proper polygon\r\n return PointInPolygonResult.IsOutside;\r\n let isAbove = op.pt.y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n op2 = op.next;\r\n while (op2 !== op) {\r\n if (isAbove)\r\n while (op2 !== op && op2.pt.y < pt.y)\r\n op2 = op2.next;\r\n else\r\n while (op2 !== op && op2.pt.y > pt.y)\r\n op2 = op2.next;\r\n if (op2 === op)\r\n break;\r\n if (op2.pt.y === pt.y) {\r\n if (op2.pt.x === pt.x || (op2.pt.y === op2.prev.pt.y &&\r\n (pt.x < op2.prev.pt.x) !== (pt.x < op2.pt.x)))\r\n return PointInPolygonResult.IsOn;\r\n op2 = op2.next;\r\n if (op2 === op)\r\n break;\r\n continue;\r\n }\r\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\r\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x)\r\n val = 1 - val;\r\n else {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n }\r\n isAbove = !isAbove;\r\n op2 = op2.next;\r\n }\r\n if (isAbove !== startingAbove) {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n if (val === 0)\r\n return PointInPolygonResult.IsOutside;\r\n else\r\n return PointInPolygonResult.IsInside;\r\n }\r\n static path1InsidePath2(op1, op2) {\r\n let result;\r\n let outside_cnt = 0;\r\n let op = op1;\r\n do {\r\n result = this.pointInOpPolygon(op.pt, op2);\r\n if (result === PointInPolygonResult.IsOutside)\r\n ++outside_cnt;\r\n else if (result === PointInPolygonResult.IsInside)\r\n --outside_cnt;\r\n op = op.next;\r\n } while (op !== op1 && Math.abs(outside_cnt) < 2);\r\n if (Math.abs(outside_cnt) > 1)\r\n return (outside_cnt < 0);\r\n const mp = ClipperBase.getBoundsPath(this.getCleanPath(op1)).midPoint();\r\n const path2 = this.getCleanPath(op2);\r\n return InternalClipper.pointInPolygon(mp, path2) !== PointInPolygonResult.IsOutside;\r\n }\r\n moveSplits(fromOr, toOr) {\r\n if (!fromOr.splits)\r\n return;\r\n toOr.splits = toOr.splits || [];\r\n for (const i of fromOr.splits) {\r\n toOr.splits.push(i);\r\n }\r\n fromOr.splits = undefined;\r\n }\r\n processHorzJoins() {\r\n for (const j of this._horzJoinList) {\r\n const or1 = ClipperBase.getRealOutRec(j.op1.outrec);\r\n let or2 = ClipperBase.getRealOutRec(j.op2.outrec);\r\n const op1b = j.op1.next;\r\n const op2b = j.op2.prev;\r\n j.op1.next = j.op2;\r\n j.op2.prev = j.op1;\r\n op1b.prev = op2b;\r\n op2b.next = op1b;\r\n if (or1 === or2) {\r\n or2 = this.newOutRec();\r\n or2.pts = op1b;\r\n ClipperBase.fixOutRecPts(or2);\r\n if (or1.pts.outrec === or2) {\r\n or1.pts = j.op1;\r\n or1.pts.outrec = or1;\r\n }\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(or1.pts, or2.pts)) {\r\n const tmp = or1.pts;\r\n or1.pts = or2.pts;\r\n or2.pts = tmp;\r\n ClipperBase.fixOutRecPts(or1);\r\n ClipperBase.fixOutRecPts(or2);\r\n or2.owner = or1.owner;\r\n }\r\n else if (ClipperBase.path1InsidePath2(or2.pts, or1.pts)) {\r\n or2.owner = or1;\r\n }\r\n else {\r\n or2.owner = or1.owner;\r\n }\r\n or1.splits = or1.splits || [];\r\n or1.splits.push(or2.idx);\r\n }\r\n else {\r\n or2.owner = or1;\r\n }\r\n }\r\n else {\r\n or2.pts = undefined;\r\n if (this._using_polytree) {\r\n ClipperBase.setOwner(or2, or1);\r\n this.moveSplits(or2, or1);\r\n }\r\n else {\r\n or2.owner = or1;\r\n }\r\n }\r\n }\r\n }\r\n static ptsReallyClose(pt1, pt2) {\r\n return (Math.abs(pt1.x - pt2.x) < 2) && (Math.abs(pt1.y - pt2.y) < 2);\r\n }\r\n static isVerySmallTriangle(op) {\r\n return op.next.next === op.prev &&\r\n (this.ptsReallyClose(op.prev.pt, op.next.pt) ||\r\n this.ptsReallyClose(op.pt, op.next.pt) ||\r\n this.ptsReallyClose(op.pt, op.prev.pt));\r\n }\r\n static isValidClosedPath(op) {\r\n return op !== undefined && op.next !== op &&\r\n (op.next !== op.prev || !this.isVerySmallTriangle(op));\r\n }\r\n static disposeOutPt(op) {\r\n const result = op.next === op ? undefined : op.next;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return result;\r\n }\r\n cleanCollinear(outrec) {\r\n outrec = ClipperBase.getRealOutRec(outrec);\r\n if (outrec === undefined || outrec.isOpen)\r\n return;\r\n if (!ClipperBase.isValidClosedPath(outrec.pts)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n let startOp = outrec.pts;\r\n let op2 = startOp;\r\n for (;;) {\r\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0 &&\r\n (op2.pt === op2.prev.pt || op2.pt === op2.next.pt || !this.preserveCollinear ||\r\n InternalClipper.dotProduct(op2.prev.pt, op2.pt, op2.next.pt) < 0)) {\r\n if (op2 === outrec.pts) {\r\n outrec.pts = op2.prev;\r\n }\r\n op2 = ClipperBase.disposeOutPt(op2);\r\n if (!ClipperBase.isValidClosedPath(op2)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n startOp = op2;\r\n continue;\r\n }\r\n op2 = op2.next;\r\n if (op2 === startOp)\r\n break;\r\n }\r\n this.fixSelfIntersects(outrec);\r\n }\r\n doSplitOp(outrec, splitOp) {\r\n // splitOp.prev <=> splitOp &&\r\n // splitOp.next <=> splitOp.next.next are intersecting\r\n const prevOp = splitOp.prev;\r\n const nextNextOp = splitOp.next.next;\r\n outrec.pts = prevOp;\r\n const ip = InternalClipper.getIntersectPoint(prevOp.pt, splitOp.pt, splitOp.next.pt, nextNextOp.pt).ip;\r\n const area1 = ClipperBase.area(prevOp);\r\n const absArea1 = Math.abs(area1);\r\n if (absArea1 < 2) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n const area2 = ClipperBase.areaTriangle(ip, splitOp.pt, splitOp.next.pt);\r\n const absArea2 = Math.abs(area2);\r\n // de-link splitOp and splitOp.next from the path\r\n // while inserting the intersection point\r\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\r\n nextNextOp.prev = prevOp;\r\n prevOp.next = nextNextOp;\r\n }\r\n else {\r\n const newOp2 = new OutPt(ip, outrec);\r\n newOp2.prev = prevOp;\r\n newOp2.next = nextNextOp;\r\n nextNextOp.prev = newOp2;\r\n prevOp.next = newOp2;\r\n }\r\n // nb: area1 is the path's area *before* splitting, whereas area2 is\r\n // the area of the triangle containing splitOp & splitOp.next.\r\n // So the only way for these areas to have the same sign is if\r\n // the split triangle is larger than the path containing prevOp or\r\n // if there's more than one self=intersection.\r\n if (absArea2 > 1 &&\r\n (absArea2 > absArea1 || (area2 > 0) === (area1 > 0))) {\r\n const newOutRec = this.newOutRec();\r\n newOutRec.owner = outrec.owner;\r\n splitOp.outrec = newOutRec;\r\n splitOp.next.outrec = newOutRec;\r\n const newOp = new OutPt(ip, newOutRec);\r\n newOp.prev = splitOp.next;\r\n newOp.next = splitOp;\r\n newOutRec.pts = newOp;\r\n splitOp.prev = newOp;\r\n splitOp.next.next = newOp;\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(prevOp, newOp)) {\r\n newOutRec.splits = newOutRec.splits || [];\r\n newOutRec.splits.push(outrec.idx);\r\n }\r\n else {\r\n outrec.splits = outrec.splits || [];\r\n outrec.splits.push(newOutRec.idx);\r\n }\r\n }\r\n }\r\n // else { splitOp = undefined; splitOp.next = undefined; }\r\n }\r\n fixSelfIntersects(outrec) {\r\n let op2 = outrec.pts;\r\n for (;;) {\r\n if (op2.prev === op2.next.next)\r\n break;\r\n if (InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt)) {\r\n this.doSplitOp(outrec, op2);\r\n if (!outrec.pts)\r\n return;\r\n op2 = outrec.pts;\r\n continue;\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n if (op2 === outrec.pts)\r\n break;\r\n }\r\n }\r\n static buildPath(op, reverse, isOpen, path) {\r\n if (op === undefined || op.next === op || (!isOpen && op.next === op.prev))\r\n return false;\r\n path.length = 0;\r\n let lastPt;\r\n let op2;\r\n if (reverse) {\r\n lastPt = op.pt;\r\n op2 = op.prev;\r\n }\r\n else {\r\n op = op.next;\r\n lastPt = op.pt;\r\n op2 = op.next;\r\n }\r\n path.push(lastPt);\r\n while (op2 !== op) {\r\n if (op2.pt !== lastPt) {\r\n lastPt = op2.pt;\r\n path.push(lastPt);\r\n }\r\n if (reverse) {\r\n op2 = op2.prev;\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n }\r\n if (path.length === 3 && this.isVerySmallTriangle(op2))\r\n return false;\r\n else\r\n return true;\r\n }\r\n buildPaths(solutionClosed, solutionOpen) {\r\n solutionClosed.length = 0;\r\n solutionOpen.length = 0;\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (!outrec.pts)\r\n continue;\r\n const path = new Path64();\r\n if (outrec.isOpen) {\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, path)) {\r\n solutionOpen.push(path);\r\n }\r\n }\r\n else {\r\n this.cleanCollinear(outrec);\r\n // closed paths should always return a Positive orientation\r\n // except when reverseSolution == true\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, path)) {\r\n solutionClosed.push(path);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n static getBoundsPath(path) {\r\n if (path.length === 0)\r\n return new Rect64();\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n return result;\r\n }\r\n checkBounds(outrec) {\r\n if (outrec.pts === undefined)\r\n return false;\r\n if (!outrec.bounds.isEmpty())\r\n return true;\r\n this.cleanCollinear(outrec);\r\n if (outrec.pts === undefined || !ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, outrec.path))\r\n return false;\r\n outrec.bounds = ClipperBase.getBoundsPath(outrec.path);\r\n return true;\r\n }\r\n checkSplitOwner(outrec, splits) {\r\n for (const i of splits) {\r\n const split = ClipperBase.getRealOutRec(this._outrecList[i]);\r\n if (split === undefined || split === outrec || split.recursiveSplit === outrec)\r\n continue;\r\n split.recursiveSplit = outrec; //#599\r\n if (split.splits !== undefined && this.checkSplitOwner(outrec, split.splits))\r\n return true;\r\n if (ClipperBase.isValidOwner(outrec, split) &&\r\n this.checkBounds(split) &&\r\n split.bounds.containsRect(outrec.bounds) &&\r\n ClipperBase.path1InsidePath2(outrec.pts, split.pts)) {\r\n outrec.owner = split; //found in split\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n recursiveCheckOwners(outrec, polypath) {\r\n // pre-condition: outrec will have valid bounds\r\n // post-condition: if a valid path, outrec will have a polypath\r\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty())\r\n return;\r\n while (outrec.owner !== undefined) {\r\n if (outrec.owner.splits !== undefined &&\r\n this.checkSplitOwner(outrec, outrec.owner.splits))\r\n break;\r\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) &&\r\n ClipperBase.path1InsidePath2(outrec.pts, outrec.owner.pts))\r\n break;\r\n outrec.owner = outrec.owner.owner;\r\n }\r\n if (outrec.owner !== undefined) {\r\n if (outrec.owner.polypath === undefined)\r\n this.recursiveCheckOwners(outrec.owner, polypath);\r\n outrec.polypath = outrec.owner.polypath.addChild(outrec.path);\r\n }\r\n else {\r\n outrec.polypath = polypath.addChild(outrec.path);\r\n }\r\n }\r\n buildTree(polytree, solutionOpen) {\r\n polytree.clear();\r\n solutionOpen.length = 0;\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (outrec.pts === undefined)\r\n continue;\r\n if (outrec.isOpen) {\r\n const open_path = new Path64();\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, open_path))\r\n solutionOpen.push(open_path);\r\n continue;\r\n }\r\n if (this.checkBounds(outrec))\r\n this.recursiveCheckOwners(outrec, polytree);\r\n }\r\n }\r\n getBounds() {\r\n const bounds = Clipper.InvalidRect64;\r\n for (const t of this._vertexList) {\r\n let v = t;\r\n do {\r\n if (v.pt.x < bounds.left)\r\n bounds.left = v.pt.x;\r\n if (v.pt.x > bounds.right)\r\n bounds.right = v.pt.x;\r\n if (v.pt.y < bounds.top)\r\n bounds.top = v.pt.y;\r\n if (v.pt.y > bounds.bottom)\r\n bounds.bottom = v.pt.y;\r\n v = v.next;\r\n } while (v !== t);\r\n }\r\n return bounds.isEmpty() ? new Rect64(0, 0, 0, 0) : bounds;\r\n }\r\n}\r\nclass Clipper64 extends ClipperBase {\r\n addPath(path, polytype, isOpen = false) {\r\n super.addPath(path, polytype, isOpen);\r\n }\r\n addReusableData(reusableData) {\r\n super.addReuseableData(reusableData);\r\n }\r\n addPaths(paths, polytype, isOpen = false) {\r\n super.addPaths(paths, polytype, isOpen);\r\n }\r\n addSubjectPaths(paths) {\r\n this.addPaths(paths, PathType.Subject);\r\n }\r\n addOpenSubjectPaths(paths) {\r\n this.addPaths(paths, PathType.Subject, true);\r\n }\r\n addClipPaths(paths) {\r\n this.addPaths(paths, PathType.Clip);\r\n }\r\n execute(clipType, fillRule, solutionClosed, solutionOpen = new Paths64()) {\r\n solutionClosed.length = 0;\r\n solutionOpen.length = 0;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildPaths(solutionClosed, solutionOpen);\r\n }\r\n catch (error) {\r\n this._succeeded = false;\r\n }\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n executePolyTree(clipType, fillRule, polytree, openPaths = new Paths64()) {\r\n polytree.clear();\r\n openPaths.length = 0;\r\n this._using_polytree = true;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildTree(polytree, openPaths);\r\n }\r\n catch (error) {\r\n this._succeeded = false;\r\n }\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n}\r\nclass PolyPathBase {\r\n get isHole() {\r\n return this.getIsHole();\r\n }\r\n constructor(parent) {\r\n this.children = [];\r\n this.forEach = this.children.forEach;\r\n this._parent = parent;\r\n }\r\n getLevel() {\r\n let result = 0;\r\n let pp = this._parent;\r\n while (pp !== undefined) {\r\n ++result;\r\n pp = pp._parent;\r\n }\r\n return result;\r\n }\r\n get level() {\r\n return this.getLevel();\r\n }\r\n getIsHole() {\r\n const lvl = this.getLevel();\r\n return lvl !== 0 && (lvl & 1) === 0;\r\n }\r\n get count() {\r\n return this.children.length;\r\n }\r\n clear() {\r\n this.children.length = 0;\r\n }\r\n} // end of PolyPathBase class\r\nclass PolyPath64 extends PolyPathBase {\r\n constructor(parent) {\r\n super(parent);\r\n }\r\n addChild(p) {\r\n const newChild = new PolyPath64(this);\r\n newChild.polygon = p;\r\n this.children.push(newChild);\r\n return newChild;\r\n }\r\n get(index) {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index];\r\n }\r\n child(index) {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index];\r\n }\r\n area() {\r\n let result = this.polygon ? Clipper.area(this.polygon) : 0;\r\n for (const polyPathBase of this.children) {\r\n const child = polyPathBase;\r\n result += child.area();\r\n }\r\n return result;\r\n }\r\n}\r\nclass PolyTree64 extends PolyPath64 {\r\n}\r\nclass ClipperLibException extends Error {\r\n constructor(description) {\r\n super(description);\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n// Note: all clipping operations except for Difference are commutative.\r\nvar ClipType;\r\n(function (ClipType) {\r\n ClipType[ClipType[\"None\"] = 0] = \"None\";\r\n ClipType[ClipType[\"Intersection\"] = 1] = \"Intersection\";\r\n ClipType[ClipType[\"Union\"] = 2] = \"Union\";\r\n ClipType[ClipType[\"Difference\"] = 3] = \"Difference\";\r\n ClipType[ClipType[\"Xor\"] = 4] = \"Xor\";\r\n})(ClipType || (ClipType = {}));\r\nvar PathType;\r\n(function (PathType) {\r\n PathType[PathType[\"Subject\"] = 0] = \"Subject\";\r\n PathType[PathType[\"Clip\"] = 1] = \"Clip\";\r\n})(PathType || (PathType = {}));\r\n// By far the most widely used filling rules for polygons are EvenOdd\r\n// and NonZero, sometimes called Alternate and Winding respectively.\r\n// https://en.wikipedia.org/wiki/Nonzero-rule\r\nvar FillRule;\r\n(function (FillRule) {\r\n FillRule[FillRule[\"EvenOdd\"] = 0] = \"EvenOdd\";\r\n FillRule[FillRule[\"NonZero\"] = 1] = \"NonZero\";\r\n FillRule[FillRule[\"Positive\"] = 2] = \"Positive\";\r\n FillRule[FillRule[\"Negative\"] = 3] = \"Negative\";\r\n})(FillRule || (FillRule = {}));\r\n// PointInPolygon\r\nvar PipResult;\r\n(function (PipResult) {\r\n PipResult[PipResult[\"Inside\"] = 0] = \"Inside\";\r\n PipResult[PipResult[\"Outside\"] = 1] = \"Outside\";\r\n PipResult[PipResult[\"OnEdge\"] = 2] = \"OnEdge\";\r\n})(PipResult || (PipResult = {}));\r\nclass Path64 extends Array {\r\n}\r\nclass Paths64 extends Array {\r\n}\r\nclass Rect64 {\r\n constructor(lOrIsValidOrRec, t, r, b) {\r\n if (typeof lOrIsValidOrRec === 'boolean') {\r\n if (lOrIsValidOrRec) {\r\n this.left = 0;\r\n this.top = 0;\r\n this.right = 0;\r\n this.bottom = 0;\r\n }\r\n else {\r\n this.left = Number.MAX_SAFE_INTEGER;\r\n this.top = Number.MAX_SAFE_INTEGER;\r\n this.right = Number.MIN_SAFE_INTEGER;\r\n this.bottom = Number.MIN_SAFE_INTEGER;\r\n }\r\n }\r\n else if (typeof lOrIsValidOrRec === 'number') {\r\n this.left = lOrIsValidOrRec;\r\n this.top = t;\r\n this.right = r;\r\n this.bottom = b;\r\n }\r\n else {\r\n this.left = lOrIsValidOrRec.left;\r\n this.top = lOrIsValidOrRec.top;\r\n this.right = lOrIsValidOrRec.right;\r\n this.bottom = lOrIsValidOrRec.bottom;\r\n }\r\n }\r\n get width() {\r\n return this.right - this.left;\r\n }\r\n set width(value) {\r\n this.right = this.left + value;\r\n }\r\n get height() {\r\n return this.bottom - this.top;\r\n }\r\n set height(value) {\r\n this.bottom = this.top + value;\r\n }\r\n isEmpty() {\r\n return this.bottom <= this.top || this.right <= this.left;\r\n }\r\n midPoint() {\r\n return new Point64((this.left + this.right) / 2, (this.top + this.bottom) / 2);\r\n }\r\n contains(pt) {\r\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\r\n }\r\n containsRect(rec) {\r\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\r\n }\r\n intersects(rec) {\r\n return (Math.max(this.left, rec.left) <= Math.min(this.right, rec.right)) &&\r\n (Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom));\r\n }\r\n asPath() {\r\n const result = new Path64();\r\n result.push(new Point64(this.left, this.top));\r\n result.push(new Point64(this.right, this.top));\r\n result.push(new Point64(this.right, this.bottom));\r\n result.push(new Point64(this.left, this.bottom));\r\n return result;\r\n }\r\n}\r\nclass Point64 {\r\n constructor(xOrPt, yOrScale) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = Math.round(xOrPt);\r\n this.y = Math.round(yOrScale);\r\n }\r\n else {\r\n const pt = xOrPt;\r\n if (yOrScale !== undefined) {\r\n this.x = Math.round(pt.x * yOrScale);\r\n this.y = Math.round(pt.y * yOrScale);\r\n }\r\n else {\r\n this.x = pt.x;\r\n this.y = pt.y;\r\n }\r\n //} else {\r\n // const pt = xOrPt as Point64\r\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\r\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\r\n }\r\n }\r\n static equals(lhs, rhs) {\r\n return lhs.x === rhs.x && lhs.y === rhs.y;\r\n }\r\n static notEquals(lhs, rhs) {\r\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\r\n }\r\n static add(lhs, rhs) {\r\n return new Point64(lhs.x + rhs.x, lhs.y + rhs.y);\r\n }\r\n static subtract(lhs, rhs) {\r\n return new Point64(lhs.x - rhs.x, lhs.y - rhs.y);\r\n }\r\n toString() {\r\n return `${this.x},${this.y} `;\r\n }\r\n equals(obj) {\r\n if (obj instanceof Point64) {\r\n return Point64.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n}\r\nclass InternalClipper {\r\n static checkPrecision(precision) {\r\n if (precision < -8 || precision > 8)\r\n throw new Error(this.precision_range_error);\r\n }\r\n static isAlmostZero(value) {\r\n return (Math.abs(value) <= this.floatingPointTolerance);\r\n }\r\n static crossProduct(pt1, pt2, pt3) {\r\n return ((pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x));\r\n }\r\n static dotProduct(pt1, pt2, pt3) {\r\n return ((pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y));\r\n }\r\n static checkCastInt64(val) {\r\n if ((val >= this.max_coord) || (val <= this.min_coord))\r\n return this.Invalid64;\r\n return Math.round(val);\r\n }\r\n static getIntersectPt(ln1a, ln1b, ln2a, ln2b) {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n let ip;\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0)\r\n ip = ln1a;\r\n else if (t >= 1.0)\r\n ip = ln1b;\r\n else\r\n ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n static getIntersectPoint(ln1a, ln1b, ln2a, ln2b) {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n let ip;\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0)\r\n ip = ln1a;\r\n else if (t >= 1.0)\r\n ip = ln2a;\r\n else\r\n ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n static segsIntersect(seg1a, seg1b, seg2a, seg2b, inclusive = false) {\r\n if (inclusive) {\r\n const res1 = InternalClipper.crossProduct(seg1a, seg2a, seg2b);\r\n const res2 = InternalClipper.crossProduct(seg1b, seg2a, seg2b);\r\n if (res1 * res2 > 0)\r\n return false;\r\n const res3 = InternalClipper.crossProduct(seg2a, seg1a, seg1b);\r\n const res4 = InternalClipper.crossProduct(seg2b, seg1a, seg1b);\r\n if (res3 * res4 > 0)\r\n return false;\r\n return (res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0);\r\n }\r\n else {\r\n return (InternalClipper.crossProduct(seg1a, seg2a, seg2b) * InternalClipper.crossProduct(seg1b, seg2a, seg2b) < 0) &&\r\n (InternalClipper.crossProduct(seg2a, seg1a, seg1b) * InternalClipper.crossProduct(seg2b, seg1a, seg1b) < 0);\r\n }\r\n }\r\n static getClosestPtOnSegment(offPt, seg1, seg2) {\r\n if (seg1.x === seg2.x && seg1.y === seg2.y)\r\n return seg1;\r\n const dx = seg2.x - seg1.x;\r\n const dy = seg2.y - seg1.y;\r\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / ((dx * dx) + (dy * dy));\r\n if (q < 0)\r\n q = 0;\r\n else if (q > 1)\r\n q = 1;\r\n return new Point64(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\r\n }\r\n static pointInPolygon(pt, polygon) {\r\n const len = polygon.length;\r\n let start = 0;\r\n if (len < 3)\r\n return PointInPolygonResult.IsOutside;\r\n while (start < len && polygon[start].y === pt.y)\r\n start++;\r\n if (start === len)\r\n return PointInPolygonResult.IsOutside;\r\n let d = 0;\r\n let isAbove = polygon[start].y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n let i = start + 1;\r\n let end = len;\r\n for (;;) {\r\n if (i === end) {\r\n if (end === 0 || start === 0)\r\n break;\r\n end = start;\r\n i = 0;\r\n }\r\n if (isAbove) {\r\n while (i < end && polygon[i].y < pt.y)\r\n i++;\r\n if (i === end)\r\n continue;\r\n }\r\n else {\r\n while (i < end && polygon[i].y > pt.y)\r\n i++;\r\n if (i === end)\r\n continue;\r\n }\r\n const curr = polygon[i];\r\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\r\n if (curr.y === pt.y) {\r\n if (curr.x === pt.x || (curr.y === prev.y && (pt.x < prev.x !== pt.x < curr.x)))\r\n return PointInPolygonResult.IsOn;\r\n i++;\r\n if (i === start)\r\n break;\r\n continue;\r\n }\r\n if (pt.x < curr.x && pt.x < prev.x) {\r\n // we're only interested in edges crossing on the left\r\n }\r\n else if (pt.x > prev.x && pt.x > curr.x) {\r\n val = 1 - val; // toggle val\r\n }\r\n else {\r\n d = InternalClipper.crossProduct(prev, curr, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n isAbove = !isAbove;\r\n i++;\r\n }\r\n if (isAbove !== startingAbove) {\r\n if (i === len)\r\n i = 0;\r\n else\r\n d = InternalClipper.crossProduct(polygon[i - 1], polygon[i], pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n if (val === 0)\r\n return PointInPolygonResult.IsOutside;\r\n return PointInPolygonResult.IsInside;\r\n }\r\n}\r\nInternalClipper.MaxInt64 = 9223372036854775807;\r\nInternalClipper.MaxCoord = InternalClipper.MaxInt64 / 4;\r\nInternalClipper.max_coord = InternalClipper.MaxCoord;\r\nInternalClipper.min_coord = -InternalClipper.MaxCoord;\r\nInternalClipper.Invalid64 = InternalClipper.MaxInt64;\r\nInternalClipper.defaultArcTolerance = 0.25;\r\nInternalClipper.floatingPointTolerance = 1E-12;\r\nInternalClipper.defaultMinimumEdgeLength = 0.1;\r\nInternalClipper.precision_range_error = \"Error: Precision is out of range.\";\n\n/*\r\n * Public API Surface of clipper2-js\r\n */\n\n/**\r\n * Generated bundle index. Do not edit.\r\n */\n\nexport { Active, ClipType, Clipper, Clipper64, ClipperBase, ClipperEngine, ClipperLibException, ClipperOffset, EndType, FillRule, HorzPosition, InternalClipper, JoinType, JoinWith, Minkowski, OutPt2, OutRec, Path64, PathType, Paths64, PipResult, Point64, PointD, PointInPolygonResult, PolyPath64, PolyPathBase, PolyTree64, Rect64, RectClip64, RectClipLines64, ReuseableDataContainer64, VertexFlags };\n//# sourceMappingURL=clipper2-js.mjs.map\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { FillRule, IPoint64, Path64, Paths64 } from \"./core\";\r\n\r\n\r\nexport class Minkowski {\r\n private static minkowskiInternal(pattern: Path64, path: Path64, isSum: boolean, isClosed: boolean): Paths64 {\r\n const delta = isClosed ? 0 : 1;\r\n const patLen = pattern.length;\r\n const pathLen = path.length;\r\n const tmp: Array> = []\r\n\r\n for (const pathPt of path) {\r\n const path2: Array = []\r\n if (isSum) {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x + basePt.x, y: pathPt.y + basePt.y });\r\n } else {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x - basePt.x, y: pathPt.y - basePt.y });\r\n }\r\n tmp.push(path2);\r\n }\r\n\r\n const result: Array> = []\r\n let g = isClosed ? pathLen - 1 : 0;\r\n\r\n let h = patLen - 1;\r\n for (let i = delta; i < pathLen; i++) {\r\n for (let j = 0; j < patLen; j++) {\r\n const quad: Path64 = [tmp[g][h], tmp[i][h], tmp[i][j], tmp[g][j]];\r\n if (!Clipper.isPositive(quad))\r\n result.push(Clipper.reversePath(quad));\r\n else\r\n result.push(quad);\r\n h = j;\r\n }\r\n g = i;\r\n }\r\n return result;\r\n }\r\n\r\n public static sum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, FillRule.NonZero);\r\n }\r\n\r\n public static diff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, FillRule.NonZero);\r\n }\r\n\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { Clipper64, PolyTree64 } from \"./engine\";\r\n\r\nexport enum JoinType {\r\n Square,\r\n Round,\r\n Miter\r\n}\r\n\r\nexport enum EndType {\r\n Polygon,\r\n Joined,\r\n Butt,\r\n Square,\r\n Round\r\n}\r\n\r\nclass Group {\r\n inPaths: Paths64;\r\n outPath: Path64;\r\n outPaths: Paths64;\r\n joinType: JoinType;\r\n endType: EndType;\r\n pathsReversed: boolean;\r\n\r\n constructor(paths: Paths64, joinType: JoinType, endType: EndType = EndType.Polygon) {\r\n this.inPaths = [...paths]; // creates a shallow copy of paths\r\n this.joinType = joinType;\r\n this.endType = endType;\r\n this.outPath = [];\r\n this.outPaths = [];\r\n this.pathsReversed = false;\r\n }\r\n}\r\n\r\nexport class PointD implements IPoint64 {\r\n public x: number;\r\n public y: number;\r\n\r\n constructor(xOrPt: number | PointD | Point64, yOrScale?: number) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = xOrPt;\r\n this.y = yOrScale;\r\n } else if (xOrPt instanceof PointD) {\r\n if (yOrScale !== undefined) {\r\n this.x = xOrPt.x * yOrScale;\r\n this.y = xOrPt.y * yOrScale;\r\n } else {\r\n this.x = xOrPt.x;\r\n this.y = xOrPt.y;\r\n }\r\n } else {\r\n this.x = (xOrPt).x * (yOrScale || 1);\r\n this.y = (xOrPt).y * (yOrScale || 1);\r\n }\r\n }\r\n\r\n public toString(precision: number = 2): string {\r\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\r\n }\r\n\r\n public static equals(lhs: PointD, rhs: PointD): boolean {\r\n return InternalClipper.isAlmostZero(lhs.x - rhs.x) &&\r\n InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n\r\n public static notEquals(lhs: PointD, rhs: PointD): boolean {\r\n return !InternalClipper.isAlmostZero(lhs.x - rhs.x) ||\r\n !InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n\r\n public equals(obj: PointD): boolean {\r\n if (obj instanceof PointD) {\r\n return PointD.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n\r\n public negate(): void {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n }\r\n\r\n // public getHashCode(): number {\r\n // return this.x ^ this.y; // XOR-based hash combination. Adjust if needed.\r\n // }\r\n}\r\n\r\nexport class ClipperOffset {\r\n\r\n private static Tolerance: number = 1.0E-12;\r\n private _groupList: Array = [];\r\n private _normals: Array = [];\r\n private _solution: Paths64 = [];\r\n private _groupDelta!: number; //*0.5 for open paths; *-1.0 for negative areas\r\n private _delta!: number;\r\n private _mitLimSqr!: number;\r\n private _stepsPerRad!: number;\r\n private _stepSin!: number;\r\n private _stepCos!: number;\r\n private _joinType!: JoinType;\r\n private _endType!: EndType;\r\n public ArcTolerance: number;\r\n public MergeGroups: boolean;\r\n public MiterLimit: number;\r\n public PreserveCollinear: boolean;\r\n public ReverseSolution: boolean;\r\n\r\n public DeltaCallback?: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number;\r\n\r\n constructor(miterLimit: number = 2.0, arcTolerance: number = 0.0,\r\n preserveCollinear: boolean = false, reverseSolution: boolean = false) {\r\n this.MiterLimit = miterLimit;\r\n this.ArcTolerance = arcTolerance;\r\n this.MergeGroups = true;\r\n this.PreserveCollinear = preserveCollinear;\r\n this.ReverseSolution = reverseSolution;\r\n }\r\n\r\n public clear(): void {\r\n this._groupList = [];\r\n }\r\n\r\n public addPath(path: Point64[], joinType: JoinType, endType: EndType): void {\r\n if (path.length === 0) return;\r\n const pp: Point64[][] = [path];\r\n this.addPaths(pp, joinType, endType);\r\n }\r\n\r\n public addPaths(paths: Paths64, joinType: JoinType, endType: EndType): void {\r\n if (paths.length === 0) return;\r\n this._groupList.push(new Group(paths, joinType, endType));\r\n }\r\n\r\n private executeInternal(delta: number): void {\r\n this._solution = [];\r\n if (this._groupList.length === 0) return;\r\n\r\n if (Math.abs(delta) < 0.5) {\r\n for (const group of this._groupList) {\r\n for (const path of group.inPaths) {\r\n this._solution.push(path);\r\n }\r\n }\r\n } else {\r\n this._delta = delta;\r\n this._mitLimSqr = (this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit));\r\n for (const group of this._groupList) {\r\n this.doGroupOffset(group);\r\n }\r\n }\r\n }\r\n\r\n private sqr(value: number): number {\r\n return value * value;\r\n }\r\n\r\n\r\n public execute(delta: number, solution: Paths64): void {\r\n solution.length = 0;\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0) return;\r\n\r\n // clean up self-intersections ...\r\n const c = new Clipper64()\r\n c.preserveCollinear = this.PreserveCollinear\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed\r\n\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.execute(ClipType.Union, FillRule.Negative, solution);\r\n else\r\n c.execute(ClipType.Union, FillRule.Positive, solution);\r\n }\r\n\r\n public executePolytree(delta: number, polytree: PolyTree64): void {\r\n polytree.clear();\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0) return;\r\n\r\n // clean up self-intersections ...\r\n const c = new Clipper64()\r\n c.preserveCollinear = this.PreserveCollinear\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed\r\n\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.executePolyTree(ClipType.Union, FillRule.Negative, polytree);\r\n else\r\n c.executePolyTree(ClipType.Union, FillRule.Positive, polytree);\r\n }\r\n\r\n protected static getUnitNormal(pt1: IPoint64, pt2: IPoint64): PointD {\r\n let dx = pt2.x - pt1.x;\r\n let dy = pt2.y - pt1.y;\r\n if (dx === 0 && dy === 0) return new PointD(0, 0);\r\n\r\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\r\n dx *= f;\r\n dy *= f;\r\n\r\n return new PointD(dy, -dx);\r\n }\r\n\r\n public executeCallback(deltaCallback: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number, solution: Point64[][]): void {\r\n this.DeltaCallback = deltaCallback;\r\n this.execute(1.0, solution);\r\n }\r\n\r\n private static getBoundsAndLowestPolyIdx(paths: Paths64): { index: number, rec: Rect64 } {\r\n const rec = new Rect64(false); // ie invalid rect\r\n let lpX: number = Number.MIN_SAFE_INTEGER;\r\n let index = -1;\r\n for (let i = 0; i < paths.length; i++) {\r\n for (const pt of paths[i]) {\r\n if (pt.y >= rec.bottom) {\r\n if (pt.y > rec.bottom || pt.x < lpX) {\r\n index = i;\r\n lpX = pt.x;\r\n rec.bottom = pt.y;\r\n }\r\n } else if (pt.y < rec.top) rec.top = pt.y;\r\n if (pt.x > rec.right) rec.right = pt.x;\r\n else if (pt.x < rec.left) rec.left = pt.x;\r\n }\r\n }\r\n return { index, rec }\r\n }\r\n\r\n private static translatePoint(pt: PointD, dx: number, dy: number): PointD {\r\n return new PointD(pt.x + dx, pt.y + dy);\r\n }\r\n\r\n private static reflectPoint(pt: PointD, pivot: PointD): PointD {\r\n return new PointD(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\r\n }\r\n\r\n private static almostZero(value: number, epsilon: number = 0.001): boolean {\r\n return Math.abs(value) < epsilon;\r\n }\r\n\r\n private static hypotenuse(x: number, y: number): number {\r\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\r\n }\r\n\r\n private static normalizeVector(vec: PointD): PointD {\r\n const h = this.hypotenuse(vec.x, vec.y);\r\n if (this.almostZero(h)) return new PointD(0, 0);\r\n const inverseHypot = 1 / h;\r\n return new PointD(vec.x * inverseHypot, vec.y * inverseHypot);\r\n }\r\n\r\n private static getAvgUnitVector(vec1: PointD, vec2: PointD): PointD {\r\n return this.normalizeVector(new PointD(vec1.x + vec2.x, vec1.y + vec2.y));\r\n }\r\n\r\n private static intersectPoint(pt1a: PointD, pt1b: PointD, pt2a: PointD, pt2b: PointD): PointD {\r\n if (InternalClipper.isAlmostZero(pt1a.x - pt1b.x)) { //vertical\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) return new PointD(0, 0);\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n return new PointD(pt1a.x, m2 * pt1a.x + b2);\r\n }\r\n\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) { //vertical\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n return new PointD(pt2a.x, m1 * pt2a.x + b1);\r\n } else {\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n if (InternalClipper.isAlmostZero(m1 - m2)) return new PointD(0, 0);\r\n const x = (b2 - b1) / (m1 - m2);\r\n return new PointD(x, m1 * x + b1);\r\n }\r\n }\r\n\r\n private getPerpendic(pt: IPoint64, norm: PointD): Point64 {\r\n return new Point64(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n\r\n private getPerpendicD(pt: IPoint64, norm: PointD): PointD {\r\n return new PointD(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n\r\n private doSquare(group: Group, path: Path64, j: number, k: number): void {\r\n let vec: PointD;\r\n if (j === k) {\r\n vec = new PointD(this._normals[j].y, -this._normals[j].x);\r\n } else {\r\n vec = ClipperOffset.getAvgUnitVector(\r\n new PointD(-this._normals[k].y, this._normals[k].x),\r\n new PointD(this._normals[j].y, -this._normals[j].x)\r\n );\r\n }\r\n\r\n const absDelta = Math.abs(this._groupDelta);\r\n // now offset the original vertex delta units along unit vector\r\n let ptQ = new PointD(path[j].x, path[j].y); \r\n ptQ = ClipperOffset.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\r\n\r\n // get perpendicular vertices\r\n const pt1 = ClipperOffset.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\r\n const pt2 = ClipperOffset.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\r\n // get 2 vertices along one edge offset\r\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\r\n\r\n if (j === k) {\r\n const pt4 = new PointD(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n } else {\r\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n }\r\n }\r\n\r\n private doMiter(group: Group, path: Path64, j: number, k: number, cosA: number): void {\r\n const q = this._groupDelta / (cosA + 1);\r\n group.outPath.push(new Point64(\r\n path[j].x + (this._normals[k].x + this._normals[j].x) * q,\r\n path[j].y + (this._normals[k].y + this._normals[j].y) * q\r\n ));\r\n }\r\n\r\n private doRound(group: Group, path: Path64, j: number, k: number, angle: number): void {\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n const absDelta = Math.abs(this._groupDelta);\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n\r\n const pt = path[j];\r\n let offsetVec = new PointD(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\r\n if (j === k) offsetVec.negate();\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n if (angle > -Math.PI + 0.01) {\r\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\r\n for (let i = 1; i < steps; i++) {\r\n offsetVec = new PointD(\r\n offsetVec.x * this._stepCos - this._stepSin * offsetVec.y,\r\n offsetVec.x * this._stepSin + offsetVec.y * this._stepCos\r\n );\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n }\r\n }\r\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\r\n }\r\n\r\n private buildNormals(path: Path64): void {\r\n const cnt = path.length;\r\n this._normals = [];\r\n this._normals.length = cnt;\r\n\r\n for (let i = 0; i < cnt - 1; i++) {\r\n this._normals.push(ClipperOffset.getUnitNormal(path[i], path[i + 1]));\r\n }\r\n this._normals.push(ClipperOffset.getUnitNormal(path[cnt - 1], path[0]));\r\n }\r\n\r\n crossProduct(vec1: PointD, vec2: PointD): number {\r\n return (vec1.y * vec2.x - vec2.y * vec1.x);\r\n }\r\n\r\n dotProduct(vec1: PointD, vec2: PointD): number {\r\n return (vec1.x * vec2.x + vec1.y * vec2.y);\r\n }\r\n\r\n private offsetPoint(group: Group, path: Path64, j: number, k: number): void {\r\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\r\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\r\n if (sinA > 1.0) cosA = 1.0;\r\n else if (sinA < -1.0) cosA = -1.0;\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\r\n if (group.pathsReversed) this._groupDelta = -this._groupDelta;\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[j]);\r\n return;\r\n }\r\n\r\n if (cosA > 0.999) {\r\n this.doMiter(group, path, j, k, cosA);\r\n } else if (cosA > -0.99 && (sinA * this._groupDelta < 0)) {\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\r\n group.outPath.push(path[j]);\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\r\n } else if (this._joinType === JoinType.Miter) {\r\n if (cosA > this._mitLimSqr - 1) {\r\n this.doMiter(group, path, j, k, cosA);\r\n } else {\r\n this.doSquare(group, path, j, k);\r\n }\r\n } else if (cosA > 0.99 || this._joinType === JoinType.Square) {\r\n this.doSquare(group, path, j, k);\r\n } else {\r\n this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\r\n }\r\n\r\n k = j;\r\n }\r\n\r\n private offsetPolygon(group: Group, path: Path64): void {\r\n const area = Clipper.area(path);\r\n if ((area < 0) !== (this._groupDelta < 0)) {\r\n const rect = Clipper.getBounds(path);\r\n if (Math.abs(this._groupDelta) * 2 > rect.width) return;\r\n }\r\n\r\n group.outPath = [];\r\n const cnt = path.length;\r\n const prev = cnt - 1;\r\n for (let i = 0; i < cnt; i++) {\r\n this.offsetPoint(group, path, i, prev);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n\r\n private offsetOpenJoined(group: Group, path: Path64): void {\r\n this.offsetPolygon(group, path);\r\n path = Clipper.reversePath(path);\r\n this.buildNormals(path);\r\n this.offsetPolygon(group, path);\r\n }\r\n\r\n private offsetOpenPath(group: Group, path: Path64): void {\r\n group.outPath = [];\r\n const highI = path.length - 1;\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[0]);\r\n } else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(\r\n path[0].x - this._normals[0].x * this._groupDelta,\r\n path[0].y - this._normals[0].y * this._groupDelta\r\n ));\r\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, 0, 0, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, 0, 0);\r\n break;\r\n }\r\n }\r\n\r\n for (let i = 1, k = 0; i < highI; i++) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n\r\n for (let i = highI; i > 0; i--) {\r\n this._normals[i] = new PointD(-this._normals[i - 1].x, -this._normals[i - 1].y);\r\n }\r\n this._normals[0] = this._normals[highI];\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[highI]);\r\n } else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(\r\n path[highI].x - this._normals[highI].x * this._groupDelta,\r\n path[highI].y - this._normals[highI].y * this._groupDelta\r\n ));\r\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, highI, highI, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, highI, highI);\r\n break;\r\n }\r\n }\r\n\r\n for (let i = highI, k = 0; i > 0; i--) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n\r\n group.outPaths.push(group.outPath);\r\n }\r\n\r\n private doGroupOffset(group: Group): void {\r\n if (group.endType == EndType.Polygon) {\r\n\r\n const { index } = ClipperOffset.getBoundsAndLowestPolyIdx(group.inPaths);\r\n\r\n if (index < 0) return;\r\n\r\n const area = Clipper.area(group.inPaths[index]);\r\n group.pathsReversed = area < 0;\r\n\r\n if (group.pathsReversed) {\r\n this._groupDelta = -this._delta;\r\n } else {\r\n this._groupDelta = this._delta;\r\n }\r\n } else {\r\n group.pathsReversed = false;\r\n this._groupDelta = Math.abs(this._delta) * 0.5;\r\n }\r\n\r\n const absDelta = Math.abs(this._groupDelta);\r\n this._joinType = group.joinType;\r\n this._endType = group.endType;\r\n\r\n if (!this.DeltaCallback &&\r\n (group.joinType == JoinType.Round || group.endType == EndType.Round)) {\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n\r\n if (this._groupDelta < 0.0) {\r\n this._stepSin = -this._stepSin;\r\n }\r\n\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n\r\n const isJoined = group.endType == EndType.Joined || group.endType == EndType.Polygon;\r\n\r\n for (const p of group.inPaths) {\r\n const path = Clipper.stripDuplicates(p, isJoined);\r\n const cnt = path.length;\r\n\r\n if (cnt === 0 || (cnt < 3 && this._endType == EndType.Polygon)) {\r\n continue;\r\n }\r\n\r\n if (cnt == 1) {\r\n group.outPath = [];\r\n\r\n if (group.endType == EndType.Round) {\r\n const r = absDelta;\r\n group.outPath = Clipper.ellipse(path[0], r, r);\r\n } else {\r\n const d = Math.ceil(this._groupDelta);\r\n const r = new Rect64(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\r\n group.outPath = r.asPath();\r\n }\r\n\r\n group.outPaths.push(group.outPath);\r\n } else {\r\n if (cnt == 2 && group.endType == EndType.Joined) {\r\n if (group.joinType == JoinType.Round) {\r\n this._endType = EndType.Round;\r\n } else {\r\n this._endType = EndType.Square;\r\n }\r\n }\r\n\r\n this.buildNormals(path);\r\n\r\n if (this._endType == EndType.Polygon) {\r\n this.offsetPolygon(group, path);\r\n } else if (this._endType == EndType.Joined) {\r\n this.offsetOpenJoined(group, path);\r\n } else {\r\n this.offsetOpenPath(group, path);\r\n }\r\n }\r\n }\r\n\r\n this._solution.push(...group.outPaths);\r\n group.outPaths = [];\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { PointInPolygonResult } from \"./engine\";\r\n\r\nexport class OutPt2 {\r\n next?: OutPt2;\r\n prev?: OutPt2;\r\n\r\n pt: IPoint64;\r\n ownerIdx: number;\r\n edge?: Array;\r\n\r\n constructor(pt: IPoint64) {\r\n this.pt = pt;\r\n this.ownerIdx = 0\r\n }\r\n}\r\n\r\nenum Location {\r\n left, top, right, bottom, inside\r\n}\r\n\r\nexport class RectClip64 {\r\n protected rect: Rect64;\r\n protected mp: Point64;\r\n protected rectPath: Path64;\r\n protected pathBounds!: Rect64;\r\n protected results: Array\r\n protected edges: Array[];\r\n protected currIdx = -1;\r\n\r\n constructor(rect: Rect64) {\r\n this.rect = rect;\r\n this.mp = rect.midPoint();\r\n this.rectPath = rect.asPath();\r\n this.results = [];\r\n this.edges = Array(8).fill(undefined).map(() => []);\r\n }\r\n\r\n protected add(pt: IPoint64, startingNewPath: boolean = false): OutPt2 {\r\n let currIdx = this.results.length;\r\n let result: OutPt2;\r\n if (currIdx === 0 || startingNewPath) {\r\n result = new OutPt2(pt);\r\n this.results.push(result);\r\n result.ownerIdx = currIdx;\r\n result.prev = result;\r\n result.next = result;\r\n } else {\r\n currIdx--;\r\n const prevOp = this.results[currIdx];\r\n if (prevOp!.pt === pt) return prevOp!;\r\n result = new OutPt2(pt);\r\n result.ownerIdx = currIdx;\r\n result.next = prevOp!.next;\r\n prevOp!.next!.prev = result;\r\n prevOp!.next = result;\r\n result.prev = prevOp!;\r\n this.results[currIdx] = result;\r\n }\r\n return result;\r\n }\r\n\r\n private static path1ContainsPath2(path1: Path64, path2: Path64): boolean {\r\n let ioCount = 0;\r\n for (const pt of path2) {\r\n const pip = InternalClipper.pointInPolygon(pt, path1);\r\n switch (pip) {\r\n case PointInPolygonResult.IsInside:\r\n ioCount--; break;\r\n case PointInPolygonResult.IsOutside:\r\n ioCount++; break;\r\n }\r\n if (Math.abs(ioCount) > 1) break;\r\n }\r\n return ioCount <= 0;\r\n }\r\n\r\n private static isClockwise(prev: Location, curr: Location, prevPt: IPoint64, currPt: IPoint64, rectMidPoint: Point64): boolean {\r\n if (this.areOpposites(prev, curr))\r\n return InternalClipper.crossProduct(prevPt, rectMidPoint, currPt) < 0;\r\n else\r\n return this.headingClockwise(prev, curr);\r\n }\r\n\r\n private static areOpposites(prev: Location, curr: Location): boolean {\r\n return Math.abs(prev - curr) === 2;\r\n }\r\n\r\n private static headingClockwise(prev: Location, curr: Location): boolean {\r\n return (prev + 1) % 4 === curr;\r\n }\r\n\r\n private static getAdjacentLocation(loc: Location, isClockwise: boolean): Location {\r\n const delta = isClockwise ? 1 : 3;\r\n return (loc + delta) % 4;\r\n }\r\n\r\n private static unlinkOp(op: OutPt2 | undefined): OutPt2 | undefined {\r\n if (op!.next === op) return undefined;\r\n op!.prev!.next = op!.next;\r\n op!.next!.prev = op!.prev;\r\n return op!.next;\r\n }\r\n\r\n private static unlinkOpBack(op: OutPt2 | undefined): OutPt2 | undefined {\r\n if (op!.next === op) return undefined;\r\n op!.prev!.next = op!.next;\r\n op!.next!.prev = op!.prev;\r\n return op!.prev;\r\n }\r\n\r\n private static getEdgesForPt(pt: IPoint64, rec: Rect64): number {\r\n let result = 0;\r\n if (pt.x === rec.left) result = 1;\r\n else if (pt.x === rec.right) result = 4;\r\n if (pt.y === rec.top) result += 2;\r\n else if (pt.y === rec.bottom) result += 8;\r\n return result;\r\n }\r\n\r\n private static isHeadingClockwise(pt1: IPoint64, pt2: IPoint64, edgeIdx: number): boolean {\r\n switch (edgeIdx) {\r\n case 0: return pt2.y < pt1.y;\r\n case 1: return pt2.x > pt1.x;\r\n case 2: return pt2.y > pt1.y;\r\n default: return pt2.x < pt1.x;\r\n }\r\n }\r\n\r\n private static hasHorzOverlap(left1: IPoint64, right1: IPoint64, left2: IPoint64, right2: IPoint64): boolean {\r\n return (left1.x < right2.x) && (right1.x > left2.x);\r\n }\r\n\r\n private static hasVertOverlap(top1: IPoint64, bottom1: IPoint64, top2: IPoint64, bottom2: IPoint64): boolean {\r\n return (top1.y < bottom2.y) && (bottom1.y > top2.y);\r\n }\r\n\r\n private static addToEdge(edge: (OutPt2 | undefined)[], op: OutPt2): void {\r\n if (op.edge) return;\r\n op.edge = edge;\r\n edge.push(op);\r\n }\r\n\r\n private static uncoupleEdge(op: OutPt2): void {\r\n if (!op.edge) return;\r\n for (let i = 0; i < op.edge.length; i++) {\r\n const op2 = op.edge[i];\r\n if (op2 === op) {\r\n op.edge[i] = undefined;\r\n break;\r\n }\r\n }\r\n op.edge = undefined;\r\n }\r\n\r\n private static setNewOwner(op: OutPt2, newIdx: number): void {\r\n op.ownerIdx = newIdx;\r\n let op2 = op.next!;\r\n while (op2 !== op) {\r\n op2.ownerIdx = newIdx;\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n private addCorner(prev: Location, curr: Location): void {\r\n if (RectClip64.headingClockwise(prev, curr))\r\n this.add(this.rectPath[prev]);\r\n else\r\n this.add(this.rectPath[curr]);\r\n }\r\n\r\n private addCornerByRef(loc: Location, isClockwise: boolean): void {\r\n if (isClockwise) {\r\n this.add(this.rectPath[loc]);\r\n loc = RectClip64.getAdjacentLocation(loc, true);\r\n } else {\r\n loc = RectClip64.getAdjacentLocation(loc, false);\r\n this.add(this.rectPath[loc]);\r\n }\r\n }\r\n\r\n protected static getLocation(rec: Rect64, pt: IPoint64): { success: boolean, loc: Location } {\r\n let loc: Location;\r\n\r\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.left; // pt on rec\r\n return { success: false, loc }\r\n }\r\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.right; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.top; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.bottom; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x < rec.left) loc = Location.left;\r\n else if (pt.x > rec.right) loc = Location.right;\r\n else if (pt.y < rec.top) loc = Location.top;\r\n else if (pt.y > rec.bottom) loc = Location.bottom;\r\n else loc = Location.inside;\r\n\r\n return { success: true, loc };\r\n }\r\n\r\n protected static getIntersection(rectPath: Path64, p: IPoint64, p2: IPoint64, loc: Location): { success: boolean, loc: Location, ip: IPoint64 } {\r\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\r\n // when result == false, loc will remain unchanged\r\n let ip: IPoint64 = new Point64();\r\n switch (loc) {\r\n case Location.left:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n } else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.right:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n } else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n case Location.top:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n } else if (p.x < rectPath[0].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (p.x > rectPath[1].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.bottom:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n } else if (p.x < rectPath[3].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (p.x > rectPath[2].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.inside:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n }\r\n return { success:true, loc, ip };\r\n }\r\n\r\n protected getNextLocation(path: Path64, context: { loc: Location, i: number, highI: number }): void {\r\n\r\n switch (context.loc) {\r\n case Location.left:\r\n while (context.i <= context.highI && path[context.i].x <= this.rect.left) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.top:\r\n while (context.i <= context.highI && path[context.i].y <= this.rect.top) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.right:\r\n while (context.i <= context.highI && path[context.i].x >= this.rect.right) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.bottom:\r\n while (context.i <= context.highI && path[context.i].y >= this.rect.bottom) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.inside:\r\n while (context.i <= context.highI) {\r\n if (path[context.i].x < this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x > this.rect.right) context.loc = Location.right;\r\n else if (path[context.i].y > this.rect.bottom) context.loc = Location.bottom;\r\n else if (path[context.i].y < this.rect.top) context.loc = Location.top;\r\n else {\r\n this.add(path[context.i]); \r\n context.i++;\r\n continue;\r\n }\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n protected executeInternal(path: Path64): void {\r\n if (path.length < 3 || this.rect.isEmpty()) return;\r\n const startLocs: Location[] = [];\r\n\r\n let firstCross: Location = Location.inside;\r\n let crossingLoc: Location = firstCross, prev: Location = firstCross;\r\n\r\n let i: number\r\n const highI = path.length - 1;\r\n let result = RectClip64.getLocation(this.rect, path[highI])\r\n let loc: Location = result.loc\r\n if (!result.success) {\r\n i = highI - 1;\r\n while (i >= 0 && !result.success) {\r\n i--\r\n result = RectClip64.getLocation(this.rect, path[i])\r\n prev = result.loc\r\n }\r\n if (i < 0) {\r\n for (const pt of path) {\r\n this.add(pt);\r\n }\r\n return;\r\n }\r\n if (prev == Location.inside) loc = Location.inside;\r\n }\r\n const startingLoc = loc;\r\n\r\n ///////////////////////////////////////////////////\r\n i = 0;\r\n while (i <= highI) {\r\n prev = loc;\r\n const prevCrossLoc: Location = crossingLoc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI) break;\r\n\r\n const prevPt = (i == 0) ? path[highI] : path[i - 1];\r\n crossingLoc = loc;\r\n\r\n let result = RectClip64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc)\r\n const ip: IPoint64 = result.ip\r\n\r\n if (!result.success) {\r\n if (prevCrossLoc == Location.inside) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp); \r\n do {\r\n startLocs.push(prev);\r\n prev = RectClip64.getAdjacentLocation(prev, isClockw);\r\n } while (prev != loc);\r\n crossingLoc = prevCrossLoc;\r\n } else if (prev != Location.inside && prev != loc) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != loc);\r\n }\r\n ++i;\r\n continue;\r\n }\r\n\r\n ////////////////////////////////////////////////////\r\n // we must be crossing the rect boundary to get here\r\n ////////////////////////////////////////////////////\r\n if (loc == Location.inside) {\r\n if (firstCross == Location.inside) {\r\n firstCross = crossingLoc;\r\n startLocs.push(prev);\r\n } else if (prev != crossingLoc) {\r\n const isClockw = RectClip64.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != crossingLoc);\r\n }\r\n } else if (prev != Location.inside) {\r\n // passing right through rect. 'ip' here will be the second\r\n // intersect pt but we'll also need the first intersect pt (ip2)\r\n\r\n loc = prev;\r\n result = RectClip64.getIntersection(this.rectPath, prevPt, path[i], loc);\r\n const ip2: IPoint64 = result.ip\r\n\r\n if (prevCrossLoc != Location.inside && prevCrossLoc != loc)\r\n this.addCorner(prevCrossLoc, loc);\r\n\r\n if (firstCross == Location.inside) {\r\n firstCross = loc;\r\n startLocs.push(prev);\r\n }\r\n\r\n loc = crossingLoc;\r\n this.add(ip2);\r\n if (ip == ip2) {\r\n loc = RectClip64.getLocation(this.rect, path[i]).loc;\r\n this.addCorner(crossingLoc, loc);\r\n crossingLoc = loc;\r\n continue;\r\n }\r\n } else {\r\n loc = crossingLoc;\r\n if (firstCross == Location.inside)\r\n firstCross = crossingLoc;\r\n }\r\n\r\n this.add(ip);\r\n }//while i <= highI\r\n ///////////////////////////////////////////////////\r\n\r\n if (firstCross == Location.inside) {\r\n if (startingLoc != Location.inside) {\r\n if (this.pathBounds.containsRect(this.rect) && RectClip64.path1ContainsPath2(path, this.rectPath)) {\r\n for (let j = 0; j < 4; j++) {\r\n this.add(this.rectPath[j]);\r\n RectClip64.addToEdge(this.edges[j * 2], this.results[0]!);\r\n }\r\n }\r\n }\r\n } else if (loc != Location.inside && (loc != firstCross || startLocs.length > 2)) {\r\n if (startLocs.length > 0) {\r\n prev = loc;\r\n for (const loc2 of startLocs) {\r\n if (prev == loc2) continue;\r\n this.addCornerByRef(prev, RectClip64.headingClockwise(prev, loc2));\r\n prev = loc2;\r\n }\r\n loc = prev;\r\n }\r\n if (loc != firstCross)\r\n this.addCornerByRef(loc, RectClip64.headingClockwise(loc, firstCross));\r\n }\r\n }\r\n\r\n public execute(paths: Paths64): Paths64 { \r\n const result: Paths64 = []; \r\n if (this.rect.isEmpty()) return result;\r\n\r\n for (const path of paths) {\r\n if (path.length < 3) continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n\r\n if (!this.rect.intersects(this.pathBounds)) continue;\r\n else if (this.rect.containsRect(this.pathBounds)) {\r\n result.push(path);\r\n continue;\r\n }\r\n this.executeInternal(path);\r\n this.checkEdges();\r\n for (let i = 0; i < 4; ++i)\r\n this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\r\n\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op); \r\n if (tmp.length > 0) result.push(tmp);\r\n }\r\n\r\n this.results.length = 0\r\n for (let i = 0; i < 8; i++)\r\n this.edges[i].length = 0\r\n }\r\n return result;\r\n }\r\n\r\n private checkEdges(): void {\r\n for (let i = 0; i < this.results.length; i++) {\r\n let op = this.results[i];\r\n let op2 = op;\r\n\r\n if (op === undefined) continue;\r\n\r\n do {\r\n if (InternalClipper.crossProduct(op2!.prev!.pt, op2!.pt, op2!.next!.pt) === 0) { \r\n if (op2 === op) {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined) break;\r\n op = op2.prev;\r\n } else {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined) break;\r\n }\r\n } else {\r\n op2 = op2!.next;\r\n }\r\n } while (op2 !== op);\r\n\r\n if (op2 === undefined) {\r\n this.results[i] = undefined;\r\n continue;\r\n }\r\n this.results[i] = op2;\r\n\r\n let edgeSet1 = RectClip64.getEdgesForPt(op!.prev!.pt, this.rect);\r\n op2 = op;\r\n do {\r\n const edgeSet2 = RectClip64.getEdgesForPt(op2!.pt, this.rect);\r\n if (edgeSet2 !== 0 && op2!.edge === undefined) {\r\n const combinedSet = (edgeSet1 & edgeSet2);\r\n for (let j = 0; j < 4; ++j) {\r\n if ((combinedSet & (1 << j)) !== 0) {\r\n if (RectClip64.isHeadingClockwise(op2!.prev!.pt, op2!.pt, j))\r\n RectClip64.addToEdge(this.edges[j * 2], op2!);\r\n else\r\n RectClip64.addToEdge(this.edges[j * 2 + 1], op2!);\r\n }\r\n }\r\n }\r\n edgeSet1 = edgeSet2;\r\n op2 = op2!.next;\r\n } while (op2 !== op);\r\n }\r\n }\r\n\r\n private tidyEdgePair(idx: number, cw: Array, ccw: Array): void {\r\n if (ccw.length === 0) return;\r\n const isHorz = (idx === 1 || idx === 3);\r\n const cwIsTowardLarger = (idx === 1 || idx === 2);\r\n let i = 0, j = 0;\r\n let p1: OutPt2 | undefined, p2: OutPt2 | undefined, p1a: OutPt2 | undefined, p2a: OutPt2 | undefined, op: OutPt2 | undefined, op2: OutPt2 | undefined;\r\n\r\n while (i < cw.length) {\r\n p1 = cw[i];\r\n if (!p1 || p1.next === p1.prev) {\r\n cw[i++] = undefined;\r\n j = 0;\r\n continue;\r\n }\r\n\r\n const jLim = ccw.length;\r\n while (j < jLim && (!ccw[j] || ccw[j]!.next === ccw[j]!.prev)) ++j;\r\n\r\n if (j === jLim) {\r\n ++i;\r\n j = 0;\r\n continue;\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n p1 = cw[i]!.prev!;\r\n p1a = cw[i];\r\n p2 = ccw[j];\r\n p2a = ccw[j]!.prev!;\r\n } else {\r\n p1 = cw[i];\r\n p1a = cw[i]!.prev!;\r\n p2 = ccw[j]!.prev!;\r\n p2a = ccw[j];\r\n }\r\n\r\n if ((isHorz && !RectClip64.hasHorzOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt)) ||\r\n (!isHorz && !RectClip64.hasVertOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt))) {\r\n ++j;\r\n continue;\r\n }\r\n\r\n const isRejoining = cw[i]!.ownerIdx !== ccw[j]!.ownerIdx;\r\n\r\n if (isRejoining) {\r\n this.results[p2!.ownerIdx] = undefined;\r\n RectClip64.setNewOwner(p2!, p1!.ownerIdx);\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n // p1 >> | >> p1a;\r\n // p2 << | << p2a;\r\n p1!.next = p2;\r\n p2!.prev = p1;\r\n p1a!.prev = p2a;\r\n p2a!.next = p1a;\r\n } else {\r\n // p1 << | << p1a;\r\n // p2 >> | >> p2a;\r\n p1!.prev = p2;\r\n p2!.next = p1;\r\n p1a!.next = p2a;\r\n p2a!.prev = p1a;\r\n }\r\n\r\n if (!isRejoining) {\r\n const new_idx = this.results.length;\r\n this.results.push(p1a);\r\n RectClip64.setNewOwner(p1a!, new_idx);\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n op = p2;\r\n op2 = p1a;\r\n } else {\r\n op = p1;\r\n op2 = p2a;\r\n }\r\n this.results[op!.ownerIdx] = op;\r\n this.results[op2!.ownerIdx] = op2;\r\n\r\n // and now lots of work to get ready for the next loop\r\n\r\n let opIsLarger: boolean, op2IsLarger: boolean;\r\n if (isHorz) { // X\r\n opIsLarger = op!.pt.x > op!.prev!.pt.x;\r\n op2IsLarger = op2!.pt.x > op2!.prev!.pt.x;\r\n } else { // Y\r\n opIsLarger = op!.pt.y > op!.prev!.pt.y;\r\n op2IsLarger = op2!.pt.y > op2!.prev!.pt.y;\r\n }\r\n\r\n if ((op!.next === op!.prev) || (op!.pt === op!.prev!.pt)) {\r\n if (op2IsLarger === cwIsTowardLarger) {\r\n cw[i] = op2;\r\n ccw[j++] = undefined;\r\n } else {\r\n ccw[j] = op2;\r\n cw[i++] = undefined;\r\n }\r\n } else if ((op2!.next === op2!.prev) || (op2!.pt === op2!.prev!.pt)) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n ccw[j++] = undefined;\r\n } else {\r\n ccw[j] = op;\r\n cw[i++] = undefined;\r\n }\r\n } else if (opIsLarger === op2IsLarger) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n RectClip64.uncoupleEdge(op2!);\r\n RectClip64.addToEdge(cw, op2!);\r\n ccw[j++] = undefined;\r\n } else {\r\n cw[i++] = undefined;\r\n ccw[j] = op2;\r\n RectClip64.uncoupleEdge(op!);\r\n RectClip64.addToEdge(ccw, op!);\r\n j = 0;\r\n }\r\n } else {\r\n if (opIsLarger === cwIsTowardLarger)\r\n cw[i] = op;\r\n else\r\n ccw[j] = op;\r\n\r\n if (op2IsLarger === cwIsTowardLarger)\r\n cw[i] = op2;\r\n else\r\n ccw[j] = op2;\r\n }\r\n }\r\n }\r\n\r\n protected getPath(op: OutPt2 | undefined): Path64 {\r\n const result = new Path64();\r\n if (!op || op.prev === op.next) return result;\r\n\r\n let op2: OutPt2 | undefined = op.next;\r\n while (op2 && op2 !== op) {\r\n if (InternalClipper.crossProduct(op2.prev!.pt, op2.pt, op2.next!.pt) === 0) {\r\n op = op2.prev!;\r\n op2 = RectClip64.unlinkOp(op2);\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n if (!op2) return new Path64();\r\n\r\n result.push(op.pt);\r\n op2 = op.next!;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next!;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nexport class RectClipLines64 extends RectClip64 {\r\n\r\n constructor(rect: Rect64) {\r\n super(rect);\r\n }\r\n\r\n public override execute(paths: Paths64): Paths64 {\r\n const result = new Paths64();\r\n if (this.rect.isEmpty()) return result; \r\n for (const path of paths) {\r\n if (path.length < 2) continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds)) continue; \r\n\r\n this.executeInternal(path);\r\n\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0) result.push(tmp);\r\n }\r\n\r\n // Clean up after every loop\r\n this.results.length = 0; // Clear the array\r\n for (let i = 0; i < 8; i++) {\r\n this.edges[i].length = 0; // Clear each array\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n protected override getPath(op: OutPt2 | undefined): Path64 {\r\n const result = new Path64();\r\n if (!op || op === op.next) return result;\r\n op = op.next; // starting at path beginning \r\n result.push(op!.pt);\r\n let op2 = op!.next!;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next!;\r\n }\r\n return result;\r\n }\r\n\r\n protected override executeInternal(path: Path64): void {\r\n this.results = [];\r\n if (path.length < 2 || this.rect.isEmpty()) return; \r\n\r\n let prev: Location = Location.inside;\r\n let i = 1;\r\n const highI = path.length - 1;\r\n\r\n let result = RectClipLines64.getLocation(this.rect, path[0])\r\n let loc: Location = result.loc\r\n if (!result.success) {\r\n while (i <= highI && !result.success) {\r\n i++\r\n result = RectClipLines64.getLocation(this.rect, path[i])\r\n prev = result.loc\r\n }\r\n if (i > highI) {\r\n for (const pt of path) this.add(pt);\r\n }\r\n if (prev == Location.inside) loc = Location.inside;\r\n i = 1;\r\n }\r\n if (loc == Location.inside) this.add(path[0]);\r\n\r\n while (i <= highI) {\r\n prev = loc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n\r\n if (i > highI) break;\r\n\r\n const prevPt: IPoint64 = path[i - 1];\r\n let crossingLoc: Location = loc;\r\n\r\n let result = RectClipLines64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc)\r\n const ip: IPoint64 = result.ip\r\n crossingLoc = result.loc\r\n\r\n if (!result.success) {\r\n i++;\r\n continue;\r\n }\r\n\r\n if (loc == Location.inside) {\r\n this.add(ip, true);\r\n } else if (prev !== Location.inside) {\r\n crossingLoc = prev;\r\n\r\n result = RectClipLines64.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\r\n const ip2: IPoint64 = result.ip\r\n crossingLoc = result.loc\r\n\r\n this.add(ip2);\r\n this.add(ip);\r\n } else {\r\n this.add(ip);\r\n }\r\n }\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, PathType, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { Clipper64, PointInPolygonResult, PolyPath64, PolyPathBase, PolyTree64 } from \"./engine\";\r\nimport { Minkowski } from \"./minkowski\";\r\nimport { ClipperOffset, EndType, JoinType } from \"./offset\";\r\nimport { RectClip64, RectClipLines64 } from \"./rectclip\";\r\n\r\nexport class Clipper {\r\n\r\n private static invalidRect64: Rect64\r\n public static get InvalidRect64(): Rect64 {\r\n if (!Clipper.invalidRect64) Clipper.invalidRect64 = new Rect64(false);\r\n return this.invalidRect64;\r\n }\r\n\r\n public static Intersect(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Intersection, subject, clip, fillRule);\r\n }\r\n\r\n public static Union(subject: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 {\r\n return this.BooleanOp(ClipType.Union, subject, clip, fillRule);\r\n }\r\n\r\n public static Difference(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Difference, subject, clip, fillRule);\r\n }\r\n\r\n public static Xor(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Xor, subject, clip, fillRule);\r\n }\r\n\r\n public static BooleanOp(clipType: ClipType, subject?: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 {\r\n const solution: Paths64 = new Paths64();\r\n if (!subject) return solution;\r\n const c: Clipper64 = new Clipper64();\r\n c.addPaths(subject, PathType.Subject);\r\n if (clip)\r\n c.addPaths(clip, PathType.Clip);\r\n c.execute(clipType, fillRule, solution);\r\n return solution;\r\n }\r\n\r\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\r\n // if (!subject) return;\r\n // const c: Clipper64 = new Clipper64();\r\n // c.addPaths(subject, PathType.Subject);\r\n // if (clip)\r\n // c.addPaths(clip, PathType.Clip);\r\n // c.execute(clipType, fillRule, polytree);\r\n //}\r\n\r\n public static InflatePaths(paths: Paths64, delta: number, joinType: JoinType, endType: EndType, miterLimit: number = 2.0): Paths64 {\r\n const co: ClipperOffset = new ClipperOffset(miterLimit);\r\n co.addPaths(paths, joinType, endType);\r\n const solution: Paths64 = new Paths64();\r\n co.execute(delta, solution);\r\n return solution;\r\n }\r\n\r\n public static RectClipPaths(rect: Rect64, paths: Paths64): Paths64 {\r\n if (rect.isEmpty() || paths.length === 0) return new Paths64();\r\n const rc = new RectClip64(rect);\r\n return rc.execute(paths);\r\n }\r\n\r\n public static RectClip(rect: Rect64, path: Path64): Paths64 {\r\n if (rect.isEmpty() || path.length === 0) return new Paths64();\r\n const tmp: Paths64 = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipPaths(rect, tmp);\r\n }\r\n\r\n public static RectClipLinesPaths(rect: Rect64, paths: Paths64): Paths64 {\r\n if (rect.isEmpty() || paths.length === 0) return new Paths64();\r\n const rc = new RectClipLines64(rect);\r\n return rc.execute(paths);\r\n }\r\n\r\n public static RectClipLines(rect: Rect64, path: Path64): Paths64 {\r\n if (rect.isEmpty() || path.length === 0) return new Paths64();\r\n const tmp: Paths64 = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipLinesPaths(rect, tmp);\r\n }\r\n\r\n public static MinkowskiSum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Minkowski.sum(pattern, path, isClosed);\r\n }\r\n\r\n public static MinkowskiDiff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Minkowski.diff(pattern, path, isClosed);\r\n }\r\n\r\n public static area(path: Path64): number {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let a = 0.0;\r\n const cnt = path.length;\r\n if (cnt < 3) return 0.0;\r\n let prevPt = path[cnt - 1];\r\n for (const pt of path) {\r\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\r\n prevPt = pt;\r\n }\r\n return a * 0.5;\r\n }\r\n\r\n public static areaPaths(paths: Paths64): number {\r\n let a = 0.0;\r\n for (const path of paths)\r\n a += this.area(path);\r\n return a;\r\n }\r\n\r\n public static isPositive(poly: Path64): boolean {\r\n return this.area(poly) >= 0;\r\n }\r\n\r\n public static path64ToString(path: Path64): string {\r\n let result = \"\";\r\n for (const pt of path)\r\n result += pt.toString();\r\n return result + '\\n';\r\n }\r\n\r\n public static paths64ToString(paths: Paths64): string {\r\n let result = \"\";\r\n for (const path of paths)\r\n result += this.path64ToString(path);\r\n return result;\r\n }\r\n\r\n public static offsetPath(path: Path64, dx: number, dy: number): Path64 {\r\n const result = new Path64();\r\n for (const pt of path)\r\n result.push(new Point64(pt.x + dx, pt.y + dy));\r\n return result;\r\n }\r\n\r\n public static scalePoint64(pt: Point64, scale: number): Point64 {\r\n const result = new Point64(\r\n Math.round(pt.x * scale),\r\n Math.round(pt.y * scale)\r\n )\r\n return result;\r\n }\r\n\r\n public static scalePath(path: Path64, scale: number): Path64 {\r\n if (InternalClipper.isAlmostZero(scale - 1)) return path;\r\n const result: Path64 = [];\r\n for (const pt of path)\r\n result.push({ x: pt.x * scale, y: pt.y * scale });\r\n return result;\r\n }\r\n\r\n public static scalePaths(paths: Paths64, scale: number): Paths64 {\r\n if (InternalClipper.isAlmostZero(scale - 1)) return paths;\r\n const result: Paths64 = [];\r\n for (const path of paths)\r\n result.push(this.scalePath(path, scale));\r\n return result;\r\n }\r\n\r\n public static translatePath(path: Path64, dx: number, dy: number): Path64 {\r\n const result: Path64 = [];\r\n for (const pt of path) {\r\n result.push({ x: pt.x + dx, y: pt.y + dy });\r\n }\r\n return result;\r\n }\r\n\r\n public static translatePaths(paths: Paths64, dx: number, dy: number): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(this.translatePath(path, dx, dy));\r\n }\r\n return result;\r\n }\r\n\r\n public static reversePath(path: Path64): Path64 {\r\n return [...path].reverse();\r\n }\r\n\r\n public static reversePaths(paths: Paths64): Paths64 {\r\n const result: Paths64 = [];\r\n for (const t of paths) {\r\n result.push(this.reversePath(t));\r\n }\r\n return result;\r\n }\r\n\r\n public static getBounds(path: Path64): Rect64 {\r\n const result: Rect64 = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n\r\n public static getBoundsPaths(paths: Paths64): Rect64 {\r\n const result: Rect64 = Clipper.InvalidRect64;\r\n for (const path of paths) {\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n\r\n static makePath(arr: number[]): Path64 {\r\n const len = arr.length / 2;\r\n const p = new Path64();\r\n for (let i = 0; i < len; i++)\r\n p.push(new Point64(arr[i * 2], arr[i * 2 + 1]));\r\n return p;\r\n }\r\n\r\n static stripDuplicates(path: Path64, isClosedPath: boolean): Path64 {\r\n const cnt = path.length;\r\n const result = new Path64();\r\n if (cnt === 0) return result;\r\n let lastPt = path[0];\r\n result.push(lastPt);\r\n for (let i = 1; i < cnt; i++)\r\n if (lastPt !== path[i]) {\r\n lastPt = path[i];\r\n result.push(lastPt);\r\n }\r\n if (isClosedPath && lastPt === result[0])\r\n result.pop();\r\n return result;\r\n }\r\n\r\n private static addPolyNodeToPaths(polyPath: PolyPathBase, paths: Paths64): void {\r\n if (polyPath.polygon && polyPath.polygon.length > 0)\r\n paths.push(polyPath.polygon);\r\n for (let i = 0; i < polyPath.count; i++)\r\n this.addPolyNodeToPaths(polyPath.children[i], paths);\r\n }\r\n\r\n public static polyTreeToPaths64(polyTree: PolyTree64): Paths64 {\r\n const result: Paths64 = new Paths64();\r\n for (let i = 0; i < polyTree.count; i++) {\r\n Clipper.addPolyNodeToPaths(polyTree.children[i] as PolyPath64, result);\r\n }\r\n return result;\r\n }\r\n\r\n public static perpendicDistFromLineSqrd(pt: IPoint64, line1: IPoint64, line2: IPoint64): number {\r\n const a = pt.x - line1.x;\r\n const b = pt.y - line1.y;\r\n const c = line2.x - line1.x;\r\n const d = line2.y - line1.y;\r\n if (c === 0 && d === 0) return 0;\r\n return Clipper.sqr(a * d - c * b) / (c * c + d * d);\r\n }\r\n\r\n static rdp(path: Path64, begin: number, end: number, epsSqrd: number, flags: boolean[]): void {\r\n let idx = 0;\r\n let max_d = 0;\r\n\r\n while (end > begin && path[begin] === path[end]) {\r\n flags[end--] = false;\r\n }\r\n for (let i = begin + 1; i < end; i++) {\r\n const d = Clipper.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\r\n if (d <= max_d) continue;\r\n max_d = d;\r\n idx = i;\r\n }\r\n\r\n if (max_d <= epsSqrd) return;\r\n\r\n flags[idx] = true;\r\n if (idx > begin + 1) Clipper.rdp(path, begin, idx, epsSqrd, flags);\r\n if (idx < end - 1) Clipper.rdp(path, idx, end, epsSqrd, flags);\r\n }\r\n\r\n public static ramerDouglasPeucker(path: Path64, epsilon: number): Path64 {\r\n const len = path.length;\r\n if (len < 5) return path;\r\n\r\n const flags = new Array(len).fill(false);\r\n flags[0] = true;\r\n flags[len - 1] = true;\r\n Clipper.rdp(path, 0, len - 1, Clipper.sqr(epsilon), flags);\r\n\r\n const result: Path64 = [];\r\n for (let i = 0; i < len; i++) {\r\n if (flags[i]) result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n\r\n public static ramerDouglasPeuckerPaths(paths: Paths64, epsilon: number): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(Clipper.ramerDouglasPeucker(path, epsilon));\r\n }\r\n return result;\r\n }\r\n\r\n private static getNext(current: number, high: number, flags: boolean[]): number {\r\n current++;\r\n while (current <= high && flags[current]) current++;\r\n if (current <= high) return current;\r\n current = 0;\r\n while (flags[current]) current++;\r\n return current;\r\n }\r\n\r\n private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n if (current === 0) current = high;\r\n else current--;\r\n while (current > 0 && flags[current]) current--;\r\n if (!flags[current]) return current;\r\n current = high;\r\n while (flags[current]) current--;\r\n return current;\r\n }\r\n\r\n private static sqr(value: number): number {\r\n return value * value;\r\n }\r\n\r\n public static simplifyPath(path: Path64, epsilon: number, isClosedPath: boolean = false): Path64 {\r\n const len = path.length;\r\n const high = len - 1;\r\n const epsSqr = this.sqr(epsilon);\r\n if (len < 4) return path;\r\n\r\n const flags: boolean[] = new Array(len).fill(false);\r\n const dsq: number[] = new Array(len).fill(0);\r\n let prev = high;\r\n let curr = 0;\r\n let start: number, next: number, prior2: number, next2: number;\r\n\r\n if (isClosedPath) {\r\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\r\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\r\n } else {\r\n dsq[0] = Number.MAX_VALUE;\r\n dsq[high] = Number.MAX_VALUE;\r\n }\r\n\r\n for (let i = 1; i < high; i++) {\r\n dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\r\n }\r\n\r\n for (; ;) {\r\n if (dsq[curr] > epsSqr) {\r\n start = curr;\r\n do {\r\n curr = this.getNext(curr, high, flags);\r\n } while (curr !== start && dsq[curr] > epsSqr);\r\n if (curr === start) break;\r\n }\r\n\r\n prev = this.getPrior(curr, high, flags);\r\n next = this.getNext(curr, high, flags);\r\n if (next === prev) break;\r\n\r\n if (dsq[next] < dsq[curr]) {\r\n flags[next] = true;\r\n next = this.getNext(next, high, flags);\r\n next2 = this.getNext(next, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (next !== high || isClosedPath) {\r\n dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\r\n }\r\n curr = next;\r\n } else {\r\n flags[curr] = true;\r\n curr = next;\r\n next = this.getNext(next, high, flags);\r\n prior2 = this.getPrior(prev, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (prev !== 0 || isClosedPath) {\r\n dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\r\n }\r\n }\r\n }\r\n\r\n const result: Path64 = [];\r\n for (let i = 0; i < len; i++) {\r\n if (!flags[i]) result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n\r\n public static simplifyPaths(paths: Paths64, epsilon: number, isClosedPaths: boolean = false): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(this.simplifyPath(path, epsilon, isClosedPaths));\r\n }\r\n return result;\r\n }\r\n\r\n //private static getNext(current: number, high: number, flags: boolean[]): number {\r\n // current++;\r\n // while (current <= high && flags[current]) current++;\r\n // return current;\r\n //}\r\n\r\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n // if (current === 0) return high;\r\n // current--;\r\n // while (current > 0 && flags[current]) current--;\r\n // return current;\r\n //}\r\n\r\n\r\n public static trimCollinear(path: Path64, isOpen: boolean = false): Path64 {\r\n let len = path.length;\r\n let i = 0;\r\n\r\n if (!isOpen) {\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 1], path[i], path[i + 1]) === 0) i++;\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 2], path[len - 1], path[i]) === 0) len--;\r\n }\r\n\r\n if (len - i < 3) {\r\n if (!isOpen || len < 2 || path[0] === path[1]) {\r\n return [];\r\n }\r\n return path;\r\n }\r\n\r\n const result: Path64 = [];\r\n let last = path[i];\r\n result.push(last);\r\n\r\n for (i++; i < len - 1; i++) {\r\n if (InternalClipper.crossProduct(last, path[i], path[i + 1]) === 0) continue;\r\n last = path[i];\r\n result.push(last);\r\n }\r\n\r\n if (isOpen) {\r\n result.push(path[len - 1]);\r\n } else if (InternalClipper.crossProduct(last, path[len - 1], result[0]) !== 0) {\r\n result.push(path[len - 1]);\r\n } else {\r\n while (result.length > 2 && InternalClipper.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0) {\r\n result.pop();\r\n }\r\n if (result.length < 3) result.splice(0, result.length);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public static pointInPolygon(pt: Point64, polygon: Path64): PointInPolygonResult {\r\n return InternalClipper.pointInPolygon(pt, polygon);\r\n }\r\n\r\n public static ellipse(center: IPoint64, radiusX: number, radiusY: number = 0, steps: number = 0): Path64 {\r\n if (radiusX <= 0) return [];\r\n if (radiusY <= 0) radiusY = radiusX;\r\n if (steps <= 2) steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\r\n\r\n const si = Math.sin(2 * Math.PI / steps);\r\n const co = Math.cos(2 * Math.PI / steps);\r\n let dx = co, dy = si;\r\n const result: Path64 = [{ x: center.x + radiusX, y: center.y }];\r\n for (let i = 1; i < steps; ++i) {\r\n result.push({ x: center.x + radiusX * dx, y: center.y + radiusY * dy });\r\n const x = dx * co - dy * si;\r\n dy = dy * co + dx * si;\r\n dx = x;\r\n }\r\n return result;\r\n }\r\n\r\n private static showPolyPathStructure(pp: PolyPathBase, level: number): void {\r\n const spaces = ' '.repeat(level * 2);\r\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\r\n if (pp.count === 0) {\r\n console.log(spaces + caption);\r\n } else {\r\n console.log(spaces + caption + `(${pp.count})`);\r\n pp.forEach(child => this.showPolyPathStructure(child, level + 1));\r\n }\r\n }\r\n\r\n public static showPolyTreeStructure(polytree: PolyTree64): void {\r\n console.log(\"Polytree Root\");\r\n polytree.forEach(child => this.showPolyPathStructure(child, 1));\r\n }\r\n\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, PathType, Paths64, Point64, Rect64 } from \"./core\";\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nexport enum PointInPolygonResult {\r\n IsOn = 0,\r\n IsInside = 1,\r\n IsOutside = 2\r\n}\r\n\r\nexport enum VertexFlags {\r\n None = 0,\r\n OpenStart = 1,\r\n OpenEnd = 2,\r\n LocalMax = 4,\r\n LocalMin = 8\r\n}\r\n\r\nclass Vertex {\r\n readonly pt: IPoint64;\r\n next: Vertex | undefined;\r\n prev: Vertex | undefined;\r\n flags: VertexFlags;\r\n\r\n constructor(pt: IPoint64, flags: VertexFlags, prev: Vertex | undefined) {\r\n this.pt = pt;\r\n this.flags = flags;\r\n this.next = undefined;\r\n this.prev = prev;\r\n }\r\n}\r\n\r\n\r\nclass LocalMinima {\r\n readonly vertex: Vertex;\r\n readonly polytype: PathType;\r\n readonly isOpen: boolean;\r\n\r\n constructor(vertex: Vertex, polytype: PathType, isOpen: boolean = false) {\r\n this.vertex = vertex;\r\n this.polytype = polytype;\r\n this.isOpen = isOpen;\r\n }\r\n\r\n static equals(lm1: LocalMinima, lm2: LocalMinima): boolean {\r\n return lm1.vertex === lm2.vertex;\r\n }\r\n\r\n static notEquals(lm1: LocalMinima, lm2: LocalMinima): boolean {\r\n return lm1.vertex !== lm2.vertex;\r\n }\r\n\r\n //hashCode(): number {\r\n // return this.vertex.hashCode();\r\n //}\r\n}\r\n\r\nclass IntersectNode {\r\n readonly pt: IPoint64;\r\n readonly edge1: Active;\r\n readonly edge2: Active;\r\n\r\n constructor(pt: IPoint64, edge1: Active, edge2: Active) {\r\n this.pt = pt;\r\n this.edge1 = edge1;\r\n this.edge2 = edge2;\r\n }\r\n}\r\n\r\nclass OutPt {\r\n pt: IPoint64;\r\n next: OutPt | undefined;\r\n prev: OutPt;\r\n outrec: OutRec;\r\n horz: HorzSegment | undefined;\r\n\r\n constructor(pt: IPoint64, outrec: OutRec) {\r\n this.pt = pt;\r\n this.outrec = outrec;\r\n this.next = this;\r\n this.prev = this;\r\n this.horz = undefined;\r\n }\r\n}\r\n\r\nexport enum JoinWith {\r\n None,\r\n Left,\r\n Right\r\n}\r\n\r\nexport enum HorzPosition {\r\n Bottom,\r\n Middle,\r\n Top\r\n}\r\n\r\n\r\nexport class OutRec {\r\n idx: number;\r\n owner: OutRec | undefined;\r\n frontEdge: Active | undefined;\r\n backEdge: Active | undefined;\r\n pts: OutPt | undefined;\r\n polypath: PolyPathBase | undefined;\r\n bounds!: Rect64;\r\n path!: Path64;\r\n isOpen: boolean;\r\n splits: number[] | undefined;\r\n recursiveSplit: OutRec | undefined;\r\n constructor(idx: number) {\r\n this.idx = idx\r\n this.isOpen = false\r\n }\r\n}\r\n\r\nclass HorzSegment {\r\n leftOp: OutPt //| undefined;\r\n rightOp: OutPt | undefined;\r\n leftToRight: boolean;\r\n\r\n constructor(op: OutPt) {\r\n this.leftOp = op;\r\n this.rightOp = undefined;\r\n this.leftToRight = true;\r\n }\r\n}\r\n\r\nclass HorzJoin {\r\n op1: OutPt | undefined;\r\n op2: OutPt | undefined;\r\n\r\n constructor(ltor: OutPt, rtol: OutPt) {\r\n this.op1 = ltor;\r\n this.op2 = rtol;\r\n }\r\n}\r\n\r\n///////////////////////////////////////////////////////////////////\r\n// Important: UP and DOWN here are premised on Y-axis positive down\r\n// displays, which is the orientation used in Clipper's development.\r\n///////////////////////////////////////////////////////////////////\r\n\r\nexport class Active {\r\n bot!: IPoint64\r\n top!: IPoint64\r\n curX!: number;// current (updated at every new scanline)\r\n dx: number;\r\n windDx!: number;// 1 or -1 depending on winding direction\r\n windCount: number;\r\n windCount2: number;// winding count of the opposite polytype\r\n outrec: OutRec | undefined;\r\n\r\n // AEL: 'active edge list' (Vatti's AET - active edge table)\r\n // a linked list of all edges (from left to right) that are present\r\n // (or 'active') within the current scanbeam (a horizontal 'beam' that\r\n // sweeps from bottom to top over the paths in the clipping operation).\r\n prevInAEL: Active | undefined;\r\n nextInAEL: Active | undefined;\r\n\r\n // SEL: 'sorted edge list' (Vatti's ST - sorted table)\r\n // linked list used when sorting edges into their new positions at the\r\n // top of scanbeams, but also (re)used to process horizontals.\r\n prevInSEL: Active | undefined;\r\n nextInSEL: Active | undefined;\r\n jump: Active | undefined;\r\n vertexTop: Vertex | undefined\r\n localMin!: LocalMinima // the bottom of an edge 'bound' (also Vatti)\r\n isLeftBound: boolean\r\n joinWith: JoinWith\r\n\r\n constructor() {\r\n this.dx = this.windCount = this.windCount2 = 0\r\n this.isLeftBound = false\r\n this.joinWith = JoinWith.None\r\n }\r\n}\r\n\r\nexport class ClipperEngine {\r\n static addLocMin(vert: Vertex, polytype: PathType, isOpen: boolean, minimaList: LocalMinima[]): void {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) !== VertexFlags.None) return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n minimaList.push(lm);\r\n }\r\n\r\n static addPathsToVertexList(paths: Path64[], polytype: PathType, isOpen: boolean, minimaList: LocalMinima[], vertexList: Vertex[]): void {\r\n let totalVertCnt = 0;\r\n for (const path of paths)\r\n totalVertCnt += path.length;\r\n\r\n for (const path of paths) {\r\n let v0: Vertex | undefined = undefined;\r\n let prev_v: Vertex | undefined = undefined;\r\n let curr_v: Vertex | undefined = undefined;\r\n for (const pt of path) {\r\n if (!v0) {\r\n v0 = new Vertex(pt, VertexFlags.None, undefined);\r\n vertexList.push(v0);\r\n prev_v = v0;\r\n } else if (prev_v!.pt !== pt) { // i.e., skips duplicates\r\n curr_v = new Vertex(pt, VertexFlags.None, prev_v);\r\n vertexList.push(curr_v);\r\n prev_v!.next = curr_v;\r\n prev_v = curr_v;\r\n }\r\n }\r\n if (!prev_v || !prev_v.prev) continue;\r\n if (!isOpen && prev_v.pt === v0!.pt) prev_v = prev_v.prev;\r\n prev_v.next = v0;\r\n v0!.prev = prev_v;\r\n if (!isOpen && prev_v.next === prev_v) continue;\r\n\r\n // OK, we have a valid path\r\n let going_up = false\r\n\r\n if (isOpen) {\r\n curr_v = v0!.next;\r\n let count = 0\r\n while (curr_v !== v0 && curr_v!.pt.y === v0!.pt.y) {\r\n curr_v = curr_v!.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n }\r\n going_up = curr_v!.pt.y <= v0!.pt.y;\r\n if (going_up) {\r\n v0!.flags = VertexFlags.OpenStart;\r\n this.addLocMin(v0!, polytype, true, minimaList);\r\n } else {\r\n v0!.flags = VertexFlags.OpenStart | VertexFlags.LocalMax;\r\n }\r\n } else { // closed path\r\n prev_v = v0!.prev;\r\n let count = 0\r\n while (prev_v !== v0 && prev_v!.pt.y === v0!.pt.y) {\r\n prev_v = prev_v!.prev;\r\n\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n }\r\n if (prev_v === v0) {\r\n continue; // only open paths can be completely flat\r\n }\r\n going_up = prev_v!.pt.y > v0!.pt.y;\r\n }\r\n\r\n const going_up0 = going_up;\r\n prev_v = v0;\r\n curr_v = v0!.next;\r\n\r\n let count = 0\r\n while (curr_v !== v0) {\r\n if (curr_v!.pt.y > prev_v!.pt.y && going_up) {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n going_up = false;\r\n } else if (curr_v!.pt.y < prev_v!.pt.y && !going_up) {\r\n going_up = true;\r\n this.addLocMin(prev_v!, polytype, isOpen, minimaList);\r\n }\r\n prev_v = curr_v;\r\n curr_v = curr_v!.next;\r\n\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n\r\n }\r\n\r\n if (isOpen) {\r\n prev_v!.flags |= VertexFlags.OpenEnd;\r\n if (going_up) {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n } else {\r\n this.addLocMin(prev_v!, polytype, isOpen, minimaList);\r\n }\r\n } else if (going_up !== going_up0) {\r\n if (going_up0) {\r\n this.addLocMin(prev_v!, polytype, false, minimaList);\r\n } else {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport class ReuseableDataContainer64 {\r\n readonly _minimaList: LocalMinima[];\r\n private readonly _vertexList: Vertex[];\r\n\r\n constructor() {\r\n this._minimaList = [];\r\n this._vertexList = [];\r\n }\r\n\r\n public clear(): void {\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n }\r\n\r\n public addPaths(paths: Paths64, pt: PathType, isOpen: boolean): void {\r\n ClipperEngine.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\r\n }\r\n}\r\n\r\nclass SimpleNavigableSet {\r\n items: Array = []\r\n\r\n constructor() {\r\n this.items = [];\r\n }\r\n\r\n clear(): void { this.items.length = 0 }\r\n isEmpty(): boolean { return this.items.length == 0 }\r\n\r\n pollLast(): number | undefined {\r\n return this.items.pop();\r\n }\r\n\r\n add(item: number) {\r\n if (!this.items.includes(item)) {\r\n this.items.push(item);\r\n this.items.sort((a, b) => a - b);\r\n }\r\n }\r\n}\r\n\r\nexport class ClipperBase {\r\n private _cliptype: ClipType = ClipType.None\r\n private _fillrule: FillRule = FillRule.EvenOdd\r\n private _actives?: Active;\r\n private _sel?: Active;\r\n private readonly _minimaList: LocalMinima[];\r\n private readonly _intersectList: IntersectNode[];\r\n private readonly _vertexList: Vertex[];\r\n private readonly _outrecList: OutRec[];\r\n private readonly _scanlineList: SimpleNavigableSet;\r\n private readonly _horzSegList: HorzSegment[];\r\n private readonly _horzJoinList: HorzJoin[];\r\n private _currentLocMin: number = 0\r\n private _currentBotY: number = 0\r\n private _isSortedMinimaList: boolean = false\r\n private _hasOpenPaths: boolean = false\r\n protected _using_polytree: boolean = false\r\n protected _succeeded: boolean = false\r\n public preserveCollinear: boolean;\r\n public reverseSolution: boolean = false\r\n\r\n constructor() {\r\n this._minimaList = [];\r\n this._intersectList = [];\r\n this._vertexList = [];\r\n this._outrecList = [];\r\n this._scanlineList = new SimpleNavigableSet()\r\n this._horzSegList = [];\r\n this._horzJoinList = [];\r\n this.preserveCollinear = true;\r\n }\r\n\r\n private static isOdd(val: number): boolean {\r\n return ((val & 1) !== 0);\r\n }\r\n\r\n private static isHotEdgeActive(ae: Active): boolean {\r\n return ae.outrec !== undefined;\r\n }\r\n\r\n private static isOpen(ae: Active): boolean {\r\n return ae.localMin.isOpen;\r\n }\r\n\r\n private static isOpenEndActive(ae: Active): boolean {\r\n return ae.localMin.isOpen && ClipperBase.isOpenEnd(ae.vertexTop!);\r\n }\r\n\r\n private static isOpenEnd(v: Vertex): boolean {\r\n return (v.flags & (VertexFlags.OpenStart | VertexFlags.OpenEnd)) !== VertexFlags.None;\r\n }\r\n\r\n private static getPrevHotEdge(ae: Active): Active | undefined {\r\n let prev: Active | undefined = ae.prevInAEL;\r\n while (prev && (ClipperBase.isOpen(prev) || !ClipperBase.isHotEdgeActive(prev)))\r\n prev = prev.prevInAEL;\r\n return prev;\r\n }\r\n\r\n private static isFront(ae: Active): boolean {\r\n return ae === ae.outrec!.frontEdge;\r\n }\r\n\r\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/\r\n\r\n private static getDx(pt1: IPoint64, pt2: IPoint64): number {\r\n const dy: number = pt2.y - pt1.y;\r\n if (dy !== 0)\r\n return (pt2.x - pt1.x) / dy;\r\n if (pt2.x > pt1.x)\r\n return Number.NEGATIVE_INFINITY;\r\n return Number.POSITIVE_INFINITY;\r\n }\r\n\r\n private static topX(ae: Active, currentY: number): number {\r\n if ((currentY === ae.top.y) || (ae.top.x === ae.bot.x)) return ae.top.x;\r\n if (currentY === ae.bot.y) return ae.bot.x;\r\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\r\n }\r\n\r\n private static isHorizontal(ae: Active): boolean {\r\n return (ae.top.y === ae.bot.y);\r\n }\r\n\r\n private static isHeadingRightHorz(ae: Active): boolean {\r\n return (Number.NEGATIVE_INFINITY === ae.dx);\r\n }\r\n\r\n private static isHeadingLeftHorz(ae: Active): boolean {\r\n return (Number.POSITIVE_INFINITY === ae.dx);\r\n }\r\n\r\n private static swapActives(ae1: Active, ae2: Active): void {\r\n [ae2, ae1] = [ae1, ae2];\r\n }\r\n\r\n private static getPolyType(ae: Active): PathType {\r\n return ae.localMin.polytype;\r\n }\r\n\r\n private static isSamePolyType(ae1: Active, ae2: Active): boolean {\r\n return ae1.localMin.polytype === ae2.localMin.polytype;\r\n }\r\n\r\n private static setDx(ae: Active): void {\r\n ae.dx = ClipperBase.getDx(ae.bot, ae.top);\r\n }\r\n\r\n private static nextVertex(ae: Active): Vertex {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop!.next!;\r\n return ae.vertexTop!.prev!;\r\n }\r\n\r\n private static prevPrevVertex(ae: Active): Vertex {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop!.prev!.prev!;\r\n return ae.vertexTop!.next!.next!;\r\n }\r\n\r\n private static isMaxima(vertex: Vertex): boolean {\r\n return (vertex.flags & VertexFlags.LocalMax) !== VertexFlags.None;\r\n }\r\n\r\n private static isMaximaActive(ae: Active): boolean {\r\n return ClipperBase.isMaxima(ae.vertexTop!);\r\n }\r\n\r\n private static getMaximaPair(ae: Active): Active | undefined {\r\n let ae2: Active | undefined = ae.nextInAEL;\r\n while (ae2) {\r\n if (ae2.vertexTop === ae.vertexTop) return ae2; // Found!\r\n ae2 = ae2.nextInAEL;\r\n }\r\n return undefined;\r\n }\r\n\r\n private static getCurrYMaximaVertex_Open(ae: Active): Vertex | undefined {\r\n let result: Vertex | undefined = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result!.next!.pt.y === result!.pt.y &&\r\n ((result!.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result!.next;\r\n } else {\r\n while (result!.prev!.pt.y === result!.pt.y &&\r\n ((result!.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result!.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result!)) result = undefined; // not a maxima\r\n return result;\r\n }\r\n\r\n private static getCurrYMaximaVertex(ae: Active): Vertex | undefined {\r\n let result: Vertex | undefined = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result!.next!.pt.y === result!.pt.y) result = result!.next;\r\n } else {\r\n while (result!.prev!.pt.y === result!.pt.y) result = result!.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result!)) result = undefined; // not a maxima\r\n return result;\r\n }\r\n\r\n private static setSides(outrec: OutRec, startEdge: Active, endEdge: Active): void {\r\n outrec.frontEdge = startEdge;\r\n outrec.backEdge = endEdge;\r\n }\r\n\r\n private static swapOutrecs(ae1: Active, ae2: Active): void {\r\n const or1: OutRec | undefined = ae1.outrec;\r\n const or2: OutRec | undefined = ae2.outrec;\r\n if (or1 === or2) {\r\n const ae: Active | undefined = or1!.frontEdge;\r\n or1!.frontEdge = or1!.backEdge;\r\n or1!.backEdge = ae;\r\n return;\r\n }\r\n\r\n if (or1) {\r\n if (ae1 === or1.frontEdge)\r\n or1.frontEdge = ae2;\r\n else\r\n or1.backEdge = ae2;\r\n }\r\n\r\n if (or2) {\r\n if (ae2 === or2.frontEdge)\r\n or2.frontEdge = ae1;\r\n else\r\n or2.backEdge = ae1;\r\n }\r\n\r\n ae1.outrec = or2;\r\n ae2.outrec = or1;\r\n }\r\n\r\n private static setOwner(outrec: OutRec, newOwner: OutRec): void {\r\n while (newOwner.owner && !newOwner.owner.pts) {\r\n newOwner.owner = newOwner.owner.owner;\r\n }\r\n\r\n //make sure that outrec isn't an owner of newOwner\r\n let tmp: OutRec | undefined = newOwner;\r\n while (tmp && tmp !== outrec)\r\n tmp = tmp.owner;\r\n if (tmp)\r\n newOwner.owner = outrec.owner;\r\n outrec.owner = newOwner;\r\n }\r\n\r\n private static area(op: OutPt): number {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let area = 0.0;\r\n let op2 = op;\r\n do {\r\n area += (op2.prev.pt.y + op2.pt.y) *\r\n (op2.prev.pt.x - op2.pt.x);\r\n op2 = op2.next!;\r\n } while (op2 !== op);\r\n return area * 0.5;\r\n }\r\n\r\n private static areaTriangle(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) +\r\n (pt1.y + pt2.y) * (pt1.x - pt2.x) +\r\n (pt2.y + pt3.y) * (pt2.x - pt3.x);\r\n }\r\n\r\n private static getRealOutRec(outRec: OutRec | undefined): OutRec | undefined {\r\n while (outRec !== undefined && outRec.pts === undefined) {\r\n outRec = outRec.owner;\r\n }\r\n return outRec;\r\n }\r\n\r\n private static isValidOwner(outRec: OutRec | undefined, testOwner: OutRec | undefined): boolean {\r\n while (testOwner !== undefined && testOwner !== outRec)\r\n testOwner = testOwner.owner;\r\n return testOwner === undefined;\r\n }\r\n\r\n private static uncoupleOutRec(ae: Active): void {\r\n const outrec = ae.outrec;\r\n if (outrec === undefined) return;\r\n outrec.frontEdge!.outrec = undefined;\r\n outrec.backEdge!.outrec = undefined;\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = undefined;\r\n }\r\n\r\n private static outrecIsAscending(hotEdge: Active): boolean {\r\n return (hotEdge === hotEdge.outrec!.frontEdge);\r\n }\r\n\r\n private static swapFrontBackSides(outrec: OutRec): void {\r\n // while this proc. is needed for open paths\r\n // it's almost never needed for closed paths\r\n const ae2 = outrec.frontEdge!;\r\n outrec.frontEdge = outrec.backEdge;\r\n outrec.backEdge = ae2;\r\n outrec.pts = outrec.pts!.next;\r\n }\r\n\r\n private static edgesAdjacentInAEL(inode: IntersectNode): boolean {\r\n return (inode.edge1.nextInAEL === inode.edge2) || (inode.edge1.prevInAEL === inode.edge2);\r\n }\r\n\r\n protected clearSolutionOnly(): void {\r\n while (this._actives) this.deleteFromAEL(this._actives);\r\n this._scanlineList.clear()\r\n this.disposeIntersectNodes();\r\n this._outrecList.length = 0\r\n this._horzSegList.length = 0\r\n this._horzJoinList.length = 0\r\n }\r\n\r\n public clear(): void {\r\n this.clearSolutionOnly();\r\n this._minimaList.length = 0\r\n this._vertexList.length = 0\r\n this._currentLocMin = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n }\r\n\r\n protected reset(): void {\r\n if (!this._isSortedMinimaList) {\r\n this._minimaList.sort((locMin1, locMin2) => locMin2.vertex.pt.y - locMin1.vertex.pt.y);\r\n this._isSortedMinimaList = true;\r\n }\r\n\r\n for (let i = this._minimaList.length - 1; i >= 0; i--) {\r\n this._scanlineList.add(this._minimaList[i].vertex.pt.y);\r\n }\r\n\r\n this._currentBotY = 0;\r\n this._currentLocMin = 0;\r\n this._actives = undefined;\r\n this._sel = undefined;\r\n this._succeeded = true;\r\n }\r\n\r\n private insertScanline(y: number): void {\r\n this._scanlineList.add(y)\r\n }\r\n\r\n private popScanline(): number | undefined {\r\n return this._scanlineList.pollLast();\r\n }\r\n\r\n private hasLocMinAtY(y: number): boolean {\r\n return (this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y);\r\n }\r\n\r\n private popLocalMinima(): LocalMinima {\r\n return this._minimaList[this._currentLocMin++];\r\n }\r\n\r\n private addLocMin(vert: Vertex, polytype: PathType, isOpen: boolean): void {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) != VertexFlags.None) return\r\n\r\n vert.flags |= VertexFlags.LocalMin;\r\n\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n this._minimaList.push(lm);\r\n }\r\n\r\n public addSubject(path: Path64): void {\r\n this.addPath(path, PathType.Subject);\r\n }\r\n\r\n public addOpenSubject(path: Path64): void {\r\n this.addPath(path, PathType.Subject, true);\r\n }\r\n\r\n public addClip(path: Path64): void {\r\n this.addPath(path, PathType.Clip);\r\n }\r\n\r\n protected addPath(path: Path64, polytype: PathType, isOpen = false): void {\r\n const tmp: Paths64 = [path];\r\n this.addPaths(tmp, polytype, isOpen);\r\n }\r\n\r\n protected addPaths(paths: Paths64, polytype: PathType, isOpen = false): void {\r\n if (isOpen) this._hasOpenPaths = true;\r\n this._isSortedMinimaList = false;\r\n ClipperEngine.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\r\n }\r\n\r\n protected addReuseableData(reuseableData: ReuseableDataContainer64): void {\r\n if (reuseableData._minimaList.length === 0) return;\r\n\r\n this._isSortedMinimaList = false;\r\n for (const lm of reuseableData._minimaList) {\r\n this._minimaList.push(new LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\r\n if (lm.isOpen) this._hasOpenPaths = true;\r\n }\r\n }\r\n\r\n private isContributingClosed(ae: Active): boolean {\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae.windCount !== 1) return false;\r\n break;\r\n case FillRule.Negative:\r\n if (ae.windCount !== -1) return false;\r\n break;\r\n case FillRule.NonZero:\r\n if (Math.abs(ae.windCount) !== 1) return false;\r\n break;\r\n }\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 > 0;\r\n case FillRule.Negative: return ae.windCount2 < 0;\r\n default: return ae.windCount2 !== 0;\r\n }\r\n case ClipType.Union:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 <= 0;\r\n case FillRule.Negative: return ae.windCount2 >= 0;\r\n default: return ae.windCount2 === 0;\r\n }\r\n case ClipType.Difference:\r\n const result = this._fillrule === FillRule.Positive ? (ae.windCount2 <= 0) :\r\n this._fillrule === FillRule.Negative ? (ae.windCount2 >= 0) :\r\n (ae.windCount2 === 0);\r\n return ClipperBase.getPolyType(ae) === PathType.Subject ? result : !result;\r\n\r\n case ClipType.Xor:\r\n return true;\r\n\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n private isContributingOpen(ae: Active): boolean {\r\n let isInClip: boolean, isInSubj: boolean;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n isInSubj = ae.windCount > 0;\r\n isInClip = ae.windCount2 > 0;\r\n break;\r\n case FillRule.Negative:\r\n isInSubj = ae.windCount < 0;\r\n isInClip = ae.windCount2 < 0;\r\n break;\r\n default:\r\n isInSubj = ae.windCount !== 0;\r\n isInClip = ae.windCount2 !== 0;\r\n break;\r\n }\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n return isInClip;\r\n case ClipType.Union:\r\n return !isInSubj && !isInClip;\r\n default:\r\n return !isInClip;\r\n }\r\n }\r\n\r\n private setWindCountForClosedPathEdge(ae: Active): void {\r\n let ae2: Active | undefined = ae.prevInAEL;\r\n const pt: PathType = ClipperBase.getPolyType(ae);\r\n\r\n while (ae2 !== undefined && (ClipperBase.getPolyType(ae2) !== pt || ClipperBase.isOpen(ae2))) {\r\n ae2 = ae2.prevInAEL;\r\n }\r\n\r\n if (ae2 === undefined) {\r\n ae.windCount = ae.windDx;\r\n ae2 = this._actives;\r\n } else if (this._fillrule === FillRule.EvenOdd) {\r\n ae.windCount = ae.windDx;\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL;\r\n } else {\r\n // NonZero, positive, or negative filling here ...\r\n // when e2's WindCnt is in the SAME direction as its WindDx,\r\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\r\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\r\n if (ae2.windCount * ae2.windDx < 0) {\r\n // opposite directions so 'ae' is outside 'ae2' ...\r\n if (Math.abs(ae2.windCount) > 1) {\r\n // outside prev poly but still inside another.\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n } else {\r\n // now outside all polys of same polytype so set own WC ...\r\n ae.windCount = (ClipperBase.isOpen(ae) ? 1 : ae.windDx);\r\n }\r\n } else {\r\n // 'ae' must be inside 'ae2'\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\r\n\r\n }\r\n\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) !== pt && !ClipperBase.isOpen(ae2!)) {\r\n ae.windCount2 = (ae.windCount2 === 0 ? 1 : 0);\r\n }\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n } else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) !== pt && !ClipperBase.isOpen(ae2!)) {\r\n ae.windCount2 += ae2!.windDx;\r\n }\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n }\r\n }\r\n\r\n private setWindCountForOpenPathEdge(ae: Active) {\r\n let ae2: Active | undefined = this._actives;\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n let cnt1 = 0, cnt2 = 0;\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) === PathType.Clip)\r\n cnt2++;\r\n else if (!ClipperBase.isOpen(ae2!))\r\n cnt1++;\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n\r\n ae.windCount = (ClipperBase.isOdd(cnt1) ? 1 : 0);\r\n ae.windCount2 = (ClipperBase.isOdd(cnt2) ? 1 : 0);\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) === PathType.Clip)\r\n ae.windCount2 += ae2!.windDx;\r\n else if (!ClipperBase.isOpen(ae2!))\r\n ae.windCount += ae2!.windDx;\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n }\r\n }\r\n\r\n private static isValidAelOrder(resident: Active, newcomer: Active): boolean {\r\n if (newcomer.curX !== resident.curX)\r\n return newcomer.curX > resident.curX;\r\n\r\n // get the turning direction a1.top, a2.bot, a2.top\r\n const d: number = InternalClipper.crossProduct(resident.top, newcomer.bot, newcomer.top);\r\n if (d !== 0.0) return (d < 0);\r\n\r\n // edges must be collinear to get here\r\n\r\n // for starting open paths, place them according to\r\n // the direction they're about to turn\r\n if (!this.isMaximaActive(resident) && (resident.top.y > newcomer.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot,\r\n resident.top, this.nextVertex(resident).pt) <= 0;\r\n }\r\n\r\n if (!this.isMaximaActive(newcomer) && (newcomer.top.y > resident.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot,\r\n newcomer.top, this.nextVertex(newcomer).pt) >= 0;\r\n }\r\n\r\n const y: number = newcomer.bot.y;\r\n const newcomerIsLeft: boolean = newcomer.isLeftBound;\r\n\r\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y)\r\n return newcomer.isLeftBound;\r\n // resident must also have just been inserted\r\n if (resident.isLeftBound !== newcomerIsLeft)\r\n return newcomerIsLeft;\r\n if (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt,\r\n resident.bot, resident.top) === 0) return true;\r\n // compare turning direction of the alternate bound\r\n return (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt,\r\n newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0) === newcomerIsLeft;\r\n }\r\n\r\n private insertLeftEdge(ae: Active): void {\r\n let ae2: Active;\r\n\r\n if (!this._actives) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = undefined;\r\n this._actives = ae;\r\n } else if (!ClipperBase.isValidAelOrder(this._actives, ae)) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = this._actives;\r\n this._actives.prevInAEL = ae;\r\n this._actives = ae;\r\n } else {\r\n ae2 = this._actives;\r\n while (ae2.nextInAEL && ClipperBase.isValidAelOrder(ae2.nextInAEL, ae))\r\n ae2 = ae2.nextInAEL;\r\n //don't separate joined edges\r\n if (ae2.joinWith === JoinWith.Right) ae2 = ae2.nextInAEL!;\r\n ae.nextInAEL = ae2.nextInAEL;\r\n if (ae2.nextInAEL) ae2.nextInAEL.prevInAEL = ae;\r\n ae.prevInAEL = ae2;\r\n ae2.nextInAEL = ae;\r\n }\r\n }\r\n\r\n private static insertRightEdge(ae: Active, ae2: Active): void {\r\n ae2.nextInAEL = ae.nextInAEL;\r\n if (ae.nextInAEL) ae.nextInAEL.prevInAEL = ae2;\r\n ae2.prevInAEL = ae;\r\n ae.nextInAEL = ae2;\r\n }\r\n\r\n private insertLocalMinimaIntoAEL(botY: number): void {\r\n let localMinima: LocalMinima;\r\n let leftBound: Active | undefined;\r\n let rightBound: Active | undefined;\r\n\r\n // Add any local minima (if any) at BotY ...\r\n // NB horizontal local minima edges should contain locMin.vertex.prev\r\n while (this.hasLocMinAtY(botY)) {\r\n localMinima = this.popLocalMinima();\r\n\r\n if ((localMinima.vertex.flags & VertexFlags.OpenStart) !== VertexFlags.None) {\r\n leftBound = undefined;\r\n } else {\r\n leftBound = new Active()\r\n leftBound.bot = localMinima.vertex.pt\r\n leftBound.curX = localMinima.vertex.pt.x\r\n leftBound.windDx = -1\r\n leftBound.vertexTop = localMinima.vertex.prev\r\n leftBound.top = localMinima.vertex.prev!.pt\r\n leftBound.outrec = undefined\r\n leftBound.localMin = localMinima\r\n\r\n ClipperBase.setDx(leftBound);\r\n }\r\n\r\n if ((localMinima.vertex.flags & VertexFlags.OpenEnd) !== VertexFlags.None) {\r\n rightBound = undefined;\r\n } else {\r\n rightBound = new Active()\r\n rightBound.bot = localMinima.vertex.pt\r\n rightBound.curX = localMinima.vertex.pt.x\r\n rightBound.windDx = 1\r\n rightBound.vertexTop = localMinima.vertex.next\r\n rightBound.top = localMinima.vertex.next!.pt\r\n rightBound.outrec = undefined\r\n rightBound.localMin = localMinima\r\n\r\n ClipperBase.setDx(rightBound);\r\n }\r\n\r\n if (leftBound && rightBound) {\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n if (ClipperBase.isHeadingRightHorz(leftBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n } else if (ClipperBase.isHorizontal(rightBound)) {\r\n if (ClipperBase.isHeadingLeftHorz(rightBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n } else if (leftBound.dx < rightBound.dx) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n //so when leftBound has windDx == 1, the polygon will be oriented\r\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\r\n } else if (leftBound === undefined) {\r\n leftBound = rightBound;\r\n rightBound = undefined;\r\n }\r\n\r\n let contributing = false\r\n leftBound!.isLeftBound = true;\r\n this.insertLeftEdge(leftBound!);\r\n\r\n if (ClipperBase.isOpen(leftBound!)) {\r\n this.setWindCountForOpenPathEdge(leftBound!);\r\n contributing = this.isContributingOpen(leftBound!);\r\n } else {\r\n this.setWindCountForClosedPathEdge(leftBound!);\r\n contributing = this.isContributingClosed(leftBound!);\r\n }\r\n\r\n if (rightBound) {\r\n rightBound.windCount = leftBound!.windCount;\r\n rightBound.windCount2 = leftBound!.windCount2;\r\n ClipperBase.insertRightEdge(leftBound!, rightBound);\r\n\r\n if (contributing) {\r\n this.addLocalMinPoly(leftBound!, rightBound, leftBound!.bot, true);\r\n if (!ClipperBase.isHorizontal(leftBound!)) {\r\n this.checkJoinLeft(leftBound!, leftBound!.bot);\r\n }\r\n }\r\n\r\n while (rightBound.nextInAEL &&\r\n ClipperBase.isValidAelOrder(rightBound.nextInAEL, rightBound)) {\r\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\r\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\r\n }\r\n\r\n if (ClipperBase.isHorizontal(rightBound)) {\r\n this.pushHorz(rightBound);\r\n } else {\r\n this.checkJoinRight(rightBound, rightBound.bot);\r\n this.insertScanline(rightBound.top.y);\r\n }\r\n\r\n } else if (contributing) {\r\n this.startOpenPath(leftBound!, leftBound!.bot);\r\n }\r\n\r\n if (ClipperBase.isHorizontal(leftBound!)) {\r\n this.pushHorz(leftBound!);\r\n } else {\r\n this.insertScanline(leftBound!.top.y);\r\n }\r\n }\r\n }\r\n\r\n private pushHorz(ae: Active): void {\r\n ae.nextInSEL = this._sel;\r\n this._sel = ae;\r\n }\r\n\r\n private popHorz(): Active | undefined {\r\n const ae = this._sel;\r\n if (this._sel === undefined) return undefined;\r\n this._sel = this._sel.nextInSEL;\r\n return ae;\r\n }\r\n\r\n private addLocalMinPoly(ae1: Active, ae2: Active, pt: IPoint64, isNew: boolean = false): OutPt {\r\n const outrec: OutRec = this.newOutRec();\r\n ae1.outrec = outrec;\r\n ae2.outrec = outrec;\r\n\r\n if (ClipperBase.isOpen(ae1)) {\r\n outrec.owner = undefined;\r\n outrec.isOpen = true;\r\n if (ae1.windDx > 0)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n } else {\r\n outrec.isOpen = false;\r\n const prevHotEdge = ClipperBase.getPrevHotEdge(ae1);\r\n\r\n // e.windDx is the winding direction of the **input** paths\r\n // and unrelated to the winding direction of output polygons.\r\n // Output orientation is determined by e.outrec.frontE which is\r\n // the ascending edge (see AddLocalMinPoly).\r\n if (prevHotEdge) {\r\n if (this._using_polytree)\r\n ClipperBase.setOwner(outrec, prevHotEdge.outrec!);\r\n outrec.owner = prevHotEdge.outrec;\r\n\r\n if (ClipperBase.outrecIsAscending(prevHotEdge) === isNew)\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n else\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n } else {\r\n outrec.owner = undefined;\r\n if (isNew)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n }\r\n\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n\r\n private addLocalMaxPoly(ae1: Active, ae2: Active, pt: IPoint64): OutPt | undefined {\r\n if (ClipperBase.isJoined(ae1)) this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n if (ClipperBase.isFront(ae1) === ClipperBase.isFront(ae2)) {\r\n if (ClipperBase.isOpenEndActive(ae1))\r\n ClipperBase.swapFrontBackSides(ae1.outrec!);\r\n else if (ClipperBase.isOpenEndActive(ae2))\r\n ClipperBase.swapFrontBackSides(ae2.outrec!);\r\n else {\r\n this._succeeded = false;\r\n return undefined;\r\n }\r\n }\r\n\r\n const result = ClipperBase.addOutPt(ae1, pt);\r\n if (ae1.outrec === ae2.outrec) {\r\n const outrec = ae1.outrec!;\r\n outrec.pts = result;\r\n\r\n if (this._using_polytree) {\r\n const e = ClipperBase.getPrevHotEdge(ae1);\r\n if (e === undefined)\r\n outrec.owner = undefined;\r\n else\r\n ClipperBase.setOwner(outrec, e.outrec!);\r\n }\r\n ClipperBase.uncoupleOutRec(ae1);\r\n } else if (ClipperBase.isOpen(ae1)) {\r\n if (ae1.windDx < 0)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n } else if (ae1.outrec!.idx < ae2.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n return result;\r\n }\r\n\r\n private static joinOutrecPaths(ae1: Active, ae2: Active): void {\r\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\r\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\r\n const p1Start: OutPt = ae1.outrec!.pts!;\r\n const p2Start: OutPt = ae2.outrec!.pts!;\r\n const p1End: OutPt = p1Start.next!;\r\n const p2End: OutPt = p2Start.next!;\r\n\r\n if (ClipperBase.isFront(ae1)) {\r\n p2End.prev = p1Start;\r\n p1Start.next = p2End;\r\n p2Start.next = p1End;\r\n p1End.prev = p2Start;\r\n\r\n ae1.outrec!.pts = p2Start;\r\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\r\n ae1.outrec!.frontEdge = ae2.outrec!.frontEdge;\r\n if (ae1.outrec!.frontEdge)\r\n ae1.outrec!.frontEdge!.outrec = ae1.outrec;\r\n } else {\r\n p1End.prev = p2Start;\r\n p2Start.next = p1End;\r\n p1Start.next = p2End;\r\n p2End.prev = p1Start;\r\n\r\n ae1.outrec!.backEdge = ae2.outrec!.backEdge;\r\n if (ae1.outrec!.backEdge)\r\n ae1.outrec!.backEdge!.outrec = ae1.outrec;\r\n }\r\n\r\n // after joining, the ae2.OutRec must contains no vertices ...\r\n ae2.outrec!.frontEdge = undefined;\r\n ae2.outrec!.backEdge = undefined;\r\n ae2.outrec!.pts = undefined;\r\n ClipperBase.setOwner(ae2.outrec!, ae1.outrec!);\r\n\r\n if (ClipperBase.isOpenEndActive(ae1)) {\r\n ae2.outrec!.pts = ae1.outrec!.pts;\r\n ae1.outrec!.pts = undefined;\r\n }\r\n\r\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\r\n ae1.outrec = undefined;\r\n ae2.outrec = undefined;\r\n }\r\n\r\n private static addOutPt(ae: Active, pt: IPoint64): OutPt {\r\n const outrec: OutRec = ae.outrec!;\r\n const toFront: boolean = ClipperBase.isFront(ae);\r\n const opFront: OutPt = outrec.pts!;\r\n const opBack: OutPt = opFront.next!;\r\n\r\n if (toFront && (pt == opFront.pt)) return opFront;\r\n else if (!toFront && (pt == opBack.pt)) return opBack;\r\n\r\n const newOp = new OutPt(pt, outrec);\r\n opBack.prev = newOp;\r\n newOp.prev = opFront;\r\n newOp.next = opBack;\r\n opFront.next = newOp;\r\n\r\n if (toFront) outrec.pts = newOp;\r\n\r\n return newOp;\r\n }\r\n\r\n private newOutRec(): OutRec {\r\n const result = new OutRec(this._outrecList.length);\r\n this._outrecList.push(result);\r\n return result;\r\n }\r\n\r\n private startOpenPath(ae: Active, pt: IPoint64): OutPt {\r\n const outrec = this.newOutRec();\r\n outrec.isOpen = true;\r\n if (ae.windDx > 0) {\r\n outrec.frontEdge = ae;\r\n outrec.backEdge = undefined;\r\n } else {\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = ae;\r\n }\r\n\r\n ae.outrec = outrec;\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n\r\n private updateEdgeIntoAEL(ae: Active): void {\r\n ae.bot = ae.top!;\r\n ae.vertexTop = ClipperBase.nextVertex(ae);\r\n ae.top = ae.vertexTop!.pt;\r\n ae.curX = ae.bot.x;\r\n ClipperBase.setDx(ae);\r\n\r\n if (ClipperBase.isJoined(ae)) this.split(ae, ae.bot);\r\n\r\n if (ClipperBase.isHorizontal(ae)) return;\r\n this.insertScanline(ae.top.y);\r\n\r\n this.checkJoinLeft(ae, ae.bot);\r\n this.checkJoinRight(ae, ae.bot, true);\r\n }\r\n\r\n private static findEdgeWithMatchingLocMin(e: Active): Active | undefined {\r\n let result: Active | undefined = e.nextInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin) return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot) result = undefined;\r\n else result = result.nextInAEL;\r\n }\r\n\r\n result = e.prevInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin) return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot) return undefined;\r\n result = result.prevInAEL;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private intersectEdges(ae1: Active, ae2: Active, pt: IPoint64): OutPt | undefined {\r\n let resultOp: OutPt | undefined = undefined;\r\n\r\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\r\n if (this._hasOpenPaths && (ClipperBase.isOpen(ae1) || ClipperBase.isOpen(ae2))) {\r\n if (ClipperBase.isOpen(ae1) && ClipperBase.isOpen(ae2)) return undefined;\r\n // the following line avoids duplicating quite a bit of code\r\n if (ClipperBase.isOpen(ae2)) ClipperBase.swapActives(ae1, ae2);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n if (this._cliptype === ClipType.Union) {\r\n if (!ClipperBase.isHotEdgeActive(ae2)) return undefined;\r\n } else if (ae2.localMin.polytype === PathType.Subject)\r\n return undefined;\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae2.windCount !== 1) return undefined;\r\n break;\r\n case FillRule.Negative:\r\n if (ae2.windCount !== -1) return undefined;\r\n break;\r\n default:\r\n if (Math.abs(ae2.windCount) !== 1) return undefined;\r\n break;\r\n }\r\n\r\n // toggle contribution ...\r\n if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n if (ClipperBase.isFront(ae1)) {\r\n ae1.outrec!.frontEdge = undefined;\r\n } else {\r\n ae1.outrec!.backEdge = undefined;\r\n }\r\n ae1.outrec = undefined;\r\n\r\n // horizontal edges can pass under open paths at a LocMins\r\n } else if (pt === ae1.localMin.vertex.pt && !ClipperBase.isOpenEnd(ae1.localMin.vertex)) {\r\n // find the other side of the LocMin and\r\n // if it's 'hot' join up with it ...\r\n const ae3: Active | undefined = ClipperBase.findEdgeWithMatchingLocMin(ae1);\r\n if (ae3 && ClipperBase.isHotEdgeActive(ae3)) {\r\n ae1.outrec = ae3.outrec;\r\n if (ae1.windDx > 0) {\r\n ClipperBase.setSides(ae3.outrec!, ae1, ae3);\r\n } else {\r\n ClipperBase.setSides(ae3.outrec!, ae3, ae1);\r\n }\r\n return ae3.outrec!.pts;\r\n }\r\n resultOp = this.startOpenPath(ae1, pt);\r\n } else {\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n\r\n return resultOp;\r\n }\r\n\r\n // MANAGING CLOSED PATHS FROM HERE ON\r\n if (ClipperBase.isJoined(ae1)) this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n // UPDATE WINDING COUNTS...\r\n let oldE1WindCount: number;\r\n let oldE2WindCount: number;\r\n\r\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n oldE1WindCount = ae1.windCount;\r\n ae1.windCount = ae2.windCount;\r\n ae2.windCount = oldE1WindCount;\r\n } else {\r\n if (ae1.windCount + ae2.windDx === 0)\r\n ae1.windCount = -ae1.windCount;\r\n else\r\n ae1.windCount += ae2.windDx;\r\n if (ae2.windCount - ae1.windDx === 0)\r\n ae2.windCount = -ae2.windCount;\r\n else\r\n ae2.windCount -= ae1.windDx;\r\n }\r\n } else {\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae1.windCount2 += ae2.windDx;\r\n else\r\n ae1.windCount2 = (ae1.windCount2 === 0 ? 1 : 0);\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae2.windCount2 -= ae1.windDx;\r\n else\r\n ae2.windCount2 = (ae2.windCount2 === 0 ? 1 : 0);\r\n }\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n oldE1WindCount = ae1.windCount;\r\n oldE2WindCount = ae2.windCount;\r\n break;\r\n case FillRule.Negative:\r\n oldE1WindCount = -ae1.windCount;\r\n oldE2WindCount = -ae2.windCount;\r\n break;\r\n default:\r\n oldE1WindCount = Math.abs(ae1.windCount);\r\n oldE2WindCount = Math.abs(ae2.windCount);\r\n break;\r\n }\r\n\r\n const e1WindCountIs0or1: boolean = oldE1WindCount === 0 || oldE1WindCount === 1;\r\n const e2WindCountIs0or1: boolean = oldE2WindCount === 0 || oldE2WindCount === 1;\r\n\r\n if ((!ClipperBase.isHotEdgeActive(ae1) && !e1WindCountIs0or1) || (!ClipperBase.isHotEdgeActive(ae2) && !e2WindCountIs0or1)) return undefined;\r\n\r\n // NOW PROCESS THE INTERSECTION ...\r\n\r\n // if both edges are 'hot' ...\r\n if (ClipperBase.isHotEdgeActive(ae1) && ClipperBase.isHotEdgeActive(ae2)) {\r\n if ((oldE1WindCount !== 0 && oldE1WindCount !== 1) ||\r\n (oldE2WindCount !== 0 && oldE2WindCount !== 1) ||\r\n (ae1.localMin.polytype !== ae2.localMin.polytype &&\r\n this._cliptype !== ClipType.Xor)) {\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n } else if (ClipperBase.isFront(ae1) || (ae1.outrec === ae2.outrec)) {\r\n // this 'else if' condition isn't strictly needed but\r\n // it's sensible to split polygons that only touch at\r\n // a common vertex (not at common edges).\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n this.addLocalMinPoly(ae1, ae2, pt);\r\n } else {\r\n // can't treat as maxima & minima\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n }\r\n // if one or the other edge is 'hot' ...\r\n else if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n } else if (ClipperBase.isHotEdgeActive(ae2)) {\r\n resultOp = ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n\r\n // neither edge is 'hot'\r\n else {\r\n let e1Wc2: number;\r\n let e2Wc2: number;\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n e1Wc2 = ae1.windCount2;\r\n e2Wc2 = ae2.windCount2;\r\n break;\r\n case FillRule.Negative:\r\n e1Wc2 = -ae1.windCount2;\r\n e2Wc2 = -ae2.windCount2;\r\n break;\r\n default:\r\n e1Wc2 = Math.abs(ae1.windCount2);\r\n e2Wc2 = Math.abs(ae2.windCount2);\r\n break;\r\n }\r\n\r\n if (!ClipperBase.isSamePolyType(ae1, ae2)) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n } else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\r\n resultOp = undefined;\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Union:\r\n if (e1Wc2 > 0 && e2Wc2 > 0) return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n\r\n case ClipType.Difference:\r\n if (((ClipperBase.getPolyType(ae1) === PathType.Clip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||\r\n ((ClipperBase.getPolyType(ae1) === PathType.Subject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n break;\r\n\r\n case ClipType.Xor:\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n\r\n default: // ClipType.Intersection:\r\n if (e1Wc2 <= 0 || e2Wc2 <= 0) return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return resultOp;\r\n }\r\n\r\n\r\n private deleteFromAEL(ae: Active): void {\r\n const prev: Active | undefined = ae.prevInAEL;\r\n const next: Active | undefined = ae.nextInAEL;\r\n if (!prev && !next && ae !== this._actives) return; // already deleted\r\n\r\n if (prev)\r\n prev.nextInAEL = next;\r\n else\r\n this._actives = next;\r\n\r\n if (next)\r\n next.prevInAEL = prev;\r\n }\r\n\r\n private adjustCurrXAndCopyToSEL(topY: number): void {\r\n let ae: Active | undefined = this._actives;\r\n this._sel = ae;\r\n while (ae) {\r\n ae.prevInSEL = ae.prevInAEL;\r\n ae.nextInSEL = ae.nextInAEL;\r\n ae.jump = ae.nextInSEL;\r\n if (ae.joinWith === JoinWith.Left)\r\n ae.curX = ae.prevInAEL!.curX; // This also avoids complications\r\n else\r\n ae.curX = ClipperBase.topX(ae, topY);\r\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n\r\n protected executeInternal(ct: ClipType, fillRule: FillRule): void {\r\n if (ct === ClipType.None) return;\r\n this._fillrule = fillRule;\r\n this._cliptype = ct;\r\n this.reset();\r\n\r\n let y = this.popScanline()\r\n if (y === undefined) return\r\n\r\n while (this._succeeded) {\r\n this.insertLocalMinimaIntoAEL(y)\r\n let ae = this.popHorz()\r\n while (ae) {\r\n this.doHorizontal(ae)\r\n ae = this.popHorz()\r\n }\r\n\r\n if (this._horzSegList.length > 0) {\r\n this.convertHorzSegsToJoins();\r\n this._horzSegList.length = 0\r\n }\r\n this._currentBotY = y; // bottom of scanbeam\r\n\r\n y = this.popScanline()\r\n if (y === undefined) break; // y new top of scanbeam\r\n\r\n this.doIntersections(y);\r\n this.doTopOfScanbeam(y);\r\n\r\n ae = this.popHorz()\r\n while (ae) {\r\n this.doHorizontal(ae)\r\n ae = this.popHorz()\r\n }\r\n }\r\n if (this._succeeded) this.processHorzJoins();\r\n }\r\n\r\n private doIntersections(topY: number): void {\r\n if (this.buildIntersectList(topY)) {\r\n this.processIntersectList();\r\n this.disposeIntersectNodes();\r\n }\r\n }\r\n\r\n private disposeIntersectNodes(): void {\r\n this._intersectList.length = 0\r\n }\r\n\r\n private addNewIntersectNode(ae1: Active, ae2: Active, topY: number): void {\r\n const result = InternalClipper.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top)\r\n let ip: IPoint64 = result.ip\r\n if (!result.success) {\r\n ip = new Point64(ae1.curX, topY);\r\n }\r\n\r\n if (ip.y > this._currentBotY || ip.y < topY) {\r\n const absDx1: number = Math.abs(ae1.dx);\r\n const absDx2: number = Math.abs(ae2.dx);\r\n if (absDx1 > 100 && absDx2 > 100) {\r\n if (absDx1 > absDx2) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n } else {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n } else if (absDx1 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n } else if (absDx2 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n } else {\r\n if (ip.y < topY) {\r\n ip.y = topY;\r\n } else {\r\n ip.y = this._currentBotY;\r\n }\r\n if (absDx1 < absDx2) {\r\n ip.x = ClipperBase.topX(ae1, ip.y);\r\n } else {\r\n ip.x = ClipperBase.topX(ae2, ip.y);\r\n }\r\n }\r\n }\r\n const node: IntersectNode = new IntersectNode(ip, ae1, ae2);\r\n this._intersectList.push(node);\r\n }\r\n\r\n private static extractFromSEL(ae: Active): Active | undefined {\r\n const res: Active | undefined = ae.nextInSEL;\r\n if (res) {\r\n res.prevInSEL = ae.prevInSEL;\r\n }\r\n ae.prevInSEL!.nextInSEL = res;\r\n return res;\r\n }\r\n\r\n private static insert1Before2InSEL(ae1: Active, ae2: Active): void {\r\n ae1.prevInSEL = ae2.prevInSEL;\r\n if (ae1.prevInSEL) {\r\n ae1.prevInSEL.nextInSEL = ae1;\r\n }\r\n ae1.nextInSEL = ae2;\r\n ae2.prevInSEL = ae1;\r\n }\r\n\r\n private buildIntersectList(topY: number): boolean {\r\n if (!this._actives || !this._actives.nextInAEL) return false;\r\n\r\n // Calculate edge positions at the top of the current scanbeam, and from this\r\n // we will determine the intersections required to reach these new positions.\r\n this.adjustCurrXAndCopyToSEL(topY);\r\n\r\n // Find all edge intersections in the current scanbeam using a stable merge\r\n // sort that ensures only adjacent edges are intersecting. Intersect info is\r\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\r\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\r\n\r\n let left: Active | undefined = this._sel,\r\n right: Active | undefined,\r\n lEnd: Active | undefined,\r\n rEnd: Active | undefined,\r\n currBase: Active | undefined,\r\n prevBase: Active | undefined,\r\n tmp: Active | undefined;\r\n\r\n while (left!.jump) {\r\n prevBase = undefined;\r\n while (left && left.jump) {\r\n currBase = left;\r\n right = left.jump;\r\n lEnd = right;\r\n rEnd = right!.jump;\r\n left.jump = rEnd;\r\n while (left !== lEnd && right !== rEnd) {\r\n if (right!.curX < left!.curX) {\r\n tmp = right!.prevInSEL!;\r\n for (; ;) {\r\n this.addNewIntersectNode(tmp, right!, topY);\r\n if (tmp === left) break;\r\n tmp = tmp.prevInSEL!;\r\n }\r\n\r\n tmp = right;\r\n right = ClipperBase.extractFromSEL(tmp!);\r\n lEnd = right;\r\n ClipperBase.insert1Before2InSEL(tmp!, left!);\r\n if (left === currBase) {\r\n currBase = tmp;\r\n currBase!.jump = rEnd;\r\n if (prevBase === undefined) this._sel = currBase;\r\n else prevBase.jump = currBase;\r\n }\r\n } else {\r\n left = left!.nextInSEL;\r\n }\r\n }\r\n\r\n prevBase = currBase;\r\n left = rEnd;\r\n }\r\n left = this._sel;\r\n }\r\n\r\n return this._intersectList.length > 0;\r\n }\r\n\r\n private processIntersectList(): void {\r\n // We now have a list of intersections required so that edges will be\r\n // correctly positioned at the top of the scanbeam. However, it's important\r\n // that edge intersections are processed from the bottom up, but it's also\r\n // crucial that intersections only occur between adjacent edges.\r\n\r\n // First we do a quicksort so intersections proceed in a bottom up order ...\r\n this._intersectList.sort((a, b) => {\r\n if (a.pt.y === b.pt.y) {\r\n if (a.pt.x === b.pt.x) return 0;\r\n return (a.pt.x < b.pt.x) ? -1 : 1;\r\n }\r\n return (a.pt.y > b.pt.y) ? -1 : 1;\r\n });\r\n\r\n // Now as we process these intersections, we must sometimes adjust the order\r\n // to ensure that intersecting edges are always adjacent ...\r\n for (let i = 0; i < this._intersectList.length; ++i) {\r\n if (!ClipperBase.edgesAdjacentInAEL(this._intersectList[i])) {\r\n let j = i + 1;\r\n while (!ClipperBase.edgesAdjacentInAEL(this._intersectList[j])) j++;\r\n // swap\r\n [this._intersectList[j], this._intersectList[i]] =\r\n [this._intersectList[i], this._intersectList[j]];\r\n }\r\n\r\n const node = this._intersectList[i];\r\n this.intersectEdges(node.edge1, node.edge2, node.pt);\r\n this.swapPositionsInAEL(node.edge1, node.edge2);\r\n\r\n node.edge1.curX = node.pt.x;\r\n node.edge2.curX = node.pt.x;\r\n this.checkJoinLeft(node.edge2, node.pt, true);\r\n this.checkJoinRight(node.edge1, node.pt, true);\r\n }\r\n }\r\n\r\n private swapPositionsInAEL(ae1: Active, ae2: Active): void {\r\n // preconditon: ae1 must be immediately to the left of ae2\r\n const next: Active | undefined = ae2.nextInAEL;\r\n if (next) next.prevInAEL = ae1;\r\n const prev: Active | undefined = ae1.prevInAEL;\r\n if (prev) prev.nextInAEL = ae2;\r\n ae2.prevInAEL = prev;\r\n ae2.nextInAEL = ae1;\r\n ae1.prevInAEL = ae2;\r\n ae1.nextInAEL = next;\r\n if (!ae2.prevInAEL) this._actives = ae2;\r\n }\r\n\r\n private static resetHorzDirection(horz: Active, vertexMax: Vertex | undefined): { isLeftToRight: boolean, leftX: number, rightX: number } {\r\n let leftX, rightX\r\n\r\n if (horz.bot.x === horz.top.x) {\r\n // the horizontal edge is going nowhere ...\r\n leftX = horz.curX;\r\n rightX = horz.curX;\r\n let ae: Active | undefined = horz.nextInAEL;\r\n while (ae && ae.vertexTop !== vertexMax)\r\n ae = ae.nextInAEL;\r\n return { isLeftToRight: ae !== undefined, leftX, rightX }\r\n }\r\n\r\n if (horz.curX < horz.top.x) {\r\n leftX = horz.curX;\r\n rightX = horz.top.x;\r\n return { isLeftToRight: true, leftX, rightX }\r\n }\r\n leftX = horz.top.x;\r\n rightX = horz.curX;\r\n return { isLeftToRight: false, leftX, rightX } // right to left\r\n }\r\n\r\n private static horzIsSpike(horz: Active): boolean {\r\n const nextPt: IPoint64 = ClipperBase.nextVertex(horz).pt;\r\n return (horz.bot.x < horz.top.x) !== (horz.top.x < nextPt.x);\r\n }\r\n\r\n private static trimHorz(horzEdge: Active, preserveCollinear: boolean): void {\r\n let wasTrimmed = false;\r\n let pt: IPoint64 = ClipperBase.nextVertex(horzEdge).pt;\r\n\r\n while (pt.y === horzEdge.top.y) {\r\n // always trim 180 deg. spikes (in closed paths)\r\n // but otherwise break if preserveCollinear = true\r\n if (preserveCollinear &&\r\n (pt.x < horzEdge.top.x) !== (horzEdge.bot.x < horzEdge.top.x)) {\r\n break;\r\n }\r\n\r\n horzEdge.vertexTop = ClipperBase.nextVertex(horzEdge);\r\n horzEdge.top = pt;\r\n wasTrimmed = true;\r\n if (ClipperBase.isMaximaActive(horzEdge)) break;\r\n pt = ClipperBase.nextVertex(horzEdge).pt;\r\n }\r\n if (wasTrimmed) ClipperBase.setDx(horzEdge); // +/-infinity\r\n }\r\n\r\n private addToHorzSegList(op: OutPt): void {\r\n if (op.outrec.isOpen) return;\r\n this._horzSegList.push(new HorzSegment(op));\r\n }\r\n\r\n private getLastOp(hotEdge: Active): OutPt {\r\n const outrec: OutRec = hotEdge.outrec!;\r\n return (hotEdge === outrec.frontEdge) ?\r\n outrec.pts! : outrec.pts!.next!;\r\n }\r\n\r\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/\r\n private doHorizontal(horz: Active): void {\r\n let pt: IPoint64;\r\n const horzIsOpen = ClipperBase.isOpen(horz);\r\n const Y = horz.bot.y;\r\n\r\n const vertex_max: Vertex | undefined = horzIsOpen ?\r\n ClipperBase.getCurrYMaximaVertex_Open(horz) :\r\n ClipperBase.getCurrYMaximaVertex(horz);\r\n\r\n // remove 180 deg.spikes and also simplify\r\n // consecutive horizontals when PreserveCollinear = true\r\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop)\r\n ClipperBase.trimHorz(horz, this.preserveCollinear);\r\n\r\n let { isLeftToRight, leftX, rightX } =\r\n ClipperBase.resetHorzDirection(horz, vertex_max);\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, new Point64(horz.curX, Y));\r\n this.addToHorzSegList(op);\r\n }\r\n\r\n for (; ;) {\r\n // loops through consec. horizontal edges (if open)\r\n let ae: Active | undefined = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\r\n\r\n while (ae) {\r\n if (ae.vertexTop === vertex_max) {\r\n // do this first!!\r\n if (ClipperBase.isHotEdgeActive(horz) && ClipperBase.isJoined(ae)) this.split(ae, ae.top);\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n while (horz.vertexTop !== vertex_max) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n if (isLeftToRight)\r\n this.addLocalMaxPoly(horz, ae, horz.top);\r\n else\r\n this.addLocalMaxPoly(ae, horz, horz.top);\r\n }\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n\r\n // if horzEdge is a maxima, keep going until we reach\r\n // its maxima pair, otherwise check for break conditions\r\n if (vertex_max !== horz.vertexTop || ClipperBase.isOpenEndActive(horz)) {\r\n // otherwise stop when 'ae' is beyond the end of the horizontal line\r\n if ((isLeftToRight && ae.curX > rightX) || (!isLeftToRight && ae.curX < leftX)) break;\r\n\r\n if (ae.curX === horz.top.x && !ClipperBase.isHorizontal(ae)) {\r\n pt = ClipperBase.nextVertex(horz).pt;\r\n\r\n // to maximize the possibility of putting open edges into\r\n // solutions, we'll only break if it's past HorzEdge's end\r\n if (ClipperBase.isOpen(ae) && !ClipperBase.isSamePolyType(ae, horz) && !ClipperBase.isHotEdgeActive(ae)) {\r\n if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) > pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) < pt.x))) break;\r\n }\r\n // otherwise for edges at horzEdge's end, only stop when horzEdge's\r\n // outslope is greater than e's slope when heading right or when\r\n // horzEdge's outslope is less than e's slope when heading left.\r\n else if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) >= pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) <= pt.x))) break;\r\n }\r\n }\r\n\r\n pt = new Point64(ae.curX, Y);\r\n\r\n if (isLeftToRight) {\r\n this.intersectEdges(horz, ae, pt);\r\n this.swapPositionsInAEL(horz, ae);\r\n horz.curX = ae.curX;\r\n ae = horz.nextInAEL;\r\n } else {\r\n this.intersectEdges(ae, horz, pt);\r\n this.swapPositionsInAEL(ae, horz);\r\n horz.curX = ae.curX;\r\n ae = horz.prevInAEL;\r\n }\r\n\r\n if (ClipperBase.isHotEdgeActive(horz))\r\n this.addToHorzSegList(this.getLastOp(horz));\r\n } // we've reached the end of this horizontal\r\n\r\n // check if we've finished looping\r\n // through consecutive horizontals\r\n if (horzIsOpen && ClipperBase.isOpenEndActive(horz)) { // ie open at top\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n if (ClipperBase.isFront(horz))\r\n horz.outrec!.frontEdge = undefined;\r\n else\r\n horz.outrec!.backEdge = undefined;\r\n horz.outrec = undefined;\r\n }\r\n this.deleteFromAEL(horz);\r\n return;\r\n } else if (ClipperBase.nextVertex(horz).pt.y !== horz.top.y)\r\n break;\r\n\r\n // still more horizontals in bound to process ...\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n }\r\n\r\n this.updateEdgeIntoAEL(horz);\r\n\r\n if (this.preserveCollinear && !horzIsOpen && ClipperBase.horzIsSpike(horz)) {\r\n ClipperBase.trimHorz(horz, true);\r\n }\r\n\r\n const result = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n isLeftToRight = result.isLeftToRight\r\n leftX = result.leftX\r\n rightX = result.rightX\r\n }\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, horz.top);\r\n this.addToHorzSegList(op);\r\n }\r\n\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n\r\n private doTopOfScanbeam(y: number): void {\r\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\r\n let ae: Active | undefined = this._actives;\r\n\r\n while (ae) {\r\n // NB 'ae' will never be horizontal here\r\n if (ae.top.y === y) {\r\n ae.curX = ae.top.x;\r\n\r\n if (ClipperBase.isMaximaActive(ae)) {\r\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\r\n continue;\r\n }\r\n\r\n // INTERMEDIATE VERTEX ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n\r\n this.updateEdgeIntoAEL(ae);\r\n\r\n if (ClipperBase.isHorizontal(ae))\r\n this.pushHorz(ae); // horizontals are processed later\r\n } else { // i.e. not the top of the edge\r\n ae.curX = ClipperBase.topX(ae, y);\r\n }\r\n\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n\r\n private doMaxima(ae: Active): Active | undefined {\r\n const prevE: Active | undefined = ae.prevInAEL\r\n let nextE: Active | undefined = ae.nextInAEL\r\n\r\n if (ClipperBase.isOpenEndActive(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) ClipperBase.addOutPt(ae, ae.top);\r\n if (!ClipperBase.isHorizontal(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) {\r\n if (ClipperBase.isFront(ae))\r\n ae.outrec!.frontEdge = undefined;\r\n else\r\n ae.outrec!.backEdge = undefined;\r\n ae.outrec = undefined;\r\n }\r\n this.deleteFromAEL(ae);\r\n }\r\n return nextE;\r\n }\r\n\r\n const maxPair: Active | undefined = ClipperBase.getMaximaPair(ae);\r\n if (!maxPair) return nextE; // eMaxPair is horizontal\r\n\r\n if (ClipperBase.isJoined(ae)) this.split(ae, ae.top);\r\n if (ClipperBase.isJoined(maxPair)) this.split(maxPair, maxPair.top);\r\n\r\n // only non-horizontal maxima here.\r\n // process any edges between maxima pair ...\r\n while (nextE !== maxPair) {\r\n this.intersectEdges(ae, nextE!, ae.top);\r\n this.swapPositionsInAEL(ae, nextE!);\r\n nextE = ae.nextInAEL\r\n }\r\n\r\n if (ClipperBase.isOpen(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(maxPair);\r\n this.deleteFromAEL(ae);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n\r\n // here ae.nextInAel == ENext == EMaxPair ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(maxPair);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n\r\n private static isJoined(e: Active): boolean {\r\n return e.joinWith !== JoinWith.None;\r\n }\r\n\r\n private split(e: Active, currPt: IPoint64): void {\r\n if (e.joinWith === JoinWith.Right) {\r\n e.joinWith = JoinWith.None;\r\n e.nextInAEL!.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e, e.nextInAEL!, currPt, true);\r\n } else {\r\n e.joinWith = JoinWith.None;\r\n e.prevInAEL!.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e.prevInAEL!, e, currPt, true);\r\n }\r\n }\r\n\r\n private checkJoinLeft(e: Active, pt: IPoint64, checkCurrX: boolean = false): void {\r\n const prev = e.prevInAEL;\r\n if (!prev || ClipperBase.isOpen(e) || ClipperBase.isOpen(prev) ||\r\n !ClipperBase.isHotEdgeActive(e) || !ClipperBase.isHotEdgeActive(prev)) return;\r\n\r\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (prev.bot.y > pt.y))) return; // (#490)\r\n\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25) return;\r\n } else if (e.curX !== prev.curX) return;\r\n if (InternalClipper.crossProduct(e.top, pt, prev.top) !== 0) return;\r\n\r\n if (e.outrec!.idx === prev.outrec!.idx)\r\n this.addLocalMaxPoly(prev, e, pt);\r\n else if (e.outrec!.idx < prev.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(e, prev);\r\n else\r\n ClipperBase.joinOutrecPaths(prev, e);\r\n prev.joinWith = JoinWith.Right;\r\n e.joinWith = JoinWith.Left;\r\n }\r\n\r\n private checkJoinRight(e: Active, pt: IPoint64, checkCurrX: boolean = false): void {\r\n const next = e.nextInAEL;\r\n if (ClipperBase.isOpen(e) || !ClipperBase.isHotEdgeActive(e) || ClipperBase.isJoined(e) ||\r\n !next || ClipperBase.isOpen(next) || !ClipperBase.isHotEdgeActive(next)) return;\r\n\r\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (next.bot.y > pt.y))) return; // (#490)\r\n\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25) return;\r\n } else if (e.curX !== next.curX) return;\r\n if (InternalClipper.crossProduct(e.top, pt, next.top) !== 0) return;\r\n\r\n if (e.outrec!.idx === next.outrec!.idx)\r\n this.addLocalMaxPoly(e, next, pt);\r\n else if (e.outrec!.idx < next.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(e, next);\r\n else\r\n ClipperBase.joinOutrecPaths(next, e);\r\n e.joinWith = JoinWith.Right;\r\n next.joinWith = JoinWith.Left;\r\n }\r\n\r\n private static fixOutRecPts(outrec: OutRec): void {\r\n let op = outrec.pts!;\r\n do {\r\n op!.outrec = outrec;\r\n op = op.next!;\r\n } while (op !== outrec.pts);\r\n }\r\n\r\n private static setHorzSegHeadingForward(hs: HorzSegment, opP: OutPt, opN: OutPt): boolean {\r\n if (opP.pt.x === opN.pt.x) return false;\r\n if (opP.pt.x < opN.pt.x) {\r\n hs.leftOp = opP;\r\n hs.rightOp = opN;\r\n hs.leftToRight = true;\r\n } else {\r\n hs.leftOp = opN;\r\n hs.rightOp = opP;\r\n hs.leftToRight = false;\r\n }\r\n return true;\r\n }\r\n\r\n private static updateHorzSegment(hs: HorzSegment): boolean {\r\n const op = hs.leftOp;\r\n const outrec = this.getRealOutRec(op.outrec)!;\r\n const outrecHasEdges = outrec.frontEdge !== undefined;\r\n const curr_y = op.pt.y;\r\n let opP = op, opN = op;\r\n\r\n if (outrecHasEdges) {\r\n const opA = outrec.pts!, opZ = opA.next!;\r\n while (opP !== opZ && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN !== opA && opN.next!.pt.y === curr_y)\r\n opN = opN.next!;\r\n } else {\r\n while (opP.prev !== opN && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN.next !== opP && opN.next!.pt.y === curr_y)\r\n opN = opN.next!;\r\n }\r\n\r\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp!.horz === undefined;\r\n\r\n if (result)\r\n hs.leftOp!.horz = hs;\r\n else\r\n hs.rightOp = undefined; // (for sorting)\r\n\r\n return result;\r\n }\r\n\r\n private static duplicateOp(op: OutPt, insert_after: boolean): OutPt {\r\n const result = new OutPt(op.pt, op.outrec);\r\n if (insert_after) {\r\n result.next = op.next;\r\n result.next!.prev = result;\r\n result.prev = op;\r\n op.next = result;\r\n } else {\r\n result.prev = op.prev;\r\n result.prev.next = result;\r\n result.next = op;\r\n op.prev = result;\r\n }\r\n return result;\r\n }\r\n\r\n private convertHorzSegsToJoins(): void {\r\n let k = 0;\r\n for (const hs of this._horzSegList) {\r\n if (ClipperBase.updateHorzSegment(hs)) k++;\r\n }\r\n if (k < 2) return;\r\n this._horzSegList.sort((hs1, hs2) => {\r\n if (!hs1 || !hs2) return 0;\r\n if (!hs1.rightOp) {\r\n return !hs2.rightOp ? 0 : 1;\r\n } else if (!hs2.rightOp)\r\n return -1;\r\n else\r\n return hs1.leftOp!.pt.x - hs2.leftOp!.pt.x;\r\n });\r\n\r\n for (let i = 0; i < k - 1; i++) {\r\n const hs1 = this._horzSegList[i];\r\n // for each HorzSegment, find others that overlap\r\n for (let j = i + 1; j < k; j++) {\r\n const hs2 = this._horzSegList[j];\r\n if (hs2.leftOp!.pt.x >= hs1.rightOp!.pt.x ||\r\n hs2.leftToRight === hs1.leftToRight ||\r\n hs2.rightOp!.pt.x <= hs1.leftOp!.pt.x) continue;\r\n\r\n const curr_y = hs1.leftOp.pt.y;\r\n\r\n if (hs1.leftToRight) {\r\n while (hs1.leftOp.next!.pt.y === curr_y &&\r\n hs1.leftOp.next!.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.next!;\r\n }\r\n while (hs2.leftOp.prev.pt.y === curr_y &&\r\n hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.prev;\r\n }\r\n const join = new HorzJoin(\r\n ClipperBase.duplicateOp(hs1.leftOp, true),\r\n ClipperBase.duplicateOp(hs2.leftOp, false)\r\n );\r\n this._horzJoinList.push(join);\r\n } else {\r\n while (hs1.leftOp.prev.pt.y === curr_y &&\r\n hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.prev;\r\n }\r\n while (hs2.leftOp.next!.pt.y === curr_y &&\r\n hs2.leftOp.next!.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.next!;\r\n }\r\n const join = new HorzJoin(\r\n ClipperBase.duplicateOp(hs2.leftOp, true),\r\n ClipperBase.duplicateOp(hs1.leftOp, false)\r\n );\r\n this._horzJoinList.push(join);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static getCleanPath(op: OutPt): Path64 {\r\n const result = new Path64();\r\n let op2 = op;\r\n while (op2.next !== op &&\r\n ((op2.pt.x === op2.next!.pt.x && op2.pt.x === op2.prev.pt.x) ||\r\n (op2.pt.y === op2.next!.pt.y && op2.pt.y === op2.prev.pt.y))) {\r\n op2 = op2.next!;\r\n }\r\n result.push(op2.pt);\r\n let prevOp = op2;\r\n op2 = op2.next!;\r\n\r\n while (op2 !== op) {\r\n if ((op2.pt.x !== op2.next!.pt.x || op2.pt.x !== prevOp.pt.x) &&\r\n (op2.pt.y !== op2.next!.pt.y || op2.pt.y !== prevOp.pt.y)) {\r\n result.push(op2.pt);\r\n prevOp = op2;\r\n }\r\n op2 = op2.next!;\r\n }\r\n return result;\r\n }\r\n\r\n private static pointInOpPolygon(pt: IPoint64, op: OutPt): PointInPolygonResult {\r\n if (op === op.next || op.prev === op.next)\r\n return PointInPolygonResult.IsOutside;\r\n\r\n let op2 = op;\r\n do {\r\n if (op.pt.y !== pt.y) break;\r\n op = op.next!;\r\n } while (op !== op2);\r\n if (op.pt.y === pt.y) // not a proper polygon\r\n return PointInPolygonResult.IsOutside;\r\n\r\n let isAbove = op.pt.y < pt.y\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n\r\n op2 = op.next!;\r\n while (op2 !== op) {\r\n if (isAbove)\r\n while (op2 !== op && op2.pt.y < pt.y) op2 = op2.next!;\r\n else\r\n while (op2 !== op && op2.pt.y > pt.y) op2 = op2.next!;\r\n if (op2 === op) break;\r\n\r\n if (op2.pt.y === pt.y) {\r\n if (op2.pt.x === pt.x || (op2.pt.y === op2.prev.pt.y &&\r\n (pt.x < op2.prev.pt.x) !== (pt.x < op2.pt.x)))\r\n return PointInPolygonResult.IsOn;\r\n op2 = op2.next!;\r\n if (op2 === op) break;\r\n continue;\r\n }\r\n\r\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\r\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x)\r\n val = 1 - val;\r\n else {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n }\r\n isAbove = !isAbove;\r\n op2 = op2.next!;\r\n }\r\n\r\n if (isAbove !== startingAbove) {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n\r\n if (val === 0) return PointInPolygonResult.IsOutside;\r\n else return PointInPolygonResult.IsInside;\r\n }\r\n\r\n private static path1InsidePath2(op1: OutPt, op2: OutPt): boolean {\r\n let result: PointInPolygonResult;\r\n let outside_cnt = 0;\r\n let op = op1;\r\n do {\r\n result = this.pointInOpPolygon(op.pt, op2);\r\n if (result === PointInPolygonResult.IsOutside) ++outside_cnt;\r\n else if (result === PointInPolygonResult.IsInside) --outside_cnt;\r\n op = op.next!;\r\n } while (op !== op1 && Math.abs(outside_cnt) < 2);\r\n if (Math.abs(outside_cnt) > 1) return (outside_cnt < 0);\r\n\r\n const mp = ClipperBase.getBoundsPath(this.getCleanPath(op1)).midPoint();\r\n const path2 = this.getCleanPath(op2);\r\n return InternalClipper.pointInPolygon(mp, path2) !== PointInPolygonResult.IsOutside;\r\n }\r\n\r\n private moveSplits(fromOr: OutRec, toOr: OutRec): void {\r\n if (!fromOr.splits) return;\r\n toOr.splits = toOr.splits || [];\r\n for (const i of fromOr.splits) {\r\n toOr.splits.push(i);\r\n }\r\n fromOr.splits = undefined;\r\n }\r\n\r\n private processHorzJoins(): void {\r\n for (const j of this._horzJoinList) {\r\n const or1 = ClipperBase.getRealOutRec(j.op1!.outrec)!;\r\n let or2 = ClipperBase.getRealOutRec(j.op2!.outrec)!;\r\n\r\n const op1b = j.op1!.next!;\r\n const op2b = j.op2!.prev!;\r\n j.op1!.next = j.op2!;\r\n j.op2!.prev = j.op1!;\r\n op1b.prev = op2b;\r\n op2b.next = op1b;\r\n\r\n if (or1 === or2) {\r\n or2 = this.newOutRec();\r\n or2.pts = op1b;\r\n ClipperBase.fixOutRecPts(or2);\r\n\r\n if (or1.pts!.outrec === or2) {\r\n or1.pts = j.op1;\r\n or1.pts!.outrec = or1;\r\n }\r\n\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(or1.pts!, or2.pts)) {\r\n const tmp = or1.pts;\r\n or1.pts = or2.pts;\r\n or2.pts = tmp;\r\n ClipperBase.fixOutRecPts(or1);\r\n ClipperBase.fixOutRecPts(or2);\r\n or2.owner = or1.owner;\r\n } else if (ClipperBase.path1InsidePath2(or2.pts, or1.pts!)) {\r\n or2.owner = or1;\r\n } else {\r\n or2.owner = or1.owner;\r\n }\r\n\r\n or1.splits = or1.splits || [];\r\n or1.splits.push(or2.idx);\r\n } else {\r\n or2.owner = or1;\r\n }\r\n } else {\r\n or2.pts = undefined;\r\n if (this._using_polytree) {\r\n ClipperBase.setOwner(or2, or1);\r\n this.moveSplits(or2, or1);\r\n } else {\r\n or2.owner = or1;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static ptsReallyClose(pt1: IPoint64, pt2: IPoint64): boolean {\r\n return (Math.abs(pt1.x - pt2.x) < 2) && (Math.abs(pt1.y - pt2.y) < 2);\r\n }\r\n\r\n private static isVerySmallTriangle(op: OutPt): boolean {\r\n return op.next!.next === op.prev &&\r\n (this.ptsReallyClose(op.prev.pt, op.next!.pt) ||\r\n this.ptsReallyClose(op.pt, op.next!.pt) ||\r\n this.ptsReallyClose(op.pt, op.prev.pt));\r\n }\r\n\r\n\r\n private static isValidClosedPath(op: OutPt | undefined): boolean {\r\n return op !== undefined && op.next !== op &&\r\n (op.next !== op.prev || !this.isVerySmallTriangle(op));\r\n }\r\n\r\n private static disposeOutPt(op: OutPt): OutPt | undefined {\r\n const result = op.next === op ? undefined : op.next;\r\n op.prev.next = op.next;\r\n op.next!.prev = op.prev;\r\n return result;\r\n }\r\n\r\n private cleanCollinear(outrec: OutRec | undefined): void {\r\n outrec = ClipperBase.getRealOutRec(outrec);\r\n\r\n if (outrec === undefined || outrec.isOpen) return;\r\n\r\n if (!ClipperBase.isValidClosedPath(outrec.pts)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n\r\n let startOp: OutPt = outrec.pts!;\r\n let op2: OutPt | undefined = startOp;\r\n for (; ;) {\r\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\r\n if (InternalClipper.crossProduct(op2!.prev.pt, op2!.pt, op2!.next!.pt) === 0 &&\r\n (op2!.pt === op2!.prev.pt || op2!.pt === op2!.next!.pt || !this.preserveCollinear ||\r\n InternalClipper.dotProduct(op2!.prev.pt, op2!.pt, op2!.next!.pt) < 0)) {\r\n\r\n if (op2 === outrec.pts) {\r\n outrec.pts = op2!.prev;\r\n }\r\n\r\n op2 = ClipperBase.disposeOutPt(op2!);\r\n if (!ClipperBase.isValidClosedPath(op2)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n startOp = op2!;\r\n continue;\r\n }\r\n op2 = op2!.next;\r\n if (op2 === startOp) break;\r\n }\r\n this.fixSelfIntersects(outrec);\r\n }\r\n\r\n private doSplitOp(outrec: OutRec, splitOp: OutPt): void {\r\n // splitOp.prev <=> splitOp &&\r\n // splitOp.next <=> splitOp.next.next are intersecting\r\n const prevOp: OutPt = splitOp.prev;\r\n const nextNextOp: OutPt = splitOp.next!.next!;\r\n outrec.pts = prevOp;\r\n\r\n const ip: IPoint64 = InternalClipper.getIntersectPoint(\r\n prevOp.pt, splitOp.pt, splitOp.next!.pt, nextNextOp.pt).ip;\r\n\r\n const area1: number = ClipperBase.area(prevOp);\r\n const absArea1: number = Math.abs(area1);\r\n\r\n if (absArea1 < 2) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n\r\n const area2: number = ClipperBase.areaTriangle(ip, splitOp.pt, splitOp.next!.pt);\r\n const absArea2: number = Math.abs(area2);\r\n\r\n // de-link splitOp and splitOp.next from the path\r\n // while inserting the intersection point\r\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\r\n nextNextOp.prev = prevOp;\r\n prevOp.next = nextNextOp;\r\n } else {\r\n const newOp2 = new OutPt(ip, outrec);\r\n newOp2.prev = prevOp;\r\n newOp2.next = nextNextOp;\r\n nextNextOp.prev = newOp2;\r\n prevOp.next = newOp2;\r\n }\r\n\r\n // nb: area1 is the path's area *before* splitting, whereas area2 is\r\n // the area of the triangle containing splitOp & splitOp.next.\r\n // So the only way for these areas to have the same sign is if\r\n // the split triangle is larger than the path containing prevOp or\r\n // if there's more than one self=intersection.\r\n if (absArea2 > 1 &&\r\n (absArea2 > absArea1 || (area2 > 0) === (area1 > 0))) {\r\n\r\n const newOutRec: OutRec = this.newOutRec();\r\n newOutRec.owner = outrec.owner;\r\n splitOp.outrec = newOutRec;\r\n splitOp.next!.outrec = newOutRec;\r\n\r\n const newOp: OutPt = new OutPt(ip, newOutRec);\r\n newOp.prev = splitOp.next!;\r\n newOp.next = splitOp;\r\n newOutRec.pts = newOp;\r\n splitOp.prev = newOp;\r\n splitOp.next!.next = newOp;\r\n\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(prevOp, newOp)) {\r\n newOutRec.splits = newOutRec.splits || [];\r\n newOutRec.splits.push(outrec.idx);\r\n } else {\r\n outrec.splits = outrec.splits || [];\r\n outrec.splits.push(newOutRec.idx);\r\n }\r\n }\r\n }\r\n // else { splitOp = undefined; splitOp.next = undefined; }\r\n }\r\n\r\n private fixSelfIntersects(outrec: OutRec): void {\r\n let op2: OutPt = outrec.pts!;\r\n for (; ;) {\r\n if (op2.prev === op2.next!.next) break;\r\n if (InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next!.pt, op2.next!.next!.pt)) {\r\n this.doSplitOp(outrec, op2);\r\n if (!outrec.pts) return;\r\n op2 = outrec.pts;\r\n continue;\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n if (op2 === outrec.pts) break;\r\n }\r\n }\r\n\r\n static buildPath(op: OutPt | undefined, reverse: boolean, isOpen: boolean, path: Path64): boolean {\r\n if (op === undefined || op.next === op || (!isOpen && op.next === op.prev)) return false;\r\n path.length = 0\r\n\r\n let lastPt: IPoint64;\r\n let op2: OutPt;\r\n if (reverse) {\r\n lastPt = op.pt;\r\n op2 = op.prev;\r\n } else {\r\n op = op.next!;\r\n lastPt = op.pt;\r\n op2 = op.next!;\r\n }\r\n path.push(lastPt);\r\n\r\n while (op2 !== op) {\r\n if (op2.pt !== lastPt) {\r\n lastPt = op2.pt;\r\n path.push(lastPt);\r\n }\r\n if (reverse) {\r\n op2 = op2.prev;\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n if (path.length === 3 && this.isVerySmallTriangle(op2)) return false;\r\n else return true;\r\n }\r\n\r\n protected buildPaths(solutionClosed: Paths64, solutionOpen: Paths64): boolean {\r\n solutionClosed.length = 0\r\n solutionOpen.length = 0\r\n\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (!outrec.pts) continue;\r\n\r\n const path = new Path64();\r\n if (outrec.isOpen) {\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, path)) {\r\n solutionOpen.push(path);\r\n }\r\n } else {\r\n this.cleanCollinear(outrec);\r\n // closed paths should always return a Positive orientation\r\n // except when reverseSolution == true\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, path)) {\r\n solutionClosed.push(path);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n private static getBoundsPath(path: Path64): Rect64 {\r\n if (path.length === 0) return new Rect64();\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n return result;\r\n }\r\n\r\n private checkBounds(outrec: OutRec): boolean {\r\n if (outrec.pts === undefined) return false;\r\n if (!outrec.bounds.isEmpty()) return true;\r\n this.cleanCollinear(outrec);\r\n if (outrec.pts === undefined || !ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, outrec.path))\r\n return false;\r\n outrec.bounds = ClipperBase.getBoundsPath(outrec.path);\r\n return true;\r\n }\r\n\r\n private checkSplitOwner(outrec: OutRec, splits: number[] | undefined): boolean {\r\n for (const i of splits!) {\r\n const split: OutRec | undefined = ClipperBase.getRealOutRec(this._outrecList[i]);\r\n if (split === undefined || split === outrec || split.recursiveSplit === outrec) continue;\r\n split.recursiveSplit = outrec; //#599\r\n if (split!.splits !== undefined && this.checkSplitOwner(outrec, split.splits)) return true;\r\n if (ClipperBase.isValidOwner(outrec, split) &&\r\n this.checkBounds(split) &&\r\n split.bounds.containsRect(outrec.bounds) &&\r\n ClipperBase.path1InsidePath2(outrec.pts!, split.pts!)) {\r\n outrec.owner = split; //found in split\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private recursiveCheckOwners(outrec: OutRec, polypath: PolyPathBase): void {\r\n // pre-condition: outrec will have valid bounds\r\n // post-condition: if a valid path, outrec will have a polypath\r\n\r\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty()) return;\r\n\r\n while (outrec.owner !== undefined) {\r\n if (outrec.owner.splits !== undefined &&\r\n this.checkSplitOwner(outrec, outrec.owner.splits)) break;\r\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) &&\r\n ClipperBase.path1InsidePath2(outrec.pts!, outrec.owner.pts!)) break;\r\n outrec.owner = outrec.owner.owner;\r\n }\r\n\r\n if (outrec.owner !== undefined) {\r\n if (outrec.owner.polypath === undefined)\r\n this.recursiveCheckOwners(outrec.owner, polypath);\r\n outrec.polypath = outrec.owner.polypath!.addChild(outrec.path);\r\n } else {\r\n outrec.polypath = polypath.addChild(outrec.path);\r\n }\r\n }\r\n\r\n protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {\r\n polytree.clear();\r\n solutionOpen.length = 0\r\n\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec: OutRec = this._outrecList[i++];\r\n if (outrec.pts === undefined) continue;\r\n\r\n if (outrec.isOpen) {\r\n const open_path = new Path64();\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, open_path))\r\n solutionOpen.push(open_path);\r\n continue;\r\n }\r\n if (this.checkBounds(outrec))\r\n this.recursiveCheckOwners(outrec, polytree);\r\n }\r\n }\r\n\r\n public getBounds(): Rect64 {\r\n const bounds = Clipper.InvalidRect64;\r\n for (const t of this._vertexList) {\r\n let v = t;\r\n do {\r\n if (v.pt.x < bounds.left) bounds.left = v.pt.x;\r\n if (v.pt.x > bounds.right) bounds.right = v.pt.x;\r\n if (v.pt.y < bounds.top) bounds.top = v.pt.y;\r\n if (v.pt.y > bounds.bottom) bounds.bottom = v.pt.y;\r\n v = v.next!;\r\n } while (v !== t);\r\n }\r\n return bounds.isEmpty() ? new Rect64(0, 0, 0, 0) : bounds;\r\n }\r\n\r\n}\r\n\r\n\r\nexport class Clipper64 extends ClipperBase {\r\n\r\n override addPath(path: Path64, polytype: PathType, isOpen: boolean = false): void {\r\n super.addPath(path, polytype, isOpen);\r\n }\r\n\r\n addReusableData(reusableData: ReuseableDataContainer64): void {\r\n super.addReuseableData(reusableData);\r\n }\r\n\r\n override addPaths(paths: Paths64, polytype: PathType, isOpen: boolean = false): void {\r\n super.addPaths(paths, polytype, isOpen);\r\n }\r\n\r\n addSubjectPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Subject);\r\n }\r\n\r\n addOpenSubjectPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Subject, true);\r\n }\r\n\r\n addClipPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Clip);\r\n }\r\n\r\n execute(clipType: ClipType, fillRule: FillRule, solutionClosed: Paths64, solutionOpen = new Paths64()): boolean {\r\n solutionClosed.length = 0\r\n solutionOpen.length = 0\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildPaths(solutionClosed, solutionOpen);\r\n } catch (error) {\r\n this._succeeded = false;\r\n }\r\n\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n\r\n\r\n executePolyTree(clipType: ClipType, fillRule: FillRule, polytree: PolyTree64, openPaths = new Paths64()): boolean {\r\n polytree.clear();\r\n openPaths.length = 0\r\n this._using_polytree = true;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildTree(polytree, openPaths);\r\n } catch (error) {\r\n this._succeeded = false;\r\n }\r\n\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n\r\n}\r\n\r\nexport abstract class PolyPathBase {\r\n protected _parent?: PolyPathBase;\r\n children: Array = [];\r\n public polygon?: Path64;\r\n\r\n get isHole(): boolean {\r\n return this.getIsHole();\r\n }\r\n\r\n constructor(parent?: PolyPathBase) {\r\n this._parent = parent;\r\n }\r\n\r\n private getLevel(): number {\r\n let result = 0;\r\n let pp: PolyPathBase | undefined = this._parent;\r\n while (pp !== undefined) {\r\n ++result;\r\n pp = pp._parent;\r\n }\r\n return result;\r\n }\r\n\r\n get level(): number {\r\n return this.getLevel();\r\n }\r\n\r\n private getIsHole(): boolean {\r\n const lvl = this.getLevel();\r\n return lvl !== 0 && (lvl & 1) === 0;\r\n }\r\n\r\n get count(): number {\r\n return this.children.length;\r\n }\r\n\r\n abstract addChild(p: Path64): PolyPathBase;\r\n\r\n clear(): void {\r\n this.children.length = 0\r\n }\r\n\r\n forEach = this.children.forEach\r\n\r\n} // end of PolyPathBase class\r\n\r\nexport class PolyPath64 extends PolyPathBase {\r\n\r\n constructor(parent?: PolyPathBase) {\r\n super(parent);\r\n }\r\n\r\n addChild(p: Path64): PolyPathBase {\r\n const newChild = new PolyPath64(this);\r\n (newChild as PolyPath64).polygon = p;\r\n this.children.push(newChild);\r\n return newChild;\r\n }\r\n\r\n get(index: number): PolyPath64 {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index] as PolyPath64;\r\n }\r\n\r\n child(index: number): PolyPath64 {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index] as PolyPath64;\r\n }\r\n\r\n area(): number {\r\n let result = this.polygon ? Clipper.area(this.polygon) : 0;\r\n for (const polyPathBase of this.children) {\r\n const child = polyPathBase as PolyPath64;\r\n result += child.area();\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n\r\nexport class PolyTree64 extends PolyPath64 { }\r\n\r\n\r\nexport class ClipperLibException extends Error {\r\n constructor(description: string) {\r\n super(description);\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\nimport { PointInPolygonResult } from \"./engine\";\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\n// Note: all clipping operations except for Difference are commutative.\r\nexport enum ClipType {\r\n None,\r\n Intersection,\r\n Union,\r\n Difference,\r\n Xor\r\n}\r\n\r\nexport enum PathType {\r\n Subject,\r\n Clip\r\n}\r\n\r\n// By far the most widely used filling rules for polygons are EvenOdd\r\n// and NonZero, sometimes called Alternate and Winding respectively.\r\n// https://en.wikipedia.org/wiki/Nonzero-rule\r\nexport enum FillRule {\r\n EvenOdd,\r\n NonZero,\r\n Positive,\r\n Negative\r\n}\r\n\r\n// PointInPolygon\r\nexport enum PipResult {\r\n Inside,\r\n Outside,\r\n OnEdge\r\n}\r\n\r\nexport interface IPoint64 {\r\n x: number;\r\n y: number;\r\n}\r\n\r\nexport class Path64 extends Array { }\r\n\r\nexport class Paths64 extends Array { }\r\n\r\n\r\n\r\nexport class Rect64 {\r\n public left: number;\r\n public top: number;\r\n public right: number;\r\n public bottom: number;\r\n\r\n constructor(lOrIsValidOrRec?: number | boolean | Rect64, t?: number, r?: number, b?: number) {\r\n if (typeof lOrIsValidOrRec === 'boolean') {\r\n if (lOrIsValidOrRec) {\r\n this.left = 0;\r\n this.top = 0;\r\n this.right = 0;\r\n this.bottom = 0;\r\n } else {\r\n this.left = Number.MAX_SAFE_INTEGER;\r\n this.top = Number.MAX_SAFE_INTEGER;\r\n this.right = Number.MIN_SAFE_INTEGER;\r\n this.bottom = Number.MIN_SAFE_INTEGER;\r\n }\r\n } else if (typeof lOrIsValidOrRec === 'number') {\r\n this.left = lOrIsValidOrRec;\r\n this.top = t as number;\r\n this.right = r as number;\r\n this.bottom = b as number;\r\n } else {\r\n this.left = lOrIsValidOrRec!.left;\r\n this.top = lOrIsValidOrRec!.top;\r\n this.right = lOrIsValidOrRec!.right;\r\n this.bottom = lOrIsValidOrRec!.bottom;\r\n }\r\n }\r\n\r\n public get width(): number {\r\n return this.right - this.left;\r\n }\r\n\r\n public set width(value: number) {\r\n this.right = this.left + value;\r\n }\r\n\r\n public get height(): number {\r\n return this.bottom - this.top;\r\n }\r\n\r\n public set height(value: number) {\r\n this.bottom = this.top + value;\r\n }\r\n\r\n public isEmpty(): boolean {\r\n return this.bottom <= this.top || this.right <= this.left;\r\n }\r\n\r\n public midPoint(): Point64 {\r\n return new Point64((this.left + this.right) / 2, (this.top + this.bottom) / 2);\r\n }\r\n\r\n public contains(pt: IPoint64): boolean {\r\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\r\n }\r\n\r\n public containsRect(rec: Rect64): boolean {\r\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\r\n }\r\n\r\n public intersects(rec: Rect64): boolean {\r\n return (Math.max(this.left, rec.left) <= Math.min(this.right, rec.right)) &&\r\n (Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom));\r\n }\r\n\r\n public asPath(): Path64 {\r\n const result = new Path64();\r\n result.push(new Point64(this.left, this.top));\r\n result.push(new Point64(this.right, this.top));\r\n result.push(new Point64(this.right, this.bottom));\r\n result.push(new Point64(this.left, this.bottom));\r\n return result;\r\n }\r\n}\r\n\r\n\r\n\r\n\r\nexport class Point64 implements IPoint64 {\r\n public x: number;\r\n public y: number;\r\n\r\n constructor(xOrPt?: number | Point64, yOrScale?: number) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = Math.round(xOrPt);\r\n this.y = Math.round(yOrScale);\r\n } else {\r\n const pt = xOrPt as Point64\r\n if (yOrScale !== undefined) {\r\n this.x = Math.round(pt.x * yOrScale);\r\n this.y = Math.round(pt.y * yOrScale);\r\n } else {\r\n this.x = pt.x;\r\n this.y = pt.y;\r\n }\r\n //} else {\r\n // const pt = xOrPt as Point64\r\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\r\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\r\n }\r\n }\r\n\r\n public static equals(lhs: Point64, rhs: Point64): boolean {\r\n return lhs.x === rhs.x && lhs.y === rhs.y;\r\n }\r\n\r\n public static notEquals(lhs: Point64, rhs: Point64): boolean {\r\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\r\n }\r\n\r\n public static add(lhs: Point64, rhs: Point64): Point64 {\r\n return new Point64(lhs.x + rhs.x, lhs.y + rhs.y);\r\n }\r\n\r\n public static subtract(lhs: Point64, rhs: Point64): Point64 {\r\n return new Point64(lhs.x - rhs.x, lhs.y - rhs.y);\r\n }\r\n\r\n public toString(): string {\r\n return `${this.x},${this.y} `;\r\n }\r\n\r\n public equals(obj: Point64): boolean {\r\n if (obj instanceof Point64) {\r\n return Point64.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n\r\n // public getHashCode(): number {\r\n // return this.X ^ this.Y; // Simple XOR-based hash combination. Adjust if needed.\r\n // }\r\n}\r\n\r\nexport class InternalClipper {\r\n static readonly MaxInt64: number = 9223372036854775807;\r\n static readonly MaxCoord: number = InternalClipper.MaxInt64 / 4;\r\n static readonly max_coord: number = InternalClipper.MaxCoord;\r\n static readonly min_coord: number = -InternalClipper.MaxCoord;\r\n static readonly Invalid64: number = InternalClipper.MaxInt64;\r\n\r\n static readonly defaultArcTolerance: number = 0.25;\r\n static readonly floatingPointTolerance: number = 1E-12;\r\n static readonly defaultMinimumEdgeLength: number = 0.1;\r\n\r\n private static readonly precision_range_error: string = \"Error: Precision is out of range.\";\r\n\r\n static checkPrecision(precision: number): void {\r\n if (precision < -8 || precision > 8)\r\n throw new Error(this.precision_range_error);\r\n }\r\n\r\n static isAlmostZero(value: number): boolean {\r\n return (Math.abs(value) <= this.floatingPointTolerance);\r\n }\r\n\r\n static crossProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return ((pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x));\r\n }\r\n\r\n static dotProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return ((pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y));\r\n }\r\n\r\n static checkCastInt64(val: number): number {\r\n if ((val >= this.max_coord) || (val <= this.min_coord)) return this.Invalid64;\r\n return Math.round(val);\r\n }\r\n\r\n\r\n public static getIntersectPt(ln1a: IPoint64, ln1b: IPoint64, ln2a: IPoint64, ln2b: IPoint64): { ip: IPoint64, success: boolean } {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n\r\n let ip: IPoint64;\r\n\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0) ip = ln1a;\r\n else if (t >= 1.0) ip = ln1b;\r\n else ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n\r\n public static getIntersectPoint(ln1a: IPoint64, ln1b: IPoint64, ln2a: IPoint64, ln2b: IPoint64): { ip: IPoint64, success: boolean } {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n\r\n let ip: IPoint64;\r\n\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0) ip = ln1a;\r\n else if (t >= 1.0) ip = ln2a;\r\n else ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n\r\n public static segsIntersect(seg1a: IPoint64, seg1b: IPoint64, seg2a: IPoint64, seg2b: IPoint64, inclusive: boolean = false): boolean {\r\n if (inclusive) {\r\n const res1 = InternalClipper.crossProduct(seg1a, seg2a, seg2b);\r\n const res2 = InternalClipper.crossProduct(seg1b, seg2a, seg2b);\r\n if (res1 * res2 > 0) return false;\r\n const res3 = InternalClipper.crossProduct(seg2a, seg1a, seg1b);\r\n const res4 = InternalClipper.crossProduct(seg2b, seg1a, seg1b);\r\n if (res3 * res4 > 0) return false;\r\n return (res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0);\r\n } else {\r\n return (InternalClipper.crossProduct(seg1a, seg2a, seg2b) * InternalClipper.crossProduct(seg1b, seg2a, seg2b) < 0) &&\r\n (InternalClipper.crossProduct(seg2a, seg1a, seg1b) * InternalClipper.crossProduct(seg2b, seg1a, seg1b) < 0);\r\n }\r\n }\r\n\r\n public static getClosestPtOnSegment(offPt: IPoint64, seg1: IPoint64, seg2: IPoint64): IPoint64 {\r\n if (seg1.x === seg2.x && seg1.y === seg2.y) return seg1;\r\n const dx = seg2.x - seg1.x;\r\n const dy = seg2.y - seg1.y;\r\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / ((dx * dx) + (dy * dy));\r\n if (q < 0) q = 0; else if (q > 1) q = 1;\r\n return new Point64(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\r\n }\r\n\r\n public static pointInPolygon(pt: IPoint64, polygon: Path64): PointInPolygonResult {\r\n const len = polygon.length;\r\n let start = 0;\r\n\r\n if (len < 3) return PointInPolygonResult.IsOutside;\r\n\r\n while (start < len && polygon[start].y === pt.y) start++;\r\n if (start === len) return PointInPolygonResult.IsOutside;\r\n\r\n let d: number = 0;\r\n let isAbove = polygon[start].y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n let i = start + 1;\r\n let end = len;\r\n\r\n for (; ;) {\r\n if (i === end) {\r\n if (end === 0 || start === 0) break;\r\n end = start;\r\n i = 0;\r\n }\r\n\r\n if (isAbove) {\r\n while (i < end && polygon[i].y < pt.y) i++;\r\n if (i === end) continue;\r\n } else {\r\n while (i < end && polygon[i].y > pt.y) i++;\r\n if (i === end) continue;\r\n }\r\n\r\n const curr = polygon[i];\r\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\r\n\r\n if (curr.y === pt.y) {\r\n if (curr.x === pt.x || (curr.y === prev.y && (pt.x < prev.x !== pt.x < curr.x))) return PointInPolygonResult.IsOn;\r\n i++;\r\n if (i === start) break;\r\n continue;\r\n }\r\n\r\n if (pt.x < curr.x && pt.x < prev.x) {\r\n // we're only interested in edges crossing on the left\r\n } else if (pt.x > prev.x && pt.x > curr.x) {\r\n val = 1 - val; // toggle val\r\n } else {\r\n d = InternalClipper.crossProduct(prev, curr, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n isAbove = !isAbove;\r\n i++;\r\n }\r\n\r\n if (isAbove !== startingAbove) {\r\n if (i === len) i = 0;\r\n else d = InternalClipper.crossProduct(polygon[i - 1], polygon[i], pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n\r\n if (val === 0) return PointInPolygonResult.IsOutside;\r\n return PointInPolygonResult.IsInside;\r\n }\r\n}\r\n","/*\n * Public API Surface of clipper2-js\n */\n\nexport * from './lib/core';\nexport * from './lib/clipper';\nexport * from './lib/engine';\nexport * from './lib/minkowski';\nexport * from './lib/offset';\nexport * from './lib/rectclip';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n","const DIRECTION_EPSILON = 1e-3;\nconst DIST_EPSILON = 1e2;\n\nfunction sameDirection( p0, p1, p2 ) {\n\n\tconst dx1 = p1.x - p0.x;\n\tconst dy1 = p1.y - p0.y;\n\n\tconst dx2 = p2.x - p1.x;\n\tconst dy2 = p2.y - p1.y;\n\n\tconst s1 = dx1 / dy1;\n\tconst s2 = dx2 / dy2;\n\n\treturn Math.abs( s1 - s2 ) < DIRECTION_EPSILON;\n\n}\n\nfunction areClose( p0, p1 ) {\n\n\tconst dx = p1.x - p0.x;\n\tconst dy = p1.y - p0.y;\n\treturn Math.sqrt( dx * dx + dy * dy ) < DIST_EPSILON;\n\n}\n\nfunction areEqual( p0, p1 ) {\n\n\treturn p0.x === p1.x && p0.y === p1.y;\n\n}\n\nexport function compressPoints( points ) {\n\n\tfor ( let k = 0; k < points.length; k ++ ) {\n\n\t\t// remove points that are equal or very close to each other\n\t\tconst v = points[ k ];\n\t\twhile ( true ) {\n\n\t\t\tconst k1 = k + 1;\n\t\t\tif (\n\t\t\t\tpoints.length > k1 &&\n\t\t\t\t(\n\t\t\t\t\tareEqual( v, points[ k1 ] ) ||\n\t\t\t\t\tareClose( v, points[ k1 ] )\n\t\t\t\t)\n\t\t\t) {\n\n\t\t\t\tpoints.splice( k1, 1 );\n\n\t\t\t} else {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\n\t\t}\n\n\t\t// join lines that are almost the same direction\n\t\twhile ( true ) {\n\n\t\t\tconst k1 = k + 1;\n\t\t\tconst k2 = k + 2;\n\t\t\tif (\n\t\t\t\tpoints.length > k2 &&\n\t\t\t\tsameDirection( v, points[ k1 ], points[ k2 ] )\n\t\t\t) {\n\n\t\t\t\tpoints.splice( k + 1, 1 );\n\n\t\t\t} else {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n","import { Line3, Ray } from 'three';\n\nfunction xzToXzCopy( v, target ) {\n\n\ttarget.x = v.x;\n\ttarget.y = v.z;\n\n}\n\nfunction epsEquals( a, b ) {\n\n\treturn Math.abs( a - b ) <= 500;\n\n}\n\nfunction vectorEpsEquals( v0, v1 ) {\n\n\treturn epsEquals( v0.x, v1.x ) &&\n\t\tepsEquals( v0.y, v1.y ) &&\n\t\tepsEquals( v0.z, v1.z );\n\n}\n\nexport function triangleIsInsidePaths( tri, paths ) {\n\n\tconst indices = [ 'a', 'b', 'c' ];\n\tconst edges = [ new Line3(), new Line3(), new Line3() ];\n\tconst line = new Line3();\n\tconst ray = new Line3();\n\tray.start\n\t\t.set( 0, 0, 0 )\n\t\t.addScaledVector( tri.a, 1 / 3 )\n\t\t.addScaledVector( tri.b, 1 / 3 )\n\t\t.addScaledVector( tri.c, 1 / 3 );\n\n\txzToXzCopy( ray.start, ray.start );\n\tray.end.copy( ray.start );\n\tray.end.y += 1e10;\n\n\t// get all triangle edges\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst i1 = ( i + 1 ) % 3;\n\t\tconst p0 = tri[ indices[ i ] ];\n\t\tconst p1 = tri[ indices[ i1 ] ];\n\n\t\tconst edge = edges[ i ];\n\t\txzToXzCopy( p0, edge.start );\n\t\txzToXzCopy( p1, edge.end );\n\n\t}\n\n\tlet crossCount = 0;\n\tfor ( let p = 0, pl = paths.length; p < pl; p ++ ) {\n\n\t\tconst points = paths[ p ];\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst i1 = ( i + 1 ) % l;\n\t\t\tline.start.copy( points[ i ] );\n\t\t\tline.start.z = 0;\n\n\t\t\tline.end.copy( points[ i1 ] );\n\t\t\tline.end.z = 0;\n\n\t\t\tif ( lineCrossesLine( ray, line ) ) {\n\n\t\t\t\tcrossCount ++;\n\n\t\t\t}\n\n\t\t\tfor ( let e = 0; e < 3; e ++ ) {\n\n\t\t\t\tconst edge = edges[ e ];\n\t\t\t\tif (\n\t\t\t\t\tlineCrossesLine( edge, line ) ||\n\t\t\t\t\tvectorEpsEquals( edge.start, line.start ) ||\n\t\t\t\t\tvectorEpsEquals( edge.end, line.end ) ||\n\t\t\t\t\tvectorEpsEquals( edge.end, line.start ) ||\n\t\t\t\t\tvectorEpsEquals( edge.start, line.end )\n\t\t\t\t) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn crossCount % 2 === 1;\n\n}\n\n// https://stackoverflow.com/questions/3838329/how-can-i-check-if-two-segments-intersect\nfunction lineCrossesLine( l1, l2 ) {\n\n\tfunction ccw( A, B, C ) {\n\n\t\treturn ( C.y - A.y ) * ( B.x - A.x ) > ( B.y - A.y ) * ( C.x - A.x );\n\n\t}\n\n\tconst A = l1.start;\n\tconst B = l1.end;\n\n\tconst C = l2.start;\n\tconst D = l2.end;\n\n\treturn ccw( A, C, D ) !== ccw( B, C, D ) && ccw( A, B, C ) !== ccw( A, B, D );\n\n}\n","import { Triangle } from 'three';\nimport { getTriCount } from './geometryUtils.js';\n\nconst _tri = new Triangle();\nexport function getSizeSortedTriList( geometry ) {\n\n\tconst index = geometry.index;\n\tconst posAttr = geometry.attributes.position;\n\tconst triCount = getTriCount( geometry );\n\n\treturn new Array( triCount )\n\t\t.fill()\n\t\t.map( ( v, i ) => {\n\n\t\t\tlet i0 = i * 3 + 0;\n\t\t\tlet i1 = i * 3 + 1;\n\t\t\tlet i2 = i * 3 + 2;\n\t\t\tif ( index ) {\n\n\t\t\t\ti0 = index.getX( i0 );\n\t\t\t\ti1 = index.getX( i1 );\n\t\t\t\ti2 = index.getX( i2 );\n\n\t\t\t}\n\n\t\t\t_tri.a.fromBufferAttribute( posAttr, i0 );\n\t\t\t_tri.b.fromBufferAttribute( posAttr, i1 );\n\t\t\t_tri.c.fromBufferAttribute( posAttr, i2 );\n\n\t\t\t_tri.a.y = 0;\n\t\t\t_tri.b.y = 0;\n\t\t\t_tri.c.y = 0;\n\n\t\t\t// get the projected area of the triangle to sort largest triangles first\n\t\t\treturn {\n\t\t\t\tarea: _tri.getArea(),\n\t\t\t\tindex: i,\n\t\t\t};\n\n\t\t} )\n\t\t.sort( ( a, b ) => {\n\n\t\t\t// sort the triangles largest to smallest\n\t\t\treturn b.area - a.area;\n\n\t\t} )\n\t\t.map( o => {\n\n\t\t\t// map to the triangle index\n\t\t\treturn o.index;\n\n\t\t} );\n\n}\n","export function getTriCount( geometry ) {\n\n\tconst { index } = geometry;\n\tconst posAttr = geometry.attributes.position;\n\treturn index ? index.count / 3 : posAttr.count / 3;\n\n}\n"],"names":["JoinType","EndType","Location","PointInPolygonResult","VertexFlags","JoinWith","HorzPosition","ClipType","PathType","FillRule","PipResult","$0b6dbf71c0c0eea1$export$738d8b3921c27063","$0b6dbf71c0c0eea1$export$38f58f6965412d86","$0b6dbf71c0c0eea1$var$Location","$0b6dbf71c0c0eea1$export$20896d302a4e5029","$0b6dbf71c0c0eea1$export$6bbe4490a892c1c5","$0b6dbf71c0c0eea1$export$290b84559c467a5c","$0b6dbf71c0c0eea1$export$c8278727b7a5228b","$0b6dbf71c0c0eea1$export$9e3ecdefb2438757","$0b6dbf71c0c0eea1$export$1ede5f4f7cadbc19","$0b6dbf71c0c0eea1$export$f26b42c94e8a4f95","$0b6dbf71c0c0eea1$export$6a3f4acf2fce52a0","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","importScripts","$e06gU","$0b6dbf71c0c0eea1$export$d7b4df78e16216b1","minkowskiInternal","pattern","path","isSum","isClosed","delta","patLen","length","pathLen","tmp","pathPt","path2","basePt","push","x","y","result","g","h","i","j","quad","$0b6dbf71c0c0eea1$export$47d6d5d06ccbc908","isPositive","reversePath","sum","Union","undefined","NonZero","diff","$0b6dbf71c0c0eea1$var$Group","constructor","paths","joinType","endType","Polygon","inPaths","outPath","outPaths","pathsReversed","$0b6dbf71c0c0eea1$export$f7b22d527d83f4ad","xOrPt","yOrScale","toString","precision","toFixed","equals","lhs","rhs","$0b6dbf71c0c0eea1$export$9bad362b29d84293","isAlmostZero","notEquals","obj","negate","$0b6dbf71c0c0eea1$export$8cbc02e4273c0b24","miterLimit","arcTolerance","preserveCollinear","reverseSolution","_groupList","_normals","_solution","MiterLimit","ArcTolerance","MergeGroups","PreserveCollinear","ReverseSolution","clear","addPath","pp","addPaths","executeInternal","Math","abs","group","_delta","_mitLimSqr","sqr","doGroupOffset","value","execute","solution","c","$0b6dbf71c0c0eea1$export$389255fe4ace408b","addSubjectPaths","Negative","Positive","executePolytree","polytree","executePolyTree","getUnitNormal","pt1","pt2","dx","dy","f","sqrt","executeCallback","deltaCallback","DeltaCallback","getBoundsAndLowestPolyIdx","rec","$0b6dbf71c0c0eea1$export$e7ab2e89a2fb5a6f","lpX","Number","MIN_SAFE_INTEGER","index","pt","bottom","top","right","left","translatePoint","reflectPoint","pivot","almostZero","epsilon","hypotenuse","pow","normalizeVector","vec","inverseHypot","getAvgUnitVector","vec1","vec2","intersectPoint","pt1a","pt1b","pt2a","pt2b","m2","b2","m1","b1","getPerpendic","norm","$0b6dbf71c0c0eea1$export$d379afd9763b528f","_groupDelta","getPerpendicD","doSquare","k","absDelta","ptQ","pt3","pt4","doMiter","cosA","q","doRound","angle","arcTol","log10","defaultArcTolerance","stepsPer360","PI","acos","_stepSin","sin","_stepCos","cos","_stepsPerRad","offsetVec","steps","ceil","buildNormals","cnt","crossProduct","dotProduct","offsetPoint","sinA","Tolerance","_joinType","Miter","Square","atan2","offsetPolygon","area","rect","getBounds","width","prev","offsetOpenJoined","offsetOpenPath","highI","_endType","Butt","Round","isJoined","Joined","p","stripDuplicates","ellipse","d","r","asPath","$0b6dbf71c0c0eea1$export$a6dea2fac1e0b407","ownerIdx","$0b6dbf71c0c0eea1$export$ada4127871f05d7b","currIdx","mp","midPoint","rectPath","results","edges","Array","fill","map","add","startingNewPath","next","prevOp","path1ContainsPath2","path1","ioCount","pip","pointInPolygon","IsInside","IsOutside","isClockwise","curr","prevPt","currPt","rectMidPoint","areOpposites","headingClockwise","getAdjacentLocation","loc","unlinkOp","op","unlinkOpBack","getEdgesForPt","isHeadingClockwise","edgeIdx","hasHorzOverlap","left1","right1","left2","right2","hasVertOverlap","top1","bottom1","top2","bottom2","addToEdge","edge","uncoupleEdge","op2","setNewOwner","newIdx","addCorner","addCornerByRef","getLocation","success","inside","getIntersection","p2","ip","segsIntersect","getIntersectPt","getNextLocation","context","isEmpty","startLocs","firstCross","crossingLoc","startingLoc","prevCrossLoc","isClockw","ip2","pathBounds","containsRect","loc2","intersects","checkEdges","tidyEdgePair","getPath","edgeSet1","edgeSet2","combinedSet","idx","cw","ccw","p1","p1a","p2a","isHorz","cwIsTowardLarger","opIsLarger","op2IsLarger","jLim","isRejoining","new_idx","$0b6dbf71c0c0eea1$export$b12670b10302a8b7","$0b6dbf71c0c0eea1$export$b1d67b8e0b9a10d2","$0b6dbf71c0c0eea1$export$3a7c4895ca9e3ca9","InvalidRect64","invalidRect64","Intersect","subject","clip","fillRule","BooleanOp","Intersection","EvenOdd","Difference","Xor","clipType","Subject","Clip","InflatePaths","co","RectClipPaths","rc","RectClip","RectClipLinesPaths","RectClipLines","MinkowskiSum","MinkowskiDiff","a","areaPaths","poly","path64ToString","paths64ToString","offsetPath","scalePoint64","scale","round","scalePath","scalePaths","translatePath","translatePaths","reverse","reversePaths","t","MAX_SAFE_INTEGER","getBoundsPaths","makePath","arr","len","isClosedPath","lastPt","pop","addPolyNodeToPaths","polyPath","polygon","count","children","polyTreeToPaths64","polyTree","perpendicDistFromLineSqrd","line1","line2","b","rdp","begin","end","epsSqrd","flags","max_d","ramerDouglasPeucker","ramerDouglasPeuckerPaths","getNext","current","high","getPrior","simplifyPath","start","prior2","next2","epsSqr","dsq","MAX_VALUE","simplifyPaths","isClosedPaths","trimCollinear","isOpen","last","splice","center","radiusX","radiusY","si","showPolyPathStructure","level","spaces","repeat","caption","isHole","console","log","forEach","child","showPolyTreeStructure","$0b6dbf71c0c0eea1$var$Vertex","$0b6dbf71c0c0eea1$var$LocalMinima","vertex","polytype","lm1","lm2","$0b6dbf71c0c0eea1$var$IntersectNode","edge1","edge2","$0b6dbf71c0c0eea1$var$OutPt","outrec","horz","$0b6dbf71c0c0eea1$export$1e0666df669b1ceb","$0b6dbf71c0c0eea1$var$HorzSegment","leftOp","rightOp","leftToRight","$0b6dbf71c0c0eea1$var$HorzJoin","ltor","rtol","op1","$0b6dbf71c0c0eea1$export$c3c7cbf43a3f0561","windCount","windCount2","isLeftBound","joinWith","None","$0b6dbf71c0c0eea1$export$467e9e338ef38141","addLocMin","vert","minimaList","LocalMin","lm","addPathsToVertexList","vertexList","totalVertCnt","v0","prev_v","curr_v","going_up","warn","OpenStart","LocalMax","going_up0","OpenEnd","$0b6dbf71c0c0eea1$var$SimpleNavigableSet","items","pollLast","item","includes","sort","$0b6dbf71c0c0eea1$export$33da2edff2b544f3","_cliptype","_fillrule","_currentLocMin","_currentBotY","_isSortedMinimaList","_hasOpenPaths","_using_polytree","_succeeded","_minimaList","_intersectList","_vertexList","_outrecList","_scanlineList","_horzSegList","_horzJoinList","isOdd","val","isHotEdgeActive","ae","localMin","isOpenEndActive","isOpenEnd","vertexTop","v","getPrevHotEdge","prevInAEL","isFront","frontEdge","getDx","NEGATIVE_INFINITY","POSITIVE_INFINITY","topX","currentY","bot","isHorizontal","isHeadingRightHorz","isHeadingLeftHorz","swapActives","ae1","ae2","getPolyType","isSamePolyType","setDx","nextVertex","windDx","prevPrevVertex","isMaxima","isMaximaActive","getMaximaPair","nextInAEL","getCurrYMaximaVertex_Open","getCurrYMaximaVertex","setSides","startEdge","endEdge","backEdge","swapOutrecs","or1","or2","setOwner","newOwner","owner","pts","areaTriangle","getRealOutRec","outRec","isValidOwner","testOwner","uncoupleOutRec","outrecIsAscending","hotEdge","swapFrontBackSides","edgesAdjacentInAEL","inode","clearSolutionOnly","_actives","deleteFromAEL","disposeIntersectNodes","reset","locMin1","locMin2","_sel","insertScanline","popScanline","hasLocMinAtY","popLocalMinima","addSubject","addOpenSubject","addClip","addReuseableData","reuseableData","isContributingClosed","isContributingOpen","isInClip","isInSubj","setWindCountForClosedPathEdge","setWindCountForOpenPathEdge","cnt1","cnt2","isValidAelOrder","resident","newcomer","curX","newcomerIsLeft","insertLeftEdge","Right","insertRightEdge","insertLocalMinimaIntoAEL","botY","localMinima","leftBound","rightBound","contributing","addLocalMinPoly","checkJoinLeft","intersectEdges","swapPositionsInAEL","pushHorz","checkJoinRight","startOpenPath","nextInSEL","popHorz","isNew","newOutRec","prevHotEdge","addLocalMaxPoly","split","addOutPt","e","joinOutrecPaths","p1Start","p2Start","p1End","p2End","toFront","opFront","opBack","newOp","updateEdgeIntoAEL","findEdgeWithMatchingLocMin","oldE1WindCount","oldE2WindCount","resultOp","ae3","e1WindCountIs0or1","e2WindCountIs0or1","e1Wc2","e2Wc2","adjustCurrXAndCopyToSEL","topY","prevInSEL","jump","Left","ct","doHorizontal","convertHorzSegsToJoins","doIntersections","doTopOfScanbeam","processHorzJoins","buildIntersectList","processIntersectList","addNewIntersectNode","absDx1","absDx2","getClosestPtOnSegment","node","extractFromSEL","res","insert1Before2InSEL","lEnd","rEnd","currBase","prevBase","resetHorzDirection","vertexMax","leftX","rightX","isLeftToRight","horzIsSpike","nextPt","trimHorz","horzEdge","wasTrimmed","addToHorzSegList","getLastOp","horzIsOpen","Y","vertex_max","doMaxima","prevE","nextE","maxPair","checkCurrX","fixOutRecPts","setHorzSegHeadingForward","hs","opP","opN","updateHorzSegment","outrecHasEdges","curr_y","opA","opZ","duplicateOp","insert_after","hs1","hs2","join","getCleanPath","pointInOpPolygon","isAbove","startingAbove","IsOn","path1InsidePath2","outside_cnt","getBoundsPath","moveSplits","fromOr","toOr","splits","op1b","op2b","ptsReallyClose","isVerySmallTriangle","isValidClosedPath","disposeOutPt","cleanCollinear","startOp","fixSelfIntersects","doSplitOp","splitOp","nextNextOp","getIntersectPoint","area1","absArea1","area2","absArea2","newOp2","buildPath","buildPaths","solutionClosed","solutionOpen","checkBounds","bounds","checkSplitOwner","recursiveSplit","recursiveCheckOwners","polypath","addChild","buildTree","open_path","addReusableData","reusableData","addOpenSubjectPaths","addClipPaths","error","openPaths","lOrIsValidOrRec","height","contains","max","min","subtract","checkPrecision","precision_range_error","floatingPointTolerance","checkCastInt64","max_coord","min_coord","Invalid64","ln1a","ln1b","ln2a","ln2b","dy1","dx1","dy2","dx2","det","seg1a","seg1b","seg2a","seg2b","inclusive","res1","res2","res3","res4","offPt","seg1","seg2","$60fc547e70fa748b$var$xzToXzCopy","target","z","$60fc547e70fa748b$var$epsEquals","$60fc547e70fa748b$var$vectorEpsEquals","v1","$60fc547e70fa748b$var$lineCrossesLine","l1","l2","A","B","C","D","MaxInt64","MaxCoord","defaultMinimumEdgeLength","$2683a3650d27fd1c$export$c56c51fae37b2d63","geometry","posAttr","attributes","position","$00d3e1a2b175655e$var$_tri","Triangle","$b7cc2dc72cc279b6$var$UP_VECTOR","Vector3","$b7cc2dc72cc279b6$var$_tri","$b7cc2dc72cc279b6$var$_normal","$b7cc2dc72cc279b6$var$_center","$b7cc2dc72cc279b6$var$_vec","$b7cc2dc72cc279b6$var$convertPathToGeometry","vector2s","points","flatMap","Vector2","holesShapes","filter","ShapeUtils","isClockWise","Shape","solidShapes","shape","holes","ShapeGeometry","rotateX","array","$b7cc2dc72cc279b6$var$convertPathToLineSegments","l","i1","p0","BufferGeometry","setFromPoints","$b7cc2dc72cc279b6$export$8f233aafe78e44af","iterationTime","intScalar","doubleSided","sortTriangles","output","generateAsync","options","Promise","resolve","reject","signal","task","generate","run","aborted","done","requestAnimationFrame","onProgress","power","extendMultiplier","triCount","overallPath","triList","i0","i2","getX","fromBufferAttribute","getArea","o","handle","getGeometry","time","performance","now","ti","getNormal","dot","copy","multiplyScalar","subVectors","normalize","addScaledVector","tri","indices","Line3","line","ray","set","crossCount","pl","k1","$00adfa846be5871c$var$areEqual","$00adfa846be5871c$var$areClose","k2","$00adfa846be5871c$var$sameDirection","s1","progress","onmessage","data","prevTime","buffers","setIndex","BufferAttribute","setAttribute","generator","currTime","postMessage","posArr","indexArr","buffer"],"version":3,"file":"silhouetteAsync.worker.f555f2b4.js.map"} \ No newline at end of file diff --git a/example/bundle/silhouetteProjection.4adac46b.js b/example/bundle/silhouetteProjection.4adac46b.js new file mode 100644 index 0000000..9463c58 --- /dev/null +++ b/example/bundle/silhouetteProjection.4adac46b.js @@ -0,0 +1,187 @@ +function e(e,t,i,n){Object.defineProperty(e,t,{get:i,set:n,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i={},n={},r=t.parcelRequire6c98;null==r&&((r=function(e){if(e in i)return i[e].exports;if(e in n){var t=n[e];delete n[e];var r={id:e,exports:{}};return i[e]=r,t.call(r.exports,r,r.exports),r.exports}var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(e,t){n[e]=t},t.parcelRequire6c98=r),r.register("ilwiq",function(t,i){let n;e(t.exports,"MOUSE",()=>r),e(t.exports,"TOUCH",()=>s),e(t.exports,"FrontSide",()=>a),e(t.exports,"BackSide",()=>o),e(t.exports,"DoubleSide",()=>l),e(t.exports,"RepeatWrapping",()=>h),e(t.exports,"ClampToEdgeWrapping",()=>u),e(t.exports,"MirroredRepeatWrapping",()=>c),e(t.exports,"NearestFilter",()=>d),e(t.exports,"NearestMipmapNearestFilter",()=>p),e(t.exports,"NearestMipmapLinearFilter",()=>f),e(t.exports,"LinearFilter",()=>m),e(t.exports,"LinearMipmapNearestFilter",()=>g),e(t.exports,"LinearMipmapLinearFilter",()=>x),e(t.exports,"InterpolateDiscrete",()=>_),e(t.exports,"InterpolateLinear",()=>v),e(t.exports,"TrianglesDrawMode",()=>y),e(t.exports,"TriangleStripDrawMode",()=>M),e(t.exports,"TriangleFanDrawMode",()=>S),e(t.exports,"SRGBColorSpace",()=>E),e(t.exports,"EventDispatcher",()=>A),e(t.exports,"MathUtils",()=>H),e(t.exports,"Vector2",()=>k),e(t.exports,"Texture",()=>eo),e(t.exports,"Quaternion",()=>ed),e(t.exports,"Vector3",()=>ep),e(t.exports,"Box3",()=>eg),e(t.exports,"Sphere",()=>eN),e(t.exports,"Ray",()=>ek),e(t.exports,"Matrix4",()=>eG),e(t.exports,"Object3D",()=>tr),e(t.exports,"Triangle",()=>tg),e(t.exports,"Material",()=>t_),e(t.exports,"Color",()=>tE),e(t.exports,"MeshBasicMaterial",()=>tT),e(t.exports,"BufferAttribute",()=>tP),e(t.exports,"Float32BufferAttribute",()=>tC),e(t.exports,"BufferGeometry",()=>tz),e(t.exports,"Mesh",()=>t3),e(t.exports,"PerspectiveCamera",()=>ii),e(t.exports,"Plane",()=>iu),e(t.exports,"OrthographicCamera",()=>iP),e(t.exports,"Group",()=>rx),e(t.exports,"WebGLRenderer",()=>rb),e(t.exports,"Scene",()=>rT),e(t.exports,"InterleavedBuffer",()=>rw),e(t.exports,"InterleavedBufferAttribute",()=>rP),e(t.exports,"SkinnedMesh",()=>rF),e(t.exports,"Bone",()=>rz),e(t.exports,"Skeleton",()=>rG),e(t.exports,"InstancedBufferAttribute",()=>rW),e(t.exports,"InstancedMesh",()=>rQ),e(t.exports,"LineBasicMaterial",()=>r$),e(t.exports,"Line",()=>r5),e(t.exports,"LineSegments",()=>r7),e(t.exports,"LineLoop",()=>r9),e(t.exports,"PointsMaterial",()=>se),e(t.exports,"Points",()=>ss),e(t.exports,"Shape",()=>sI),e(t.exports,"ShapeUtils",()=>sJ),e(t.exports,"ShapeGeometry",()=>s3),e(t.exports,"TorusKnotGeometry",()=>s8),e(t.exports,"MeshStandardMaterial",()=>s9),e(t.exports,"MeshPhysicalMaterial",()=>ae),e(t.exports,"Interpolant",()=>aa),e(t.exports,"NumberKeyframeTrack",()=>ap),e(t.exports,"QuaternionKeyframeTrack",()=>am),e(t.exports,"VectorKeyframeTrack",()=>ax),e(t.exports,"AnimationClip",()=>a_),e(t.exports,"Loader",()=>aM),e(t.exports,"FileLoader",()=>ab),e(t.exports,"TextureLoader",()=>aw),e(t.exports,"SpotLight",()=>aO),e(t.exports,"PointLight",()=>aF),e(t.exports,"DirectionalLight",()=>aV),e(t.exports,"AmbientLight",()=>aH),e(t.exports,"LoaderUtils",()=>ak),e(t.exports,"ImageBitmapLoader",()=>aG),e(t.exports,"PropertyBinding",()=>a0),e(t.exports,"Spherical",()=>a1),e(t.exports,"Line3",()=>a4);let r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=0,o=1,l=2,h=1e3,u=1001,c=1002,d=1003,p=1004,f=1005,m=1006,g=1007,x=1008,_=2300,v=2301,y=0,M=1,S=2,E="srgb",b="srgb-linear",T="display-p3",w="300 es";class A{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners,n=i[e];if(void 0!==n){let e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;let t=i.slice(0);for(let i=0,n=t.length;i>8&255]+P[e>>16&255]+P[e>>24&255]+"-"+P[255&t]+P[t>>8&255]+"-"+P[t>>16&15|64]+P[t>>24&255]+"-"+P[63&i|128]+P[i>>8&255]+"-"+P[i>>16&255]+P[i>>24&255]+P[255&n]+P[n>>8&255]+P[n>>16&255]+P[n>>24&255];return r.toLowerCase()}function O(e,t,i){return Math.max(t,Math.min(i,e))}function N(e,t){return(e%t+t)%t}function U(e,t,i){return(1-i)*e+i*t}function D(e){return(e&e-1)==0&&0!==e}function B(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function F(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function z(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function V(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let H={DEG2RAD:L,RAD2DEG:C,generateUUID:I,clamp:O,euclideanModulo:N,mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:U,damp:function(e,t,i,n){return U(e,t,1-Math.exp(-i*n))},pingpong:function(e,t=1){return t-Math.abs(N(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-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())},seededRandom:function(e){void 0!==e&&(R=e);let t=R+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*L},radToDeg:function(e){return e*C},isPowerOfTwo:D,ceilPowerOfTwo:B,floorPowerOfTwo:F,setQuaternionFromProperEuler:function(e,t,i,n,r){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),h=s((t+n)/2),u=a((t+n)/2),c=s((t-n)/2),d=a((t-n)/2),p=s((n-t)/2),f=a((n-t)/2);switch(r){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:V,denormalize:z};class k{constructor(e=0,t=0){k.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(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(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(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(O(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*i-s*n+e.x,this.y=r*n+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class G{constructor(e,t,i,n,r,s,a,o,l){G.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,s,a,o,l)}set(e,t,i,n,r,s,a,o,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=a,h[3]=t,h[4]=r,h[5]=o,h[6]=i,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],h=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],x=n[1],_=n[4],v=n[7],y=n[2],M=n[5],S=n[8];return r[0]=s*f+a*x+o*y,r[3]=s*m+a*_+o*M,r[6]=s*g+a*v+o*S,r[1]=l*f+h*x+u*y,r[4]=l*m+h*_+u*M,r[7]=l*g+h*v+u*S,r[2]=c*f+d*x+p*y,r[5]=c*m+d*_+p*M,r[8]=c*g+d*v+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8];return t*s*h-t*a*l-i*r*h+i*a*o+n*r*l-n*s*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],u=h*s-a*l,c=a*o-h*r,d=l*r-s*o,p=t*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=u*f,e[1]=(n*l-h*i)*f,e[2]=(a*i-n*s)*f,e[3]=c*f,e[4]=(h*t-n*o)*f,e[5]=(n*r-a*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(s*t-i*r)*f,this}transpose(){let e;let 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(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let 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(e,t,i,n,r,s,a){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+e,-n*l,n*o,-n*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(W.makeScale(e,t)),this}rotate(e){return this.premultiply(W.makeRotation(-e)),this}translate(e,t){return this.premultiply(W.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let W=new G;function X(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function j(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let q={};function Y(e){e in q||(q[e]=!0,console.warn(e))}function J(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Z(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let K=new G().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-.0000001,1e-7,.9105199]),Q=new G().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),$={[b]:e=>e,[E]:e=>e.convertSRGBToLinear(),[T]:function(e){return e.convertSRGBToLinear().applyMatrix3(Q)}},ee={[b]:e=>e,[E]:e=>e.convertLinearToSRGB(),[T]:function(e){return e.applyMatrix3(K).convertLinearToSRGB()}},et={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(legacyMode){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!legacyMode},get workingColorSpace(){return b},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(!1===this.enabled||t===i||!t||!i)return e;let n=$[t],r=ee[i];if(void 0===n||void 0===r)throw Error(`Unsupported color space conversion, "${t}" to "${i}".`);return r(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}};class ei{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===n&&(n=j("canvas")),n.width=e.width,n.height=e.height;let i=n.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=n}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=j("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let e=0;e0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case h:e.x=e.x-Math.floor(e.x);break;case u:e.x=e.x<0?0:1;break;case c: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 h:e.y=e.y-Math.floor(e.y);break;case u:e.y=e.y<0?0:1;break;case c: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}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Y("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===E?3001:3e3}set encoding(e){Y("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===e?E:""}}eo.DEFAULT_IMAGE=null,eo.DEFAULT_MAPPING=300,eo.DEFAULT_ANISOTROPY=1;class el{constructor(e=0,t=0,i=0,n=1){el.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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 Error("index is out of range: "+e)}return this}getComponent(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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(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(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(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(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(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*t+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*t+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*t+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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(e){let t,i,n;let r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],h=r[5],u=r[9],c=r[2],d=r[6],p=r[10];if(.01>Math.abs(a-l)&&.01>Math.abs(o-c)&&.01>Math.abs(u-d)){if(.1>Math.abs(a+l)&&.1>Math.abs(o+c)&&.1>Math.abs(u+d)&&.1>Math.abs(s+h+p-3))return this.set(1,0,0,0),this;let e=(s+1)/2,r=(h+1)/2,f=(p+1)/2,m=(a+l)/4,g=(o+c)/4,x=(u+d)/4;return e>r&&e>f?e<.01?(t=0,i=.707106781,n=.707106781):(i=m/(t=Math.sqrt(e)),n=g/t):r>f?r<.01?(t=.707106781,i=0,n=.707106781):(t=m/(i=Math.sqrt(r)),n=x/i):f<.01?(t=.707106781,i=.707106781,n=0):(t=g/(n=Math.sqrt(f)),i=x/n),this.set(t,i,n,Math.PI),this}let f=Math.sqrt((d-u)*(d-u)+(o-c)*(o-c)+(l-a)*(l-a));return .001>Math.abs(f)&&(f=1),this.x=(d-u)/f,this.y=(o-c)/f,this.z=(l-a)/f,this.w=Math.acos((s+h+p-1)/2),this}min(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(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(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(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(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class eh extends A{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new el(0,0,e,t),this.scissorTest=!1,this.viewport=new el(0,0,e,t),void 0!==i.encoding&&(Y("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=3001===i.encoding?E:""),this.texture=new eo({width:e,height:t,depth:1},i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:m,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new er(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class eu extends eh{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class ec extends eo{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=d,this.minFilter=d,this.wrapR=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ed{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,s,a){let o=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3],c=r[s+0],d=r[s+1],p=r[s+2],f=r[s+3];if(0===a){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(1===a){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||o!==c||l!==d||h!==p){let e=1-a,t=o*c+l*d+h*p+u*f,i=t>=0?1:-1,n=1-t*t;if(n>Number.EPSILON){let r=Math.sqrt(n),s=Math.atan2(r,t*i);e=Math.sin(e*s)/r,a=Math.sin(a*s)/r}let r=a*i;if(o=o*e+c*r,l=l*e+d*r,h=h*e+p*r,u=u*e+f*r,e===1-a){let e=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=e,l*=e,h*=e,u*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,n,r,s){let a=i[n],o=i[n+1],l=i[n+2],h=i[n+3],u=r[s],c=r[s+1],d=r[s+2],p=r[s+3];return e[t]=a*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-a*d,e[t+2]=l*p+h*d+a*c-o*u,e[t+3]=h*p-a*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let i=e._x,n=e._y,r=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(n/2),u=a(r/2),c=o(i/2),d=o(n/2),p=o(r/2);switch(s){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],s=t[1],a=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=i+a+u;if(c>0){let e=.5/Math.sqrt(c+1);this._w=.25/e,this._x=(h-o)*e,this._y=(r-l)*e,this._z=(s-n)*e}else if(i>a&&i>u){let e=2*Math.sqrt(1+i-a-u);this._w=(h-o)/e,this._x=.25*e,this._y=(n+s)/e,this._z=(r+l)/e}else if(a>u){let e=2*Math.sqrt(1+a-i-u);this._w=(r-l)/e,this._x=(n+s)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+u-i-a);this._w=(s-n)/e,this._x=(r+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(O(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);return 0===i||this.slerp(e,Math.min(1,t/i)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,r=e._z,s=e._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+s*a+n*l-r*o,this._y=n*h+s*o+r*a-i*l,this._z=r*h+s*l+i*o-n*a,this._w=s*h-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,n=this._y,r=this._z,s=this._w,a=s*e._w+i*e._x+n*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=s,this._x=i,this._y=n,this._z=r,this;let o=1-a*a;if(o<=Number.EPSILON){let e=1-t;return this._w=e*s+t*this._w,this._x=e*i+t*this._x,this._y=e*n+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,c=Math.sin(t*h)/l;return this._w=s*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=r*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(r),i*Math.cos(r),t*Math.sin(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ep{constructor(e=0,t=0,i=0){ep.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(em.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(em.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,s=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,a=e.z,o=e.w,l=o*t+s*n-a*i,h=o*i+a*t-r*n,u=o*n+r*i-s*t,c=-r*t-s*i-a*n;return this.x=l*o+-(c*r)+-(h*a)- -(u*s),this.y=h*o+-(c*s)+-(u*r)- -(l*a),this.z=u*o+-(c*a)+-(l*s)- -(h*r),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(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(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(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(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(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ef.copy(this).projectOnVector(e),this.sub(ef)}reflect(e){return this.sub(ef.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(O(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ef=new ep,em=new ed;class eg{constructor(e=new ep(1/0,1/0,1/0),t=new ep(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x)&&!(e.ythis.max.y)&&!(e.zthis.max.z)}containsBox(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(e,t){return 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(e){return!(e.max.xthis.max.x)&&!(e.max.ythis.max.y)&&!(e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,e_),e_.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ew),eA.subVectors(this.max,ew),ey.subVectors(e.a,ew),eM.subVectors(e.b,ew),eS.subVectors(e.c,ew),eE.subVectors(eM,ey),eb.subVectors(eS,eM),eT.subVectors(ey,eS);let t=[0,-eE.z,eE.y,0,-eb.z,eb.y,0,-eT.z,eT.y,eE.z,0,-eE.x,eb.z,0,-eb.x,eT.z,0,-eT.x,-eE.y,eE.x,0,-eb.y,eb.x,0,-eT.y,eT.x,0];return!!(eL(t,ey,eM,eS,eA)&&eL(t=[1,0,0,0,1,0,0,0,1],ey,eM,eS,eA))&&(eP.crossVectors(eE,eb),eL(t=[eP.x,eP.y,eP.z],ey,eM,eS,eA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,e_).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(e_).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(ex[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ex[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ex[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ex[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ex[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ex[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ex[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ex[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ex)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let ex=[new ep,new ep,new ep,new ep,new ep,new ep,new ep,new ep],e_=new ep,ev=new eg,ey=new ep,eM=new ep,eS=new ep,eE=new ep,eb=new ep,eT=new ep,ew=new ep,eA=new ep,eP=new ep,eR=new ep;function eL(e,t,i,n,r){for(let s=0,a=e.length-3;s<=a;s+=3){eR.fromArray(e,s);let a=r.x*Math.abs(eR.x)+r.y*Math.abs(eR.y)+r.z*Math.abs(eR.z),o=t.dot(eR),l=i.dot(eR),h=n.dot(eR);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}let eC=new eg,eI=new ep,eO=new ep;class eN{constructor(e=new ep,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):eC.setFromPoints(e).getCenter(i);let n=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;eI.subVectors(e,this.center);let t=eI.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(eI,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(eO.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(eI.copy(e.center).add(eO)),this.expandByPoint(eI.copy(e.center).sub(eO)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let eU=new ep,eD=new ep,eB=new ep,eF=new ep,ez=new ep,eV=new ep,eH=new ep;class ek{constructor(e=new ep,t=new ep(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,eU)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=eU.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(eU.copy(this.origin).addScaledVector(this.direction,t),eU.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){let r,s,a,o;eD.copy(e).add(t).multiplyScalar(.5),eB.copy(t).sub(e).normalize(),eF.copy(this.origin).sub(eD);let l=.5*e.distanceTo(t),h=-this.direction.dot(eB),u=eF.dot(this.direction),c=-eF.dot(eB),d=eF.lengthSq(),p=Math.abs(1-h*h);if(p>0){if(r=h*c-u,s=h*u-c,o=l*p,r>=0){if(s>=-o){if(s<=o){let e=1/p;r*=e,s*=e,a=r*(r+h*s+2*u)+s*(h*r+s+2*c)+d}else a=-(r=Math.max(0,-(h*(s=l)+u)))*r+s*(s+2*c)+d}else a=-(r=Math.max(0,-(h*(s=-l)+u)))*r+s*(s+2*c)+d}else s<=-o?(s=(r=Math.max(0,-(-h*l+u)))>0?-l:Math.min(Math.max(-l,-c),l),a=-r*r+s*(s+2*c)+d):s<=o?(r=0,a=(s=Math.min(Math.max(-l,-c),l))*(s+2*c)+d):(s=(r=Math.max(0,-(h*l+u)))>0?l:Math.min(Math.max(-l,-c),l),a=-r*r+s*(s+2*c)+d)}else s=h>0?-l:l,a=-(r=Math.max(0,-(h*s+u)))*r+s*(s+2*c)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(eD).addScaledVector(eB,s),a}intersectSphere(e,t){eU.subVectors(e.center,this.origin);let i=eU.dot(this.direction),n=eU.dot(eU)-i*i,r=e.radius*e.radius;if(n>r)return null;let s=Math.sqrt(r-n),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let i=e.normal.dot(this.direction);return i*t<0}intersectBox(e,t){let i,n,r,s,a,o;let l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(l>=0?(i=(e.min.x-c.x)*l,n=(e.max.x-c.x)*l):(i=(e.max.x-c.x)*l,n=(e.min.x-c.x)*l),h>=0?(r=(e.min.y-c.y)*h,s=(e.max.y-c.y)*h):(r=(e.max.y-c.y)*h,s=(e.min.y-c.y)*h),i>s||r>n)?null:((r>i||isNaN(i))&&(i=r),(s=0?(a=(e.min.z-c.z)*u,o=(e.max.z-c.z)*u):(a=(e.max.z-c.z)*u,o=(e.min.z-c.z)*u),i>o||a>n)?null:((a>i||i!=i)&&(i=a),(o=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,eU)}intersectTriangle(e,t,i,n,r){let s;ez.subVectors(t,e),eV.subVectors(i,e),eH.crossVectors(ez,eV);let a=this.direction.dot(eH);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}eF.subVectors(this.origin,e);let o=s*this.direction.dot(eV.crossVectors(eF,eV));if(o<0)return null;let l=s*this.direction.dot(ez.cross(eF));if(l<0||o+l>a)return null;let h=-s*eF.dot(eH);return h<0?null:this.at(h/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eG{constructor(e,t,i,n,r,s,a,o,l,h,u,c,d,p,f,m){eG.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,s,a,o,l,h,u,c,d,p,f,m)}set(e,t,i,n,r,s,a,o,l,h,u,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eG().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/eW.setFromMatrixColumn(e,0).length(),r=1/eW.setFromMatrixColumn(e,1).length(),s=1/eW.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,r=e.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){let e=s*h,i=s*u,n=a*h,r=a*u;t[0]=o*h,t[4]=-o*u,t[8]=l,t[1]=i+n*l,t[5]=e-r*l,t[9]=-a*o,t[2]=r-e*l,t[6]=n+i*l,t[10]=s*o}else if("YXZ"===e.order){let e=o*h,i=o*u,n=l*h,r=l*u;t[0]=e+r*a,t[4]=n*a-i,t[8]=s*l,t[1]=s*u,t[5]=s*h,t[9]=-a,t[2]=i*a-n,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){let e=o*h,i=o*u,n=l*h,r=l*u;t[0]=e-r*a,t[4]=-s*u,t[8]=n+i*a,t[1]=i+n*a,t[5]=s*h,t[9]=r-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){let e=s*h,i=s*u,n=a*h,r=a*u;t[0]=o*h,t[4]=n*l-i,t[8]=e*l+r,t[1]=o*u,t[5]=r*l+e,t[9]=i*l-n,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){let e=s*o,i=s*l,n=a*o,r=a*l;t[0]=o*h,t[4]=r-e*u,t[8]=n*u+i,t[1]=u,t[5]=s*h,t[9]=-a*h,t[2]=-l*h,t[6]=i*u+n,t[10]=e-r*u}else if("XZY"===e.order){let e=s*o,i=s*l,n=a*o,r=a*l;t[0]=o*h,t[4]=-u,t[8]=l*h,t[1]=e*u+r,t[5]=s*h,t[9]=i*u-n,t[2]=n*u-i,t[6]=a*h,t[10]=r*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ej,e,eq)}lookAt(e,t,i){let n=this.elements;return eZ.subVectors(e,t),0===eZ.lengthSq()&&(eZ.z=1),eZ.normalize(),eY.crossVectors(i,eZ),0===eY.lengthSq()&&(1===Math.abs(i.z)?eZ.x+=1e-4:eZ.z+=1e-4,eZ.normalize(),eY.crossVectors(i,eZ)),eY.normalize(),eJ.crossVectors(eZ,eY),n[0]=eY.x,n[4]=eJ.x,n[8]=eZ.x,n[1]=eY.y,n[5]=eJ.y,n[9]=eZ.y,n[2]=eY.z,n[6]=eJ.z,n[10]=eZ.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],h=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],x=i[3],_=i[7],v=i[11],y=i[15],M=n[0],S=n[4],E=n[8],b=n[12],T=n[1],w=n[5],A=n[9],P=n[13],R=n[2],L=n[6],C=n[10],I=n[14],O=n[3],N=n[7],U=n[11],D=n[15];return r[0]=s*M+a*T+o*R+l*O,r[4]=s*S+a*w+o*L+l*N,r[8]=s*E+a*A+o*C+l*U,r[12]=s*b+a*P+o*I+l*D,r[1]=h*M+u*T+c*R+d*O,r[5]=h*S+u*w+c*L+d*N,r[9]=h*E+u*A+c*C+d*U,r[13]=h*b+u*P+c*I+d*D,r[2]=p*M+f*T+m*R+g*O,r[6]=p*S+f*w+m*L+g*N,r[10]=p*E+f*A+m*C+g*U,r[14]=p*b+f*P+m*I+g*D,r[3]=x*M+_*T+v*R+y*O,r[7]=x*S+_*w+v*L+y*N,r[11]=x*E+_*A+v*C+y*U,r[15]=x*b+_*P+v*I+y*D,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],s=e[1],a=e[5],o=e[9],l=e[13],h=e[2],u=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+r*o*u-n*l*u-r*a*c+i*l*c+n*a*d-i*o*d)+f*(+t*o*d-t*l*c+r*s*c-n*s*d+n*l*h-r*o*h)+m*(+t*l*u-t*a*d-r*s*u+i*s*d+r*a*h-i*l*h)+g*(-n*a*h-t*o*u+t*a*c+n*s*u-i*s*c+i*o*h)}transpose(){let e;let 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(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],x=u*m*l-f*c*l+f*o*d-a*m*d-u*o*g+a*c*g,_=p*c*l-h*m*l-p*o*d+s*m*d+h*o*g-s*c*g,v=h*f*l-p*u*l+p*a*d-s*f*d-h*a*g+s*u*g,y=p*u*o-h*f*o-p*a*c+s*f*c+h*a*m-s*u*m,M=t*x+i*_+n*v+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return e[0]=x*S,e[1]=(f*c*r-u*m*r-f*n*d+i*m*d+u*n*g-i*c*g)*S,e[2]=(a*m*r-f*o*r+f*n*l-i*m*l-a*n*g+i*o*g)*S,e[3]=(u*o*r-a*c*r-u*n*l+i*c*l+a*n*d-i*o*d)*S,e[4]=_*S,e[5]=(h*m*r-p*c*r+p*n*d-t*m*d-h*n*g+t*c*g)*S,e[6]=(p*o*r-s*m*r-p*n*l+t*m*l+s*n*g-t*o*g)*S,e[7]=(s*c*r-h*o*r+h*n*l-t*c*l-s*n*d+t*o*d)*S,e[8]=v*S,e[9]=(p*u*r-h*f*r-p*i*d+t*f*d+h*i*g-t*u*g)*S,e[10]=(s*f*r-p*a*r+p*i*l-t*f*l-s*i*g+t*a*g)*S,e[11]=(h*a*r-s*u*r-h*i*l+t*u*l+s*i*d-t*a*d)*S,e[12]=y*S,e[13]=(h*f*n-p*u*n+p*i*c-t*f*c-h*i*m+t*u*m)*S,e[14]=(p*a*n-s*f*n-p*i*o+t*f*o+s*i*m-t*a*m)*S,e[15]=(s*u*n-h*a*n+h*i*o-t*u*o-s*i*c+t*a*c)*S,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),r=1-i,s=e.x,a=e.y,o=e.z,l=r*s,h=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,h*a+i,h*o-n*s,0,l*o-n*a,h*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,s){return this.set(1,i,r,0,e,1,s,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,s=t._y,a=t._z,o=t._w,l=r+r,h=s+s,u=a+a,c=r*l,d=r*h,p=r*u,f=s*h,m=s*u,g=a*u,x=o*l,_=o*h,v=o*u,y=i.x,M=i.y,S=i.z;return n[0]=(1-(f+g))*y,n[1]=(d+v)*y,n[2]=(p-_)*y,n[3]=0,n[4]=(d-v)*M,n[5]=(1-(c+g))*M,n[6]=(m+x)*M,n[7]=0,n[8]=(p+_)*S,n[9]=(m-x)*S,n[10]=(1-(c+f))*S,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,r=eW.set(n[0],n[1],n[2]).length(),s=eW.set(n[4],n[5],n[6]).length(),a=eW.set(n[8],n[9],n[10]).length(),o=this.determinant();o<0&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],eX.copy(this);let l=1/r,h=1/s,u=1/a;return eX.elements[0]*=l,eX.elements[1]*=l,eX.elements[2]*=l,eX.elements[4]*=h,eX.elements[5]*=h,eX.elements[6]*=h,eX.elements[8]*=u,eX.elements[9]*=u,eX.elements[10]*=u,t.setFromRotationMatrix(eX),i.x=r,i.y=s,i.z=a,this}makePerspective(e,t,i,n,r,s,a=2e3){let o,l;let h=this.elements;if(2e3===a)o=-(s+r)/(s-r),l=-2*s*r/(s-r);else if(2001===a)o=-s/(s-r),l=-s*r/(s-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return h[0]=2*r/(t-e),h[4]=0,h[8]=(t+e)/(t-e),h[12]=0,h[1]=0,h[5]=2*r/(i-n),h[9]=(i+n)/(i-n),h[13]=0,h[2]=0,h[6]=0,h[10]=o,h[14]=l,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,i,n,r,s,a=2e3){let o,l;let h=this.elements,u=1/(t-e),c=1/(i-n),d=1/(s-r);if(2e3===a)o=(s+r)*d,l=-2*d;else if(2001===a)o=r*d,l=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return h[0]=2*u,h[4]=0,h[8]=0,h[12]=-((t+e)*u),h[1]=0,h[5]=2*c,h[9]=0,h[13]=-((i+n)*c),h[2]=0,h[6]=0,h[10]=l,h[14]=-o,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}let eW=new ep,eX=new eG,ej=new ep(0,0,0),eq=new ep(1,1,1),eY=new ep,eJ=new ep,eZ=new ep,eK=new eG,eQ=new ed;class e${constructor(e=0,t=0,i=0,n=e$.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let n=e.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],h=n[9],u=n[2],c=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(O(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-O(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(O(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-O(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(O(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-O(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(c,l),this._y=Math.atan2(a,r)):(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,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return eK.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eK,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eQ.setFromEuler(this),this.setFromQuaternion(eQ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(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(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}e$.DEFAULT_ORDER="XYZ";class e0{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(i=i.concat(r))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(e6,e,e8),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(e6,e7,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t0){n.children=[];for(let t=0;t0){n.animations=[];for(let t=0;t0&&(i.geometries=t),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),u.length>0&&(i.nodes=u)}return i.object=n,i;function s(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){ts.subVectors(n,t),ta.subVectors(i,t),to.subVectors(e,t);let s=ts.dot(ts),a=ts.dot(ta),o=ts.dot(to),l=ta.dot(ta),h=ta.dot(to),u=s*l-a*a;if(0===u)return r.set(-2,-1,-1);let c=1/u,d=(l*o-a*h)*c,p=(s*h-a*o)*c;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,tl),tl.x>=0&&tl.y>=0&&tl.x+tl.y<=1}static getUV(e,t,i,n,r,s,a,o){return!1===tm&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),tm=!0),this.getInterpolation(e,t,i,n,r,s,a,o)}static getInterpolation(e,t,i,n,r,s,a,o){return this.getBarycoord(e,t,i,n,tl),o.setScalar(0),o.addScaledVector(r,tl.x),o.addScaledVector(s,tl.y),o.addScaledVector(a,tl.z),o}static isFrontFacing(e,t,i,n){return ts.subVectors(i,t),ta.subVectors(e,t),0>ts.cross(ta).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ts.subVectors(this.c,this.b),ta.subVectors(this.a,this.b),.5*ts.cross(ta).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tg.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tg.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,r){return!1===tm&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),tm=!0),tg.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}getInterpolation(e,t,i,n,r){return tg.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return tg.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tg.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,n;let r=this.a,s=this.b,a=this.c;th.subVectors(s,r),tu.subVectors(a,r),td.subVectors(e,r);let o=th.dot(td),l=tu.dot(td);if(o<=0&&l<=0)return t.copy(r);tp.subVectors(e,s);let h=th.dot(tp),u=tu.dot(tp);if(h>=0&&u<=h)return t.copy(s);let c=o*u-h*l;if(c<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(r).addScaledVector(th,i);tf.subVectors(e,a);let d=th.dot(tf),p=tu.dot(tf);if(p>=0&&d<=p)return t.copy(a);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(r).addScaledVector(tu,n);let m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return tc.subVectors(a,s),n=(u-h)/(u-h+(d-p)),t.copy(s).addScaledVector(tc,n);let g=1/(m+f+c);return i=f*g,n=c*g,t.copy(r).addScaledVector(th,i).addScaledVector(tu,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let tx=0;class t_ extends A{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tx++}),this.uuid=I(),this.name="",this.type="Material",this.blending=1,this.side=a,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),this.side!==a&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=n(e.textures),r=n(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,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;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let n=0;n!==e;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}let tv={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},ty={h:0,s:0,l:0},tM={h:0,s:0,l:0};function tS(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class tE{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=E){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,et.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=et.workingColorSpace){return this.r=e,this.g=t,this.b=i,et.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=et.workingColorSpace){if(e=N(e,1),t=O(t,0,1),i=O(i,0,1),0===t)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=tS(r,n,e+1/3),this.g=tS(r,n,e),this.b=tS(r,n,e-1/3)}return et.toWorkingColorSpace(this,n),this}setStyle(e,t=E){let i;function n(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;let s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=E){let i=tv[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=J(e.r),this.g=J(e.g),this.b=J(e.b),this}copyLinearToSRGB(e){return this.r=Z(e.r),this.g=Z(e.g),this.b=Z(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=E){return et.fromWorkingColorSpace(tb.copy(this),e),65536*Math.round(O(255*tb.r,0,255))+256*Math.round(O(255*tb.g,0,255))+Math.round(O(255*tb.b,0,255))}getHexString(e=E){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=et.workingColorSpace){let i,n;et.fromWorkingColorSpace(tb.copy(this),t);let r=tb.r,s=tb.g,a=tb.b,o=Math.max(r,s,a),l=Math.min(r,s,a),h=(l+o)/2;if(l===o)i=0,n=0;else{let e=o-l;switch(n=h<=.5?e/(o+l):e/(2-o-l),o){case r:i=(s-a)/e+(s0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let n=i[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},r=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],s=[];for(let t=0,n=i.length;t0&&(n[t]=s,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let n=e.attributes;for(let e in n){let i=n[e];this.setAttribute(e,i.clone(t))}let r=e.morphAttributes;for(let e in r){let i=[],n=r[e];for(let e=0,r=n.length;e0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;t(e.far-e.near)**2)||(tV.copy(r).invert(),tH.copy(e.ray).applyMatrix4(tV),null!==i.boundingBox&&!1===tH.intersectsBox(i.boundingBox)))return;this._computeIntersections(e,t,tH)}}_computeIntersections(e,t,i){let n;let r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,c=r.groups,d=r.drawRange;if(null!==a){if(Array.isArray(s))for(let r=0,o=c.length;ri.far?null:{distance:u,point:t2.clone(),object:e}}(e,t,i,n,tW,tX,tj,t1);if(d){r&&(tJ.fromBufferAttribute(r,h),tZ.fromBufferAttribute(r,u),tK.fromBufferAttribute(r,c),d.uv=tg.getInterpolation(t1,tW,tX,tj,tJ,tZ,tK,new k)),s&&(tJ.fromBufferAttribute(s,h),tZ.fromBufferAttribute(s,u),tK.fromBufferAttribute(s,c),d.uv1=tg.getInterpolation(t1,tW,tX,tj,tJ,tZ,tK,new k),d.uv2=d.uv1),l&&(tQ.fromBufferAttribute(l,h),t$.fromBufferAttribute(l,u),t0.fromBufferAttribute(l,c),d.normal=tg.getInterpolation(t1,tW,tX,tj,tQ,t$,t0,new ep),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));let e={a:h,b:u,c:c,normal:new ep,materialIndex:0};tg.getNormal(tW,tX,tj,e.normal),d.face=e}return d}class t5 extends tz{constructor(e=1,t=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};let a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);let o=[],l=[],h=[],u=[],c=0,d=0;function p(e,t,i,n,r,s,p,f,m,g,x){let _=s/m,v=p/g,y=s/2,M=p/2,S=f/2,E=m+1,b=g+1,T=0,w=0,A=new ep;for(let s=0;s0?1:-1,h.push(A.x,A.y,A.z),u.push(o/m),u.push(1-s/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class it extends tr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eG,this.projectionMatrix=new eG,this.projectionMatrixInverse=new eG,this.coordinateSystem=2e3}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class ii extends it{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e){let t=.5*this.getFilmHeight()/e;this.fov=2*C*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*L*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*C*Math.atan(Math.tan(.5*L*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,n,r,s){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=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*L*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,s=this.view;if(null!==this.view&&this.view.enabled){let e=s.fullWidth,a=s.fullHeight;r+=s.offsetX*n/e,t-=s.offsetY*i/a,n*=s.width/e,i*=s.height/a}let a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}}class ir extends tr{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;let n=new ii(-90,1,e,t);n.layers=this.layers,this.add(n);let r=new ii(-90,1,e,t);r.layers=this.layers,this.add(r);let s=new ii(-90,1,e,t);s.layers=this.layers,this.add(s);let a=new ii(-90,1,e,t);a.layers=this.layers,this.add(a);let o=new ii(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new ii(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,r,s,a,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[n,r,s,a,o,l]=this.children,h=e.getRenderTarget(),u=e.xr.enabled;e.xr.enabled=!1;let c=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,n),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,s),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,o),i.texture.generateMipmaps=c,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=u,i.texture.needsPMREMUpdate=!0}}class is extends eo{constructor(e,t,i,n,r,s,a,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,n,r,s,a,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ia extends eu{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];void 0!==t.encoding&&(Y("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=3001===t.encoding?E:""),this.texture=new is(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:m}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},n=new t5(5,5,5),r=new ie({name:"CubemapFromEquirect",uniforms:t6(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:o,blending:0});r.uniforms.tEquirect.value=t;let s=new t3(n,r),a=t.minFilter;t.minFilter===x&&(t.minFilter=m);let l=new ir(1,10,this);return l.update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(r)}}let io=new ep,il=new ep,ih=new G;class iu{constructor(e=new ep(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=io.subVectors(i,t).cross(il.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(io),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||ih.getNormalMatrix(e),n=this.coplanarPoint(io).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let ic=new eN,id=new ep;class ip{constructor(e=new iu,t=new iu,i=new iu,n=new iu,r=new iu,s=new iu){this.planes=[e,t,i,n,r,s]}set(e,t,i,n,r,s){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3){let i=this.planes,n=e.elements,r=n[0],s=n[1],a=n[2],o=n[3],l=n[4],h=n[5],u=n[6],c=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],x=n[13],_=n[14],v=n[15];if(i[0].setComponents(o-r,c-l,m-d,v-g).normalize(),i[1].setComponents(o+r,c+l,m+d,v+g).normalize(),i[2].setComponents(o+s,c+h,m+p,v+x).normalize(),i[3].setComponents(o-s,c-h,m-p,v-x).normalize(),i[4].setComponents(o-a,c-u,m-f,v-_).normalize(),2e3===t)i[5].setComponents(o+a,c+u,m+f,v+_).normalize();else if(2001===t)i[5].setComponents(a,u,f,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ic.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ic.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ic)}intersectsSprite(e){return ic.center.set(0,0,0),ic.radius=.7071067811865476,ic.applyMatrix4(e.matrixWorld),this.intersectsSphere(ic)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++){let r=t[e].distanceToPoint(i);if(r0?e.max.x:e.min.x,id.y=n.normal.y>0?e.max.y:e.min.y,id.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(id))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function im(){let e=null,t=!1,i=null,n=null;function r(t,s){i(t,s),n=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function ig(e,t){let i=t.isWebGL2,n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let i=n.get(t);i&&(e.deleteBuffer(i.buffer),n.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){let e=n.get(t);(!e||e.version 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float 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 }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 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 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\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 mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return 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}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometry.position;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometry.position;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometry, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometry.normal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_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 uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif",map_fragment:"#ifdef USE_MAP\n diffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},iv={common:{diffuse:{value:new tE(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new G},alphaMap:{value:null},alphaMapTransform:{value:new G},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new G}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new G}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new G}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new G},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new G},normalScale:{value:new k(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new G},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new G}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new G}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new G}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tE(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tE(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new G},alphaTest:{value:0},uvTransform:{value:new G}},sprite:{diffuse:{value:new tE(16777215)},opacity:{value:1},center:{value:new k(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new G},alphaMap:{value:null},alphaMapTransform:{value:new G},alphaTest:{value:0}}},iy={basic:{uniforms:t8([iv.common,iv.specularmap,iv.envmap,iv.aomap,iv.lightmap,iv.fog]),vertexShader:i_.meshbasic_vert,fragmentShader:i_.meshbasic_frag},lambert:{uniforms:t8([iv.common,iv.specularmap,iv.envmap,iv.aomap,iv.lightmap,iv.emissivemap,iv.bumpmap,iv.normalmap,iv.displacementmap,iv.fog,iv.lights,{emissive:{value:new tE(0)}}]),vertexShader:i_.meshlambert_vert,fragmentShader:i_.meshlambert_frag},phong:{uniforms:t8([iv.common,iv.specularmap,iv.envmap,iv.aomap,iv.lightmap,iv.emissivemap,iv.bumpmap,iv.normalmap,iv.displacementmap,iv.fog,iv.lights,{emissive:{value:new tE(0)},specular:{value:new tE(1118481)},shininess:{value:30}}]),vertexShader:i_.meshphong_vert,fragmentShader:i_.meshphong_frag},standard:{uniforms:t8([iv.common,iv.envmap,iv.aomap,iv.lightmap,iv.emissivemap,iv.bumpmap,iv.normalmap,iv.displacementmap,iv.roughnessmap,iv.metalnessmap,iv.fog,iv.lights,{emissive:{value:new tE(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:i_.meshphysical_vert,fragmentShader:i_.meshphysical_frag},toon:{uniforms:t8([iv.common,iv.aomap,iv.lightmap,iv.emissivemap,iv.bumpmap,iv.normalmap,iv.displacementmap,iv.gradientmap,iv.fog,iv.lights,{emissive:{value:new tE(0)}}]),vertexShader:i_.meshtoon_vert,fragmentShader:i_.meshtoon_frag},matcap:{uniforms:t8([iv.common,iv.bumpmap,iv.normalmap,iv.displacementmap,iv.fog,{matcap:{value:null}}]),vertexShader:i_.meshmatcap_vert,fragmentShader:i_.meshmatcap_frag},points:{uniforms:t8([iv.points,iv.fog]),vertexShader:i_.points_vert,fragmentShader:i_.points_frag},dashed:{uniforms:t8([iv.common,iv.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:i_.linedashed_vert,fragmentShader:i_.linedashed_frag},depth:{uniforms:t8([iv.common,iv.displacementmap]),vertexShader:i_.depth_vert,fragmentShader:i_.depth_frag},normal:{uniforms:t8([iv.common,iv.bumpmap,iv.normalmap,iv.displacementmap,{opacity:{value:1}}]),vertexShader:i_.meshnormal_vert,fragmentShader:i_.meshnormal_frag},sprite:{uniforms:t8([iv.sprite,iv.fog]),vertexShader:i_.sprite_vert,fragmentShader:i_.sprite_frag},background:{uniforms:{uvTransform:{value:new G},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:i_.background_vert,fragmentShader:i_.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:i_.backgroundCube_vert,fragmentShader:i_.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:i_.cube_vert,fragmentShader:i_.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:i_.equirect_vert,fragmentShader:i_.equirect_frag},distanceRGBA:{uniforms:t8([iv.common,iv.displacementmap,{referencePosition:{value:new ep},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:i_.distanceRGBA_vert,fragmentShader:i_.distanceRGBA_frag},shadow:{uniforms:t8([iv.lights,iv.fog,{color:{value:new tE(0)},opacity:{value:1}}]),vertexShader:i_.shadow_vert,fragmentShader:i_.shadow_frag}};iy.physical={uniforms:t8([iy.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new G},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new G},clearcoatNormalScale:{value:new k(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new G},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new G},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new G},sheen:{value:0},sheenColor:{value:new tE(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new G},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new G},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new G},transmissionSamplerSize:{value:new k},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new G},attenuationDistance:{value:0},attenuationColor:{value:new tE(0)},specularColor:{value:new tE(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new G},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new G},anisotropyVector:{value:new k},anisotropyMap:{value:null},anisotropyMapTransform:{value:new G}}]),vertexShader:i_.meshphysical_vert,fragmentShader:i_.meshphysical_frag};let iM={r:0,b:0,g:0};function iS(e,t,i,n,r,s,l){let h,u;let c=new tE(0),d=!0===s?0:1,p=null,f=0,m=null;function g(t,i){t.getRGB(iM,t7(e)),n.buffers.color.setClear(iM.r,iM.g,iM.b,i,l)}return{getClearColor:function(){return c},setClearColor:function(e,t=1){c.set(e),g(c,d=t)},getClearAlpha:function(){return d},setClearAlpha:function(e){g(c,d=e)},render:function(s,x){let _=!1,v=!0===x.isScene?x.background:null;if(v&&v.isTexture){let e=x.backgroundBlurriness>0;v=(e?i:t).get(v)}null===v?g(c,d):v&&v.isColor&&(g(v,1),_=!0);let y=e.xr,M=y.getEnvironmentBlendMode();switch(M){case"opaque":_=!0;break;case"additive":n.buffers.color.setClear(0,0,0,1,l),_=!0;break;case"alpha-blend":n.buffers.color.setClear(0,0,0,0,l),_=!0}(e.autoClear||_)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),v&&(v.isCubeTexture||306===v.mapping)?(void 0===u&&((u=new t3(new t5(1,1,1),new ie({name:"BackgroundCubeMaterial",uniforms:t6(iy.backgroundCube.uniforms),vertexShader:iy.backgroundCube.vertexShader,fragmentShader:iy.backgroundCube.fragmentShader,side:o,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.toneMapped=v.colorSpace!==E,(p!==v||f!==v.version||m!==e.toneMapping)&&(u.material.needsUpdate=!0,p=v,f=v.version,m=e.toneMapping),u.layers.enableAll(),s.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(void 0===h&&((h=new t3(new ix(2,2),new ie({name:"BackgroundMaterial",uniforms:t6(iy.background.uniforms),vertexShader:iy.background.vertexShader,fragmentShader:iy.background.fragmentShader,side:a,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=v,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.toneMapped=v.colorSpace!==E,!0===v.matrixAutoUpdate&&v.updateMatrix(),h.material.uniforms.uvTransform.value.copy(v.matrix),(p!==v||f!==v.version||m!==e.toneMapping)&&(h.material.needsUpdate=!0,p=v,f=v.version,m=e.toneMapping),h.layers.enableAll(),s.unshift(h,h.geometry,h.material,0,0,null))}}}function iE(e,t,i,n){let r=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:t.get("OES_vertex_array_object"),a=n.isWebGL2||null!==s,o={},l=p(null),h=l,u=!1;function c(t){return n.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return n.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){let t=[],i=[],n=[];for(let e=0;e=0){let i=r[t],n=s[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===i||i.attribute!==n||n&&i.data!==n.data)return!0;a++}}return h.attributesNum!==a||h.index!==n}(r,v,d,y))&&function(e,t,i,n){let r={},s=t.attributes,a=0,o=i.getAttributes();for(let t in o){let i=o[t];if(i.location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[t]=n,a++}}h.attributes=r,h.attributesNum=a,h.index=n}(r,v,d,y)}else{let e=!0===l.wireframe;(h.geometry!==v.id||h.program!==d.id||h.wireframe!==e)&&(h.geometry=v.id,h.program=d.id,h.wireframe=e,M=!0)}null!==y&&i.update(y,e.ELEMENT_ARRAY_BUFFER),(M||u)&&(u=!1,function(r,s,a,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();let l=o.attributes,h=a.getAttributes(),u=s.defaultAttributeValues;for(let t in h){let s=h[t];if(s.location>=0){let a=l[t];if(void 0===a&&("instanceMatrix"===t&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){let t=a.normalized,l=a.itemSize,h=i.get(a);if(void 0===h)continue;let u=h.buffer,c=h.type,d=h.bytesPerElement,p=!0===n.isWebGL2&&(c===e.INT||c===e.UNSIGNED_INT||1013===a.gpuType);if(a.isInterleavedBufferAttribute){let i=a.data,n=i.stride,h=a.offset;if(i.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,a=void 0!==i.precision?i.precision:"highp",o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);let l=s||t.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),x=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),_=c>0,v=s||t.has("OES_texture_float"),y=s?e.getParameter(e.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:x,vertexTextures:_,floatFragmentTextures:v,floatVertexTextures:_&&v,maxSamples:y}}function iw(e){let t=this,i=null,n=0,r=!1,s=!1,a=new iu,o=new G,l={value:null,needsUpdate:!1};function h(e,i,n,r){let s=null!==e?e.length:0,h=null;if(0!==s){if(h=l.value,!0!==r||null===h){let t=n+4*s,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length0),t.numPlanes=n,t.numIntersection=0)}}function iA(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let s=r.mapping;if(303===s||304===s){if(t.has(r)){let e=t.get(r).texture;return i(e,r.mapping)}{let s=r.image;if(!s||!(s.height>0))return null;{let a=new ia(s.height/2);return a.fromEquirectangularTexture(e,r),t.set(r,a),r.addEventListener("dispose",n),i(a.texture,r.mapping)}}}}return r},dispose:function(){t=new WeakMap}}}class iP extends it{constructor(e=-1,t=1,i=1,n=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e,t,i,n,r,s){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=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,s=i+e,a=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}}let iR=[.125,.215,.35,.446,.526,.582],iL=new iP,iC=new tE,iI=null,iO=(1+Math.sqrt(5))/2,iN=1/iO,iU=[new ep(1,1,1),new ep(-1,1,1),new ep(1,1,-1),new ep(-1,1,-1),new ep(0,iO,iN),new ep(0,iO,-iN),new ep(iN,0,iO),new ep(-iN,0,iO),new ep(iO,iN,0),new ep(-iO,iN,0)];class iD{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){iI=this._renderer.getRenderTarget(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=iV(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=iz(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=iR[a-e+4-1]:0===a&&(o=0),n.push(o);let l=1/(s-2),h=-l,u=1+l,c=[h,h,u,h,u,u,h,h,u,u,h,u],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,n=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(n,18*e),p.set(c,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new tz;m.setAttribute("position",new tP(d,3)),m.setAttribute("uv",new tP(p,2)),m.setAttribute("faceIndex",new tP(f,1)),t.push(m),r>4&&r--}return{lodPlanes:t,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(e,t,i){let n=new Float32Array(20),r=new ep(0,1,0),s=new ie({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:iH(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:0,depthTest:!1,depthWrite:!1});return s}(n,e,t)}return n}_compileMaterial(e){let t=new t3(this._lodPlanes[0],e);this._renderer.compile(t,iL)}_sceneToCubeUV(e,t,i,n){let r=new ii(90,1,t,i),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],l=this._renderer,h=l.autoClear,u=l.toneMapping;l.getClearColor(iC),l.toneMapping=0,l.autoClear=!1;let c=new tT({name:"PMREM.Background",side:o,depthWrite:!1,depthTest:!1}),d=new t3(new t5,c),p=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,p=!0):(c.color.copy(iC),p=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(r.up.set(0,s[t],0),r.lookAt(a[t],0,0)):1===i?(r.up.set(0,0,s[t]),r.lookAt(0,a[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,a[t]));let o=this._cubeSize;iF(n,i*o,t>2?o:0,o,o),l.setRenderTarget(n),p&&l.render(d,r),l.render(e,r)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=u,l.autoClear=h,e.background=f}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=iV()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=iz());let r=n?this._cubemapMaterial:this._equirectMaterial,s=new t3(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;let o=this._cubeSize;iF(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(s,iL)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);m.push(i),0===e?g+=i:ex-4?n-x+4:0),y=4*(this._cubeSize-_);iF(t,v,y,3*_,2*_),o.setRenderTarget(t),o.render(h,iL)}}function iB(e,t,i){let n=new eu(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function iF(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function iz(){return new ie({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:iH(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function iV(){return new ie({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:iH(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function iH(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function ik(e){let t=new WeakMap,i=null;function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let s=r.mapping,a=303===s||304===s,o=301===s||302===s;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=t.get(r);return null===i&&(i=new iD(e)),n=a?i.fromEquirectangular(r,n):i.fromCubemap(r,n),t.set(r,n),n.texture}if(t.has(r))return t.get(r).texture;{let s=r.image;if(!(a&&s&&s.height>0||o&&s&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(s)))return null;{null===i&&(i=new iD(e));let s=a?i.fromEquirectangular(r):i.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",n),s.texture}}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function iG(e){let t={};function i(i){let n;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return t[i]=n,n}return{has:function(e){return null!==i(e)},init:function(e){e.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(e){let t=i(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function iW(e,t,i,n){let r={},s=new WeakMap;function a(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);for(let e in o.morphAttributes){let i=o.morphAttributes[e];for(let e=0,n=i.length;et.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*r),g=new ec(m,p,f,r);g.type=1015,g.needsUpdate=!0;let x=4*d;for(let t=0;t0)return e;let r=t*i,s=i1[r];if(void 0===s&&(s=new Float32Array(r),i1[r]=s),0!==t){n.toArray(s,0);for(let n=1,r=0;n!==t;++n)r+=i,e[n].toArray(s,r)}return s}function i8(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i":" "} ${r}: ${i[e]}`)}return n.join("\n")}(e.getShaderSource(t),n)}}function nq(e){return""!==e}function nY(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).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_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function nJ(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let nZ=/^[ \t]*#include +<([\w\d./]+)>/gm;function nK(e){return e.replace(nZ,n$)}let nQ=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function n$(e,t){let i=i_[t];if(void 0===i){let e=nQ.get(t);if(void 0!==e)i=i_[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return nK(i)}let n0=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function n1(e){return e.replace(n0,n2)}function n2(e,t,i,n){let r="";for(let e=parseInt(t);e0&&(r+="\n"),(s=[v,"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(nq).join("\n")).length>0&&(s+="\n")):(r=[n3(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(nq).join("\n"),s=[v,n3(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+g:"",i.envMap?"#define "+x:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?i_.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",i_.colorspace_pars_fragment,function(e,t){let i=function(e){switch(e){case b:return["Linear","( value )"];case E:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(nq).join("\n")),d=nJ(d=nY(d=nK(d),i),i),p=nJ(p=nY(p=nK(p),i),i),d=n1(d),p=n1(p),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(S="#version 300 es\n",r="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+r,s=["#define varying in",i.glslVersion===w?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===w?"":"#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"+s);let T=S+r+d,A=S+s+p,P=nW(u,u.VERTEX_SHADER,T),R=nW(u,u.FRAGMENT_SHADER,A);if(u.attachShader(M,P),u.attachShader(M,R),void 0!==i.index0AttributeName?u.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&u.bindAttribLocation(M,0,"position"),u.linkProgram(M),e.debug.checkShaderErrors){let t=u.getProgramInfoLog(M).trim(),i=u.getShaderInfoLog(P).trim(),n=u.getShaderInfoLog(R).trim(),a=!0,o=!0;if(!1===u.getProgramParameter(M,u.LINK_STATUS)){if(a=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(u,M,P,R);else{let e=nj(u,P,"vertex"),i=nj(u,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+u.getError()+" - VALIDATE_STATUS "+u.getProgramParameter(M,u.VALIDATE_STATUS)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+i)}}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):(""===i||""===n)&&(o=!1);o&&(this.diagnostics={runnable:a,programLog:t,vertexShader:{log:i,prefix:r},fragmentShader:{log:n,prefix:s}})}return u.deleteShader(P),u.deleteShader(R),this.getUniforms=function(){return void 0===a&&(a=new nG(u,M)),a},this.getAttributes=function(){return void 0===o&&(o=function(e,t){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,Y=s.clearcoat>0,J=s.iridescence>0,Z=s.sheen>0,K=s.transmission>0,Q=q&&!!s.anisotropyMap,$=Y&&!!s.clearcoatMap,ee=Y&&!!s.clearcoatNormalMap,et=Y&&!!s.clearcoatRoughnessMap,ei=J&&!!s.iridescenceMap,en=J&&!!s.iridescenceThicknessMap,er=Z&&!!s.sheenColorMap,es=Z&&!!s.sheenRoughnessMap,ea=!!s.specularMap,eo=!!s.specularColorMap,el=!!s.specularIntensityMap,eh=K&&!!s.transmissionMap,eu=K&&!!s.thicknessMap,ec=!!s.gradientMap,ed=!!s.alphaMap,ep=s.alphaTest>0,ef=!!s.alphaHash,em=!!s.extensions,eg=!!w.attributes.uv1,ex=!!w.attributes.uv2,e_=!!w.attributes.uv3,ev=0;s.toneMapped&&(null===N||!0===N.isXRRenderTarget)&&(ev=e.toneMapping);let ey={isWebGL2:d,shaderID:L,shaderType:s.type,shaderName:s.name,vertexShader:y,fragmentShader:M,defines:s.defines,customVertexShaderID:S,customFragmentShaderID:E,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:m,instancing:U,instancingColor:U&&null!==v.instanceColor,supportsVertexTextures:f,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:b,map:D,matcap:B,envMap:F,envMapMode:F&&P.mapping,envMapCubeUVHeight:R,aoMap:z,lightMap:V,bumpMap:H,normalMap:k,displacementMap:f&&G,emissiveMap:W,normalMapObjectSpace:k&&1===s.normalMapType,normalMapTangentSpace:k&&0===s.normalMapType,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:Q,clearcoat:Y,clearcoatMap:$,clearcoatNormalMap:ee,clearcoatRoughnessMap:et,iridescence:J,iridescenceMap:ei,iridescenceThicknessMap:en,sheen:Z,sheenColorMap:er,sheenRoughnessMap:es,specularMap:ea,specularColorMap:eo,specularIntensityMap:el,transmission:K,transmissionMap:eh,thicknessMap:eu,gradientMap:ec,opaque:!1===s.transparent&&1===s.blending,alphaMap:ed,alphaTest:ep,alphaHash:ef,combine:s.combine,mapUv:D&&x(s.map.channel),aoMapUv:z&&x(s.aoMap.channel),lightMapUv:V&&x(s.lightMap.channel),bumpMapUv:H&&x(s.bumpMap.channel),normalMapUv:k&&x(s.normalMap.channel),displacementMapUv:G&&x(s.displacementMap.channel),emissiveMapUv:W&&x(s.emissiveMap.channel),metalnessMapUv:X&&x(s.metalnessMap.channel),roughnessMapUv:j&&x(s.roughnessMap.channel),anisotropyMapUv:Q&&x(s.anisotropyMap.channel),clearcoatMapUv:$&&x(s.clearcoatMap.channel),clearcoatNormalMapUv:ee&&x(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&x(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ei&&x(s.iridescenceMap.channel),iridescenceThicknessMapUv:en&&x(s.iridescenceThicknessMap.channel),sheenColorMapUv:er&&x(s.sheenColorMap.channel),sheenRoughnessMapUv:es&&x(s.sheenRoughnessMap.channel),specularMapUv:ea&&x(s.specularMap.channel),specularColorMapUv:eo&&x(s.specularColorMap.channel),specularIntensityMapUv:el&&x(s.specularIntensityMap.channel),transmissionMapUv:eh&&x(s.transmissionMap.channel),thicknessMapUv:eu&&x(s.thicknessMap.channel),alphaMapUv:ed&&x(s.alphaMap.channel),vertexTangents:!!w.attributes.tangent&&(k||q),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!w.attributes.color&&4===w.attributes.color.itemSize,vertexUv1s:eg,vertexUv2s:ex,vertexUv3s:e_,pointsUvs:!0===v.isPoints&&!!w.attributes.uv&&(D||ed),fog:!!T,useFog:!0===s.fog,fogExp2:T&&T.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==w.morphAttributes.position,morphNormals:void 0!==w.morphAttributes.normal,morphColors:void 0!==w.morphAttributes.color,morphTargetsCount:I,morphTextureStride:O,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numSpotLightMaps:h.spotLightMap.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numDirLightShadows:h.directionalShadowMap.length,numPointLightShadows:h.pointShadowMap.length,numSpotLightShadows:h.spotShadowMap.length,numSpotLightShadowsWithMaps:h.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ev,useLegacyLights:e._useLegacyLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===l,flipSided:s.side===o,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:em&&!0===s.extensions.derivatives,extensionFragDepth:em&&!0===s.extensions.fragDepth,extensionDrawBuffers:em&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:em&&!0===s.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()};return ey},getProgramCacheKey:function(t){let i=[];if(t.shaderID?i.push(t.shaderID):(i.push(t.customVertexShaderID),i.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)i.push(e),i.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i.push(t.precision),i.push(t.outputColorSpace),i.push(t.envMapMode),i.push(t.envMapCubeUVHeight),i.push(t.mapUv),i.push(t.alphaMapUv),i.push(t.lightMapUv),i.push(t.aoMapUv),i.push(t.bumpMapUv),i.push(t.normalMapUv),i.push(t.displacementMapUv),i.push(t.emissiveMapUv),i.push(t.metalnessMapUv),i.push(t.roughnessMapUv),i.push(t.anisotropyMapUv),i.push(t.clearcoatMapUv),i.push(t.clearcoatNormalMapUv),i.push(t.clearcoatRoughnessMapUv),i.push(t.iridescenceMapUv),i.push(t.iridescenceThicknessMapUv),i.push(t.sheenColorMapUv),i.push(t.sheenRoughnessMapUv),i.push(t.specularMapUv),i.push(t.specularColorMapUv),i.push(t.specularIntensityMapUv),i.push(t.transmissionMapUv),i.push(t.thicknessMapUv),i.push(t.combine),i.push(t.fogExp2),i.push(t.sizeAttenuation),i.push(t.morphTargetsCount),i.push(t.morphAttributeCount),i.push(t.numDirLights),i.push(t.numPointLights),i.push(t.numSpotLights),i.push(t.numSpotLightMaps),i.push(t.numHemiLights),i.push(t.numRectAreaLights),i.push(t.numDirLightShadows),i.push(t.numPointLightShadows),i.push(t.numSpotLightShadows),i.push(t.numSpotLightShadowsWithMaps),i.push(t.shadowMapType),i.push(t.toneMapping),i.push(t.numClippingPlanes),i.push(t.numClipIntersection),i.push(t.depthPacking),h.disableAll(),t.isWebGL2&&h.enable(0),t.supportsVertexTextures&&h.enable(1),t.instancing&&h.enable(2),t.instancingColor&&h.enable(3),t.matcap&&h.enable(4),t.envMap&&h.enable(5),t.normalMapObjectSpace&&h.enable(6),t.normalMapTangentSpace&&h.enable(7),t.clearcoat&&h.enable(8),t.iridescence&&h.enable(9),t.alphaTest&&h.enable(10),t.vertexColors&&h.enable(11),t.vertexAlphas&&h.enable(12),t.vertexUv1s&&h.enable(13),t.vertexUv2s&&h.enable(14),t.vertexUv3s&&h.enable(15),t.vertexTangents&&h.enable(16),t.anisotropy&&h.enable(17),i.push(h.mask),h.disableAll(),t.fog&&h.enable(0),t.useFog&&h.enable(1),t.flatShading&&h.enable(2),t.logarithmicDepthBuffer&&h.enable(3),t.skinning&&h.enable(4),t.morphTargets&&h.enable(5),t.morphNormals&&h.enable(6),t.morphColors&&h.enable(7),t.premultipliedAlpha&&h.enable(8),t.shadowMapEnabled&&h.enable(9),t.useLegacyLights&&h.enable(10),t.doubleSided&&h.enable(11),t.flipSided&&h.enable(12),t.useDepthPacking&&h.enable(13),t.dithering&&h.enable(14),t.transmission&&h.enable(15),t.sheen&&h.enable(16),t.opaque&&h.enable(17),t.pointsUvs&&h.enable(18),i.push(h.mask),i.push(e.outputColorSpace)),i.push(t.customProgramCacheKey),i.join()},getUniforms:function(e){let t;let i=g[e.type];if(i){let e=iy[i];t=t9.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,i){let n;for(let e=0,t=c.length;e0?n.push(u):!0===a.transparent?r.push(u):i.push(u)},unshift:function(e,t,a,o,l,h){let u=s(e,t,a,o,l,h);a.transmission>0?n.unshift(u):!0===a.transparent?r.unshift(u):i.unshift(u)},finish:function(){for(let i=t,n=e.length;i1&&i.sort(e||re),n.length>1&&n.sort(t||rt),r.length>1&&r.sort(t||rt)}}}function rn(){let e=new WeakMap;return{get:function(t,i){let n;let r=e.get(t);return void 0===r?(n=new ri,e.set(t,[n])):i>=r.length?(n=new ri,r.push(n)):n=r[i],n},dispose:function(){e=new WeakMap}}}function rr(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new ep,color:new tE};break;case"SpotLight":i={position:new ep,direction:new ep,color:new tE,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new ep,color:new tE,distance:0,decay:0};break;case"HemisphereLight":i={direction:new ep,skyColor:new tE,groundColor:new tE};break;case"RectAreaLight":i={color:new tE,position:new ep,halfWidth:new ep,halfHeight:new ep}}return e[t.id]=i,i}}}let rs=0;function ra(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function ro(e,t){let i=new rr,n=function(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new k};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new k,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)r.probe.push(new ep);let s=new ep,a=new eG,o=new eG;return{setup:function(s,a){let o=0,l=0,h=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let u=0,c=0,d=0,p=0,f=0,m=0,g=0,x=0,_=0,v=0;s.sort(ra);let y=!0===a?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2?(r.rectAreaLTC1=iv.LTC_FLOAT_1,r.rectAreaLTC2=iv.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=iv.LTC_FLOAT_1,r.rectAreaLTC2=iv.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=iv.LTC_HALF_1,r.rectAreaLTC2=iv.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;let M=r.hash;(M.directionalLength!==u||M.pointLength!==c||M.spotLength!==d||M.rectAreaLength!==p||M.hemiLength!==f||M.numDirectionalShadows!==m||M.numPointShadows!==g||M.numSpotShadows!==x||M.numSpotMaps!==_)&&(r.directional.length=u,r.spot.length=d,r.rectArea.length=p,r.point.length=c,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=x,r.spotShadowMap.length=x,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=x+_-v,r.spotLightMap.length=_,r.numSpotLightShadowsWithMaps=v,M.directionalLength=u,M.pointLength=c,M.spotLength=d,M.rectAreaLength=p,M.hemiLength=f,M.numDirectionalShadows=m,M.numPointShadows=g,M.numSpotShadows=x,M.numSpotMaps=_,r.version=rs++)},setupView:function(e,t){let i=0,n=0,l=0,h=0,u=0,c=t.matrixWorldInverse;for(let t=0,d=e.length;t=a.length?(s=new rl(e,t),a.push(s)):s=a[r],s},dispose:function(){i=new WeakMap}}}class ru extends t_{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}class rc extends t_{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function rd(e,t,i){let n=new ip,r=new k,s=new k,h=new el,u=new ru({depthPacking:3201}),c=new rc,p={},f=i.maxTextureSize,m={[a]:o,[o]:a,[l]:l},g=new ie({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new k},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 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, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),x=g.clone();x.defines.HORIZONTAL_PASS=1;let _=new tz;_.setAttribute("position",new tP(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new t3(_,g),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let M=this.type;function S(t,i,n,r){let s=null,a=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===n.isPointLight?c:u,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=s.uuid,t=i.uuid,n=p[e];void 0===n&&(n={},p[e]=n);let r=n[t];void 0===r&&(r=s.clone(),n[t]=r),s=r}if(s.visible=i.visible,s.wireframe=i.wireframe,3===r?s.side=null!==i.shadowSide?i.shadowSide:i.side:s.side=null!==i.shadowSide?i.shadowSide:m[i.side],s.alphaMap=i.alphaMap,s.alphaTest=i.alphaTest,s.map=i.map,s.clipShadows=i.clipShadows,s.clippingPlanes=i.clippingPlanes,s.clipIntersection=i.clipIntersection,s.displacementMap=i.displacementMap,s.displacementScale=i.displacementScale,s.displacementBias=i.displacementBias,s.wireframeLinewidth=i.wireframeLinewidth,s.linewidth=i.linewidth,!0===n.isPointLight&&!0===s.isMeshDistanceMaterial){let t=e.properties.get(s);t.light=n}return s}this.render=function(i,a,o){if(!1===y.enabled||!1===y.autoUpdate&&!1===y.needsUpdate||0===i.length)return;let l=e.getRenderTarget(),u=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);let m=3!==M&&3===this.type,_=3===M&&3!==this.type;for(let l=0,u=i.length;lf||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/y.x),r.x=s.x*y.x,c.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/y.y),r.y=s.y*y.y,c.mapSize.y=s.y)),null===c.map||!0===m||!0===_){let e=3!==this.type?{minFilter:d,magFilter:d}:{};null!==c.map&&c.map.dispose(),c.map=new eu(r.x,r.y,e),c.map.texture.name=u.name+".shadowMap",c.camera.updateProjectionMatrix()}e.setRenderTarget(c.map),e.clear();let M=c.getViewportCount();for(let i=0;i=1:-1!==I.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(I)[1])>=2);let O=null,N={},U=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),B=new el().fromArray(U),F=new el().fromArray(D);function z(t,i,r,s){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;on||e.height>n)&&(r=n/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){let n=t?F:Math.floor,s=n(r*e.width),a=n(r*e.height);void 0===o&&(o=R(s,a));let l=i?R(s,a):o;l.width=s,l.height=a;let h=l.getContext("2d");return h.drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),l}"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function C(e){return D(e.width)&&D(e.height)}function I(e,t){return e.generateMipmaps&&t&&e.minFilter!==d&&e.minFilter!==m}function O(t){e.generateMipmap(t)}function N(i,n,r,s,a=!1){if(!1===l)return n;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;return n===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),n===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),n===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),n===e.RGBA&&(r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=s===E&&!1===a?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)),(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function U(e,t,i){return!0===I(e,i)||e.isFramebufferTexture&&e.minFilter!==d&&e.minFilter!==m?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function B(t){return t===d||t===p||t===f?e.NEAREST:e.LINEAR}function z(e){let t=e.target;t.removeEventListener("dispose",z),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=A.get(i);if(r){let n=r[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&H(e),0===Object.keys(r).length&&A.delete(i)}n.remove(e)}(t),t.isVideoTexture&&w.delete(t)}function V(t){let i=t.target;i.removeEventListener("dispose",V),function(t){let i=t.texture,r=n.get(t),s=n.get(i);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),a.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(r.__webglFramebuffer[t]))for(let i=0;i0&&s.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Z(s,t,r);return}}i.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}let W={[h]:e.REPEAT,[u]:e.CLAMP_TO_EDGE,[c]:e.MIRRORED_REPEAT},X={[d]:e.NEAREST,[p]:e.NEAREST_MIPMAP_NEAREST,[f]:e.NEAREST_MIPMAP_LINEAR,[m]:e.LINEAR,[g]:e.LINEAR_MIPMAP_NEAREST,[x]:e.LINEAR_MIPMAP_LINEAR},q={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function Y(i,s,a){if(a?(e.texParameteri(i,e.TEXTURE_WRAP_S,W[s.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,W[s.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,W[s.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,X[s.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,X[s.minFilter])):(e.texParameteri(i,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(i,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),(s.wrapS!==u||s.wrapT!==u)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,e.TEXTURE_MAG_FILTER,B(s.magFilter)),e.texParameteri(i,e.TEXTURE_MIN_FILTER,B(s.minFilter)),s.minFilter!==d&&s.minFilter!==m&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),s.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,q[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){let a=t.get("EXT_texture_filter_anisotropic");s.magFilter!==d&&(s.minFilter===f||s.minFilter===x)&&(1015!==s.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==l||1016!==s.type||!1!==t.has("OES_texture_half_float_linear"))&&(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(e.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function J(t,i){let n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",z));let r=i.source,s=A.get(r);void 0===s&&(s={},A.set(r,s));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(i);if(o!==t.__cacheKey){void 0===s[o]&&(s[o]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,n=!0),s[o].usedTimes++;let r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&H(i)),t.__cacheKey=o,t.__webglTexture=s[o].texture}return n}function Z(t,r,a){let o=e.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(o=e.TEXTURE_2D_ARRAY),r.isData3DTexture&&(o=e.TEXTURE_3D);let h=J(t,r),c=r.source;i.bindTexture(o,t.__webglTexture,e.TEXTURE0+a);let p=n.get(c);if(c.version!==p.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+a),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);let n=!l&&(r.wrapS!==u||r.wrapT!==u||r.minFilter!==d&&r.minFilter!==m)&&!1===C(r.image),f=L(r.image,n,!1,y);f=en(r,f);let g=C(f)||l,x=s.convert(r.format,r.colorSpace),_=s.convert(r.type),v=N(r.internalFormat,x,_,r.colorSpace);Y(o,r,g);let M=r.mipmaps,S=l&&!0!==r.isVideoTexture,E=void 0===p.__version||!0===h,b=U(r,f,g);if(r.isDepthTexture)v=e.DEPTH_COMPONENT,l?v=1015===r.type?e.DEPTH_COMPONENT32F:1014===r.type?e.DEPTH_COMPONENT24:1020===r.type?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&v===e.DEPTH_COMPONENT&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1014,_=s.convert(r.type)),1027===r.format&&v===e.DEPTH_COMPONENT&&(v=e.DEPTH_STENCIL,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,_=s.convert(r.type))),E&&(S?i.texStorage2D(e.TEXTURE_2D,1,v,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,v,f.width,f.height,0,x,_,null));else if(r.isDataTexture){if(M.length>0&&g){S&&E&&i.texStorage2D(e.TEXTURE_2D,b,v,M[0].width,M[0].height);for(let n=0,r=M.length;n>=1,n>>=1}}}else if(M.length>0&&g){S&&E&&i.texStorage2D(e.TEXTURE_2D,b,v,M[0].width,M[0].height);for(let n=0,r=M.length;n>h),n=Math.max(1,r.height>>h);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?i.texImage3D(l,h,d,t,n,r.depth,0,u,c,null):i.texImage2D(l,h,d,t,n,0,u,c,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),et(r)?S.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,l,n.get(a).__webglTexture,0,ee(r)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,l,n.get(a).__webglTexture,h),i.bindFramebuffer(e.FRAMEBUFFER,null)}function Q(t,i,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer){let r=e.DEPTH_COMPONENT16;if(n||et(i)){let t=i.depthTexture;t&&t.isDepthTexture&&(1015===t.type?r=e.DEPTH_COMPONENT32F:1014===t.type&&(r=e.DEPTH_COMPONENT24));let n=ee(i);et(i)?S.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,n,r,i.width,i.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,n,r,i.width,i.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,i.width,i.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(i.depthBuffer&&i.stencilBuffer){let r=ee(i);n&&!1===et(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,i.width,i.height):et(i)?S.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{let t=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function en(e,i){let n=e.colorSpace,r=e.format,s=e.type;return!0===e.isCompressedTexture||1035===e.format||n!==b&&""!==n&&(n===E?!1===l?!0===t.has("EXT_sRGB")&&1023===r?(e.format=1035,e.minFilter=m,e.generateMipmaps=!1):i=ei.sRGBToLinear(i):(1023!==r||1009!==s)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),i}this.allocateTextureUnit=function(){let e=k;return e>=_&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+_),k+=1,e},this.resetTextureUnits=function(){k=0},this.setTexture2D=G,this.setTexture2DArray=function(t,r){let s=n.get(t);if(t.version>0&&s.__version!==t.version){Z(s,t,r);return}i.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){let s=n.get(t);if(t.version>0&&s.__version!==t.version){Z(s,t,r);return}i.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,r){let a=n.get(t);if(t.version>0&&a.__version!==t.version){(function(t,r,a){if(6!==r.image.length)return;let o=J(t,r),h=r.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+a);let u=n.get(h);if(h.version!==u.__version||!0===o){let t;i.activeTexture(e.TEXTURE0+a),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);let n=r.isCompressedTexture||r.image[0].isCompressedTexture,c=r.image[0]&&r.image[0].isDataTexture,d=[];for(let e=0;e<6;e++)n||c?d[e]=c?r.image[e].image:r.image[e]:d[e]=L(r.image[e],!1,!0,v),d[e]=en(r,d[e]);let p=d[0],f=C(p)||l,m=s.convert(r.format,r.colorSpace),g=s.convert(r.type),x=N(r.internalFormat,m,g,r.colorSpace),_=l&&!0!==r.isVideoTexture,y=void 0===u.__version||!0===o,M=U(r,p,f);if(Y(e.TEXTURE_CUBE_MAP,r,f),n){_&&y&&i.texStorage2D(e.TEXTURE_CUBE_MAP,M,x,p.width,p.height);for(let n=0;n<6;n++){t=d[n].mipmaps;for(let s=0;s0&&M++,i.texStorage2D(e.TEXTURE_CUBE_MAP,M,x,d[0].width,d[0].height));for(let n=0;n<6;n++)if(c){_?i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,d[n].width,d[n].height,m,g,d[n].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,x,d[n].width,d[n].height,0,m,g,d[n].data);for(let r=0;r0){h.__webglFramebuffer[t]=[];for(let i=0;i0){h.__webglFramebuffer=[];for(let t=0;t0&&!1===et(t)){let n=d?o:[o];h.__webglMultisampledFramebuffer=e.createFramebuffer(),h.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer);for(let i=0;i0)for(let n=0;n0)for(let i=0;i0&&!1===et(t)){let r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],s=t.width,a=t.height,o=e.COLOR_BUFFER_BIT,l=[],h=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=n.get(t),c=!0===t.isWebGLMultipleRenderTargets;if(c)for(let t=0;t.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==a&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(r_)))}return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new rx;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class ry extends eo{constructor(e,t,i,n,r,s,a,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1014),void 0===i&&1027===h&&(i=1020),super(null,n,r,s,a,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==a?a:d,this.minFilter=void 0!==o?o:d,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class rM extends A{constructor(e,t){super();let i=this,n=null,r=1,s=null,a="local-floor",o=1,l=null,h=null,u=null,c=null,d=null,p=null,f=t.getContextAttributes(),m=null,g=null,x=[],_=[],v=new ii;v.layers.enable(1),v.viewport=new el;let y=new ii;y.layers.enable(2),y.viewport=new el;let M=[v,y],S=new rg;S.layers.enable(1),S.layers.enable(2);let E=null,b=null;function T(e){let t=_.indexOf(e.inputSource);if(-1===t)return;let i=x[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||s),i.dispatchEvent({type:e.type,data:e.inputSource}))}function w(){n.removeEventListener("select",T),n.removeEventListener("selectstart",T),n.removeEventListener("selectend",T),n.removeEventListener("squeeze",T),n.removeEventListener("squeezestart",T),n.removeEventListener("squeezeend",T),n.removeEventListener("end",w),n.removeEventListener("inputsourceschange",A);for(let e=0;e=0&&(_[n]=null,x[n].disconnect(i))}for(let t=0;t=_.length){_.push(i),n=e;break}if(null===_[e]){_[e]=i,n=e;break}}if(-1===n)break}let r=x[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new rv,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new rv,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new rv,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==c?c:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(h){if(null!==(n=h)){if(m=e.getRenderTarget(),n.addEventListener("select",T),n.addEventListener("selectstart",T),n.addEventListener("selectend",T),n.addEventListener("squeeze",T),n.addEventListener("squeezestart",T),n.addEventListener("squeezeend",T),n.addEventListener("end",w),n.addEventListener("inputsourceschange",A),!0!==f.xrCompatible&&await t.makeXRCompatible(),void 0===n.renderState.layers||!1===e.capabilities.isWebGL2){let i={antialias:void 0!==n.renderState.layers||f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,t,i),n.updateRenderState({baseLayer:d}),g=new eu(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let i=null,s=null,a=null;f.depth&&(a=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=f.stencil?1027:1026,s=f.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:a,scaleFactor:r};c=(u=new XRWebGLBinding(n,t)).createProjectionLayer(o),n.updateRenderState({layers:[c]}),g=new eu(c.textureWidth,c.textureHeight,{format:1023,type:1009,depthTexture:new ry(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0});let l=e.properties.get(g);l.__ignoreDepthValues=c.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await n.requestReferenceSpace(a),O.setContext(n),O.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};let P=new ep,R=new ep;function L(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===n)return;S.near=y.near=v.near=e.near,S.far=y.far=v.far=e.far,(E!==S.near||b!==S.far)&&(n.updateRenderState({depthNear:S.near,depthFar:S.far}),E=S.near,b=S.far);let t=e.parent,i=S.cameras;L(S,t);for(let e=0;e0&&(n.alphaTest.value=r.alphaTest);let s=t.get(r).envMap;if(s&&(n.envMap.value=s,n.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;let t=!0===e._useLegacyLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*t,i(r.lightMap,n.lightMapTransform)}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,t7(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,s,a,l){r.isMeshBasicMaterial?n(e,r):r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),r.gradientMap&&(e.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?(n(e,r),e.specular.value.copy(r.specular),e.shininess.value=Math.max(r.shininess,1e-4)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.metalness.value=n.metalness,n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap,i(n.metalnessMap,e.metalnessMapTransform)),e.roughness.value=n.roughness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap,i(n.roughnessMap,e.roughnessMapTransform));let r=t.get(n).envMap;r&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&(e.ior.value=r.ior,r.sheen>0&&(e.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen),e.sheenRoughness.value=r.sheenRoughness,r.sheenColorMap&&(e.sheenColorMap.value=r.sheenColorMap,i(r.sheenColorMap,e.sheenColorMapTransform)),r.sheenRoughnessMap&&(e.sheenRoughnessMap.value=r.sheenRoughnessMap,i(r.sheenRoughnessMap,e.sheenRoughnessMapTransform))),r.clearcoat>0&&(e.clearcoat.value=r.clearcoat,e.clearcoatRoughness.value=r.clearcoatRoughness,r.clearcoatMap&&(e.clearcoatMap.value=r.clearcoatMap,i(r.clearcoatMap,e.clearcoatMapTransform)),r.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=r.clearcoatRoughnessMap,i(r.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),r.clearcoatNormalMap&&(e.clearcoatNormalMap.value=r.clearcoatNormalMap,i(r.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(r.clearcoatNormalScale),r.side===o&&e.clearcoatNormalScale.value.negate())),r.iridescence>0&&(e.iridescence.value=r.iridescence,e.iridescenceIOR.value=r.iridescenceIOR,e.iridescenceThicknessMinimum.value=r.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=r.iridescenceThicknessRange[1],r.iridescenceMap&&(e.iridescenceMap.value=r.iridescenceMap,i(r.iridescenceMap,e.iridescenceMapTransform)),r.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=r.iridescenceThicknessMap,i(r.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),r.transmission>0&&(e.transmission.value=r.transmission,e.transmissionSamplerMap.value=l.texture,e.transmissionSamplerSize.value.set(l.width,l.height),r.transmissionMap&&(e.transmissionMap.value=r.transmissionMap,i(r.transmissionMap,e.transmissionMapTransform)),e.thickness.value=r.thickness,r.thicknessMap&&(e.thicknessMap.value=r.thicknessMap,i(r.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=r.attenuationDistance,e.attenuationColor.value.copy(r.attenuationColor)),r.anisotropy>0&&(e.anisotropyVector.value.set(r.anisotropy*Math.cos(r.anisotropyRotation),r.anisotropy*Math.sin(r.anisotropyRotation)),r.anisotropyMap&&(e.anisotropyMap.value=r.anisotropyMap,i(r.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=r.specularIntensity,e.specularColor.value.copy(r.specularColor),r.specularColorMap&&(e.specularColorMap.value=r.specularColorMap,i(r.specularColorMap,e.specularColorMapTransform)),r.specularIntensityMap&&(e.specularIntensityMap.value=r.specularIntensityMap,i(r.specularIntensityMap,e.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(n(e,r),r.matcap&&(e.matcap.value=r.matcap)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,i){let n=t.get(i).light;e.referencePosition.value.setFromMatrixPosition(n.matrixWorld),e.nearDistance.value=n.shadow.camera.near,e.farDistance.value=n.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,r.map&&(e.map.value=r.map,i(r.map,e.mapTransform)),r.isLineDashedMaterial&&(e.dashSize.value=r.dashSize,e.totalSize.value=r.dashSize+r.gapSize,e.scale.value=r.scale)):r.isPointsMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.size.value=r.size*s,e.scale.value=.5*a,r.map&&(e.map.value=r.map,i(r.map,e.uvTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,i(r.alphaMap,e.alphaMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isSpriteMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.rotation.value=r.rotation,r.map&&(e.map.value=r.map,i(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,i(r.alphaMap,e.alphaMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function rE(e,t,i,n){let r={},s={},a=[],o=i.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let i=t.target;i.removeEventListener("dispose",h);let n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete s[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,u){let c=r[i.id];void 0===c&&(function(e){let t=e.uniforms,i=0,n=0;for(let e=0,r=t.length;e0){n=i%16;let e=16-n;0!==n&&e-s.boundary<0&&(i+=16-n,r.__offset=i)}i+=s.storage}(n=i%16)>0&&(i+=16-n),e.__size=i,e.__cache={}}(i),c=function(t){let i=function(){for(let e=0;ea.matrixWorld.determinant(),g=function(e,t,i,s,a){var o;!0!==t.isScene&&(t=eA),u.resetTextureUnits();let l=t.fog,p=s.isMeshStandardMaterial?t.environment:null,f=null===et?K.outputColorSpace:!0===et.isXRRenderTarget?et.texture.colorSpace:b,m=(s.isMeshStandardMaterial?d:c).get(s.envMap||p),g=!0===s.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,x=!!i.attributes.tangent&&(!!s.normalMap||s.anisotropy>0),v=!!i.morphAttributes.position,y=!!i.morphAttributes.normal,S=!!i.morphAttributes.color,E=0;s.toneMapped&&(null===et||!0===et.isXRRenderTarget)&&(E=K.toneMapping);let T=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,A=void 0!==T?T.length:0,P=h.get(s),R=Y.state.lights;if(!0===eM&&(!0===eS||e!==en)){let t=e===en&&s.id===ei;M.setState(s,e,t)}let L=!1;s.version===P.__version?P.needsLights&&P.lightsStateVersion!==R.state.version?L=!0:P.outputColorSpace!==f?L=!0:a.isInstancedMesh&&!1===P.instancing?L=!0:a.isInstancedMesh||!0!==P.instancing?a.isSkinnedMesh&&!1===P.skinning?L=!0:a.isSkinnedMesh||!0!==P.skinning?a.isInstancedMesh&&!0===P.instancingColor&&null===a.instanceColor?L=!0:a.isInstancedMesh&&!1===P.instancingColor&&null!==a.instanceColor?L=!0:P.envMap!==m?L=!0:!0===s.fog&&P.fog!==l?L=!0:void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==M.numPlanes||P.numIntersection!==M.numIntersection)?L=!0:P.vertexAlphas!==g?L=!0:P.vertexTangents!==x?L=!0:P.morphTargets!==v?L=!0:P.morphNormals!==y?L=!0:P.morphColors!==S?L=!0:P.toneMapping!==E?L=!0:!0===n.isWebGL2&&P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:(L=!0,P.__version=s.version);let I=P.currentProgram;!0===L&&(I=eX(s,t,a));let O=!1,N=!1,U=!1,D=I.getUniforms(),B=P.uniforms;if(r.useProgram(I.program)&&(O=!0,N=!0,U=!0),s.id!==ei&&(ei=s.id,N=!0),O||en!==e){if(D.setValue(eR,"projectionMatrix",e.projectionMatrix),n.logarithmicDepthBuffer&&D.setValue(eR,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),en!==e&&(en=e,N=!0,U=!0),s.isShaderMaterial||s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshStandardMaterial||s.envMap){let t=D.map.cameraPosition;void 0!==t&&t.setValue(eR,ew.setFromMatrixPosition(e.matrixWorld))}(s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshLambertMaterial||s.isMeshBasicMaterial||s.isMeshStandardMaterial||s.isShaderMaterial)&&D.setValue(eR,"isOrthographic",!0===e.isOrthographicCamera),(s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshLambertMaterial||s.isMeshBasicMaterial||s.isMeshStandardMaterial||s.isShaderMaterial||s.isShadowMaterial||a.isSkinnedMesh)&&D.setValue(eR,"viewMatrix",e.matrixWorldInverse)}if(a.isSkinnedMesh){D.setOptional(eR,a,"bindMatrix"),D.setOptional(eR,a,"bindMatrixInverse");let e=a.skeleton;e&&(n.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),D.setValue(eR,"boneTexture",e.boneTexture,u),D.setValue(eR,"boneTextureSize",e.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let F=i.morphAttributes;if((void 0!==F.position||void 0!==F.normal||void 0!==F.color&&!0===n.isWebGL2)&&w.update(a,i,I),(N||P.receiveShadow!==a.receiveShadow)&&(P.receiveShadow=a.receiveShadow,D.setValue(eR,"receiveShadow",a.receiveShadow)),s.isMeshGouraudMaterial&&null!==s.envMap&&(B.envMap.value=m,B.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1),N&&(D.setValue(eR,"toneMappingExposure",K.toneMappingExposure),P.needsLights&&(o=U,B.ambientLightColor.needsUpdate=o,B.lightProbe.needsUpdate=o,B.directionalLights.needsUpdate=o,B.directionalLightShadows.needsUpdate=o,B.pointLights.needsUpdate=o,B.pointLightShadows.needsUpdate=o,B.spotLights.needsUpdate=o,B.spotLightShadows.needsUpdate=o,B.rectAreaLights.needsUpdate=o,B.hemisphereLights.needsUpdate=o),l&&!0===s.fog&&_.refreshFogUniforms(B,l),_.refreshMaterialUniforms(B,s,ef,ed,eE),nG.upload(eR,P.uniformsList,B,u)),s.isShaderMaterial&&!0===s.uniformsNeedUpdate&&(nG.upload(eR,P.uniformsList,B,u),s.uniformsNeedUpdate=!1),s.isSpriteMaterial&&D.setValue(eR,"center",a.center),D.setValue(eR,"modelViewMatrix",a.modelViewMatrix),D.setValue(eR,"normalMatrix",a.normalMatrix),D.setValue(eR,"modelMatrix",a.matrixWorld),s.isShaderMaterial||s.isRawShaderMaterial){let e=s.uniformsGroups;for(let t=0,i=e.length;t0&&function(e,t,r,s){let a=n.isWebGL2;null===eE&&(eE=new eu(1,1,{generateMipmaps:!0,type:i.has("EXT_color_buffer_half_float")?1016:1009,minFilter:x,samples:a?4:0})),K.getDrawingBufferSize(eT),a?eE.setSize(eT.x,eT.y):eE.setSize(F(eT.x),F(eT.y));let h=K.getRenderTarget();K.setRenderTarget(eE),K.getClearColor(eo),(eh=K.getClearAlpha())<1&&K.setClearColor(16777215,.5),K.clear();let c=K.toneMapping;K.toneMapping=0,ek(e,r,s),u.updateMultisampleRenderTarget(eE),u.updateRenderTargetMipmap(eE);let d=!1;for(let e=0,i=t.length;e0&&ek(h,t,s),c.length>0&&ek(c,t,s),d.length>0&&ek(d,t,s),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function ek(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?Z[Z.length-1]:null,J.pop(),q=J.length>0?J[J.length-1]:null},this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return et},this.setRenderTargetTextures=function(e,t,n){h.get(e.texture).__webglTexture=t,h.get(e.depthTexture).__webglTexture=n;let r=h.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0!==i.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let i=h.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,i=0){et=e,$=t,ee=i;let s=!0,a=null,o=!1,l=!1;if(e){let c=h.get(e);void 0!==c.__useDefaultFramebuffer?(r.bindFramebuffer(eR.FRAMEBUFFER,null),s=!1):void 0===c.__webglFramebuffer?u.setupRenderTarget(e):c.__hasExternalTextures&&u.rebindTextures(e,h.get(e.texture).__webglTexture,h.get(e.depthTexture).__webglTexture);let d=e.texture;(d.isData3DTexture||d.isDataArrayTexture||d.isCompressedArrayTexture)&&(l=!0);let p=h.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(p[t])?p[t][i]:p[t],o=!0):a=n.isWebGL2&&e.samples>0&&!1===u.useMultisampledRTT(e)?h.get(e).__webglMultisampledFramebuffer:Array.isArray(p)?p[i]:p,er.copy(e.viewport),es.copy(e.scissor),ea=e.scissorTest}else er.copy(ex).multiplyScalar(ef).floor(),es.copy(e_).multiplyScalar(ef).floor(),ea=ev;let c=r.bindFramebuffer(eR.FRAMEBUFFER,a);if(c&&n.drawBuffers&&s&&r.drawBuffers(e,a),r.viewport(er),r.scissor(es),r.setScissorTest(ea),o){let n=h.get(e.texture);eR.framebufferTexture2D(eR.FRAMEBUFFER,eR.COLOR_ATTACHMENT0,eR.TEXTURE_CUBE_MAP_POSITIVE_X+t,n.__webglTexture,i)}else if(l){let n=h.get(e.texture),r=t||0;eR.framebufferTextureLayer(eR.FRAMEBUFFER,eR.COLOR_ATTACHMENT0,n.__webglTexture,i||0,r)}ei=-1},this.readRenderTargetPixels=function(e,t,s,a,o,l,u){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let c=h.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(c=c[u]),c){r.bindFramebuffer(eR.FRAMEBUFFER,c);try{let r=e.texture,h=r.format,u=r.type;if(1023!==h&&R.convert(h)!==eR.getParameter(eR.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let c=1016===u&&(i.has("EXT_color_buffer_half_float")||n.isWebGL2&&i.has("EXT_color_buffer_float"));if(1009!==u&&R.convert(u)!==eR.getParameter(eR.IMPLEMENTATION_COLOR_READ_TYPE)&&!(1015===u&&(n.isWebGL2||i.has("OES_texture_float")||i.has("WEBGL_color_buffer_float")))&&!c){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-a&&s>=0&&s<=e.height-o&&eR.readPixels(t,s,a,o,R.convert(h),R.convert(u),l)}finally{let e=null!==et?h.get(et).__webglFramebuffer:null;r.bindFramebuffer(eR.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,i=0){let n=Math.pow(2,-i),s=Math.floor(t.image.width*n),a=Math.floor(t.image.height*n);u.setTexture2D(t,0),eR.copyTexSubImage2D(eR.TEXTURE_2D,i,0,0,e.x,e.y,s,a),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i,n=0){let s=t.image.width,a=t.image.height,o=R.convert(i.format),l=R.convert(i.type);u.setTexture2D(i,0),eR.pixelStorei(eR.UNPACK_FLIP_Y_WEBGL,i.flipY),eR.pixelStorei(eR.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),eR.pixelStorei(eR.UNPACK_ALIGNMENT,i.unpackAlignment),t.isDataTexture?eR.texSubImage2D(eR.TEXTURE_2D,n,e.x,e.y,s,a,o,l,t.image.data):t.isCompressedTexture?eR.compressedTexSubImage2D(eR.TEXTURE_2D,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):eR.texSubImage2D(eR.TEXTURE_2D,n,e.x,e.y,o,l,t.image),0===n&&i.generateMipmaps&&eR.generateMipmap(eR.TEXTURE_2D),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,n,s=0){let a;if(K.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let o=e.max.x-e.min.x+1,l=e.max.y-e.min.y+1,h=e.max.z-e.min.z+1,c=R.convert(n.format),d=R.convert(n.type);if(n.isData3DTexture)u.setTexture3D(n,0),a=eR.TEXTURE_3D;else if(n.isDataArrayTexture)u.setTexture2DArray(n,0),a=eR.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}eR.pixelStorei(eR.UNPACK_FLIP_Y_WEBGL,n.flipY),eR.pixelStorei(eR.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eR.pixelStorei(eR.UNPACK_ALIGNMENT,n.unpackAlignment);let p=eR.getParameter(eR.UNPACK_ROW_LENGTH),f=eR.getParameter(eR.UNPACK_IMAGE_HEIGHT),m=eR.getParameter(eR.UNPACK_SKIP_PIXELS),g=eR.getParameter(eR.UNPACK_SKIP_ROWS),x=eR.getParameter(eR.UNPACK_SKIP_IMAGES),_=i.isCompressedTexture?i.mipmaps[0]:i.image;eR.pixelStorei(eR.UNPACK_ROW_LENGTH,_.width),eR.pixelStorei(eR.UNPACK_IMAGE_HEIGHT,_.height),eR.pixelStorei(eR.UNPACK_SKIP_PIXELS,e.min.x),eR.pixelStorei(eR.UNPACK_SKIP_ROWS,e.min.y),eR.pixelStorei(eR.UNPACK_SKIP_IMAGES,e.min.z),i.isDataTexture||i.isData3DTexture?eR.texSubImage3D(a,s,t.x,t.y,t.z,o,l,h,c,d,_.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),eR.compressedTexSubImage3D(a,s,t.x,t.y,t.z,o,l,h,c,_.data)):eR.texSubImage3D(a,s,t.x,t.y,t.z,o,l,h,c,d,_),eR.pixelStorei(eR.UNPACK_ROW_LENGTH,p),eR.pixelStorei(eR.UNPACK_IMAGE_HEIGHT,f),eR.pixelStorei(eR.UNPACK_SKIP_PIXELS,m),eR.pixelStorei(eR.UNPACK_SKIP_ROWS,g),eR.pixelStorei(eR.UNPACK_SKIP_IMAGES,x),0===s&&n.generateMipmaps&&eR.generateMipmap(a),r.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?u.setTextureCube(e,0):e.isData3DTexture?u.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?u.setTexture2DArray(e,0):u.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){$=0,ee=0,et=null,r.reset(),L.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===E?3001:3e3}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=3001===e?E:b}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}(class extends rb{}).prototype.isWebGL1Renderer=!0;class rT extends tr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class rw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=I()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let n=0,r=this.stride;no)continue;c.applyMatrix4(this.matrixWorld);let a=e.ray.origin.distanceTo(c);ae.far||t.push({distance:a,point:u.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else{let i=Math.max(0,s.start),n=Math.min(m.count,s.start+s.count);for(let r=i,s=n-1;ro)continue;c.applyMatrix4(this.matrixWorld);let n=e.ray.origin.distanceTo(c);ne.far||t.push({distance:n,point:u.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;t0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;tr.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:t,face:null,object:a})}}class so{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)t.push(r+=(i=this.getPoint(s/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i;let n=this.getLengths(),r=0,s=n.length;i=t||e*n[s-1];let a=0,o=s-1,l;for(;a<=o;)if((l=n[r=Math.floor(a+(o-a)/2)]-i)<0)a=r+1;else if(l>0)o=r-1;else{o=r;break}if(n[r=o]===i)return r/(s-1);let h=n[r],u=n[r+1],c=(r+(i-h)/(u-h))/(s-1);return c}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),s=this.getPoint(n),a=t||(r.isVector2?new k:new ep);return a.copy(s).sub(r).normalize(),a}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new ep,n=[],r=[],s=[],a=new ep,o=new eG;for(let t=0;t<=e;t++){let i=t/e;n[t]=this.getTangentAt(i,new ep)}r[0]=new ep,s[0]=new ep;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),c<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(n[t-1],n[t]),a.length()>Number.EPSILON){a.normalize();let e=Math.acos(O(n[t-1].dot(n[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(n[t],r[t])}if(!0===t){let t=Math.acos(O(r[0].dot(r[e]),-1,1));t/=e,n[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let i=1;i<=e;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],t*i)),s[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class sl extends so{constructor(e=0,t=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t){let i=t||new k,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,s=Math.abs(r)n;)r-=n;ri.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return t.set(sf(s,a.x,o.x,l.x,h.x),sf(s,a.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t0?0:(Math.floor(Math.abs(o)/s)+1)*s:0===l&&o===s-1&&(o=s-2,l=1),this.closed||o>0?i=r[(o-1)%s]:(su.subVectors(r[0],r[1]).add(r[0]),i=su);let h=r[o%s],u=r[(o+1)%s];if(this.closed||o+2=i){let e=n[r]-i,s=this.curves[r],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class sT extends tz{constructor(e=[new k(0,-.5),new k(.5,0),new k(0,.5)],t=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},t=Math.floor(t),n=O(n,0,2*Math.PI);let r=[],s=[],a=[],o=[],l=[],h=1/t,u=new ep,c=new k,d=new ep,p=new ep,f=new ep,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){let d=i+r*h*n,p=Math.sin(d),f=Math.cos(d);for(let i=0;i<=e.length-1;i++){u.x=e[i].x*p,u.y=e[i].y,u.z=e[i].x*f,s.push(u.x,u.y,u.z),c.x=r/t,c.y=i/(e.length-1),a.push(c.x,c.y);let n=o[3*i+0]*p,h=o[3*i+1],d=o[3*i+0]*f;l.push(n,h,d)}}for(let i=0;i0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new tC(u,3)),this.setAttribute("normal",new tC(c,3)),this.setAttribute("uv",new tC(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sP(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class sR extends sP{constructor(e=1,t=1,i=32,n=1,r=!1,s=0,a=2*Math.PI){super(0,e,t,i,n,r,s,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(e){return new sR(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class sL extends tz{constructor(e=[],t=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n};let r=[],s=[];function a(e){r.push(e.x,e.y,e.z)}function o(t,i){let n=3*t;i.x=e[n+0],i.y=e[n+1],i.z=e[n+2]}function l(e,t,i,n){n<0&&1===e.x&&(s[t]=e.x-1),0===i.x&&0===i.z&&(s[t]=n/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}(function(e){let i=new ep,n=new ep,r=new ep;for(let s=0;s.9&&a<.1&&(t<.2&&(s[e+0]+=1),i<.2&&(s[e+2]+=1),n<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new tC(r,3)),this.setAttribute("normal",new tC(r.slice(),3)),this.setAttribute("uv",new tC(s,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sL(e.vertices,e.indices,e.radius,e.details)}}class sC extends sL{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,n=1/i,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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];super(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="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sC(e.radius,e.detail)}}class sI extends sb{constructor(e){super(e),this.uuid=I(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,n=this.holes.length;i=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=s&&e>n&&(n=e,r=i.x=i.x&&i.x>=l&&s!==i.x&&sF(ar.x||i.x===r.x&&(d=r,p=i,0>sz(d.prev,d,p.prev)&&0>sz(p.next,d,d.next))))&&(r=i,u=c)),i=i.next}while(i!==o)return r}(e,t);if(!i)return t;let n=sX(i,e);return sU(n,n.next),sU(i,i.next)}(h[r],i);return i}(e,t,d,i)),e.length>80*i){n=s=e[0],r=a=e[1];for(let t=i;ts&&(s=o),l>a&&(a=l);h=0!==(h=Math.max(s-n,a-r))?32767/h:0}return function e(t,i,n,r,s,a,o){if(!t)return;!o&&a&&function(e,t,i,n){let r=e;do 0===r.z&&(r.z=sB(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e)r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,i,n,r,s,a,o,l,h=1;do{for(i=e,e=null,s=null,a=0;i;){for(a++,n=i,o=0,t=0;t0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1)}(r)}(t,r,s,a);let l=t,h,u;for(;t.prev!==t.next;){if(h=t.prev,u=t.next,a?function(e,t,i,n){let r=e.prev,s=e.next;if(sz(r,e,s)>=0)return!1;let a=r.x,o=e.x,l=s.x,h=r.y,u=e.y,c=s.y,d=ao?a>l?a:l:o>l?o:l,m=h>u?h>c?h:c:u>c?u:c,g=sB(d,p,t,i,n),x=sB(f,m,t,i,n),_=e.prevZ,v=e.nextZ;for(;_&&_.z>=g&&v&&v.z<=x;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==s&&sF(a,h,o,u,l,c,_.x,_.y)&&sz(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==s&&sF(a,h,o,u,l,c,v.x,v.y)&&sz(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=g;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==s&&sF(a,h,o,u,l,c,_.x,_.y)&&sz(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=x;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==s&&sF(a,h,o,u,l,c,v.x,v.y)&&sz(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(t,r,s,a):function(e){let t=e.prev,i=e.next;if(sz(t,e,i)>=0)return!1;let n=t.x,r=e.x,s=i.x,a=t.y,o=e.y,l=i.y,h=nr?n>s?n:s:r>s?r:s,d=a>o?a>l?a:l:o>l?o:l,p=i.next;for(;p!==t;){if(p.x>=h&&p.x<=c&&p.y>=u&&p.y<=d&&sF(n,a,r,o,s,l,p.x,p.y)&&sz(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){i.push(h.i/n|0),i.push(t.i/n|0),i.push(u.i/n|0),sq(t),t=u.next,l=u.next;continue}if((t=u)===l){o?1===o?e(t=function(e,t,i){let n=e;do{let r=n.prev,s=n.next.next;!sV(r,s)&&sH(r,n,n.next,s)&&sW(r,s)&&sW(s,r)&&(t.push(r.i/i|0),t.push(n.i/i|0),t.push(s.i/i|0),sq(n),sq(n.next),n=e=s),n=n.next}while(n!==e)return sU(n)}(sU(t),i,n),i,n,r,s,a,2):2===o&&function(t,i,n,r,s,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,h;if(o.i!==t.i&&(l=o,h=t,l.next.i!==h.i&&l.prev.i!==h.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&sH(i,i.next,e,t))return!0;i=i.next}while(i!==e)return!1}(l,h)&&(sW(l,h)&&sW(h,l)&&function(e,t){let i=e,n=!1,r=(e.x+t.x)/2,s=(e.y+t.y)/2;do i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next;while(i!==e)return n}(l,h)&&(sz(l.prev,l,h.prev)||sz(l,h.prev,h))||sV(l,h)&&sz(l.prev,l,l.next)>0&&sz(h.prev,h,h.next)>0))){let l=sX(o,t);o=sU(o,o.next),l=sU(l,l.next),e(o,i,n,r,s,a,0),e(l,i,n,r,s,a,0);return}t=t.next}o=o.next}while(o!==t)}(t,i,n,r,s,a):e(sU(t),i,n,r,s,a,1);break}}}(d,p,i,n,r,h,0),p}};function sN(e,t,i,n,r){let s,a;if(r===function(e,t,i,n){let r=0;for(let s=t,a=i-n;s0)for(s=t;s=t;s-=n)a=sj(s,e[s],e[s+1],a);return a&&sV(a,a.next)&&(sq(a),a=a.next),a}function sU(e,t){if(!e)return e;t||(t=e);let i=e,n;do if(n=!1,!i.steiner&&(sV(i,i.next)||0===sz(i.prev,i,i.next))){if(sq(i),(i=t=i.prev)===i.next)break;n=!0}else i=i.next;while(n||i!==t)return t}function sD(e,t){return e.x-t.x}function sB(e,t,i,n,r){return(e=((e=((e=((e=((e=(e-i)*r|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-n)*r|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function sF(e,t,i,n,r,s,a,o){return(r-a)*(t-o)>=(e-a)*(s-o)&&(e-a)*(n-o)>=(i-a)*(t-o)&&(i-a)*(s-o)>=(r-a)*(n-o)}function sz(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function sV(e,t){return e.x===t.x&&e.y===t.y}function sH(e,t,i,n){let r=sG(sz(e,t,i)),s=sG(sz(e,t,n)),a=sG(sz(i,n,e)),o=sG(sz(i,n,t));return!!(r!==s&&a!==o||0===r&&sk(e,i,t)||0===s&&sk(e,n,t)||0===a&&sk(i,e,n)||0===o&&sk(i,t,n))}function sk(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function sG(e){return e>0?1:e<0?-1:0}function sW(e,t){return 0>sz(e.prev,e,e.next)?sz(e,t,e.next)>=0&&sz(e,e.prev,t)>=0:0>sz(e,t,e.prev)||0>sz(e,e.next,t)}function sX(e,t){let i=new sY(e.i,e.x,e.y),n=new sY(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function sj(e,t,i,n){let r=new sY(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function sq(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 sY(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class sJ{static area(e){let t=e.length,i=0;for(let n=t-1,r=0;rsJ.area(e)}static triangulateShape(e,t){let i=[],n=[],r=[];sZ(e),sK(i,e);let s=e.length;t.forEach(sZ);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function sK(e,t){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),d=Math.sqrt(l*l+h*h),p=t.x-o/c,f=t.y+a/c,m=i.x-h/d,g=i.y+l/d,x=((m-p)*h-(g-f)*l)/(a*h-o*l);n=p+a*x-e.x,r=f+o*x-e.y;let _=n*n+r*r;if(_<=2)return new k(n,r);s=Math.sqrt(_/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(h)&&(e=!0),e?(n=-o,r=a,s=Math.sqrt(u)):(n=a,r=o,s=Math.sqrt(u/2))}return new k(n/s,r/s)}let I=[];for(let e=0,t=A.length,i=t-1,n=e+1;e=0;e--){let t=e/x,i=f*Math.cos(t*Math.PI/2),n=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=A.length;e=0;){let s=r,a=r-1;a<0&&(a=e.length-1);for(let e=0,r=c+2*x;e0)&&d.push(t,r,l),(e!==i-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,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.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function at(e,t,i){return an(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)}function ai(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function an(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ar(e,t,i){let n=e.length,r=new e.constructor(n);for(let s=0,a=0;a!==n;++s){let n=i[s]*t;for(let i=0;i!==t;++i)r[a++]=e[n+i]}return r}function as(e,t,i,n){let r=1,s=e[0];for(;void 0!==s&&void 0===s[n];)s=e[r++];if(void 0===s)return;let a=s[n];if(void 0!==a){if(Array.isArray(a))do void 0!==(a=s[n])&&(t.push(s.time),i.push.apply(i,a)),s=e[r++];while(void 0!==s)else if(void 0!==a.toArray)do void 0!==(a=s[n])&&(t.push(s.time),a.toArray(i,i.length)),s=e[r++];while(void 0!==s)else do void 0!==(a=s[n])&&(t.push(s.time),i.push(a)),s=e[r++];while(void 0!==s)}}class aa{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{let s;i:{n:if(!(e=r)){let a=t[1];e=(r=t[--i-1]))break t}s=i,i=0;break i}break e}for(;i>>1;et;)--s;if(++s,0!==r||s!==n){r>=s&&(r=(s=Math.max(s,1))-1);let e=this.getValueSize();this.times=at(i,r,s),this.values=at(this.values,r*e,s*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){let n=i[t];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,n),e=!1;break}if(null!==s&&s>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,n,s),e=!1;break}s=n}if(void 0!==n&&an(n))for(let t=0,i=n.length;t!==i;++t){let i=n[t];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,i),e=!1;break}}return e}optimize(){let e=at(this.times),t=at(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,s=1;for(let a=1;a0){e[s]=e[r];for(let e=r*i,n=s*i,a=0;a!==i;++a)t[n+a]=t[e+a];++s}return s!==e.length?(this.times=at(e,0,s),this.values=at(t,0,s*i)):(this.times=e,this.values=t),this}clone(){let e=at(this.times,0),t=at(this.values,0),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}au.prototype.TimeBufferType=Float32Array,au.prototype.ValueBufferType=Float32Array,au.prototype.DefaultInterpolation=v;class ac extends au{}ac.prototype.ValueTypeName="bool",ac.prototype.ValueBufferType=Array,ac.prototype.DefaultInterpolation=_,ac.prototype.InterpolantFactoryMethodLinear=void 0,ac.prototype.InterpolantFactoryMethodSmooth=void 0;class ad extends au{}ad.prototype.ValueTypeName="color";class ap extends au{}ap.prototype.ValueTypeName="number";class af extends aa{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(i-t)/(n-t),l=e*a;for(let e=l+a;l!==e;l+=4)ed.slerpFlat(r,0,s,l-a,s,l,o);return r}}class am extends au{InterpolantFactoryMethodLinear(e){return new af(this.times,this.values,this.getValueSize(),e)}}am.prototype.ValueTypeName="quaternion",am.prototype.DefaultInterpolation=v,am.prototype.InterpolantFactoryMethodSmooth=void 0;class ag extends au{}ag.prototype.ValueTypeName="string",ag.prototype.ValueBufferType=Array,ag.prototype.DefaultInterpolation=_,ag.prototype.InterpolantFactoryMethodLinear=void 0,ag.prototype.InterpolantFactoryMethodSmooth=void 0;class ax extends au{}ax.prototype.ValueTypeName="vector";class a_{constructor(e,t=-1,i,n=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=I(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let e=0,r=i.length;e!==r;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ap;case"vector":case"vector2":case"vector3":case"vector4":return ax;case"color":return ad;case"quaternion":return am;case"bool":case"boolean":return ac;case"string":return ag}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];as(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(n));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,n=i.length;e!==n;++e)t.push(au.toJSON(i[e]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let r=t.length,s=[];for(let e=0;e1){let e=s[1],t=n[e];t||(n[e]=t=[]),t.push(i)}}let s=[];for(let e in n)s.push(this.CreateFromMorphTargetSequence(e,n[e],t,i));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,n,r){if(0!==i.length){let s=[],a=[];as(i,s,a,n),0!==s.length&&r.push(new e(t,s,a))}},n=[],r=e.name||"default",s=e.fps||30,a=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==aS[e]){aS[e].push({onLoad:t,onProgress:i,onError:n});return}aS[e]=[],aS[e].push({onLoad:t,onProgress:i,onError:n});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=aS[e],n=t.body.getReader(),r=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s,o=0,l=new ReadableStream({start(e){(function t(){n.read().then(({done:n,value:r})=>{if(n)e.close();else{o+=r.byteLength;let n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=i.length;e{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>{let t=new DOMParser;return t.parseFromString(e,a)});case"json":return e.json();default:if(void 0===a)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(a),i=t&&t[1]?t[1].toLowerCase():void 0,n=new TextDecoder(i);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{av.add(e,t);let i=aS[e];delete aS[e];for(let e=0,n=i.length;e{let i=aS[e];if(void 0===i)throw this.manager.itemError(e),t;delete aS[e];for(let e=0,n=i.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class aT extends aM{constructor(e){super(e)}load(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,s=av.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;let a=j("img");function o(){h(),av.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){h(),n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class aw extends aM{constructor(e){super(e)}load(e,t,i,n){let r=new eo,s=new aT(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},i,n),r}}class aA extends tr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tE(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(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}}let aP=new eG,aR=new ep,aL=new ep;class aC{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new k(512,512),this.map=null,this.mapPass=null,this.matrix=new eG,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ip,this._frameExtents=new k(1,1),this._viewportCount=1,this._viewports=[new el(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;aR.setFromMatrixPosition(e.matrixWorld),t.position.copy(aR),aL.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(aL),t.updateMatrixWorld(),aP.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aP),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(aP)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),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}}class aI extends aC{constructor(){super(new ii(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=2*C*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||n!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=n,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class aO extends aA{constructor(e,t,i=0,n=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(tr.DEFAULT_UP),this.updateMatrix(),this.target=new tr,this.distance=i,this.angle=n,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new aI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),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}}let aN=new eG,aU=new ep,aD=new ep;class aB extends aC{constructor(){super(new ii(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new k(4,2),this._viewportCount=6,this._viewports=[new el(2,1,1,1),new el(0,1,1,1),new el(3,1,1,1),new el(1,1,1,1),new el(3,0,1,1),new el(1,0,1,1)],this._cubeDirections=[new ep(1,0,0),new ep(-1,0,0),new ep(0,0,1),new ep(0,0,-1),new ep(0,1,0),new ep(0,-1,0)],this._cubeUps=[new ep(0,1,0),new ep(0,1,0),new ep(0,1,0),new ep(0,1,0),new ep(0,0,1),new ep(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,n=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),aU.setFromMatrixPosition(e.matrixWorld),i.position.copy(aU),aD.copy(i.position),aD.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(aD),i.updateMatrixWorld(),n.makeTranslation(-aU.x,-aU.y,-aU.z),aN.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aN)}}class aF extends aA{constructor(e,t,i=0,n=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new aB}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class az extends aC{constructor(){super(new iP(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class aV extends aA{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tr.DEFAULT_UP),this.updateMatrix(),this.target=new tr,this.shadow=new az}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class aH extends aA{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class ak{static decodeText(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;ic);var n=r("ilwiq");let s={type:"change"},a={type:"start"},o={type:"end"},l=new n.Ray,h=new n.Plane,u=Math.cos(70*n.MathUtils.DEG2RAD);class c extends n.EventDispatcher{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new n.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",$),this._domElementKeyEvents=e},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",$),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(s),i.update(),c=r.NONE},this.update=function(){let t=new n.Vector3,a=new(0,n.Quaternion)().setFromUnitVectors(e.up,new n.Vector3(0,1,0)),o=a.clone().invert(),x=new n.Vector3,_=new n.Quaternion,v=new n.Vector3,y=2*Math.PI;return function(){let M=i.object.position;t.copy(M).sub(i.target),t.applyQuaternion(a),p.setFromVector3(t),i.autoRotate&&c===r.NONE&&I(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(p.theta+=f.theta*i.dampingFactor,p.phi+=f.phi*i.dampingFactor):(p.theta+=f.theta,p.phi+=f.phi);let S=i.minAzimuthAngle,E=i.maxAzimuthAngle;isFinite(S)&&isFinite(E)&&(S<-Math.PI?S+=y:S>Math.PI&&(S-=y),E<-Math.PI?E+=y:E>Math.PI&&(E-=y),S<=E?p.theta=Math.max(S,Math.min(E,p.theta)):p.theta=p.theta>(S+E)/2?Math.max(S,p.theta):Math.min(E,p.theta)),p.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,p.phi)),p.makeSafe(),!0===i.enableDamping?i.target.addScaledVector(g,i.dampingFactor):i.target.add(g),i.zoomToCursor&&P||i.object.isOrthographicCamera?p.radius=V(p.radius):p.radius=V(p.radius*m),t.setFromSpherical(p),t.applyQuaternion(o),M.copy(i.target).add(t),i.object.lookAt(i.target),!0===i.enableDamping?(f.theta*=1-i.dampingFactor,f.phi*=1-i.dampingFactor,g.multiplyScalar(1-i.dampingFactor)):(f.set(0,0,0),g.set(0,0,0));let b=!1;if(i.zoomToCursor&&P){let r=null;if(i.object.isPerspectiveCamera){let e=t.length();r=V(e*m);let n=e-r;i.object.position.addScaledVector(w,n),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let e=new n.Vector3(A.x,A.y,0);e.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/m)),i.object.updateProjectionMatrix(),b=!0;let s=new n.Vector3(A.x,A.y,0);s.unproject(i.object),i.object.position.sub(s).add(e),i.object.updateMatrixWorld(),r=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;null!==r&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(r).add(i.object.position):(l.origin.copy(i.object.position),l.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(l.direction))d||8*(1-_.dot(i.object.quaternion))>d||v.distanceToSquared(i.target)>0)&&(i.dispatchEvent(s),x.copy(i.object.position),_.copy(i.object.quaternion),v.copy(i.target),b=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",ee),i.domElement.removeEventListener("pointerdown",J),i.domElement.removeEventListener("pointercancel",K),i.domElement.removeEventListener("wheel",Q),i.domElement.removeEventListener("pointermove",Z),i.domElement.removeEventListener("pointerup",K),null!==i._domElementKeyEvents&&(i._domElementKeyEvents.removeEventListener("keydown",$),i._domElementKeyEvents=null)};let i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},c=r.NONE,d=1e-6,p=new n.Spherical,f=new n.Spherical,m=1,g=new n.Vector3,x=new n.Vector2,_=new n.Vector2,v=new n.Vector2,y=new n.Vector2,M=new n.Vector2,S=new n.Vector2,E=new n.Vector2,b=new n.Vector2,T=new n.Vector2,w=new n.Vector3,A=new n.Vector2,P=!1,R=[],L={};function C(){return Math.pow(.95,i.zoomSpeed)}function I(e){f.theta-=e}function O(e){f.phi-=e}let N=function(){let e=new n.Vector3;return function(t,i){e.setFromMatrixColumn(i,0),e.multiplyScalar(-t),g.add(e)}}(),U=function(){let e=new n.Vector3;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),g.add(e)}}(),D=function(){let e=new n.Vector3;return function(t,n){let r=i.domElement;if(i.object.isPerspectiveCamera){let s=i.object.position;e.copy(s).sub(i.target);let a=e.length();N(2*t*(a*=Math.tan(i.object.fov/2*Math.PI/180))/r.clientHeight,i.object.matrix),U(2*n*a/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(N(t*(i.object.right-i.object.left)/i.object.zoom/r.clientWidth,i.object.matrix),U(n*(i.object.top-i.object.bottom)/i.object.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function B(e){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?m/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function F(e){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?m*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function z(t){if(!i.zoomToCursor)return;P=!0;let n=i.domElement.getBoundingClientRect(),r=t.clientX-n.left,s=t.clientY-n.top,a=n.width,o=n.height;A.x=r/a*2-1,A.y=-(2*(s/o))+1,w.set(A.x,A.y,1).unproject(e).sub(e.position).normalize()}function V(e){return Math.max(i.minDistance,Math.min(i.maxDistance,e))}function H(e){x.set(e.clientX,e.clientY)}function k(e){y.set(e.clientX,e.clientY)}function G(){if(1===R.length)x.set(R[0].pageX,R[0].pageY);else{let e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY);x.set(e,t)}}function W(){if(1===R.length)y.set(R[0].pageX,R[0].pageY);else{let e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY);y.set(e,t)}}function X(){let e=R[0].pageX-R[1].pageX,t=R[0].pageY-R[1].pageY;E.set(0,Math.sqrt(e*e+t*t))}function j(e){if(1==R.length)_.set(e.pageX,e.pageY);else{let t=ei(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);_.set(i,n)}v.subVectors(_,x).multiplyScalar(i.rotateSpeed);let t=i.domElement;I(2*Math.PI*v.x/t.clientHeight),O(2*Math.PI*v.y/t.clientHeight),x.copy(_)}function q(e){if(1===R.length)M.set(e.pageX,e.pageY);else{let t=ei(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);M.set(i,n)}S.subVectors(M,y).multiplyScalar(i.panSpeed),D(S.x,S.y),y.copy(M)}function Y(e){let t=ei(e),n=e.pageX-t.x,r=e.pageY-t.y;b.set(0,Math.sqrt(n*n+r*r)),T.set(0,Math.pow(b.y/E.y,i.zoomSpeed)),B(T.y),E.copy(b)}function J(e){!1!==i.enabled&&(0===R.length&&(i.domElement.setPointerCapture(e.pointerId),i.domElement.addEventListener("pointermove",Z),i.domElement.addEventListener("pointerup",K)),R.push(e),"touch"===e.pointerType?function(e){switch(et(e),R.length){case 1:switch(i.touches.ONE){case n.TOUCH.ROTATE:if(!1===i.enableRotate)return;G(),c=r.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(!1===i.enablePan)return;W(),c=r.TOUCH_PAN;break;default:c=r.NONE}break;case 2:switch(i.touches.TWO){case n.TOUCH.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&X(),i.enablePan&&W(),c=r.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&X(),i.enableRotate&&G(),c=r.TOUCH_DOLLY_ROTATE;break;default:c=r.NONE}break;default:c=r.NONE}c!==r.NONE&&i.dispatchEvent(a)}(e):function(e){let t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(!1===i.enableZoom)return;z(e),E.set(e.clientX,e.clientY),c=r.DOLLY;break;case n.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;k(e),c=r.PAN}else{if(!1===i.enableRotate)return;H(e),c=r.ROTATE}break;case n.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;H(e),c=r.ROTATE}else{if(!1===i.enablePan)return;k(e),c=r.PAN}break;default:c=r.NONE}c!==r.NONE&&i.dispatchEvent(a)}(e))}function Z(e){!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(et(e),c){case r.TOUCH_ROTATE:if(!1===i.enableRotate)return;j(e),i.update();break;case r.TOUCH_PAN:if(!1===i.enablePan)return;q(e),i.update();break;case r.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&Y(e),i.enablePan&&q(e),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&Y(e),i.enableRotate&&j(e),i.update();break;default:c=r.NONE}}(e):function(e){switch(c){case r.ROTATE:if(!1===i.enableRotate)return;!function(e){_.set(e.clientX,e.clientY),v.subVectors(_,x).multiplyScalar(i.rotateSpeed);let t=i.domElement;I(2*Math.PI*v.x/t.clientHeight),O(2*Math.PI*v.y/t.clientHeight),x.copy(_),i.update()}(e);break;case r.DOLLY:if(!1===i.enableZoom)return;b.set(e.clientX,e.clientY),T.subVectors(b,E),T.y>0?B(C()):T.y<0&&F(C()),E.copy(b),i.update();break;case r.PAN:if(!1===i.enablePan)return;M.set(e.clientX,e.clientY),S.subVectors(M,y).multiplyScalar(i.panSpeed),D(S.x,S.y),y.copy(M),i.update()}}(e))}function K(e){(function(e){delete L[e.pointerId];for(let t=0;t0&&B(C()),i.update(),i.dispatchEvent(o))}function $(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?O(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):D(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?O(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):D(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?I(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):D(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?I(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):D(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function ee(e){!1!==i.enabled&&e.preventDefault()}function et(e){let t=L[e.pointerId];void 0===t&&(t=new n.Vector2,L[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ei(e){let t=e.pointerId===R[0].pointerId?R[1]:R[0];return L[t.pointerId]}i.domElement.addEventListener("contextmenu",ee),i.domElement.addEventListener("pointerdown",J),i.domElement.addEventListener("pointercancel",K),i.domElement.addEventListener("wheel",Q,{passive:!1}),this.update()}}}),r.register("7ePFa",function(t,i){e(t.exports,"mergeGeometries",()=>s),e(t.exports,"toTrianglesDrawMode",()=>o);var n=r("ilwiq");function s(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),o={},l={},h=e[0].morphTargetsRelative,u=new n.BufferGeometry,c=0;for(let n=0;nr("kTiqx").ProjectionGenerator),e(t.exports,"OUTPUT_BOTH",()=>r("l7uOa").OUTPUT_BOTH),e(t.exports,"SilhouetteGenerator",()=>r("l7uOa").SilhouetteGenerator),r("kTiqx"),r("l7uOa")}),r.register("kTiqx",function(t,i){e(t.exports,"ProjectionGenerator",()=>v);var n=r("ilwiq"),s=r("6KVZ3"),a=r("bJKwC"),o=r("fNPnQ"),l=r("33ViW"),h=r("itkSV"),u=r("64zt3"),c=r("iQQnd"),d=r("5zNJG");let p=new n.Vector3(0,1,0),f=new n.Line3,m=new n.Ray,g=new n.Vector3,x=new n.Line3;class _{constructor(){this.edges=[]}getLineGeometry(e=0){let t=this.edges,i=new Float32Array(6*t.length),r=0;for(let n=0,s=t.length;n{let{signal:r}=t,s=this.generate(e,t);(function e(){r&&r.aborted&&n(Error("ProjectionGenerator: Process aborted via AbortSignal."));let t=s.next();t.done?i(t.value):requestAnimationFrame(e)})()})}*generate(e,t={}){let{onProgress:i}=t,{sortEdges:r,iterationTime:v,angleThreshold:y,includeIntersectionEdges:M}=this;e instanceof n.BufferGeometry&&(e=new s.MeshBVH(e,{maxLeafTris:1}));let S=e.geometry,E=(0,o.generateEdges)(S,p,y);if(M){let t=yield*(0,d.generateIntersectionEdges)(e,v);E=E.concat(t)}r&&E.sort((e,t)=>Math.min(e.start.y,e.end.y)-Math.min(t.start.y,t.end.y)),yield;let b=new _,T=performance.now();for(let t=0,n=E.length;t{e.min.y=Math.min(r-1e-6,e.min.y);let{origin:t,direction:i}=m;return t.copy(n.start),n.delta(i).normalize(),!!e.containsPoint(t)||!!m.intersectBox(e,g)&&t.distanceToSquared(g){let t=Math.max(e.a.y,e.b.y,e.c.y);if(t<=r||(0,a.isYProjectedTriangleDegenerate)(e)||(0,a.isLineTriangleEdge)(e,n))return!1;let i=Math.min(e.a.y,e.b.y,e.c.y);if(sf.distance())return!1;if((0,u.getProjectedLineOverlap)(f,e,x)&&(0,c.appendOverlapRange)(n,x,o)&&(0,l.compressEdgeOverlaps)(o),0!==o.length){let[e,t]=o[o.length-1];return 0===e&&1===t}return!1}}),(0,l.overlapsToLines)(n,o,b.edges);let d=performance.now()-T;if(d>v){if(i){let e=t/E.length;i(e,b)}yield,T=performance.now()}}return b.getLineGeometry(0)}}}),r.register("6KVZ3",function(t,i){e(t.exports,"MeshBVH",()=>R);var n=r("ilwiq"),s=r("alNGj"),a=r("knbvI"),o=r("lenTA"),l=r("eADNI"),h=r("7EZfU"),u=r("8hs00"),c=r("8VlEg"),d=r("9Kyri"),p=r("ayHng"),f=r("laUNa"),m=r("1SnJR"),g=r("dhXUU"),x=r("dnRHH"),_=r("7AkHD"),v=r("gDpfV"),y=r("iERXt"),M=r("kNP8c"),S=r("ZxvHI"),E=r("bD1WL"),b=r("gUrAj"),T=r("86OmO"),w=r("cSOJe");let A=new o.OrientedBox,P=new n.Box3;class R{static serialize(e,t={}){t={cloneBuffers:!0,...t};let i=e.geometry,n=e._roots,r=e._indirectBuffer,s=i.getIndex();return t.cloneBuffers?{roots:n.map(e=>e.slice()),index:s.array.slice(),indirectBuffer:r?r.slice():null}:{roots:n,index:s.array,indirectBuffer:r}}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};let{index:r,roots:a,indirectBuffer:o}=e,l=new R(t,{...i,[s.SKIP_GENERATION]:!0});if(l._roots=a,l._indirectBuffer=o||null,i.setIndex){let i=t.getIndex();if(null===i){let i=new n.BufferAttribute(e.index,1,!1);t.setIndex(i)}else i.array!==r&&(i.array.set(r),i.needsUpdate=!0)}return l}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw Error("MeshBVH: Only BufferGeometries are supported.");if((t=Object.assign({strategy:s.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[s.SKIP_GENERATION]:!1},t)).useSharedArrayBuffer&&!(0,w.isSharedArrayBufferSupported)())throw Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[s.SKIP_GENERATION]||((0,a.buildPackedTree)(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new n.Box3)));let{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?e=>i[e]:e=>e}refit(e=null){let t=this.indirect?y.refit_indirect:p.refit;return t(this,e)}traverse(e,t=0){let i=this._roots[t],n=new Uint32Array(i),r=new Uint16Array(i);(function t(a,o=0){let l=2*a,h=r[l+15]===s.IS_LEAFNODE_FLAG;if(h){let t=n[a+6],s=r[l+14];e(o,h,new Float32Array(i,4*a,6),t,s)}else{let r=a+s.BYTES_PER_NODE/4,l=n[a+6],u=n[a+7],c=e(o,h,new Float32Array(i,4*a,6),u);c||(t(r,o+1),t(l,o+1))}})(0)}raycast(e,t=n.FrontSide){let i=this._roots,r=this.geometry,s=[],a=t.isMaterial,o=Array.isArray(t),l=r.groups,h=a?t.side:t,u=this.indirect?M.raycast_indirect:f.raycast;for(let n=0,r=i.length;n!!e(n,r,s,o,l)||i(n,r,this,a,s,o,t)}else s||(s=a?(e,n,r,s)=>i(e,n,this,a,r,s,t):(e,t,i)=>i);let o=!1,l=0,c=this._roots;for(let e=0,t=c.length;eA.intersectsBox(e),intersectsTriangle:e=>A.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},n={},r=0,s=1/0){let a=this.indirect?b.closestPointToGeometry_indirect:x.closestPointToGeometry;return a(this,e,t,i,n,r,s)}closestPointToPoint(e,t={},i=0,n=1/0){return(0,c.closestPointToPoint)(this,e,t,i,n)}getBoundingBox(e){e.makeEmpty();let t=this._roots;return t.forEach(t=>{(0,l.arrayToBox)(0,new Float32Array(t),P),e.union(P)}),e}}}),r.register("alNGj",function(t,i){e(t.exports,"CENTER",()=>n),e(t.exports,"AVERAGE",()=>r),e(t.exports,"SAH",()=>s),e(t.exports,"CONTAINED",()=>a),e(t.exports,"TRIANGLE_INTERSECT_COST",()=>o),e(t.exports,"TRAVERSAL_COST",()=>l),e(t.exports,"BYTES_PER_NODE",()=>h),e(t.exports,"IS_LEAFNODE_FLAG",()=>u),e(t.exports,"FLOAT32_EPSILON",()=>c),e(t.exports,"SKIP_GENERATION",()=>d);let n=0,r=1,s=2,a=2,o=1.25,l=1,h=32,u=65535,c=5960464477539063e-23,d=Symbol("SKIP_GENERATION")}),r.register("knbvI",function(t,i){e(t.exports,"buildPackedTree",()=>c);var n=r("5Gkg5"),s=r("6zZ33"),a=r("4rNvL"),o=r("O2f62"),l=r("alNGj"),h=r("8aRzr"),u=r("fe03E");function c(e,t){let i,r,c;let d=e.geometry;t.indirect&&(e._indirectBuffer=function(e,t){let i=(e.index?e.index.count:e.attributes.position.count)/3,n=i>65536,r=n?4:2,s=t?new SharedArrayBuffer(i*r):new ArrayBuffer(i*r),a=n?new Uint32Array(s):new Uint16Array(s);for(let e=0,t=a.length;e=l&&(x=!0,c&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(i))),n<=d||u>=l)return b(t+n),e.offset=t,e.count=n,e;let f=(0,a.getOptimalSplit)(e.boundingData,h,y,t,n,p);if(-1===f.axis)return b(t+n),e.offset=t,e.count=n,e;let m=M(g,r,y,t,n,f);if(m===t||m===t+n)b(t+n),e.offset=t,e.count=n;else{e.splitAxis=f.axis;let i=new o.MeshBVHNode,r=m-t;e.left=i,i.boundingData=new Float32Array(6),(0,s.getBounds)(y,t,r,i.boundingData,v),T(i,t,r,v,u+1);let a=new o.MeshBVHNode,l=n-r;e.right=a,a.boundingData=new Float32Array(6),(0,s.getBounds)(y,m,l,a.boundingData,v),T(a,m,l,v,u+1)}return e}}(e,t),f=[],m=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let e=0;e4294967296)throw Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[s+6]=i/4,i=e(i,o),r[s+7]=h,i}}(0,t),f.push(s)}e._roots=f}}),r.register("5Gkg5",function(t,i){e(t.exports,"getTriCount",()=>s),e(t.exports,"ensureIndex",()=>a),e(t.exports,"getFullGeometryRange",()=>o),e(t.exports,"getRootIndexRanges",()=>l),e(t.exports,"hasGroupGaps",()=>h);var n=r("ilwiq");function s(e){return(e.index?e.index.count:e.attributes.position.count)/3}function a(e,t){if(!e.index){let i=e.attributes.position.count,r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=function(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}(i,r);e.setIndex(new n.BufferAttribute(s,1));for(let e=0;ee-t);for(let e=0;ee.offset-t.offset),n=i[i.length-1];n.count=Math.min(t-n.offset,n.count);let r=0;return i.forEach(({count:e})=>r+=e),t!==r}}),r.register("6zZ33",function(t,i){e(t.exports,"getBounds",()=>o),e(t.exports,"getCentroidBounds",()=>l),e(t.exports,"computeTriangleBounds",()=>h);var n=r("alNGj"),s=r("eADNI"),a=r("5Gkg5");function o(e,t,i,n,r=null){let s=1/0,a=1/0,o=1/0,l=-1/0,h=-1/0,u=-1/0,c=1/0,d=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0,x=null!==r;for(let n=6*t,r=(t+i)*6;nl&&(l=_),x&&tf&&(f=t);let v=e[n+2],y=e[n+3],M=v-y,S=v+y;Mh&&(h=S),x&&vm&&(m=v);let E=e[n+4],b=e[n+5],T=E-b,w=E+b;Tu&&(u=w),x&&Eg&&(g=E)}n[0]=s,n[1]=a,n[2]=o,n[3]=l,n[4]=h,n[5]=u,x&&(r[0]=c,r[1]=d,r[2]=p,r[3]=f,r[4]=m,r[5]=g)}function l(e,t,i,n){let r=1/0,s=1/0,a=1/0,o=-1/0,l=-1/0,h=-1/0;for(let n=6*t,u=(t+i)*6;no&&(o=t);let i=e[n+2];il&&(l=i);let u=e[n+4];uh&&(h=u)}n[0]=r,n[1]=s,n[2]=a,n[3]=o,n[4]=l,n[5]=h}function h(e,t){(0,s.makeEmptyBounds)(t);let i=e.attributes.position,r=e.index?e.index.array:null,o=(0,a.getTriCount)(e),l=new Float32Array(6*o),h=i.normalized,u=i.array,c=i.offset||0,d=3;i.isInterleavedBufferAttribute&&(d=i.data.stride);let p=["getX","getY","getZ"];for(let e=0;eg&&(g=s),c>g&&(g=c);let x=(g-d)/2,_=2*e;l[a+_+0]=d+x,l[a+_+1]=x+(Math.abs(d)+x)*n.FLOAT32_EPSILON,dt[e+3]&&(t[e+3]=g)}}return l}}),r.register("eADNI",function(t,i){function n(e,t,i){return i.min.x=t[e],i.min.y=t[e+1],i.min.z=t[e+2],i.max.x=t[e+3],i.max.y=t[e+4],i.max.z=t[e+5],i}function r(e){e[0]=e[1]=e[2]=1/0,e[3]=e[4]=e[5]=-1/0}function s(e){let t=-1,i=-1/0;for(let n=0;n<3;n++){let r=e[n+3]-e[n];r>i&&(i=r,t=n)}return t}function a(e,t){t.set(e)}function o(e,t,i){let n,r;for(let s=0;s<3;s++){let a=s+3;n=e[s],r=t[s],i[s]=nr?n:r}}function l(e,t,i){for(let n=0;n<3;n++){let r=t[e+2*n],s=t[e+2*n+1],a=r-s,o=r+s;ai[n+3]&&(i[n+3]=o)}}function h(e){let t=e[3]-e[0],i=e[4]-e[1],n=e[5]-e[2];return 2*(t*i+i*n+n*t)}e(t.exports,"arrayToBox",()=>n),e(t.exports,"makeEmptyBounds",()=>r),e(t.exports,"getLongestEdgeIndex",()=>s),e(t.exports,"copyBounds",()=>a),e(t.exports,"unionBounds",()=>o),e(t.exports,"expandByTriangleBounds",()=>l),e(t.exports,"computeSurfaceArea",()=>h)}),r.register("4rNvL",function(t,i){e(t.exports,"getOptimalSplit",()=>h);var n=r("eADNI"),s=r("alNGj");let a=(e,t)=>e.candidate-t.candidate,o=Array(32).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),l=new Float32Array(6);function h(e,t,i,r,h,u){let c=-1,d=0;if(u===s.CENTER)-1!==(c=(0,n.getLongestEdgeIndex)(t))&&(d=(t[c]+t[c+3])/2);else if(u===s.AVERAGE)-1!==(c=(0,n.getLongestEdgeIndex)(e))&&(d=function(e,t,i,n){let r=0;for(let s=t,a=t+i;s=a.candidate?(0,n.expandByTriangleBounds)(r,i,a.rightCacheBounds):((0,n.expandByTriangleBounds)(r,i,a.leftCacheBounds),a.count++)}}for(let i=0;i=32&&(l=31);let h=o[l];h.count++,(0,n.expandByTriangleBounds)(t,i,h.bounds)}let t=o[31];(0,n.copyBounds)(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){let t=o[e],i=o[e+1];(0,n.unionBounds)(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let a=0;for(let t=0;t<31;t++){let i=o[t],r=i.count,f=i.bounds,m=o[t+1],g=m.rightCacheBounds;0!==r&&(0===a?(0,n.copyBounds)(f,l):(0,n.unionBounds)(f,l,l));let x=0,_=0;0!==(a+=r)&&(x=(0,n.computeSurfaceArea)(l)/u);let v=h-a;0!==v&&(_=(0,n.computeSurfaceArea)(g)/u);let y=s.TRAVERSAL_COST+s.TRIANGLE_INTERSECT_COST*(x*a+_*v);yn);class n{constructor(){}}}),r.register("8aRzr",function(t,i){e(t.exports,"partition",()=>n);function n(e,t,i,n,r,s){let a=n,o=n+r-1,l=s.pos,h=2*s.axis;for(;;){for(;a<=o&&i[6*a+h]=l;)o--;if(!(an);function n(e,t,i,n,r,s){let a=n,o=n+r-1,l=s.pos,h=2*s.axis;for(;;){for(;a<=o&&i[6*a+h]=l;)o--;if(!(al);var n=r("ilwiq"),s=r("2OKGW"),a=r("8VYkb"),o=r("f56Km");class l{constructor(e,t,i){this.isOrientedBox=!0,this.min=new n.Vector3,this.max=new n.Vector3,this.matrix=new n.Matrix4,this.invMatrix=new n.Matrix4,this.points=Array(8).fill().map(()=>new n.Vector3),this.satAxes=[,,,].fill().map(()=>new n.Vector3),this.satBounds=[,,,].fill().map(()=>new s.SeparatingAxisBounds),this.alignedSatBounds=[,,,].fill().map(()=>new s.SeparatingAxisBounds),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}l.prototype.update=function(){let e=this.matrix,t=this.min,i=this.max,n=this.points;for(let r=0;r<=1;r++)for(let s=0;s<=1;s++)for(let a=0;a<=1;a++){let o=1*r|2*s|4*a,l=n[o];l.x=r?i.x:t.x,l.y=s?i.y:t.y,l.z=a?i.z:t.z,l.applyMatrix4(e)}let r=this.satBounds,s=this.satAxes,a=n[0];for(let e=0;e<3;e++){let t=s[e],i=r[e],o=1<new n.Line3),i=Array(12).fill().map(()=>new n.Line3),r=new n.Vector3,s=new n.Vector3;return function(n,a=0,l=null,h=null){if(this.needsUpdate&&this.update(),this.intersectsBox(n))return(l||h)&&(n.getCenter(s),this.closestPointToPoint(s,r),n.closestPointToPoint(r,s),l&&l.copy(r),h&&h.copy(s)),0;let u=a*a,c=n.min,d=n.max,p=this.points,f=1/0;for(let e=0;e<8;e++){let t=p[e];s.copy(t).clamp(c,d);let i=t.distanceToSquared(s);if(is);var n=r("ilwiq");class s{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,n=-1/0;for(let r=0,s=e.length;rn?a:n}this.min=i,this.max=n}setFromPoints(e,t){let i=1/0,n=-1/0;for(let r=0,s=t.length;rn?a:n}this.min=i,this.max=n}isSeparated(e){return this.min>e.max||e.min>this.max}}s.prototype.setFromBox=function(){let e=new n.Vector3;return function(t,i){let n=i.min,r=i.max,s=1/0,a=-1/0;for(let i=0;i<=1;i++)for(let o=0;o<=1;o++)for(let l=0;l<=1;l++){e.x=n.x*i+r.x*(1-i),e.y=n.y*o+r.y*(1-o),e.z=n.z*l+r.z*(1-l);let h=t.dot(e);s=Math.min(h,s),a=Math.max(h,a)}this.min=s,this.max=a}}(),new s}),r.register("8VYkb",function(t,i){e(t.exports,"ExtendedTriangle",()=>l);var n=r("ilwiq"),s=r("2OKGW"),a=r("f56Km");function o(e){return 1e-15>Math.abs(e)}class l extends n.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=[,,,,].fill().map(()=>new n.Vector3),this.satBounds=[,,,,].fill().map(()=>new s.SeparatingAxisBounds),this.points=[this.a,this.b,this.c],this.sphere=new n.Sphere,this.plane=new n.Plane,this.needsUpdate=!0}intersectsSphere(e){return(0,a.sphereIntersectTriangle)(e,this)}update(){let e=this.a,t=this.b,i=this.c,n=this.points,r=this.satAxes,s=this.satBounds,a=r[0],o=s[0];this.getNormal(a),o.setFromPoints(a,n);let l=r[1],h=s[1];l.subVectors(e,t),h.setFromPoints(l,n);let u=r[2],c=s[2];u.subVectors(t,i),c.setFromPoints(u,n);let d=r[3],p=s[3];d.subVectors(i,e),p.setFromPoints(d,n),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}l.prototype.closestPointToSegment=function(){let e=new n.Vector3,t=new n.Vector3,i=new n.Line3;return function(n,r=null,s=null){let o;let{start:l,end:h}=n,u=this.points,c=1/0;for(let l=0;l<3;l++){let h=(l+1)%3;i.start.copy(u[l]),i.end.copy(u[h]),(0,a.closestPointsSegmentToSegment)(i,n,e,t),(o=e.distanceToSquared(t))=2){let e=1===s?i.start:i.end;e.copy(x),r=2;break}if(2==++r&&-1===s)break}}return r}return function(n,s=null,o=!1){this.needsUpdate&&this.update(),n.isExtendedTriangle?n.needsUpdate&&n.update():(e.copy(n),e.update(),n=e);let l=this.plane,u=n.plane;if(Math.abs(l.normal.dot(u.normal))>1-1e-10){let e=this.satBounds,l=this.satAxes;i[0]=n.a,i[1]=n.b,i[2]=n.c;for(let t=0;t<4;t++){let n=e[t],s=l[t];if(r.setFromPoints(s,i),n.isSeparated(r))return!1}let u=n.satBounds,c=n.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let e=0;e<4;e++){let i=u[e],n=c[e];if(r.setFromPoints(n,t),i.isSeparated(r))return!1}for(let e=0;e<4;e++){let n=l[e];for(let e=0;e<4;e++){let s=c[e];if(h.crossVectors(n,s),r.setFromPoints(h,t),a.setFromPoints(h,i),r.isSeparated(a))return!1}}return s&&(o||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),s.start.set(0,0,0),s.end.set(0,0,0)),!0}{let e=_(this,u,m);if(1===e&&n.containsPoint(m.end))return s&&(s.start.copy(m.end),s.end.copy(m.end)),!0;if(2!==e)return!1;let t=_(n,l,g);if(1===t&&this.containsPoint(g.end))return s&&(s.start.copy(g.end),s.end.copy(g.end)),!0;if(2!==t)return!1;if(m.delta(c),g.delta(d),0>c.dot(d)){let e=g.start;g.start=g.end,g.end=e}let i=m.start.dot(c),r=m.end.dot(c),a=g.start.dot(c),o=g.end.dot(c);return(i===o||a===r||r0?s.start.copy(m.start):s.start.copy(g.start),p.subVectors(m.end,g.end),0>p.dot(c)?s.end.copy(m.end):s.end.copy(g.end)),!0)}}}(),l.prototype.distanceToPoint=function(){let e=new n.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),l.prototype.distanceToTriangle=function(){let e=new n.Vector3,t=new n.Vector3,i=["a","b","c"],r=new n.Line3,s=new n.Line3;return function(n,o=null,l=null){let h=o||l?r:null;if(this.intersectsTriangle(n,h))return(o||l)&&(o&&h.getCenter(o),l&&h.getCenter(l)),0;let u=1/0;for(let t=0;t<3;t++){let r;let s=i[t],a=n[s];this.closestPointToPoint(a,e),(r=a.distanceToSquared(e))a),e(t.exports,"sphereIntersectTriangle",()=>o);var n=r("ilwiq");let s=function(){let e=new n.Vector3,t=new n.Vector3,i=new n.Vector3;return function(n,r,s){let a,o;let l=n.start,h=r.start;i.subVectors(l,h),e.subVectors(n.end,n.start),t.subVectors(r.end,r.start);let u=i.dot(t),c=t.dot(e),d=t.dot(t),p=i.dot(e),f=e.dot(e),m=f*d-c*c;a=0!==m?(u*c-p*d)/m:0,o=(u+a*c)/d,s.x=a,s.y=o}}(),a=function(){let e=new n.Vector2,t=new n.Vector3,i=new n.Vector3;return function(n,r,a,o){s(n,r,e);let l=e.x,h=e.y;if(l>=0&&l<=1&&h>=0&&h<=1){n.at(l,a),r.at(h,o);return}if(l>=0&&l<=1){h<0?r.at(0,o):r.at(1,o),n.closestPointToPoint(o,!0,a);return}if(h>=0&&h<=1){l<0?n.at(0,a):n.at(1,a),r.closestPointToPoint(a,!0,o);return}{let e,s;if(e=l<0?n.start:n.end,s=h<0?r.start:r.end,n.closestPointToPoint(s,!0,t),r.closestPointToPoint(e,!0,i),t.distanceToSquared(s)<=i.distanceToSquared(e)){a.copy(t),o.copy(s);return}a.copy(e),o.copy(i);return}}}(),o=function(){let e=new n.Vector3,t=new n.Vector3,i=new n.Plane,r=new n.Line3;return function(n,s){let{radius:a,center:o}=n,{a:l,b:h,c:u}=s;r.start=l,r.end=h;let c=r.closestPointToPoint(o,!0,e);if(c.distanceTo(o)<=a)return!0;r.start=l,r.end=u;let d=r.closestPointToPoint(o,!0,e);if(d.distanceTo(o)<=a)return!0;r.start=h,r.end=u;let p=r.closestPointToPoint(o,!0,e);if(p.distanceTo(o)<=a)return!0;let f=s.getPlane(i),m=Math.abs(f.distanceToPoint(o));if(m<=a){let e=f.projectPoint(o,t),i=s.containsPoint(e);if(i)return!0}return!1}}()}),r.register("7EZfU",function(t,i){e(t.exports,"ExtendedTrianglePool",()=>o);var n=r("8VYkb"),s=r("1l8b2");class a extends s.PrimitivePool{constructor(){super(()=>new n.ExtendedTriangle)}}let o=new a}),r.register("1l8b2",function(t,i){e(t.exports,"PrimitivePool",()=>n);class n{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){let e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}}),r.register("8hs00",function(t,i){let n,s;e(t.exports,"shapecast",()=>f);var a=r("ilwiq"),o=r("alNGj"),l=r("eADNI"),h=r("1l8b2"),u=r("8x2iv"),c=r("xqrrD");let d=[],p=new h.PrimitivePool(()=>new a.Box3);function f(e,t,i,r,a,h){n=p.getPrimitive(),s=p.getPrimitive(),d.push(n,s),(0,c.BufferStack).setBuffer(e._roots[t]);let f=function e(t,i,r,a,h=null,d=0,p=0){let{float32Array:f,uint16Array:m,uint32Array:g}=c.BufferStack,x=2*t,_=(0,u.IS_LEAF)(x,m);if(_){let e=(0,u.OFFSET)(t,g),i=(0,u.COUNT)(x,m);return(0,l.arrayToBox)((0,u.BOUNDING_DATA_INDEX)(t),f,n),a(e,i,!1,p,d+t,n)}{let x,_,M,S,E,b;let T=(0,u.LEFT_NODE)(t),w=(0,u.RIGHT_NODE)(t,g),A=T,P=w;if(h&&(M=n,S=s,(0,l.arrayToBox)((0,u.BOUNDING_DATA_INDEX)(A),f,M),(0,l.arrayToBox)((0,u.BOUNDING_DATA_INDEX)(P),f,S),x=h(M),(_=h(S))0&&(s=d[m-1],n=d[m-2]),f}}),r.register("8x2iv",function(t,i){function n(e,t){return 65535===t[e+15]}function r(e,t){return t[e+6]}function s(e,t){return t[e+14]}function a(e){return e+8}function o(e,t){return t[e+6]}function l(e,t){return t[e+7]}function h(e){return e}e(t.exports,"IS_LEAF",()=>n),e(t.exports,"OFFSET",()=>r),e(t.exports,"COUNT",()=>s),e(t.exports,"LEFT_NODE",()=>a),e(t.exports,"RIGHT_NODE",()=>o),e(t.exports,"SPLIT_AXIS",()=>l),e(t.exports,"BOUNDING_DATA_INDEX",()=>h)}),r.register("xqrrD",function(t,i){e(t.exports,"BufferStack",()=>n);let n=new class{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let e=[],t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,0!==e.length&&this.setBuffer(e.pop())}}}}),r.register("8VlEg",function(t,i){e(t.exports,"closestPointToPoint",()=>o);var n=r("ilwiq");let s=new n.Vector3,a=new n.Vector3;function o(e,t,i={},n=0,r=1/0){let o=n*n,l=r*r,h=1/0,u=null;if(e.shapecast({boundsTraverseOrder:e=>(s.copy(t).clamp(e.min,e.max),s.distanceToSquared(t)),intersectsBounds:(e,t,i)=>i{e.closestPointToPoint(t,s);let n=t.distanceToSquared(s);return na),e(t.exports,"intersectClosestTri",()=>o),e(t.exports,"iterateOverTriangles",()=>l);var n=r("7pS02"),s=r("dRxiJ");function a(e,t,i,r,s,a){let{geometry:o,_indirectBuffer:l}=e;for(let e=r,l=r+s;em);var n=r("ilwiq");let s=new n.Vector3,a=new n.Vector3,o=new n.Vector3,l=new n.Vector2,h=new n.Vector2,u=new n.Vector2,c=new n.Vector3,d=new n.Vector3,p=new n.Vector3,f=new n.Vector3;function m(e,t,i,r,m){let g=3*r,x=g+0,_=g+1,v=g+2,y=e.index;e.index&&(x=y.getX(x),_=y.getX(_),v=y.getX(v));let{position:M,normal:S,uv:E,uv1:b}=e.attributes,T=function(e,t,i,r,m,g,x,_,v){s.fromBufferAttribute(t,g),a.fromBufferAttribute(t,x),o.fromBufferAttribute(t,_);let y=function(e,t,i,r,s,a){if(null===(a===n.BackSide?e.intersectTriangle(r,i,t,!0,s):e.intersectTriangle(t,i,r,a!==n.DoubleSide,s)))return null;let o=e.origin.distanceTo(s);return{distance:o,point:s.clone()}}(e,s,a,o,f,v);if(y){r&&(l.fromBufferAttribute(r,g),h.fromBufferAttribute(r,x),u.fromBufferAttribute(r,_),y.uv=(0,n.Triangle).getInterpolation(f,s,a,o,l,h,u,new n.Vector2)),m&&(l.fromBufferAttribute(m,g),h.fromBufferAttribute(m,x),u.fromBufferAttribute(m,_),y.uv1=(0,n.Triangle).getInterpolation(f,s,a,o,l,h,u,new n.Vector2)),i&&(c.fromBufferAttribute(i,g),d.fromBufferAttribute(i,x),p.fromBufferAttribute(i,_),y.normal=(0,n.Triangle).getInterpolation(f,s,a,o,c,d,p,new n.Vector3),y.normal.dot(e.direction)>0&&y.normal.multiplyScalar(-1));let t={a:g,b:x,c:_,normal:new n.Vector3,materialIndex:0};(0,n.Triangle).getNormal(s,a,o,t.normal),y.face=t,y.faceIndex=g}return y}(i,M,S,E,b,x,_,v,t);return T?(T.faceIndex=r,m&&m.push(T),T):null}}),r.register("dRxiJ",function(t,i){function n(e,t,i,n){let r=e.a,s=e.b,a=e.c,o=t,l=t+1,h=t+2;i&&(o=i.getX(o),l=i.getX(l),h=i.getX(h)),r.x=n.getX(o),r.y=n.getY(o),r.z=n.getZ(o),s.x=n.getX(l),s.y=n.getY(l),s.z=n.getZ(l),a.x=n.getX(h),a.y=n.getY(h),a.z=n.getZ(h)}e(t.exports,"setTriangle",()=>n),r("ilwiq")}),r.register("ayHng",function(t,i){e(t.exports,"refit",()=>s);var n=r("alNGj");function s(e,t=null){let i,r,s,a;t&&Array.isArray(t)&&(t=new Set(t));let o=e.geometry,l=o.index?o.index.array:null,h=o.attributes.position,u=0,c=e._roots;for(let e=0,o=c.length;ed&&(d=t),rp&&(p=r),sf&&(f=s)}return(a[i+0]!==n||a[i+1]!==o||a[i+2]!==u||a[i+3]!==d||a[i+4]!==p||a[i+5]!==f)&&(a[i+0]=n,a[i+1]=o,a[i+2]=u,a[i+3]=d,a[i+4]=p,a[i+5]=f,!0)}{let n=i+8,s=r[i+6],l=n+o,h=s+o,c=u,d=!1,p=!1;t?c||(d=t.has(l),p=t.has(h),c=!d&&!p):(d=!0,p=!0);let f=c||d,m=c||p,g=!1;f&&(g=e(n,o,c));let x=!1;m&&(x=e(s,o,c));let _=g||x;if(_)for(let e=0;e<3;e++){let t=n+e,r=s+e,o=a[t],l=a[t+3],h=a[r],u=a[r+3];a[i+e]=ou?l:u}return _}}(0,u),u+=i.byteLength}}),r.register("laUNa",function(t,i){e(t.exports,"raycast",()=>u);var n=r("ilwiq"),s=r("d4vta"),a=r("8x2iv"),o=r("xqrrD"),l=r("9Kyri");let h=new n.Vector3;function u(e,t,i,n,r){(0,o.BufferStack).setBuffer(e._roots[t]),function e(t,i,n,r,u){let{float32Array:c,uint16Array:d,uint32Array:p}=o.BufferStack,f=2*t,m=(0,a.IS_LEAF)(f,d);if(m){let e=(0,a.OFFSET)(t,p),s=(0,a.COUNT)(f,d);(0,l.intersectTris)(i,n,r,e,s,u)}else{let o=(0,a.LEFT_NODE)(t);(0,s.intersectRay)(o,c,r,h)&&e(o,i,n,r,u);let l=(0,a.RIGHT_NODE)(t,p);(0,s.intersectRay)(l,c,r,h)&&e(l,i,n,r,u)}}(0,e,i,n,r),(0,o.BufferStack).clearBuffer()}}),r.register("d4vta",function(t,i){e(t.exports,"intersectRay",()=>o);var n=r("ilwiq"),s=r("eADNI");let a=new n.Box3;function o(e,t,i,n){return(0,s.arrayToBox)(e,t,a),i.intersectBox(a,n)}}),r.register("1SnJR",function(t,i){e(t.exports,"raycastFirst",()=>c);var n=r("ilwiq"),s=r("8x2iv"),a=r("xqrrD"),o=r("d4vta"),l=r("9Kyri");let h=new n.Vector3,u=["x","y","z"];function c(e,t,i,n){(0,a.BufferStack).setBuffer(e._roots[t]);let r=function e(t,i,n,r){let{float32Array:c,uint16Array:d,uint32Array:p}=a.BufferStack,f=2*t,m=(0,s.IS_LEAF)(f,d);if(m){let e=(0,s.OFFSET)(t,p),a=(0,s.COUNT)(f,d);return(0,l.intersectClosestTri)(i,n,r,e,a)}{let a,l;let d=(0,s.SPLIT_AXIS)(t,p),f=u[d],m=r.direction[f],g=m>=0;g?(a=(0,s.LEFT_NODE)(t),l=(0,s.RIGHT_NODE)(t,p)):(a=(0,s.RIGHT_NODE)(t,p),l=(0,s.LEFT_NODE)(t));let x=(0,o.intersectRay)(a,c,r,h),_=x?e(a,i,n,r):null;if(_){let e=_.point[f],t=g?e<=c[l+d]:e>=c[l+d+3];if(t)return _}let v=(0,o.intersectRay)(l,c,r,h),y=v?e(l,i,n,r):null;return _&&y?_.distance<=y.distance?_:y:_||y||null}}(0,e,i,n);return(0,a.BufferStack).clearBuffer(),r}}),r.register("dhXUU",function(t,i){e(t.exports,"intersectsGeometry",()=>x);var n=r("ilwiq"),s=r("lenTA"),a=r("8VYkb"),o=r("dRxiJ"),l=r("eADNI"),h=r("8x2iv"),u=r("xqrrD");let c=new n.Box3,d=new a.ExtendedTriangle,p=new a.ExtendedTriangle,f=new n.Matrix4,m=new s.OrientedBox,g=new s.OrientedBox;function x(e,t,i,n){(0,u.BufferStack).setBuffer(e._roots[t]);let r=function e(t,i,n,r,s=null){let{float32Array:a,uint16Array:x,uint32Array:_}=u.BufferStack,v=2*t;null===s&&(n.boundingBox||n.computeBoundingBox(),m.set(n.boundingBox.min,n.boundingBox.max,r),s=m);let y=(0,h.IS_LEAF)(v,x);if(y){let e=i.geometry,s=e.index,u=e.attributes.position,c=n.index,m=n.attributes.position,y=(0,h.OFFSET)(t,_),M=(0,h.COUNT)(v,x);if(f.copy(r).invert(),n.boundsTree){(0,l.arrayToBox)((0,h.BOUNDING_DATA_INDEX)(t),a,g),g.matrix.copy(f),g.needsUpdate=!0;let e=n.boundsTree.shapecast({intersectsBounds:e=>g.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(r),e.b.applyMatrix4(r),e.c.applyMatrix4(r),e.needsUpdate=!0;for(let t=3*y,i=(M+y)*3;tg);var n=r("ilwiq"),s=r("lenTA"),a=r("dRxiJ"),o=r("5Gkg5"),l=r("7EZfU");let h=new n.Matrix4,u=new s.OrientedBox,c=new s.OrientedBox,d=new n.Vector3,p=new n.Vector3,f=new n.Vector3,m=new n.Vector3;function g(e,t,i,n={},r={},s=0,g=1/0){t.boundingBox||t.computeBoundingBox(),u.set(t.boundingBox.min,t.boundingBox.max,i),u.needsUpdate=!0;let x=e.geometry,_=x.attributes.position,v=x.index,y=t.attributes.position,M=t.index,S=(0,l.ExtendedTrianglePool).getPrimitive(),E=(0,l.ExtendedTrianglePool).getPrimitive(),b=null,T=null;r&&(b=f,T=m);let w=1/0,A=null,P=null;return(h.copy(i).invert(),c.matrix.copy(h),e.shapecast({boundsTraverseOrder:e=>u.distanceToBox(e),intersectsBounds:(e,t,i)=>i{if(t.boundsTree){let r=t.boundsTree;return r.shapecast({boundsTraverseOrder:e=>c.distanceToBox(e),intersectsBounds:(e,t,i)=>i{for(let o=t,l=t+r;ou);var n=r("ilwiq"),s=r("dRxiJ"),a=r("7EZfU");let o=new n.Matrix4,l=new n.Box3,h=new n.Box3;function u(e,t,i,n){let{intersectsRanges:r,intersectsTriangles:u}=n,c=e.geometry.index,d=e.geometry.attributes.position,p=t.geometry.index,f=t.geometry.attributes.position;o.copy(i).invert();let m=(0,a.ExtendedTrianglePool).getPrimitive(),g=(0,a.ExtendedTrianglePool).getPrimitive();if(u){let e=(e,t,n,r,a,o,l,h)=>{for(let x=n,_=n+r;x<_;x++){(0,s.setTriangle)(g,3*x,p,f),g.a.applyMatrix4(i),g.b.applyMatrix4(i),g.c.applyMatrix4(i),g.needsUpdate=!0;for(let i=e,n=e+t;ih.intersectsBox(e),intersectsRange:(e,i,n,s,a,h)=>(l.copy(h),l.applyMatrix4(o),t.shapecast({intersectsBounds:e=>l.intersectsBox(e),intersectsRange:(t,n,o,l,h)=>r(e,i,t,n,s,a,l,h)}))});return(0,a.ExtendedTrianglePool).releasePrimitive(m),(0,a.ExtendedTrianglePool).releasePrimitive(g),x}}),r.register("gDpfV",function(t,i){e(t.exports,"intersectTris_indirect",()=>a),e(t.exports,"intersectClosestTri_indirect",()=>o),e(t.exports,"iterateOverTriangles_indirect",()=>l);var n=r("7pS02"),s=r("dRxiJ");function a(e,t,i,r,s,a){let{geometry:o,_indirectBuffer:l}=e;for(let e=r,h=r+s;es);var n=r("alNGj");function s(e,t=null){let i,r,s,a;t&&Array.isArray(t)&&(t=new Set(t));let o=e.geometry,l=o.index?o.index.array:null,h=o.attributes.position,u=0,c=e._roots;for(let o=0,d=c.length;op&&(p=r),sf&&(f=s),am&&(m=a)}}return(a[o+0]!==n||a[o+1]!==u||a[o+2]!==c||a[o+3]!==p||a[o+4]!==f||a[o+5]!==m)&&(a[o+0]=n,a[o+1]=u,a[o+2]=c,a[o+3]=p,a[o+4]=f,a[o+5]=m,!0)}{let e=o+8,n=r[o+6],s=e+u,l=n+u,h=c,d=!1,p=!1;t?h||(d=t.has(s),p=t.has(l),h=!d&&!p):(d=!0,p=!0);let f=h||d,m=h||p,g=!1;f&&(g=i(e,u,h));let x=!1;m&&(x=i(n,u,h));let _=g||x;if(_)for(let t=0;t<3;t++){let i=e+t,r=n+t,s=a[i],l=a[i+3],h=a[r],u=a[r+3];a[o+t]=su?l:u}return _}}(0,u),u+=i.byteLength}}),r.register("kNP8c",function(t,i){e(t.exports,"raycast_indirect",()=>u);var n=r("ilwiq"),s=r("d4vta"),a=r("8x2iv"),o=r("xqrrD"),l=r("gDpfV");let h=new n.Vector3;function u(e,t,i,n,r){(0,o.BufferStack).setBuffer(e._roots[t]),function e(t,i,n,r,u){let{float32Array:c,uint16Array:d,uint32Array:p}=o.BufferStack,f=2*t,m=(0,a.IS_LEAF)(f,d);if(m){let e=(0,a.OFFSET)(t,p),s=(0,a.COUNT)(f,d);(0,l.intersectTris_indirect)(i,n,r,e,s,u)}else{let o=(0,a.LEFT_NODE)(t);(0,s.intersectRay)(o,c,r,h)&&e(o,i,n,r,u);let l=(0,a.RIGHT_NODE)(t,p);(0,s.intersectRay)(l,c,r,h)&&e(l,i,n,r,u)}}(0,e,i,n,r),(0,o.BufferStack).clearBuffer()}}),r.register("ZxvHI",function(t,i){e(t.exports,"raycastFirst_indirect",()=>c);var n=r("ilwiq"),s=r("8x2iv"),a=r("xqrrD"),o=r("d4vta"),l=r("gDpfV");let h=new n.Vector3,u=["x","y","z"];function c(e,t,i,n){(0,a.BufferStack).setBuffer(e._roots[t]);let r=function e(t,i,n,r){let{float32Array:c,uint16Array:d,uint32Array:p}=a.BufferStack,f=2*t,m=(0,s.IS_LEAF)(f,d);if(m){let e=(0,s.OFFSET)(t,p),a=(0,s.COUNT)(f,d);return(0,l.intersectClosestTri_indirect)(i,n,r,e,a)}{let a,l;let d=(0,s.SPLIT_AXIS)(t,p),f=u[d],m=r.direction[f],g=m>=0;g?(a=(0,s.LEFT_NODE)(t),l=(0,s.RIGHT_NODE)(t,p)):(a=(0,s.RIGHT_NODE)(t,p),l=(0,s.LEFT_NODE)(t));let x=(0,o.intersectRay)(a,c,r,h),_=x?e(a,i,n,r):null;if(_){let e=_.point[f],t=g?e<=c[l+d]:e>=c[l+d+3];if(t)return _}let v=(0,o.intersectRay)(l,c,r,h),y=v?e(l,i,n,r):null;return _&&y?_.distance<=y.distance?_:y:_||y||null}}(0,e,i,n);return(0,a.BufferStack).clearBuffer(),r}}),r.register("bD1WL",function(t,i){e(t.exports,"intersectsGeometry_indirect",()=>x);var n=r("ilwiq"),s=r("lenTA"),a=r("8VYkb"),o=r("dRxiJ"),l=r("eADNI"),h=r("8x2iv"),u=r("xqrrD");let c=new n.Box3,d=new a.ExtendedTriangle,p=new a.ExtendedTriangle,f=new n.Matrix4,m=new s.OrientedBox,g=new s.OrientedBox;function x(e,t,i,n){(0,u.BufferStack).setBuffer(e._roots[t]);let r=function e(t,i,n,r,s=null){let{float32Array:a,uint16Array:x,uint32Array:_}=u.BufferStack,v=2*t;null===s&&(n.boundingBox||n.computeBoundingBox(),m.set(n.boundingBox.min,n.boundingBox.max,r),s=m);let y=(0,h.IS_LEAF)(v,x);if(y){let e=i.geometry,s=e.index,u=e.attributes.position,c=n.index,m=n.attributes.position,y=(0,h.OFFSET)(t,_),M=(0,h.COUNT)(v,x);if(f.copy(r).invert(),n.boundsTree){(0,l.arrayToBox)((0,h.BOUNDING_DATA_INDEX)(t),a,g),g.matrix.copy(f),g.needsUpdate=!0;let e=n.boundsTree.shapecast({intersectsBounds:e=>g.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(r),e.b.applyMatrix4(r),e.c.applyMatrix4(r),e.needsUpdate=!0;for(let t=y,n=M+y;tg);var n=r("ilwiq"),s=r("lenTA"),a=r("dRxiJ"),o=r("5Gkg5"),l=r("7EZfU");let h=new n.Matrix4,u=new s.OrientedBox,c=new s.OrientedBox,d=new n.Vector3,p=new n.Vector3,f=new n.Vector3,m=new n.Vector3;function g(e,t,i,n={},r={},s=0,g=1/0){t.boundingBox||t.computeBoundingBox(),u.set(t.boundingBox.min,t.boundingBox.max,i),u.needsUpdate=!0;let x=e.geometry,_=x.attributes.position,v=x.index,y=t.attributes.position,M=t.index,S=(0,l.ExtendedTrianglePool).getPrimitive(),E=(0,l.ExtendedTrianglePool).getPrimitive(),b=null,T=null;r&&(b=f,T=m);let w=1/0,A=null,P=null;return(h.copy(i).invert(),c.matrix.copy(h),e.shapecast({boundsTraverseOrder:e=>u.distanceToBox(e),intersectsBounds:(e,t,i)=>i{if(t.boundsTree){let o=t.boundsTree;return o.shapecast({boundsTraverseOrder:e=>c.distanceToBox(e),intersectsBounds:(e,t,i)=>i{for(let h=t,u=t+l;hu);var n=r("ilwiq"),s=r("dRxiJ"),a=r("7EZfU");let o=new n.Matrix4,l=new n.Box3,h=new n.Box3;function u(e,t,i,n){let{intersectsRanges:r,intersectsTriangles:u}=n,c=e.geometry.index,d=e.geometry.attributes.position,p=t.geometry.index,f=t.geometry.attributes.position;o.copy(i).invert();let m=(0,a.ExtendedTrianglePool).getPrimitive(),g=(0,a.ExtendedTrianglePool).getPrimitive();if(u){let n=(n,r,a,o,l,h,x,_)=>{for(let v=a,y=a+o;vh.intersectsBox(e),intersectsRange:(e,i,n,s,a,h)=>(l.copy(h),l.applyMatrix4(o),t.shapecast({intersectsBounds:e=>l.intersectsBox(e),intersectsRange:(t,n,o,l,h)=>r(e,i,t,n,s,a,l,h)}))});return(0,a.ExtendedTrianglePool).releasePrimitive(m),(0,a.ExtendedTrianglePool).releasePrimitive(g),x}}),r.register("cSOJe",function(t,i){e(t.exports,"isSharedArrayBufferSupported",()=>n);function n(){return"undefined"!=typeof SharedArrayBuffer}}),r.register("bJKwC",function(t,i){e(t.exports,"isYProjectedLineDegenerate",()=>o),e(t.exports,"isYProjectedTriangleDegenerate",()=>l),e(t.exports,"isLineTriangleEdge",()=>h);var n=r("ilwiq");let s=new n.Vector3(0,1,0),a=new n.Vector3;function o(e){return e.delta(a).normalize(),Math.abs(a.dot(s))>=.9999999999999999}function l(e){return e.needsUpdate&&e.update(),1e-16>=Math.abs(e.plane.normal.dot(s))}function h(e,t){let{start:i,end:n}=t,r=e.points,s=!1,a=!1;for(let e=0;e<3;e++){let t=r[e];if(!s&&1e-16>=i.distanceToSquared(t)&&(s=!0),!a&&1e-16>=n.distanceToSquared(t)&&(a=!0),s&&a)return!0}return s&&a}}),r.register("fNPnQ",function(t,i){e(t.exports,"generateEdges",()=>u);var n=r("ilwiq");let s=new n.Vector3(0,1,0),a=new n.Vector3,o=new n.Vector3,l=new n.Vector3,h=new n.Triangle;function u(e,t=s,i=1){let r=[],u=Math.cos(n.MathUtils.DEG2RAD*i),c=e.getIndex(),d=e.getAttribute("position"),p=c?c.count:d.count,f=[0,0,0],m=["a","b","c"],g=[,,,],x={};for(let e=0;eMath.abs(s)?0:s;let a=t.dot(e);a=1e-16>Math.abs(a)?0:a;let h=Math.sign(s)!==Math.sign(a);if(i||h){let e=new n.Line3;e.start.copy(o),e.end.copy(c),r.push(e)}x[p]=null}else d in x||(x[d]={index0:f[e],index1:f[i],normal:l.clone()})}}for(let e in x)if(x[e]){let{index0:t,index1:i}=x[e];a.fromBufferAttribute(d,t),o.fromBufferAttribute(d,i);let s=new n.Line3;s.start.copy(a),s.end.copy(o),r.push(s)}return r}}),r.register("33ViW",function(t,i){e(t.exports,"compressEdgeOverlaps",()=>a),e(t.exports,"overlapsToLines",()=>o);var n=r("ilwiq");let s=new n.Line3;function a(e){e.sort((e,t)=>e[0]-t[0]);for(let t=1;t=i[0]&&(n[1]=Math.max(n[1],i[1]),e.splice(t,1),t--)}}function o(e,t,i=[]){a(t);let n=[[0,1]];for(let e=0,i=t.length;eu);var n=r("ilwiq"),s=r("bJKwC");let a=new n.Vector3(0,1,0),o=new n.Plane,l=new n.Vector3,h=new n.Vector3;function u(e,t,i){if((0,s.isYProjectedTriangleDegenerate)(e))return!1;e.needsUpdate&&e.update(),o.copy(e.plane),0>o.normal.dot(a)&&(o.normal.multiplyScalar(-1),o.constant*=-1);let n=o.distanceToPoint(t.start),r=o.distanceToPoint(t.end),u=1e-16>Math.abs(n),c=n<0,d=r<0;if(t.delta(h).normalize(),1e-16>Math.abs(o.normal.dot(h)))return!u&&!!c&&(i.copy(t),!0);if(c&&d)return i.copy(t),!0;{if(!c&&!d)return!1;let e=o.intersectLine(t,l);if(!e&&(u&&(l.copy(t.start),e=!0),1e-16>Math.abs(r)&&(l.copy(t.end),e=!0)),e){if(c)return i.start.copy(t.start),i.end.copy(l),!0;if(d)return i.end.copy(t.end),i.start.copy(l),!0}}return!1}}),r.register("64zt3",function(t,i){e(t.exports,"getProjectedLineOverlap",()=>m);var n=r("ilwiq"),s=r("8VYkb");let a=new n.Plane,o=new n.Line3,l=new n.Vector3,h=new n.Vector3,u=new s.ExtendedTriangle,c=new n.Line3,d=new n.Line3,p=new n.Vector3,f=new n.Vector3;function m(e,t,i=new n.Line3){if(u.copy(t),u.a.y=0,u.b.y=0,u.c.y=0,u.update(),c.copy(e),c.start.y=0,c.end.y=0,1e-16>=u.getArea())return null;c.delta(p).normalize(),p.cross(u.plane.normal).normalize(),a.setFromNormalAndCoplanarPoint(p,c.start);let r=0,{points:s}=u;for(let e=0;e<3;e++){let t=s[e],i=s[(e+1)%3];o.start.copy(t),o.end.copy(i);let n=1e-16>Math.abs(a.distanceToPoint(o.start)),h=1e-16>Math.abs(a.distanceToPoint(o.end)),u=a.intersectLine(o,l);if((u&&!h||n)&&(n&&!u&&l.copy(o.start),0===r?d.start.copy(l):d.end.copy(l),2==++r))break}if(2===r){if(c.delta(p).normalize(),d.delta(f).normalize(),0>p.dot(f)){let e=d.start;d.start=d.end,d.end=e}let t=h.subVectors(c.end,c.start).dot(p),n=h.subVectors(d.start,c.start).dot(p),r=h.subVectors(d.end,c.start).dot(p);return t<=n||r<=0?null:(e.at(Math.max(0,n)/c.distance(),i.start),e.at(Math.min(t,r)/c.distance(),i.end),i)}return null}}),r.register("iQQnd",function(t,i){e(t.exports,"appendOverlapRange",()=>l);var n=r("ilwiq");let s=new n.Vector3,a=new n.Vector3,o=new n.Vector3;function l(e,t,i){e.delta(s),a.subVectors(t.start,e.start),o.subVectors(t.end,e.start);let n=s.length(),r=a.length()/n,l=o.length()/n;return!(1e-16>=Math.abs((r=Math.min(Math.max(r,0),1))-(l=Math.min(Math.max(l,0),1))))&&(i.push(new Float32Array([r,l])),!0)}}),r.register("5zNJG",function(t,i){e(t.exports,"generateIntersectionEdges",()=>h);var n=r("ilwiq"),s=r("8VYkb"),a=r("bJKwC");let o=new s.ExtendedTriangle,l=new n.Line3;function*h(e,t=30){let i=[],n=e.geometry,r=n.index,s=n.attributes.position,h=r?r.count:s,u=performance.now();for(let n=0;ne.intersectsTriangle(o),intersectsTriangle:e=>!o.equals(e)&&(e.needsUpdate&&e.update(),!(Math.abs(o.plane.normal.dot(e.plane.normal))>1-1e-6)&&void(!o.intersectsTriangle(e,l,!0)||(0,a.isLineTriangleEdge)(o,l)||(0,a.isLineTriangleEdge)(e,l)||(l.start.y+=1e-6,l.end.y+=1e-6,i.push(l.clone()))))});let g=performance.now()-u;g>t&&(yield,u=performance.now())}return i}}),r.register("l7uOa",function(t,i){e(t.exports,"OUTPUT_BOTH",()=>x),e(t.exports,"SilhouetteGenerator",()=>_);var n=r("4Yai1"),s=r("ilwiq"),a=r("9bB8r"),o=r("e5S3P"),l=r("2lMur"),h=r("ahD9r");let u=new s.Vector3(0,1,0),c=new s.Triangle,d=new s.Vector3,p=new s.Vector3,f=new s.Vector3;function m(e,t){let i=e.map(e=>e.flatMap(e=>new s.Vector2(e.x/t,e.y/t))),n=i.filter(e=>(0,s.ShapeUtils).isClockWise(e)).map(e=>new s.Shape(e)),r=i.filter(e=>!(0,s.ShapeUtils).isClockWise(e)).map(e=>{let t=new s.Shape(e);return t.holes=n,t}),a=new(0,s.ShapeGeometry)(r).rotateX(Math.PI/2);return a.index.array.reverse(),a}function g(e,t){let i=[];e.forEach(e=>{for(let n=0,r=e.length;n{let{signal:r}=t,s=this.generate(e,t);(function e(){r&&r.aborted&&n(Error("SilhouetteGenerator: Process aborted via AbortSignal."));let t=s.next();t.done?i(t.value):requestAnimationFrame(e)})()})}*generate(e,t={}){let{iterationTime:i,intScalar:r,doubleSided:s,output:x,sortTriangles:_}=this,{onProgress:v}=t,y=Math.log10(r),M=Math.pow(10,-(y-2)),S=e.index,E=e.attributes.position,b=(0,h.getTriCount)(e),T=null,w=_?(0,l.getSizeSortedTriList)(e):Array(b).fill().map((e,t)=>t),A={getGeometry:()=>0===x?m(T,r):1===x?g(T,r):[m(T,r),g(T,r)]},P=performance.now();for(let e=0;ed.dot(u))||(g.y=0,x.y=0,_.y=0,1e-8>c.getArea()))continue;p.copy(g).add(x).add(_).multiplyScalar(1/3),f.subVectors(g,p).normalize(),g.addScaledVector(f,M),f.subVectors(x,p).normalize(),x.addScaledVector(f,M),f.subVectors(_,p).normalize(),_.addScaledVector(f,M);let y=new n.Path64;if(y.push((0,n.Clipper).makePath([g.x*r,g.z*r,x.x*r,x.z*r,_.x*r,_.z*r])),g.multiplyScalar(r),x.multiplyScalar(r),_.multiplyScalar(r),T&&(0,o.triangleIsInsidePaths)(c,T))continue;null===T?T=y:(T=(0,n.Clipper).Union(T,y,n.FillRule.NonZero)).forEach(e=>(0,a.compressPoints)(e));let R=performance.now()-P;if(R>i){if(v){let t=e/b;v(t,A)}yield,P=performance.now()}}return A.getGeometry()}}}),r.register("4Yai1",function(t,i){var n,r,s,a,o,l,h,u,c,d,p,f,m,g,x,_,v,y,M,S,E,b;e(t.exports,"Clipper",()=>I),e(t.exports,"FillRule",()=>d),e(t.exports,"Path64",()=>X);class T{static minkowskiInternal(e,t,i,n){let r=n?0:1,s=e.length,a=t.length,o=[];for(let n of t){let t=[];if(i)for(let i of e)t.push({x:n.x+i.x,y:n.y+i.y});else for(let i of e)t.push({x:n.x-i.x,y:n.y-i.y});o.push(t)}let l=[],h=n?a-1:0,u=s-1;for(let e=r;eMath.abs(e))for(let e of this._groupList)for(let t of e.inPaths)this._solution.push(t);else for(let t of(this._delta=e,this._mitLimSqr=this.MiterLimit<=1?2:2/this.sqr(this.MiterLimit),this._groupList))this.doGroupOffset(t)}}sqr(e){return e*e}execute(e,t){if(t.length=0,this.executeInternal(e),0===this._groupList.length)return;let i=new W;i.preserveCollinear=this.PreserveCollinear,i.reverseSolution=this.ReverseSolution!==this._groupList[0].pathsReversed,i.addSubjectPaths(this._solution),this._groupList[0].pathsReversed?i.execute(u.Union,d.Negative,t):i.execute(u.Union,d.Positive,t)}executePolytree(e,t){if(t.clear(),this.executeInternal(e),0===this._groupList.length)return;let i=new W;i.preserveCollinear=this.PreserveCollinear,i.reverseSolution=this.ReverseSolution!==this._groupList[0].pathsReversed,i.addSubjectPaths(this._solution),this._groupList[0].pathsReversed?i.executePolyTree(u.Union,d.Negative,t):i.executePolyTree(u.Union,d.Positive,t)}static getUnitNormal(e,t){let i=t.x-e.x,n=t.y-e.y;if(0===i&&0===n)return new A(0,0);let r=1/Math.sqrt(i*i+n*n);return i*=r,n*=r,new A(n,-i)}executeCallback(e,t){this.DeltaCallback=e,this.execute(1,t)}static getBoundsAndLowestPolyIdx(e){let t=new q(!1),i=Number.MIN_SAFE_INTEGER,n=-1;for(let r=0;r=t.bottom?(s.y>t.bottom||s.xt.right?t.right=s.x:s.x.01?this.ArcTolerance:Math.log10(2+e)*J.defaultArcTolerance,i=Math.PI/Math.acos(1-t/e);this._stepSin=Math.sin(2*Math.PI/i),this._stepCos=Math.cos(2*Math.PI/i),this._groupDelta<0&&(this._stepSin=-this._stepSin),this._stepsPerRad=i/(2*Math.PI)}let s=t[i],a=new A(this._normals[n].x*this._groupDelta,this._normals[n].y*this._groupDelta);if(i===n&&a.negate(),e.outPath.push(new Y(s.x+a.x,s.y+a.y)),r>-Math.PI+.01){let t=Math.ceil(this._stepsPerRad*Math.abs(r));for(let i=1;i1?a=1:s<-1&&(a=-1),void 0!==this.DeltaCallback&&(this._groupDelta=this.DeltaCallback(t,this._normals,i,r),e.pathsReversed&&(this._groupDelta=-this._groupDelta)),Math.abs(this._groupDelta).999?this.doMiter(e,t,i,r,a):a>-.99&&s*this._groupDelta<0?(e.outPath.push(this.getPerpendic(t[i],this._normals[r])),e.outPath.push(t[i]),e.outPath.push(this.getPerpendic(t[i],this._normals[i]))):this._joinType===n.Miter?a>this._mitLimSqr-1?this.doMiter(e,t,i,r,a):this.doSquare(e,t,i,r):a>.99||this._joinType===n.Square?this.doSquare(e,t,i,r):this.doRound(e,t,i,r,Math.atan2(s,a)),r=i}offsetPolygon(e,t){let i=I.area(t);if(i<0!=this._groupDelta<0){let e=I.getBounds(t);if(2*Math.abs(this._groupDelta)>e.width)return}e.outPath=[];let n=t.length,r=n-1;for(let i=0;i0;e--)this._normals[e]=new A(-this._normals[e-1].x,-this._normals[e-1].y);if(this._normals[0]=this._normals[i],void 0!==this.DeltaCallback&&(this._groupDelta=this.DeltaCallback(t,this._normals,i,i)),Math.abs(this._groupDelta)0;n--)this.offsetPoint(e,t,n,0);e.outPaths.push(e.outPath)}doGroupOffset(e){if(e.endType==r.Polygon){let{index:t}=P.getBoundsAndLowestPolyIdx(e.inPaths);if(t<0)return;let i=I.area(e.inPaths[t]);e.pathsReversed=i<0,e.pathsReversed?this._groupDelta=-this._delta:this._groupDelta=this._delta}else e.pathsReversed=!1,this._groupDelta=.5*Math.abs(this._delta);let t=Math.abs(this._groupDelta);if(this._joinType=e.joinType,this._endType=e.endType,!this.DeltaCallback&&(e.joinType==n.Round||e.endType==r.Round)){let e=this.ArcTolerance>.01?this.ArcTolerance:Math.log10(2+t)*J.defaultArcTolerance,i=Math.PI/Math.acos(1-e/t);this._stepSin=Math.sin(2*Math.PI/i),this._stepCos=Math.cos(2*Math.PI/i),this._groupDelta<0&&(this._stepSin=-this._stepSin),this._stepsPerRad=i/(2*Math.PI)}let i=e.endType==r.Joined||e.endType==r.Polygon;for(let s of e.inPaths){let a=I.stripDuplicates(s,i),o=a.length;if(0!==o&&(!(o<3)||this._endType!=r.Polygon)){if(1==o){if(e.outPath=[],e.endType==r.Round)e.outPath=I.ellipse(a[0],t,t);else{let t=Math.ceil(this._groupDelta),i=new q(a[0].x-t,a[0].y-t,a[0].x-t,a[0].y-t);e.outPath=i.asPath()}e.outPaths.push(e.outPath)}else 2==o&&e.endType==r.Joined&&(e.joinType==n.Round?this._endType=r.Round:this._endType=r.Square),this.buildNormals(a),this._endType==r.Polygon?this.offsetPolygon(e,a):this._endType==r.Joined?this.offsetOpenJoined(e,a):this.offsetOpenPath(e,a)}}this._solution.push(...e.outPaths),e.outPaths=[]}}P.Tolerance=1e-12;class R{constructor(e){this.pt=e,this.ownerIdx=0}}(g=s||(s={}))[g.left=0]="left",g[g.top=1]="top",g[g.right=2]="right",g[g.bottom=3]="bottom",g[g.inside=4]="inside";class L{constructor(e){this.currIdx=-1,this.rect=e,this.mp=e.midPoint(),this.rectPath=e.asPath(),this.results=[],this.edges=Array(8).fill(void 0).map(()=>[])}add(e,t=!1){let i,n=this.results.length;if(0===n||t)i=new R(e),this.results.push(i),i.ownerIdx=n,i.prev=i,i.next=i;else{n--;let t=this.results[n];if(t.pt===e)return t;(i=new R(e)).ownerIdx=n,i.next=t.next,t.next.prev=i,t.next=i,i.prev=t,this.results[n]=i}return i}static path1ContainsPath2(e,t){let i=0;for(let n of t){let t=J.pointInPolygon(n,e);switch(t){case a.IsInside:i--;break;case a.IsOutside:i++}if(Math.abs(i)>1)break}return i<=0}static isClockwise(e,t,i,n,r){return this.areOpposites(e,t)?0>J.crossProduct(i,r,n):this.headingClockwise(e,t)}static areOpposites(e,t){return 2===Math.abs(e-t)}static headingClockwise(e,t){return(e+1)%4===t}static getAdjacentLocation(e,t){return(e+(t?1:3))%4}static unlinkOp(e){if(e.next!==e)return e.prev.next=e.next,e.next.prev=e.prev,e.next}static unlinkOpBack(e){if(e.next!==e)return e.prev.next=e.next,e.next.prev=e.prev,e.prev}static getEdgesForPt(e,t){let i=0;return e.x===t.left?i=1:e.x===t.right&&(i=4),e.y===t.top?i+=2:e.y===t.bottom&&(i+=8),i}static isHeadingClockwise(e,t,i){switch(i){case 0:return t.ye.x;case 2:return t.y>e.y;default:return t.xi.x}static hasVertOverlap(e,t,i,n){return e.yi.y}static addToEdge(e,t){t.edge||(t.edge=e,e.push(t))}static uncoupleEdge(e){if(e.edge){for(let t=0;t=e.top&&t.y<=e.bottom?{success:!1,loc:s.left}:t.x===e.right&&t.y>=e.top&&t.y<=e.bottom?{success:!1,loc:s.right}:t.y===e.top&&t.x>=e.left&&t.x<=e.right?{success:!1,loc:s.top}:t.y===e.bottom&&t.x>=e.left&&t.x<=e.right?{success:!1,loc:s.bottom}:{success:!0,loc:t.xe.right?s.right:t.ye.bottom?s.bottom:s.inside}}static getIntersection(e,t,i,n){let r=new Y;switch(n){case s.left:if(J.segsIntersect(t,i,e[0],e[3],!0))r=J.getIntersectPt(t,i,e[0],e[3]).ip;else if(t.ye[1].x&&J.segsIntersect(t,i,e[1],e[2],!0)))return{success:!1,loc:n,ip:r};r=J.getIntersectPt(t,i,e[1],e[2]).ip,n=s.right}break;case s.bottom:if(J.segsIntersect(t,i,e[2],e[3],!0))r=J.getIntersectPt(t,i,e[2],e[3]).ip;else if(t.xe[2].x&&J.segsIntersect(t,i,e[1],e[2],!0)))return{success:!1,loc:n,ip:r};r=J.getIntersectPt(t,i,e[1],e[2]).ip,n=s.right}break;case s.inside:if(J.segsIntersect(t,i,e[0],e[3],!0))r=J.getIntersectPt(t,i,e[0],e[3]).ip,n=s.left;else if(J.segsIntersect(t,i,e[0],e[1],!0))r=J.getIntersectPt(t,i,e[0],e[1]).ip,n=s.top;else if(J.segsIntersect(t,i,e[1],e[2],!0))r=J.getIntersectPt(t,i,e[1],e[2]).ip,n=s.right;else{if(!J.segsIntersect(t,i,e[2],e[3],!0))return{success:!1,loc:n,ip:r};r=J.getIntersectPt(t,i,e[2],e[3]).ip,n=s.bottom}}return{success:!0,loc:n,ip:r}}getNextLocation(e,t){switch(t.loc){case s.left:for(;t.i<=t.highI&&e[t.i].x<=this.rect.left;)t.i++;if(t.i>t.highI)break;e[t.i].x>=this.rect.right?t.loc=s.right:e[t.i].y<=this.rect.top?t.loc=s.top:e[t.i].y>=this.rect.bottom?t.loc=s.bottom:t.loc=s.inside;break;case s.top:for(;t.i<=t.highI&&e[t.i].y<=this.rect.top;)t.i++;if(t.i>t.highI)break;e[t.i].y>=this.rect.bottom?t.loc=s.bottom:e[t.i].x<=this.rect.left?t.loc=s.left:e[t.i].x>=this.rect.right?t.loc=s.right:t.loc=s.inside;break;case s.right:for(;t.i<=t.highI&&e[t.i].x>=this.rect.right;)t.i++;if(t.i>t.highI)break;e[t.i].x<=this.rect.left?t.loc=s.left:e[t.i].y<=this.rect.top?t.loc=s.top:e[t.i].y>=this.rect.bottom?t.loc=s.bottom:t.loc=s.inside;break;case s.bottom:for(;t.i<=t.highI&&e[t.i].y>=this.rect.bottom;)t.i++;if(t.i>t.highI)break;e[t.i].y<=this.rect.top?t.loc=s.top:e[t.i].x<=this.rect.left?t.loc=s.left:e[t.i].x>=this.rect.right?t.loc=s.right:t.loc=s.inside;break;case s.inside:for(;t.i<=t.highI;){if(e[t.i].xthis.rect.right)t.loc=s.right;else if(e[t.i].y>this.rect.bottom)t.loc=s.bottom;else if(e[t.i].y=0&&!l.success;)t--,a=(l=L.getLocation(this.rect,e[t])).loc;if(t<0){for(let t of e)this.add(t);return}a==s.inside&&(h=s.inside)}let u=h;for(t=0;t<=o;){a=h;let l=r;if(this.getNextLocation(e,{loc:h,i:t,highI:o}),t>o)break;let u=0==t?e[o]:e[t-1];r=h;let c=L.getIntersection(this.rectPath,e[t],u,r),d=c.ip;if(!c.success){if(l==s.inside){let n=L.isClockwise(a,h,u,e[t],this.mp);do i.push(a),a=L.getAdjacentLocation(a,n);while(a!=h)r=l}else if(a!=s.inside&&a!=h){let i=L.isClockwise(a,h,u,e[t],this.mp);do this.addCornerByRef(a,i);while(a!=h)}++t;continue}if(h==s.inside){if(n==s.inside)n=r,i.push(a);else if(a!=r){let i=L.isClockwise(a,r,u,e[t],this.mp);do this.addCornerByRef(a,i);while(a!=r)}}else if(a!=s.inside){h=a,c=L.getIntersection(this.rectPath,u,e[t],h);let o=c.ip;if(l!=s.inside&&l!=h&&this.addCorner(l,h),n==s.inside&&(n=h,i.push(a)),h=r,this.add(o),d==o){h=L.getLocation(this.rect,e[t]).loc,this.addCorner(r,h),r=h;continue}}else h=r,n==s.inside&&(n=r);this.add(d)}if(n==s.inside){if(u!=s.inside&&this.pathBounds.containsRect(this.rect)&&L.path1ContainsPath2(e,this.rectPath))for(let e=0;e<4;e++)this.add(this.rectPath[e]),L.addToEdge(this.edges[2*e],this.results[0])}else if(h!=s.inside&&(h!=n||i.length>2)){if(i.length>0){for(let e of(a=h,i))a!=e&&(this.addCornerByRef(a,L.headingClockwise(a,e)),a=e);h=a}h!=n&&this.addCornerByRef(h,L.headingClockwise(h,n))}}execute(e){let t=[];if(this.rect.isEmpty())return t;for(let i of e)if(!(i.length<3)){if(this.pathBounds=I.getBounds(i),!this.rect.intersects(this.pathBounds))continue;if(this.rect.containsRect(this.pathBounds)){t.push(i);continue}this.executeInternal(i),this.checkEdges();for(let e=0;e<4;++e)this.tidyEdgePair(e,this.edges[2*e],this.edges[2*e+1]);for(let e of this.results){let i=this.getPath(e);i.length>0&&t.push(i)}this.results.length=0;for(let e=0;e<8;e++)this.edges[e].length=0}return t}checkEdges(){for(let e=0;eo.prev.pt.x,p=l.pt.x>l.prev.pt.x):(e=o.pt.y>o.prev.pt.y,p=l.pt.y>l.prev.pt.y),o.next===o.prev||o.pt===o.prev.pt?p===u?(t[c]=l,i[d++]=void 0):(i[d]=l,t[c++]=void 0):l.next===l.prev||l.pt===l.prev.pt?e===u?(t[c]=o,i[d++]=void 0):(i[d]=o,t[c++]=void 0):e===p?e===u?(t[c]=o,L.uncoupleEdge(l),L.addToEdge(t,l),i[d++]=void 0):(t[c++]=void 0,i[d]=l,L.uncoupleEdge(o),L.addToEdge(i,o),d=0):(e===u?t[c]=o:i[d]=o,p===u?t[c]=l:i[d]=l)}}getPath(e){let t=new X;if(!e||e.prev===e.next)return t;let i=e.next;for(;i&&i!==e;)0===J.crossProduct(i.prev.pt,i.pt,i.next.pt)?(e=i.prev,i=L.unlinkOp(i)):i=i.next;if(!i)return new X;for(t.push(e.pt),i=e.next;i!==e;)t.push(i.pt),i=i.next;return t}}class C extends L{constructor(e){super(e)}execute(e){let t=new j;if(this.rect.isEmpty())return t;for(let i of e)if(!(i.length<2)&&(this.pathBounds=I.getBounds(i),this.rect.intersects(this.pathBounds))){for(let e of(this.executeInternal(i),this.results)){let i=this.getPath(e);i.length>0&&t.push(i)}this.results.length=0;for(let e=0;e<8;e++)this.edges[e].length=0}return t}getPath(e){let t=new X;if(!e||e===e.next)return t;e=e.next,t.push(e.pt);let i=e.next;for(;i!==e;)t.push(i.pt),i=i.next;return t}executeInternal(e){if(this.results=[],e.length<2||this.rect.isEmpty())return;let t=s.inside,i=1,n=e.length-1,r=C.getLocation(this.rect,e[0]),a=r.loc;if(!r.success){for(;i<=n&&!r.success;)i++,t=(r=C.getLocation(this.rect,e[i])).loc;if(i>n)for(let t of e)this.add(t);t==s.inside&&(a=s.inside),i=1}for(a==s.inside&&this.add(e[0]);i<=n&&(t=a,this.getNextLocation(e,{loc:a,i:i,highI:n}),!(i>n));){let n=e[i-1],r=a,o=C.getIntersection(this.rectPath,e[i],n,r),l=o.ip;if(r=o.loc,!o.success){i++;continue}if(a==s.inside)this.add(l,!0);else if(t!==s.inside){r=t,o=C.getIntersection(this.rectPath,n,e[i],r);let s=o.ip;r=o.loc,this.add(s),this.add(l)}else this.add(l)}}}class I{static get InvalidRect64(){return I.invalidRect64||(I.invalidRect64=new q(!1)),this.invalidRect64}static Intersect(e,t,i){return this.BooleanOp(u.Intersection,e,t,i)}static Union(e,t,i=d.EvenOdd){return this.BooleanOp(u.Union,e,t,i)}static Difference(e,t,i){return this.BooleanOp(u.Difference,e,t,i)}static Xor(e,t,i){return this.BooleanOp(u.Xor,e,t,i)}static BooleanOp(e,t,i,n=d.EvenOdd){let r=new j;if(!t)return r;let s=new W;return s.addPaths(t,c.Subject),i&&s.addPaths(i,c.Clip),s.execute(e,n,r),r}static InflatePaths(e,t,i,n,r=2){let s=new P(r);s.addPaths(e,i,n);let a=new j;return s.execute(t,a),a}static RectClipPaths(e,t){if(e.isEmpty()||0===t.length)return new j;let i=new L(e);return i.execute(t)}static RectClip(e,t){if(e.isEmpty()||0===t.length)return new j;let i=new j;return i.push(t),this.RectClipPaths(e,i)}static RectClipLinesPaths(e,t){if(e.isEmpty()||0===t.length)return new j;let i=new C(e);return i.execute(t)}static RectClipLines(e,t){if(e.isEmpty()||0===t.length)return new j;let i=new j;return i.push(t),this.RectClipLinesPaths(e,i)}static MinkowskiSum(e,t,i){return T.sum(e,t,i)}static MinkowskiDiff(e,t,i){return T.diff(e,t,i)}static area(e){let t=0,i=e.length;if(i<3)return 0;let n=e[i-1];for(let i of e)t+=(n.y+i.y)*(n.x-i.x),n=i;return .5*t}static areaPaths(e){let t=0;for(let i of e)t+=this.area(i);return t}static isPositive(e){return this.area(e)>=0}static path64ToString(e){let t="";for(let i of e)t+=i.toString();return t+"\n"}static paths64ToString(e){let t="";for(let i of e)t+=this.path64ToString(i);return t}static offsetPath(e,t,i){let n=new X;for(let r of e)n.push(new Y(r.x+t,r.y+i));return n}static scalePoint64(e,t){let i=new Y(Math.round(e.x*t),Math.round(e.y*t));return i}static scalePath(e,t){if(J.isAlmostZero(t-1))return e;let i=[];for(let n of e)i.push({x:n.x*t,y:n.y*t});return i}static scalePaths(e,t){if(J.isAlmostZero(t-1))return e;let i=[];for(let n of e)i.push(this.scalePath(n,t));return i}static translatePath(e,t,i){let n=[];for(let r of e)n.push({x:r.x+t,y:r.y+i});return n}static translatePaths(e,t,i){let n=[];for(let r of e)n.push(this.translatePath(r,t,i));return n}static reversePath(e){return[...e].reverse()}static reversePaths(e){let t=[];for(let i of e)t.push(this.reversePath(i));return t}static getBounds(e){let t=I.InvalidRect64;for(let i of e)i.xt.right&&(t.right=i.x),i.yt.bottom&&(t.bottom=i.y);return t.left===Number.MAX_SAFE_INTEGER?new q(0,0,0,0):t}static getBoundsPaths(e){let t=I.InvalidRect64;for(let i of e)for(let e of i)e.xt.right&&(t.right=e.x),e.yt.bottom&&(t.bottom=e.y);return t.left===Number.MAX_SAFE_INTEGER?new q(0,0,0,0):t}static makePath(e){let t=e.length/2,i=new X;for(let n=0;n0&&t.push(e.polygon);for(let i=0;it&&e[t]===e[i];)r[i--]=!1;for(let n=t+1;nt+1&&I.rdp(e,t,s,n,r),s0&&i[e];)e--;if(!i[e])return e;for(e=t;i[e];)e--;return e}static sqr(e){return e*e}static simplifyPath(e,t,i=!1){let n,r,s,a;let o=e.length,l=o-1,h=this.sqr(t);if(o<4)return e;let u=Array(o).fill(!1),c=Array(o).fill(0),d=l,p=0;i?(c[0]=this.perpendicDistFromLineSqrd(e[0],e[l],e[1]),c[l]=this.perpendicDistFromLineSqrd(e[l],e[0],e[l-1])):(c[0]=Number.MAX_VALUE,c[l]=Number.MAX_VALUE);for(let t=1;th){n=p;do p=this.getNext(p,l,u);while(p!==n&&c[p]>h)if(p===n)break}if(d=this.getPrior(p,l,u),(r=this.getNext(p,l,u))===d)break;c[r]2&&0===J.crossProduct(r[r.length-1],r[r.length-2],r[0]);)r.pop();r.length<3&&r.splice(0,r.length)}return r}static pointInPolygon(e,t){return J.pointInPolygon(e,t)}static ellipse(e,t,i=0,n=0){if(t<=0)return[];i<=0&&(i=t),n<=2&&(n=Math.ceil(Math.PI*Math.sqrt((t+i)/2)));let r=Math.sin(2*Math.PI/n),s=Math.cos(2*Math.PI/n),a=s,o=r,l=[{x:e.x+t,y:e.y}];for(let h=1;hthis.showPolyPathStructure(e,t+1)))}static showPolyTreeStructure(e){console.log("Polytree Root"),e.forEach(e=>this.showPolyPathStructure(e,1))}}(x=a||(a={}))[x.IsOn=0]="IsOn",x[x.IsInside=1]="IsInside",x[x.IsOutside=2]="IsOutside",(_=o||(o={}))[_.None=0]="None",_[_.OpenStart=1]="OpenStart",_[_.OpenEnd=2]="OpenEnd",_[_.LocalMax=4]="LocalMax",_[_.LocalMin=8]="LocalMin";class O{constructor(e,t,i){this.pt=e,this.flags=t,this.next=void 0,this.prev=i}}class N{constructor(e,t,i=!1){this.vertex=e,this.polytype=t,this.isOpen=i}static equals(e,t){return e.vertex===t.vertex}static notEquals(e,t){return e.vertex!==t.vertex}}class U{constructor(e,t,i){this.pt=e,this.edge1=t,this.edge2=i}}class D{constructor(e,t){this.pt=e,this.outrec=t,this.next=this,this.prev=this,this.horz=void 0}}(v=l||(l={}))[v.None=0]="None",v[v.Left=1]="Left",v[v.Right=2]="Right",(y=h||(h={}))[y.Bottom=0]="Bottom",y[y.Middle=1]="Middle",y[y.Top=2]="Top";class B{constructor(e){this.idx=e,this.isOpen=!1}}class F{constructor(e){this.leftOp=e,this.rightOp=void 0,this.leftToRight=!0}}class z{constructor(e,t){this.op1=e,this.op2=t}}class V{constructor(){this.dx=this.windCount=this.windCount2=0,this.isLeftBound=!1,this.joinWith=l.None}}class H{static addLocMin(e,t,i,n){if((e.flags&o.LocalMin)!==o.None)return;e.flags|=o.LocalMin;let r=new N(e,t,i);n.push(r)}static addPathsToVertexList(e,t,i,n,r){let s=0;for(let t of e)s+=t.length;for(let a of e){let e,l,h;for(let t of a)e?l.pt!==t&&(h=new O(t,o.None,l),r.push(h),l.next=h,l=h):(e=new O(t,o.None,void 0),r.push(e),l=e);if(!l||!l.prev||(i||l.pt!==e.pt||(l=l.prev),l.next=e,e.prev=l,!i&&l.next===l))continue;let u=!1;if(i){h=e.next;let i=0;for(;h!==e&&h.pt.y===e.pt.y;)if(h=h.next,i++>s){console.warn("infinite loop detected");break}(u=h.pt.y<=e.pt.y)?(e.flags=o.OpenStart,this.addLocMin(e,t,!0,n)):e.flags=o.OpenStart|o.LocalMax}else{l=e.prev;let t=0;for(;l!==e&&l.pt.y===e.pt.y;)if(l=l.prev,t++>s){console.warn("infinite loop detected");break}if(l===e)continue;u=l.pt.y>e.pt.y}let c=u;l=e,h=e.next;let d=0;for(;h!==e;)if(h.pt.y>l.pt.y&&u?(l.flags|=o.LocalMax,u=!1):h.pt.ys){console.warn("infinite loop detected");break}i?(l.flags|=o.OpenEnd,u?l.flags|=o.LocalMax:this.addLocMin(l,t,i,n)):u!==c&&(c?this.addLocMin(l,t,!1,n):l.flags|=o.LocalMax)}}}class k{constructor(){this.items=[],this.items=[]}clear(){this.items.length=0}isEmpty(){return 0==this.items.length}pollLast(){return this.items.pop()}add(e){this.items.includes(e)||(this.items.push(e),this.items.sort((e,t)=>e-t))}}class G{constructor(){this._cliptype=u.None,this._fillrule=d.EvenOdd,this._currentLocMin=0,this._currentBotY=0,this._isSortedMinimaList=!1,this._hasOpenPaths=!1,this._using_polytree=!1,this._succeeded=!1,this.reverseSolution=!1,this._minimaList=[],this._intersectList=[],this._vertexList=[],this._outrecList=[],this._scanlineList=new k,this._horzSegList=[],this._horzJoinList=[],this.preserveCollinear=!0}static isOdd(e){return(1&e)!=0}static isHotEdgeActive(e){return void 0!==e.outrec}static isOpen(e){return e.localMin.isOpen}static isOpenEndActive(e){return e.localMin.isOpen&&G.isOpenEnd(e.vertexTop)}static isOpenEnd(e){return(e.flags&(o.OpenStart|o.OpenEnd))!==o.None}static getPrevHotEdge(e){let t=e.prevInAEL;for(;t&&(G.isOpen(t)||!G.isHotEdgeActive(t));)t=t.prevInAEL;return t}static isFront(e){return e===e.outrec.frontEdge}static getDx(e,t){let i=t.y-e.y;return 0!==i?(t.x-e.x)/i:t.x>e.x?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}static topX(e,t){return t===e.top.y||e.top.x===e.bot.x?e.top.x:t===e.bot.y?e.bot.x:e.bot.x+Math.round(e.dx*(t-e.bot.y))}static isHorizontal(e){return e.top.y===e.bot.y}static isHeadingRightHorz(e){return Number.NEGATIVE_INFINITY===e.dx}static isHeadingLeftHorz(e){return Number.POSITIVE_INFINITY===e.dx}static swapActives(e,t){[t,e]=[e,t]}static getPolyType(e){return e.localMin.polytype}static isSamePolyType(e,t){return e.localMin.polytype===t.localMin.polytype}static setDx(e){e.dx=G.getDx(e.bot,e.top)}static nextVertex(e){return e.windDx>0?e.vertexTop.next:e.vertexTop.prev}static prevPrevVertex(e){return e.windDx>0?e.vertexTop.prev.prev:e.vertexTop.next.next}static isMaxima(e){return(e.flags&o.LocalMax)!==o.None}static isMaximaActive(e){return G.isMaxima(e.vertexTop)}static getMaximaPair(e){let t=e.nextInAEL;for(;t;){if(t.vertexTop===e.vertexTop)return t;t=t.nextInAEL}}static getCurrYMaximaVertex_Open(e){let t=e.vertexTop;if(e.windDx>0)for(;t.next.pt.y===t.pt.y&&(t.flags&(o.OpenEnd|o.LocalMax))===o.None;)t=t.next;else for(;t.prev.pt.y===t.pt.y&&(t.flags&(o.OpenEnd|o.LocalMax))===o.None;)t=t.prev;return G.isMaxima(t)||(t=void 0),t}static getCurrYMaximaVertex(e){let t=e.vertexTop;if(e.windDx>0)for(;t.next.pt.y===t.pt.y;)t=t.next;else for(;t.prev.pt.y===t.pt.y;)t=t.prev;return G.isMaxima(t)||(t=void 0),t}static setSides(e,t,i){e.frontEdge=t,e.backEdge=i}static swapOutrecs(e,t){let i=e.outrec,n=t.outrec;if(i===n){let e=i.frontEdge;i.frontEdge=i.backEdge,i.backEdge=e;return}i&&(e===i.frontEdge?i.frontEdge=t:i.backEdge=t),n&&(t===n.frontEdge?n.frontEdge=e:n.backEdge=e),e.outrec=n,t.outrec=i}static setOwner(e,t){for(;t.owner&&!t.owner.pts;)t.owner=t.owner.owner;let i=t;for(;i&&i!==e;)i=i.owner;i&&(t.owner=e.owner),e.owner=t}static area(e){let t=0,i=e;do t+=(i.prev.pt.y+i.pt.y)*(i.prev.pt.x-i.pt.x),i=i.next;while(i!==e)return .5*t}static areaTriangle(e,t,i){return(i.y+e.y)*(i.x-e.x)+(e.y+t.y)*(e.x-t.x)+(t.y+i.y)*(t.x-i.x)}static getRealOutRec(e){for(;void 0!==e&&void 0===e.pts;)e=e.owner;return e}static isValidOwner(e,t){for(;void 0!==t&&t!==e;)t=t.owner;return void 0===t}static uncoupleOutRec(e){let t=e.outrec;void 0!==t&&(t.frontEdge.outrec=void 0,t.backEdge.outrec=void 0,t.frontEdge=void 0,t.backEdge=void 0)}static outrecIsAscending(e){return e===e.outrec.frontEdge}static swapFrontBackSides(e){let t=e.frontEdge;e.frontEdge=e.backEdge,e.backEdge=t,e.pts=e.pts.next}static edgesAdjacentInAEL(e){return e.edge1.nextInAEL===e.edge2||e.edge1.prevInAEL===e.edge2}clearSolutionOnly(){for(;this._actives;)this.deleteFromAEL(this._actives);this._scanlineList.clear(),this.disposeIntersectNodes(),this._outrecList.length=0,this._horzSegList.length=0,this._horzJoinList.length=0}clear(){this.clearSolutionOnly(),this._minimaList.length=0,this._vertexList.length=0,this._currentLocMin=0,this._isSortedMinimaList=!1,this._hasOpenPaths=!1}reset(){this._isSortedMinimaList||(this._minimaList.sort((e,t)=>t.vertex.pt.y-e.vertex.pt.y),this._isSortedMinimaList=!0);for(let e=this._minimaList.length-1;e>=0;e--)this._scanlineList.add(this._minimaList[e].vertex.pt.y);this._currentBotY=0,this._currentLocMin=0,this._actives=void 0,this._sel=void 0,this._succeeded=!0}insertScanline(e){this._scanlineList.add(e)}popScanline(){return this._scanlineList.pollLast()}hasLocMinAtY(e){return this._currentLocMin0;case d.Negative:return e.windCount2<0;default:return 0!==e.windCount2}case u.Union:switch(this._fillrule){case d.Positive:return e.windCount2<=0;case d.Negative:return e.windCount2>=0;default:return 0===e.windCount2}case u.Difference:let t=this._fillrule===d.Positive?e.windCount2<=0:this._fillrule===d.Negative?e.windCount2>=0:0===e.windCount2;return G.getPolyType(e)===c.Subject?t:!t;case u.Xor:return!0;default:return!1}}isContributingOpen(e){let t,i;switch(this._fillrule){case d.Positive:i=e.windCount>0,t=e.windCount2>0;break;case d.Negative:i=e.windCount<0,t=e.windCount2<0;break;default:i=0!==e.windCount,t=0!==e.windCount2}switch(this._cliptype){case u.Intersection:return t;case u.Union:return!i&&!t;default:return!t}}setWindCountForClosedPathEdge(e){let t=e.prevInAEL,i=G.getPolyType(e);for(;void 0!==t&&(G.getPolyType(t)!==i||G.isOpen(t));)t=t.prevInAEL;if(void 0===t?(e.windCount=e.windDx,t=this._actives):(this._fillrule===d.EvenOdd?e.windCount=e.windDx:t.windCount*t.windDx<0?Math.abs(t.windCount)>1?t.windDx*e.windDx<0?e.windCount=t.windCount:e.windCount=t.windCount+e.windDx:e.windCount=G.isOpen(e)?1:e.windDx:t.windDx*e.windDx<0?e.windCount=t.windCount:e.windCount=t.windCount+e.windDx,e.windCount2=t.windCount2,t=t.nextInAEL),this._fillrule===d.EvenOdd)for(;t!==e;)G.getPolyType(t)===i||G.isOpen(t)||(e.windCount2=0===e.windCount2?1:0),t=t.nextInAEL;else for(;t!==e;)G.getPolyType(t)===i||G.isOpen(t)||(e.windCount2+=t.windDx),t=t.nextInAEL}setWindCountForOpenPathEdge(e){let t=this._actives;if(this._fillrule===d.EvenOdd){let i=0,n=0;for(;t!==e;)G.getPolyType(t)===c.Clip?n++:!G.isOpen(t)&&i++,t=t.nextInAEL;e.windCount=G.isOdd(i)?1:0,e.windCount2=G.isOdd(n)?1:0}else for(;t!==e;)G.getPolyType(t)===c.Clip?e.windCount2+=t.windDx:G.isOpen(t)||(e.windCount+=t.windDx),t=t.nextInAEL}static isValidAelOrder(e,t){if(t.curX!==e.curX)return t.curX>e.curX;let i=J.crossProduct(e.top,t.bot,t.top);if(0!==i)return i<0;if(!this.isMaximaActive(e)&&e.top.y>t.top.y)return 0>=J.crossProduct(t.bot,e.top,this.nextVertex(e).pt);if(!this.isMaximaActive(t)&&t.top.y>e.top.y)return J.crossProduct(t.bot,t.top,this.nextVertex(t).pt)>=0;let n=t.bot.y,r=t.isLeftBound;return e.bot.y!==n||e.localMin.vertex.pt.y!==n?t.isLeftBound:e.isLeftBound!==r?r:0===J.crossProduct(this.prevPrevVertex(e).pt,e.bot,e.top)||J.crossProduct(this.prevPrevVertex(e).pt,t.bot,this.prevPrevVertex(t).pt)>0===r}insertLeftEdge(e){let t;if(this._actives){if(G.isValidAelOrder(this._actives,e)){for(t=this._actives;t.nextInAEL&&G.isValidAelOrder(t.nextInAEL,e);)t=t.nextInAEL;t.joinWith===l.Right&&(t=t.nextInAEL),e.nextInAEL=t.nextInAEL,t.nextInAEL&&(t.nextInAEL.prevInAEL=e),e.prevInAEL=t,t.nextInAEL=e}else e.prevInAEL=void 0,e.nextInAEL=this._actives,this._actives.prevInAEL=e,this._actives=e}else e.prevInAEL=void 0,e.nextInAEL=void 0,this._actives=e}static insertRightEdge(e,t){t.nextInAEL=e.nextInAEL,e.nextInAEL&&(e.nextInAEL.prevInAEL=t),t.prevInAEL=e,e.nextInAEL=t}insertLocalMinimaIntoAEL(e){let t,i,n;for(;this.hasLocMinAtY(e);){((t=this.popLocalMinima()).vertex.flags&o.OpenStart)!==o.None?i=void 0:((i=new V).bot=t.vertex.pt,i.curX=t.vertex.pt.x,i.windDx=-1,i.vertexTop=t.vertex.prev,i.top=t.vertex.prev.pt,i.outrec=void 0,i.localMin=t,G.setDx(i)),(t.vertex.flags&o.OpenEnd)!==o.None?n=void 0:((n=new V).bot=t.vertex.pt,n.curX=t.vertex.pt.x,n.windDx=1,n.vertexTop=t.vertex.next,n.top=t.vertex.next.pt,n.outrec=void 0,n.localMin=t,G.setDx(n)),i&&n?G.isHorizontal(i)?G.isHeadingRightHorz(i)&&([n,i]=[i,n]):G.isHorizontal(n)?G.isHeadingLeftHorz(n)&&([n,i]=[i,n]):i.dx0?G.setSides(r,e,t):G.setSides(r,t,e);else{r.isOpen=!1;let i=G.getPrevHotEdge(e);i?(this._using_polytree&&G.setOwner(r,i.outrec),r.owner=i.outrec,G.outrecIsAscending(i)===n?G.setSides(r,t,e):G.setSides(r,e,t)):(r.owner=void 0,n?G.setSides(r,e,t):G.setSides(r,t,e))}let s=new D(i,r);return r.pts=s,s}addLocalMaxPoly(e,t,i){if(G.isJoined(e)&&this.split(e,i),G.isJoined(t)&&this.split(t,i),G.isFront(e)===G.isFront(t)){if(G.isOpenEndActive(e))G.swapFrontBackSides(e.outrec);else if(G.isOpenEndActive(t))G.swapFrontBackSides(t.outrec);else{this._succeeded=!1;return}}let n=G.addOutPt(e,i);if(e.outrec===t.outrec){let t=e.outrec;if(t.pts=n,this._using_polytree){let i=G.getPrevHotEdge(e);void 0===i?t.owner=void 0:G.setOwner(t,i.outrec)}G.uncoupleOutRec(e)}else G.isOpen(e)?e.windDx<0?G.joinOutrecPaths(e,t):G.joinOutrecPaths(t,e):e.outrec.idx0?(i.frontEdge=e,i.backEdge=void 0):(i.frontEdge=void 0,i.backEdge=e),e.outrec=i;let n=new D(t,i);return i.pts=n,n}updateEdgeIntoAEL(e){e.bot=e.top,e.vertexTop=G.nextVertex(e),e.top=e.vertexTop.pt,e.curX=e.bot.x,G.setDx(e),G.isJoined(e)&&this.split(e,e.bot),G.isHorizontal(e)||(this.insertScanline(e.top.y),this.checkJoinLeft(e,e.bot),this.checkJoinRight(e,e.bot,!0))}static findEdgeWithMatchingLocMin(e){let t=e.nextInAEL;for(;t;){if(t.localMin===e.localMin)return t;t=G.isHorizontal(t)||e.bot===t.bot?t.nextInAEL:void 0}for(t=e.prevInAEL;t&&t.localMin!==e.localMin;){if(!G.isHorizontal(t)&&e.bot!==t.bot)return;t=t.prevInAEL}return t}intersectEdges(e,t,i){let n,r,s;if(this._hasOpenPaths&&(G.isOpen(e)||G.isOpen(t))){if(G.isOpen(e)&&G.isOpen(t))return;if(G.isOpen(t)&&G.swapActives(e,t),G.isJoined(t)&&this.split(t,i),this._cliptype===u.Union){if(!G.isHotEdgeActive(t))return}else if(t.localMin.polytype===c.Subject)return;switch(this._fillrule){case d.Positive:if(1!==t.windCount)return;break;case d.Negative:if(-1!==t.windCount)return;break;default:if(1!==Math.abs(t.windCount))return}if(G.isHotEdgeActive(e))s=G.addOutPt(e,i),G.isFront(e)?e.outrec.frontEdge=void 0:e.outrec.backEdge=void 0,e.outrec=void 0;else if(i!==e.localMin.vertex.pt||G.isOpenEnd(e.localMin.vertex))s=this.startOpenPath(e,i);else{let t=G.findEdgeWithMatchingLocMin(e);if(t&&G.isHotEdgeActive(t))return e.outrec=t.outrec,e.windDx>0?G.setSides(t.outrec,e,t):G.setSides(t.outrec,t,e),t.outrec.pts;s=this.startOpenPath(e,i)}return s}switch(G.isJoined(e)&&this.split(e,i),G.isJoined(t)&&this.split(t,i),e.localMin.polytype===t.localMin.polytype?this._fillrule===d.EvenOdd?(n=e.windCount,e.windCount=t.windCount,t.windCount=n):(e.windCount+t.windDx===0?e.windCount=-e.windCount:e.windCount+=t.windDx,t.windCount-e.windDx==0?t.windCount=-t.windCount:t.windCount-=e.windDx):(this._fillrule!==d.EvenOdd?e.windCount2+=t.windDx:e.windCount2=0===e.windCount2?1:0,this._fillrule!==d.EvenOdd?t.windCount2-=e.windDx:t.windCount2=0===t.windCount2?1:0),this._fillrule){case d.Positive:n=e.windCount,r=t.windCount;break;case d.Negative:n=-e.windCount,r=-t.windCount;break;default:n=Math.abs(e.windCount),r=Math.abs(t.windCount)}let a=0===n||1===n,o=0===r||1===r;if((G.isHotEdgeActive(e)||a)&&(G.isHotEdgeActive(t)||o)){if(G.isHotEdgeActive(e)&&G.isHotEdgeActive(t))0!==n&&1!==n||0!==r&&1!==r||e.localMin.polytype!==t.localMin.polytype&&this._cliptype!==u.Xor?s=this.addLocalMaxPoly(e,t,i):G.isFront(e)||e.outrec===t.outrec?(s=this.addLocalMaxPoly(e,t,i),this.addLocalMinPoly(e,t,i)):(s=G.addOutPt(e,i),G.addOutPt(t,i),G.swapOutrecs(e,t));else if(G.isHotEdgeActive(e))s=G.addOutPt(e,i),G.swapOutrecs(e,t);else if(G.isHotEdgeActive(t))s=G.addOutPt(t,i),G.swapOutrecs(e,t);else{let a,o;switch(this._fillrule){case d.Positive:a=e.windCount2,o=t.windCount2;break;case d.Negative:a=-e.windCount2,o=-t.windCount2;break;default:a=Math.abs(e.windCount2),o=Math.abs(t.windCount2)}if(G.isSamePolyType(e,t)){if(1===n&&1===r)switch(s=void 0,this._cliptype){case u.Union:if(a>0&&o>0)return;s=this.addLocalMinPoly(e,t,i);break;case u.Difference:(G.getPolyType(e)===c.Clip&&a>0&&o>0||G.getPolyType(e)===c.Subject&&a<=0&&o<=0)&&(s=this.addLocalMinPoly(e,t,i));break;case u.Xor:s=this.addLocalMinPoly(e,t,i);break;default:if(a<=0||o<=0)return;s=this.addLocalMinPoly(e,t,i)}}else s=this.addLocalMinPoly(e,t,i)}return s}}deleteFromAEL(e){let t=e.prevInAEL,i=e.nextInAEL;(t||i||e===this._actives)&&(t?t.nextInAEL=i:this._actives=i,i&&(i.prevInAEL=t))}adjustCurrXAndCopyToSEL(e){let t=this._actives;for(this._sel=t;t;)t.prevInSEL=t.prevInAEL,t.nextInSEL=t.nextInAEL,t.jump=t.nextInSEL,t.joinWith===l.Left?t.curX=t.prevInAEL.curX:t.curX=G.topX(t,e),t=t.nextInAEL}executeInternal(e,t){if(e===u.None)return;this._fillrule=t,this._cliptype=e,this.reset();let i=this.popScanline();if(void 0!==i){for(;this._succeeded;){this.insertLocalMinimaIntoAEL(i);let e=this.popHorz();for(;e;)this.doHorizontal(e),e=this.popHorz();if(this._horzSegList.length>0&&(this.convertHorzSegsToJoins(),this._horzSegList.length=0),this._currentBotY=i,void 0===(i=this.popScanline()))break;for(this.doIntersections(i),this.doTopOfScanbeam(i),e=this.popHorz();e;)this.doHorizontal(e),e=this.popHorz()}this._succeeded&&this.processHorzJoins()}}doIntersections(e){this.buildIntersectList(e)&&(this.processIntersectList(),this.disposeIntersectNodes())}disposeIntersectNodes(){this._intersectList.length=0}addNewIntersectNode(e,t,i){let n=J.getIntersectPt(e.bot,e.top,t.bot,t.top),r=n.ip;if(n.success||(r=new Y(e.curX,i)),r.y>this._currentBotY||r.y100&&s>100?r=n>s?J.getClosestPtOnSegment(r,e.bot,e.top):J.getClosestPtOnSegment(r,t.bot,t.top):n>100?r=J.getClosestPtOnSegment(r,e.bot,e.top):s>100?r=J.getClosestPtOnSegment(r,t.bot,t.top):(r.y0}processIntersectList(){this._intersectList.sort((e,t)=>e.pt.y===t.pt.y?e.pt.x===t.pt.x?0:e.pt.xt.pt.y?-1:1);for(let e=0;eo||!s&&l.curX=t.x||!s&&G.topX(l,t.y)<=t.x)break}else if(s&&G.topX(l,t.y)>t.x||!s&&G.topX(l,t.y)t.y)&&!(n.bot.y>t.y))){if(i){if(I.perpendicDistFromLineSqrd(t,n.bot,n.top)>.25)return}else if(e.curX!==n.curX)return;0===J.crossProduct(e.top,t,n.top)&&(e.outrec.idx===n.outrec.idx?this.addLocalMaxPoly(n,e,t):e.outrec.idxt.y)&&!(n.bot.y>t.y))){if(i){if(I.perpendicDistFromLineSqrd(t,n.bot,n.top)>.25)return}else if(e.curX!==n.curX)return;0===J.crossProduct(e.top,t,n.top)&&(e.outrec.idx===n.outrec.idx?this.addLocalMaxPoly(e,n,t):e.outrec.idxe&&t?e.rightOp?t.rightOp?e.leftOp.pt.x-t.leftOp.pt.x:-1:t.rightOp?1:0:0);for(let t=0;t=i.rightOp.pt.x||e.leftToRight===i.leftToRight||e.rightOp.pt.x<=i.leftOp.pt.x)continue;let t=i.leftOp.pt.y;if(i.leftToRight){for(;i.leftOp.next.pt.y===t&&i.leftOp.next.pt.x<=e.leftOp.pt.x;)i.leftOp=i.leftOp.next;for(;e.leftOp.prev.pt.y===t&&e.leftOp.prev.pt.x<=i.leftOp.pt.x;)e.leftOp=e.leftOp.prev;let n=new z(G.duplicateOp(i.leftOp,!0),G.duplicateOp(e.leftOp,!1));this._horzJoinList.push(n)}else{for(;i.leftOp.prev.pt.y===t&&i.leftOp.prev.pt.x<=e.leftOp.pt.x;)i.leftOp=i.leftOp.prev;for(;e.leftOp.next.pt.y===t&&e.leftOp.next.pt.x<=i.leftOp.pt.x;)e.leftOp=e.leftOp.next;let n=new z(G.duplicateOp(e.leftOp,!0),G.duplicateOp(i.leftOp,!1));this._horzJoinList.push(n)}}}}}static getCleanPath(e){let t=new X,i=e;for(;i.next!==e&&(i.pt.x===i.next.pt.x&&i.pt.x===i.prev.pt.x||i.pt.y===i.next.pt.y&&i.pt.y===i.prev.pt.y);)i=i.next;t.push(i.pt);let n=i;for(i=i.next;i!==e;)(i.pt.x!==i.next.pt.x||i.pt.x!==n.pt.x)&&(i.pt.y!==i.next.pt.y||i.pt.y!==n.pt.y)&&(t.push(i.pt),n=i),i=i.next;return t}static pointInOpPolygon(e,t){if(t===t.next||t.prev===t.next)return a.IsOutside;let i=t;do{if(t.pt.y!==e.y)break;t=t.next}while(t!==i)if(t.pt.y===e.y)return a.IsOutside;let n=t.pt.ye.y;)i=i.next;if(i===t)break;if(i.pt.y===e.y){if(i.pt.x===e.x||i.pt.y===i.prev.pt.y&&e.xMath.abs(n))if(Math.abs(n)>1)return n<0;let s=G.getBoundsPath(this.getCleanPath(e)).midPoint(),o=this.getCleanPath(t);return J.pointInPolygon(s,o)!==a.IsOutside}moveSplits(e,t){if(e.splits){for(let i of(t.splits=t.splits||[],e.splits))t.splits.push(i);e.splits=void 0}}processHorzJoins(){for(let e of this._horzJoinList){let t=G.getRealOutRec(e.op1.outrec),i=G.getRealOutRec(e.op2.outrec),n=e.op1.next,r=e.op2.prev;if(e.op1.next=e.op2,e.op2.prev=e.op1,n.prev=r,r.next=n,t===i){if((i=this.newOutRec()).pts=n,G.fixOutRecPts(i),t.pts.outrec===i&&(t.pts=e.op1,t.pts.outrec=t),this._using_polytree){if(G.path1InsidePath2(t.pts,i.pts)){let e=t.pts;t.pts=i.pts,i.pts=e,G.fixOutRecPts(t),G.fixOutRecPts(i),i.owner=t.owner}else G.path1InsidePath2(i.pts,t.pts)?i.owner=t:i.owner=t.owner;t.splits=t.splits||[],t.splits.push(i.idx)}else i.owner=t}else i.pts=void 0,this._using_polytree?(G.setOwner(i,t),this.moveSplits(i,t)):i.owner=t}}static ptsReallyClose(e,t){return 2>Math.abs(e.x-t.x)&&2>Math.abs(e.y-t.y)}static isVerySmallTriangle(e){return e.next.next===e.prev&&(this.ptsReallyClose(e.prev.pt,e.next.pt)||this.ptsReallyClose(e.pt,e.next.pt)||this.ptsReallyClose(e.pt,e.prev.pt))}static isValidClosedPath(e){return void 0!==e&&e.next!==e&&(e.next!==e.prev||!this.isVerySmallTriangle(e))}static disposeOutPt(e){let t=e.next===e?void 0:e.next;return e.prev.next=e.next,e.next.prev=e.prev,t}cleanCollinear(e){if(void 0===(e=G.getRealOutRec(e))||e.isOpen)return;if(!G.isValidClosedPath(e.pts)){e.pts=void 0;return}let t=e.pts,i=t;for(;;){if(0===J.crossProduct(i.prev.pt,i.pt,i.next.pt)&&(i.pt===i.prev.pt||i.pt===i.next.pt||!this.preserveCollinear||0>J.dotProduct(i.prev.pt,i.pt,i.next.pt))){if(i===e.pts&&(e.pts=i.prev),i=G.disposeOutPt(i),!G.isValidClosedPath(i)){e.pts=void 0;return}t=i;continue}if((i=i.next)===t)break}this.fixSelfIntersects(e)}doSplitOp(e,t){let i=t.prev,n=t.next.next;e.pts=i;let r=J.getIntersectPoint(i.pt,t.pt,t.next.pt,n.pt).ip,s=G.area(i),a=Math.abs(s);if(a<2){e.pts=void 0;return}let o=G.areaTriangle(r,t.pt,t.next.pt),l=Math.abs(o);if(r===i.pt||r===n.pt)n.prev=i,i.next=n;else{let t=new D(r,e);t.prev=i,t.next=n,n.prev=t,i.next=t}if(l>1&&(l>a||o>0==s>0)){let n=this.newOutRec();n.owner=e.owner,t.outrec=n,t.next.outrec=n;let s=new D(r,n);s.prev=t.next,s.next=t,n.pts=s,t.prev=s,t.next.next=s,this._using_polytree&&(G.path1InsidePath2(i,s)?(n.splits=n.splits||[],n.splits.push(e.idx)):(e.splits=e.splits||[],e.splits.push(n.idx)))}}fixSelfIntersects(e){let t=e.pts;for(;t.prev!==t.next.next;){if(J.segsIntersect(t.prev.pt,t.pt,t.next.pt,t.next.next.pt)){if(this.doSplitOp(e,t),!e.pts)return;t=e.pts;continue}if((t=t.next)===e.pts)break}}static buildPath(e,t,i,n){let r,s;if(void 0===e||e.next===e||!i&&e.next===e.prev)return!1;for(n.length=0,t?(r=e.pt,s=e.prev):(r=(e=e.next).pt,s=e.next),n.push(r);s!==e;)s.pt!==r&&(r=s.pt,n.push(r)),s=t?s.prev:s.next;return!(3===n.length&&this.isVerySmallTriangle(s))}buildPaths(e,t){e.length=0,t.length=0;let i=0;for(;it.right&&(t.right=i.x),i.yt.bottom&&(t.bottom=i.y);return t}checkBounds(e){return void 0!==e.pts&&(!e.bounds.isEmpty()||(this.cleanCollinear(e),!!(void 0!==e.pts&&G.buildPath(e.pts,this.reverseSolution,!1,e.path))&&(e.bounds=G.getBoundsPath(e.path),!0)))}checkSplitOwner(e,t){for(let i of t){let t=G.getRealOutRec(this._outrecList[i]);if(void 0!==t&&t!==e&&t.recursiveSplit!==e){if(t.recursiveSplit=e,void 0!==t.splits&&this.checkSplitOwner(e,t.splits))return!0;if(G.isValidOwner(e,t)&&this.checkBounds(t)&&t.bounds.containsRect(e.bounds)&&G.path1InsidePath2(e.pts,t.pts))return e.owner=t,!0}}return!1}recursiveCheckOwners(e,t){if(!(void 0!==e.polypath||e.bounds.isEmpty())){for(;void 0!==e.owner&&!(void 0!==e.owner.splits&&this.checkSplitOwner(e,e.owner.splits))&&!(void 0!==e.owner.pts&&this.checkBounds(e.owner)&&G.path1InsidePath2(e.pts,e.owner.pts));)e.owner=e.owner.owner;void 0!==e.owner?(void 0===e.owner.polypath&&this.recursiveCheckOwners(e.owner,t),e.polypath=e.owner.polypath.addChild(e.path)):e.polypath=t.addChild(e.path)}}buildTree(e,t){e.clear(),t.length=0;let i=0;for(;ie.right&&(e.right=i.pt.x),i.pt.ye.bottom&&(e.bottom=i.pt.y),i=i.next;while(i!==t)}return e.isEmpty()?new q(0,0,0,0):e}}class W extends G{addPath(e,t,i=!1){super.addPath(e,t,i)}addReusableData(e){super.addReuseableData(e)}addPaths(e,t,i=!1){super.addPaths(e,t,i)}addSubjectPaths(e){this.addPaths(e,c.Subject)}addOpenSubjectPaths(e){this.addPaths(e,c.Subject,!0)}addClipPaths(e){this.addPaths(e,c.Clip)}execute(e,t,i,n=new j){i.length=0,n.length=0;try{this.executeInternal(e,t),this.buildPaths(i,n)}catch(e){this._succeeded=!1}return this.clearSolutionOnly(),this._succeeded}executePolyTree(e,t,i,n=new j){i.clear(),n.length=0,this._using_polytree=!0;try{this.executeInternal(e,t),this.buildTree(i,n)}catch(e){this._succeeded=!1}return this.clearSolutionOnly(),this._succeeded}}(M=u||(u={}))[M.None=0]="None",M[M.Intersection=1]="Intersection",M[M.Union=2]="Union",M[M.Difference=3]="Difference",M[M.Xor=4]="Xor",(S=c||(c={}))[S.Subject=0]="Subject",S[S.Clip=1]="Clip",(E=d||(d={}))[E.EvenOdd=0]="EvenOdd",E[E.NonZero=1]="NonZero",E[E.Positive=2]="Positive",E[E.Negative=3]="Negative",(b=p||(p={}))[b.Inside=0]="Inside",b[b.Outside=1]="Outside",b[b.OnEdge=2]="OnEdge";class X extends Array{}class j extends Array{}class q{constructor(e,t,i,n){"boolean"==typeof e?e?(this.left=0,this.top=0,this.right=0,this.bottom=0):(this.left=Number.MAX_SAFE_INTEGER,this.top=Number.MAX_SAFE_INTEGER,this.right=Number.MIN_SAFE_INTEGER,this.bottom=Number.MIN_SAFE_INTEGER):"number"==typeof e?(this.left=e,this.top=t,this.right=i,this.bottom=n):(this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom)}get width(){return this.right-this.left}set width(e){this.right=this.left+e}get height(){return this.bottom-this.top}set height(e){this.bottom=this.top+e}isEmpty(){return this.bottom<=this.top||this.right<=this.left}midPoint(){return new Y((this.left+this.right)/2,(this.top+this.bottom)/2)}contains(e){return e.x>this.left&&e.xthis.top&&e.y=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom}intersects(e){return Math.max(this.left,e.left)<=Math.min(this.right,e.right)&&Math.max(this.top,e.top)<=Math.min(this.bottom,e.bottom)}asPath(){let e=new X;return e.push(new Y(this.left,this.top)),e.push(new Y(this.right,this.top)),e.push(new Y(this.right,this.bottom)),e.push(new Y(this.left,this.bottom)),e}}class Y{constructor(e,t){"number"==typeof e&&"number"==typeof t?(this.x=Math.round(e),this.y=Math.round(t)):void 0!==t?(this.x=Math.round(e.x*t),this.y=Math.round(e.y*t)):(this.x=e.x,this.y=e.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static notEquals(e,t){return e.x!==t.x||e.y!==t.y}static add(e,t){return new Y(e.x+t.x,e.y+t.y)}static subtract(e,t){return new Y(e.x-t.x,e.y-t.y)}toString(){return`${this.x},${this.y} `}equals(e){return e instanceof Y&&Y.equals(this,e)}}class J{static checkPrecision(e){if(e<-8||e>8)throw Error(this.precision_range_error)}static isAlmostZero(e){return Math.abs(e)<=this.floatingPointTolerance}static crossProduct(e,t,i){return(t.x-e.x)*(i.y-t.y)-(t.y-e.y)*(i.x-t.x)}static dotProduct(e,t,i){return(t.x-e.x)*(i.x-t.x)+(t.y-e.y)*(i.y-t.y)}static checkCastInt64(e){return e>=this.max_coord||e<=this.min_coord?this.Invalid64:Math.round(e)}static getIntersectPt(e,t,i,n){let r=t.y-e.y,s=t.x-e.x,a=n.y-i.y,o=n.x-i.x,l=r*o-a*s;if(0===l)return{ip:new Y(0,0),success:!1};let h=((e.x-i.x)*a-(e.y-i.y)*o)/l;return{ip:h<=0?e:h>=1?t:new Y(e.x+h*s,e.y+h*r),success:!0}}static getIntersectPoint(e,t,i,n){let r=t.y-e.y,s=t.x-e.x,a=n.y-i.y,o=n.x-i.x,l=r*o-a*s;if(0===l)return{ip:new Y(0,0),success:!1};let h=((e.x-i.x)*a-(e.y-i.y)*o)/l;return{ip:h<=0?e:h>=1?i:new Y(e.x+h*s,e.y+h*r),success:!0}}static segsIntersect(e,t,i,n,r=!1){if(!r)return J.crossProduct(e,i,n)*J.crossProduct(t,i,n)<0&&J.crossProduct(i,e,t)*J.crossProduct(n,e,t)<0;{let r=J.crossProduct(e,i,n),s=J.crossProduct(t,i,n);if(r*s>0)return!1;let a=J.crossProduct(i,e,t),o=J.crossProduct(n,e,t);return!(a*o>0)&&(0!==r||0!==s||0!==a||0!==o)}}static getClosestPtOnSegment(e,t,i){if(t.x===i.x&&t.y===i.y)return t;let n=i.x-t.x,r=i.y-t.y,s=((e.x-t.x)*n+(e.y-t.y)*r)/(n*n+r*r);return s<0?s=0:s>1&&(s=1),new Y(t.x+Math.round(s*n),t.y+Math.round(s*r))}static pointInPolygon(e,t){let i=t.length,n=0;if(i<3)return a.IsOutside;for(;ne.y;)h++;if(h===u)continue}let o=t[h],c=h>0?t[h-1]:t[i-1];if(o.y===e.y){if(o.x===e.x||o.y===c.y&&e.xc.x&&e.x>o.x)l=1-l;else{if(0===(r=J.crossProduct(c,o,e)))return a.IsOn;r<0===s&&(l=1-l)}s=!s,h++}if(s!==o){if(h===i?h=0:r=J.crossProduct(t[h-1],t[h],e),0===r)return a.IsOn;r<0===s&&(l=1-l)}return 0===l?a.IsOutside:a.IsInside}}J.MaxInt64=0x7fffffffffffffff,J.MaxCoord=J.MaxInt64/4,J.max_coord=J.MaxCoord,J.min_coord=-J.MaxCoord,J.Invalid64=J.MaxInt64,J.defaultArcTolerance=.25,J.floatingPointTolerance=1e-12,J.defaultMinimumEdgeLength=.1,J.precision_range_error="Error: Precision is out of range."}),r.register("9bB8r",function(t,i){e(t.exports,"compressPoints",()=>n);function n(e){for(let i=0;ir&&(t=e[r],n.x===t.x&&n.y===t.y||function(e,t){let i=t.x-e.x,n=t.y-e.y;return 100>Math.sqrt(i*i+n*n)}(n,e[r])))e.splice(r,1);else break}for(;;){let t=i+1,r=i+2;if(e.length>r&&function(e,t,i){let n=t.x-e.x,r=t.y-e.y,s=i.x-t.x,a=i.y-t.y;return .001>Math.abs(n/r-s/a)}(n,e[t],e[r]))e.splice(i+1,1);else break}}}}),r.register("e5S3P",function(t,i){e(t.exports,"triangleIsInsidePaths",()=>l);var n=r("ilwiq");function s(e,t){t.x=e.x,t.y=e.z}function a(e,t){return 500>=Math.abs(e-t)}function o(e,t){return a(e.x,t.x)&&a(e.y,t.y)&&a(e.z,t.z)}function l(e,t){let i=["a","b","c"],r=[new n.Line3,new n.Line3,new n.Line3],a=new n.Line3,l=new n.Line3;l.start.set(0,0,0).addScaledVector(e.a,1/3).addScaledVector(e.b,1/3).addScaledVector(e.c,1/3),s(l.start,l.start),l.end.copy(l.start),l.end.y+=1e10;for(let t=0;t<3;t++){let n=(t+1)%3,a=e[i[t]],o=e[i[n]],l=r[t];s(a,l.start),s(o,l.end)}let u=0;for(let e=0,i=t.length;e(t.y-e.y)*(i.x-e.x)}let n=e.start,r=e.end,s=t.start,a=t.end;return i(n,s,a)!==i(r,s,a)&&i(n,r,s)!==i(n,r,a)}}),r.register("2lMur",function(t,i){e(t.exports,"getSizeSortedTriList",()=>o);var n=r("ilwiq"),s=r("ahD9r");let a=new n.Triangle;function o(e){let t=e.index,i=e.attributes.position,n=(0,s.getTriCount)(e);return Array(n).fill().map((e,n)=>{let r=3*n+0,s=3*n+1,o=3*n+2;return t&&(r=t.getX(r),s=t.getX(s),o=t.getX(o)),a.a.fromBufferAttribute(i,r),a.b.fromBufferAttribute(i,s),a.c.fromBufferAttribute(i,o),a.a.y=0,a.b.y=0,a.c.y=0,{area:a.getArea(),index:n}}).sort((e,t)=>t.area-e.area).map(e=>e.index)}}),r.register("ahD9r",function(t,i){e(t.exports,"getTriCount",()=>n);function n(e){let{index:t}=e,i=e.attributes.position;return t?t.count/3:i.count/3}}); +//# sourceMappingURL=silhouetteProjection.4adac46b.js.map diff --git a/example/bundle/silhouetteProjection.4adac46b.js.map b/example/bundle/silhouetteProjection.4adac46b.js.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AA,CAAO,EAAE,IAAlB,EAGA,GAAA,CAAK,AAAA,GAGE,EAAE,KAAT,CAIH,C,G,E,Q,C,Q,S,C,C,C,E,E,E,O,C,c,I,GCrDO,SAAS,EAAa,CAAQ,EAEpC,GAAM,CAAA,MAAE,CAAK,CAAE,CAAG,EACZ,EAAU,EAAS,UAAA,CAAW,QAApC,CACA,OAAO,EAAQ,EAAM,KAAA,CAAQ,EAAI,EAAQ,KAAA,CAAQ,CAElD,C","sources":["","node_modules/three/build/three.module.js","node_modules/three/examples/jsm/controls/OrbitControls.js","node_modules/three/examples/jsm/utils/BufferGeometryUtils.js","src/index.js","src/ProjectionGenerator.js","node_modules/three-mesh-bvh/src/core/MeshBVH.js","node_modules/three-mesh-bvh/src/core/Constants.js","node_modules/three-mesh-bvh/src/core/build/buildTree.js","node_modules/three-mesh-bvh/src/core/build/geometryUtils.js","node_modules/three-mesh-bvh/src/core/build/computeBoundsUtils.js","node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js","node_modules/three-mesh-bvh/src/core/build/splitUtils.js","node_modules/three-mesh-bvh/src/core/MeshBVHNode.js","node_modules/three-mesh-bvh/src/core/build/sortUtils.generated.js","node_modules/three-mesh-bvh/src/core/build/sortUtils_indirect.generated.js","node_modules/three-mesh-bvh/src/math/OrientedBox.js","node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js","node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js","node_modules/three-mesh-bvh/src/math/MathUtilities.js","node_modules/three-mesh-bvh/src/utils/ExtendedTrianglePool.js","node_modules/three-mesh-bvh/src/utils/PrimitivePool.js","node_modules/three-mesh-bvh/src/core/cast/shapecast.js","node_modules/three-mesh-bvh/src/core/utils/nodeBufferUtils.js","node_modules/three-mesh-bvh/src/core/utils/BufferStack.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToPoint.js","node_modules/three-mesh-bvh/src/core/utils/iterationUtils.generated.js","node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js","node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js","node_modules/three-mesh-bvh/src/core/cast/refit.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycast.generated.js","node_modules/three-mesh-bvh/src/core/utils/intersectUtils.js","node_modules/three-mesh-bvh/src/core/cast/raycastFirst.generated.js","node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry.generated.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry.generated.js","node_modules/three-mesh-bvh/src/core/cast/bvhcast.generated.js","node_modules/three-mesh-bvh/src/core/utils/iterationUtils_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/refit_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycast_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/raycastFirst_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry_indirect.generated.js","node_modules/three-mesh-bvh/src/core/cast/bvhcast_indirect.generated.js","node_modules/three-mesh-bvh/src/utils/BufferUtils.js","src/utils/triangleLineUtils.js","src/utils/generateEdges.js","src/utils/overlapUtils.js","src/utils/trimToBeneathTriPlane.js","src/utils/getProjectedLineOverlap.js","src/utils/getProjectedOverlaps.js","src/utils/generateIntersectionEdges.js","src/SilhouetteGenerator.js","node_modules/clipper2-js/fesm2015/clipper2-js.mjs","projects/clipper2-js/src/lib/minkowski.ts","projects/clipper2-js/src/lib/offset.ts","projects/clipper2-js/src/lib/rectclip.ts","projects/clipper2-js/src/lib/clipper.ts","projects/clipper2-js/src/lib/engine.ts","projects/clipper2-js/src/lib/core.ts","projects/clipper2-js/src/public-api.ts","projects/clipper2-js/src/clipper2-js.ts","src/utils/compressPoints.js","src/utils/triangleIsInsidePaths.js","src/utils/getSizeSortedTriList.js","src/utils/geometryUtils.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"ilwiq\", function(module, exports) {\n\n$parcel$export(module.exports, \"MOUSE\", () => $d5b33d7c30034067$export$7177b3e430c2d7ca);\n$parcel$export(module.exports, \"TOUCH\", () => $d5b33d7c30034067$export$d46bd3ead7cc759b);\n$parcel$export(module.exports, \"FrontSide\", () => $d5b33d7c30034067$export$2ede184fc2998901);\n$parcel$export(module.exports, \"BackSide\", () => $d5b33d7c30034067$export$d9f0486e75b5ace);\n$parcel$export(module.exports, \"DoubleSide\", () => $d5b33d7c30034067$export$3b296b6f144d5b03);\n$parcel$export(module.exports, \"RepeatWrapping\", () => $d5b33d7c30034067$export$533346c8e8dac0f5);\n$parcel$export(module.exports, \"ClampToEdgeWrapping\", () => $d5b33d7c30034067$export$9d9334239a5a5e06);\n$parcel$export(module.exports, \"MirroredRepeatWrapping\", () => $d5b33d7c30034067$export$c7e7c00b14f51a4f);\n$parcel$export(module.exports, \"NearestFilter\", () => $d5b33d7c30034067$export$727aa5ec3fe39bf0);\n$parcel$export(module.exports, \"NearestMipmapNearestFilter\", () => $d5b33d7c30034067$export$d129e38cf6feaa8c);\n$parcel$export(module.exports, \"NearestMipmapLinearFilter\", () => $d5b33d7c30034067$export$d2327c1afe5bfdf2);\n$parcel$export(module.exports, \"LinearFilter\", () => $d5b33d7c30034067$export$8a72f490b25c56c8);\n$parcel$export(module.exports, \"LinearMipmapNearestFilter\", () => $d5b33d7c30034067$export$19a719f377145a13);\n$parcel$export(module.exports, \"LinearMipmapLinearFilter\", () => $d5b33d7c30034067$export$5d8599b6a933fb1b);\n$parcel$export(module.exports, \"InterpolateDiscrete\", () => $d5b33d7c30034067$export$995b32462a65e855);\n$parcel$export(module.exports, \"InterpolateLinear\", () => $d5b33d7c30034067$export$30fac1aace31cf4d);\n$parcel$export(module.exports, \"TrianglesDrawMode\", () => $d5b33d7c30034067$export$4c28c87c2dc84758);\n$parcel$export(module.exports, \"TriangleStripDrawMode\", () => $d5b33d7c30034067$export$b23a071aa286eb29);\n$parcel$export(module.exports, \"TriangleFanDrawMode\", () => $d5b33d7c30034067$export$f0d8293634f88842);\n$parcel$export(module.exports, \"SRGBColorSpace\", () => $d5b33d7c30034067$export$561f394b24edfcaa);\n$parcel$export(module.exports, \"EventDispatcher\", () => $d5b33d7c30034067$export$ec8b666c5fe2c75a);\n$parcel$export(module.exports, \"MathUtils\", () => $d5b33d7c30034067$export$6a7ef315a0d1ef07);\n$parcel$export(module.exports, \"Vector2\", () => $d5b33d7c30034067$export$c977b3e384af9ae1);\n$parcel$export(module.exports, \"Texture\", () => $d5b33d7c30034067$export$5431306cf43de24a);\n$parcel$export(module.exports, \"Quaternion\", () => $d5b33d7c30034067$export$23d6a54f0bbc85a3);\n$parcel$export(module.exports, \"Vector3\", () => $d5b33d7c30034067$export$64b5c384219d3699);\n$parcel$export(module.exports, \"Box3\", () => $d5b33d7c30034067$export$6f7d5a9418ab2aa3);\n$parcel$export(module.exports, \"Sphere\", () => $d5b33d7c30034067$export$805e8b72413ccaba);\n$parcel$export(module.exports, \"Ray\", () => $d5b33d7c30034067$export$a186db52eed6d40e);\n$parcel$export(module.exports, \"Matrix4\", () => $d5b33d7c30034067$export$2ae72fc923e5eb5);\n$parcel$export(module.exports, \"Object3D\", () => $d5b33d7c30034067$export$e4dd07dff30cc924);\n$parcel$export(module.exports, \"Triangle\", () => $d5b33d7c30034067$export$5a465592bfe74b48);\n$parcel$export(module.exports, \"Material\", () => $d5b33d7c30034067$export$a2d8b23205c25948);\n$parcel$export(module.exports, \"Color\", () => $d5b33d7c30034067$export$892596cec99bc70e);\n$parcel$export(module.exports, \"MeshBasicMaterial\", () => $d5b33d7c30034067$export$55cbcc9b622fe1f5);\n$parcel$export(module.exports, \"BufferAttribute\", () => $d5b33d7c30034067$export$8dea267bd6bde117);\n$parcel$export(module.exports, \"Float32BufferAttribute\", () => $d5b33d7c30034067$export$cbe7a62641830ebd);\n$parcel$export(module.exports, \"BufferGeometry\", () => $d5b33d7c30034067$export$b7be63a67df8959);\n$parcel$export(module.exports, \"Mesh\", () => $d5b33d7c30034067$export$e176487c05830cc5);\n$parcel$export(module.exports, \"PerspectiveCamera\", () => $d5b33d7c30034067$export$74e4ae24825f68d7);\n$parcel$export(module.exports, \"Plane\", () => $d5b33d7c30034067$export$7ff5ac152ef991b0);\n$parcel$export(module.exports, \"OrthographicCamera\", () => $d5b33d7c30034067$export$9ebf355ee4ed261b);\n$parcel$export(module.exports, \"Group\", () => $d5b33d7c30034067$export$eb2fcfdbd7ba97d4);\n$parcel$export(module.exports, \"WebGLRenderer\", () => $d5b33d7c30034067$export$f6cc00ef28d7cf97);\n$parcel$export(module.exports, \"Scene\", () => $d5b33d7c30034067$export$38af1803e3442a7f);\n$parcel$export(module.exports, \"InterleavedBuffer\", () => $d5b33d7c30034067$export$3d5cd879f108f53f);\n$parcel$export(module.exports, \"InterleavedBufferAttribute\", () => $d5b33d7c30034067$export$920b6d07334599c7);\n$parcel$export(module.exports, \"SkinnedMesh\", () => $d5b33d7c30034067$export$b303577035157ecf);\n$parcel$export(module.exports, \"Bone\", () => $d5b33d7c30034067$export$b127726e56765aa4);\n$parcel$export(module.exports, \"Skeleton\", () => $d5b33d7c30034067$export$8f31e4c4a37b8e9c);\n$parcel$export(module.exports, \"InstancedBufferAttribute\", () => $d5b33d7c30034067$export$32ea87a8b54d744a);\n$parcel$export(module.exports, \"InstancedMesh\", () => $d5b33d7c30034067$export$f3c979c331175ad7);\n$parcel$export(module.exports, \"LineBasicMaterial\", () => $d5b33d7c30034067$export$fbaaa33907730a0c);\n$parcel$export(module.exports, \"Line\", () => $d5b33d7c30034067$export$17d680238e50603e);\n$parcel$export(module.exports, \"LineSegments\", () => $d5b33d7c30034067$export$ff1ed10fedfdd604);\n$parcel$export(module.exports, \"LineLoop\", () => $d5b33d7c30034067$export$f85a24d745e4f17d);\n$parcel$export(module.exports, \"PointsMaterial\", () => $d5b33d7c30034067$export$a178c45366ce5d6b);\n$parcel$export(module.exports, \"Points\", () => $d5b33d7c30034067$export$1c787534cb11aa3e);\n$parcel$export(module.exports, \"Shape\", () => $d5b33d7c30034067$export$6428a7f2611ef1fa);\n$parcel$export(module.exports, \"ShapeUtils\", () => $d5b33d7c30034067$export$96bdf6d9c66d7ba8);\n$parcel$export(module.exports, \"ShapeGeometry\", () => $d5b33d7c30034067$export$57a29a1c803e9065);\n$parcel$export(module.exports, \"TorusKnotGeometry\", () => $d5b33d7c30034067$export$77e9bfadfb9ab8c8);\n$parcel$export(module.exports, \"MeshStandardMaterial\", () => $d5b33d7c30034067$export$f2980790215acccd);\n$parcel$export(module.exports, \"MeshPhysicalMaterial\", () => $d5b33d7c30034067$export$28d04986c4269c9f);\n$parcel$export(module.exports, \"Interpolant\", () => $d5b33d7c30034067$export$b558baee9c0f72d3);\n$parcel$export(module.exports, \"NumberKeyframeTrack\", () => $d5b33d7c30034067$export$d45f0d1a4d9a9314);\n$parcel$export(module.exports, \"QuaternionKeyframeTrack\", () => $d5b33d7c30034067$export$b8043f12b5aafbd7);\n$parcel$export(module.exports, \"VectorKeyframeTrack\", () => $d5b33d7c30034067$export$5ce2dcb4cc9f2bff);\n$parcel$export(module.exports, \"AnimationClip\", () => $d5b33d7c30034067$export$d942c706bf23829c);\n$parcel$export(module.exports, \"Loader\", () => $d5b33d7c30034067$export$3b0d6d7590275603);\n$parcel$export(module.exports, \"FileLoader\", () => $d5b33d7c30034067$export$98435a25b5cf7b2b);\n$parcel$export(module.exports, \"TextureLoader\", () => $d5b33d7c30034067$export$fd1bfc71f64c538c);\n$parcel$export(module.exports, \"SpotLight\", () => $d5b33d7c30034067$export$81495cbb73897362);\n$parcel$export(module.exports, \"PointLight\", () => $d5b33d7c30034067$export$4c9c1cb3f0b6f455);\n$parcel$export(module.exports, \"DirectionalLight\", () => $d5b33d7c30034067$export$3fea33cc9972c868);\n$parcel$export(module.exports, \"AmbientLight\", () => $d5b33d7c30034067$export$af279bfef9ec2c96);\n$parcel$export(module.exports, \"LoaderUtils\", () => $d5b33d7c30034067$export$b5d2dc08d867e41a);\n$parcel$export(module.exports, \"ImageBitmapLoader\", () => $d5b33d7c30034067$export$52286b55c4a9b51f);\n$parcel$export(module.exports, \"PropertyBinding\", () => $d5b33d7c30034067$export$7bf70fcf9f891893);\n$parcel$export(module.exports, \"Spherical\", () => $d5b33d7c30034067$export$d712cd887b4a00f7);\n$parcel$export(module.exports, \"Line3\", () => $d5b33d7c30034067$export$e0ba6359f1954fd3);\n/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */ const $d5b33d7c30034067$export$3545e07a80636437 = \"155\";\nconst $d5b33d7c30034067$export$7177b3e430c2d7ca = {\n LEFT: 0,\n MIDDLE: 1,\n RIGHT: 2,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2\n};\nconst $d5b33d7c30034067$export$d46bd3ead7cc759b = {\n ROTATE: 0,\n PAN: 1,\n DOLLY_PAN: 2,\n DOLLY_ROTATE: 3\n};\nconst $d5b33d7c30034067$export$3237e1f2c1ea1f44 = 0;\nconst $d5b33d7c30034067$export$b9a7b4fc5cb15f9b = 1;\nconst $d5b33d7c30034067$export$b8058bcc7037d3f3 = 2;\nconst $d5b33d7c30034067$export$f24be24dcddeac0d = 3;\nconst $d5b33d7c30034067$export$346307dbae2b7447 = 0;\nconst $d5b33d7c30034067$export$5813f879eee7cd88 = 1;\nconst $d5b33d7c30034067$export$a47c4b43a1be34f0 = 2;\nconst $d5b33d7c30034067$export$896ae1ade6c829c4 = 3;\nconst $d5b33d7c30034067$export$2ede184fc2998901 = 0;\nconst $d5b33d7c30034067$export$d9f0486e75b5ace = 1;\nconst $d5b33d7c30034067$export$3b296b6f144d5b03 = 2;\nconst $d5b33d7c30034067$export$211211c00f97204d = 2; // r149\nconst $d5b33d7c30034067$export$63b8d6b580fc65ba = 0;\nconst $d5b33d7c30034067$export$5b29a26d96ee6af0 = 1;\nconst $d5b33d7c30034067$export$777d8f9551c2216b = 2;\nconst $d5b33d7c30034067$export$cdfa06f868e2e467 = 3;\nconst $d5b33d7c30034067$export$4138e1c684b46a20 = 4;\nconst $d5b33d7c30034067$export$eda4864c68df1fa2 = 5;\nconst $d5b33d7c30034067$export$20183a0484ce21a0 = 100;\nconst $d5b33d7c30034067$export$73e0df5177988548 = 101;\nconst $d5b33d7c30034067$export$28e582859cbec660 = 102;\nconst $d5b33d7c30034067$export$c8c1508da8d0600c = 103;\nconst $d5b33d7c30034067$export$99948c02fb51055f = 104;\nconst $d5b33d7c30034067$export$2110f05edf778d3d = 200;\nconst $d5b33d7c30034067$export$8805bad65e24940e = 201;\nconst $d5b33d7c30034067$export$7fbe15b28d28cf52 = 202;\nconst $d5b33d7c30034067$export$947829af9f2c17f6 = 203;\nconst $d5b33d7c30034067$export$d5773124e86cf28c = 204;\nconst $d5b33d7c30034067$export$11d468cc7f19e971 = 205;\nconst $d5b33d7c30034067$export$a78aed1ca2a87192 = 206;\nconst $d5b33d7c30034067$export$5d0fe17fd8773bac = 207;\nconst $d5b33d7c30034067$export$ef5f2dd8ffac5574 = 208;\nconst $d5b33d7c30034067$export$56b85b2686ab16 = 209;\nconst $d5b33d7c30034067$export$c05e2a1fc8609506 = 210;\nconst $d5b33d7c30034067$export$69025ce147cee220 = 0;\nconst $d5b33d7c30034067$export$7182eb52ea3b3f04 = 1;\nconst $d5b33d7c30034067$export$eedccec66ab7ebe = 2;\nconst $d5b33d7c30034067$export$296f78a0b892f81a = 3;\nconst $d5b33d7c30034067$export$a60d398fc7b7590e = 4;\nconst $d5b33d7c30034067$export$7d7234c1240a1fc4 = 5;\nconst $d5b33d7c30034067$export$c5e2c52991f30937 = 6;\nconst $d5b33d7c30034067$export$2f843afa843d8916 = 7;\nconst $d5b33d7c30034067$export$e50ac29801f1774d = 0;\nconst $d5b33d7c30034067$export$9f9d94f963c85479 = 1;\nconst $d5b33d7c30034067$export$e641dc52bc3494aa = 2;\nconst $d5b33d7c30034067$export$9fcb6b4294603b2 = 0;\nconst $d5b33d7c30034067$export$98f52c2a46c598ca = 1;\nconst $d5b33d7c30034067$export$74b25e54b3bcd548 = 2;\nconst $d5b33d7c30034067$export$932b3dd283d4a366 = 3;\nconst $d5b33d7c30034067$export$a0d98fe6d7e4af64 = 4;\nconst $d5b33d7c30034067$export$2c7b09c1e9abfb5e = 5;\nconst $d5b33d7c30034067$export$1beec6768cbb3d2d = 300;\nconst $d5b33d7c30034067$export$8759762a6477f2c4 = 301;\nconst $d5b33d7c30034067$export$dc59f8aed047f61d = 302;\nconst $d5b33d7c30034067$export$d64030b316d3b087 = 303;\nconst $d5b33d7c30034067$export$ee99d97d46898098 = 304;\nconst $d5b33d7c30034067$export$dbf3e70ff37af79 = 306;\nconst $d5b33d7c30034067$export$533346c8e8dac0f5 = 1000;\nconst $d5b33d7c30034067$export$9d9334239a5a5e06 = 1001;\nconst $d5b33d7c30034067$export$c7e7c00b14f51a4f = 1002;\nconst $d5b33d7c30034067$export$727aa5ec3fe39bf0 = 1003;\nconst $d5b33d7c30034067$export$d129e38cf6feaa8c = 1004;\nconst $d5b33d7c30034067$export$14a4936464a36496 = 1004;\nconst $d5b33d7c30034067$export$d2327c1afe5bfdf2 = 1005;\nconst $d5b33d7c30034067$export$cbc5b7f5647595d8 = 1005;\nconst $d5b33d7c30034067$export$8a72f490b25c56c8 = 1006;\nconst $d5b33d7c30034067$export$19a719f377145a13 = 1007;\nconst $d5b33d7c30034067$export$dbe96bee3fe9dbf0 = 1007;\nconst $d5b33d7c30034067$export$5d8599b6a933fb1b = 1008;\nconst $d5b33d7c30034067$export$90d80f1e3506775f = 1008;\nconst $d5b33d7c30034067$export$2e8ce08d3f6f5e10 = 1009;\nconst $d5b33d7c30034067$export$545fce0311a9796a = 1010;\nconst $d5b33d7c30034067$export$88572337f312435f = 1011;\nconst $d5b33d7c30034067$export$c63dc51868b06a9d = 1012;\nconst $d5b33d7c30034067$export$5c612977753abe2 = 1013;\nconst $d5b33d7c30034067$export$c3c7fc4518ebba96 = 1014;\nconst $d5b33d7c30034067$export$f6d331659b644596 = 1015;\nconst $d5b33d7c30034067$export$2697304443f382bc = 1016;\nconst $d5b33d7c30034067$export$b3969b01faf587f2 = 1017;\nconst $d5b33d7c30034067$export$18886f8ae33e90de = 1018;\nconst $d5b33d7c30034067$export$6c8ea339bfab1301 = 1020;\nconst $d5b33d7c30034067$export$988473390501ed4b = 1021;\nconst $d5b33d7c30034067$export$3f8bb04b555a363c = 1023;\nconst $d5b33d7c30034067$export$cc09ccbf6d1ed449 = 1024;\nconst $d5b33d7c30034067$export$9053a81c4a69c289 = 1025;\nconst $d5b33d7c30034067$export$c1b6b5136be58045 = 1026;\nconst $d5b33d7c30034067$export$1e113ac2d0905829 = 1027;\nconst $d5b33d7c30034067$export$4e041a7967d15c4b = 1028;\nconst $d5b33d7c30034067$export$aa92e870a709d190 = 1029;\nconst $d5b33d7c30034067$export$6cdf0b461c7ce8a0 = 1030;\nconst $d5b33d7c30034067$export$1ba1c45f9f77d4d7 = 1031;\nconst $d5b33d7c30034067$export$c200e7d26f592f21 = 1033;\nconst $d5b33d7c30034067$export$21d1799c6d552fc0 = 33776;\nconst $d5b33d7c30034067$export$afa304c3e981b668 = 33777;\nconst $d5b33d7c30034067$export$d2a1a68024a3e56c = 33778;\nconst $d5b33d7c30034067$export$9a79c424327dacf9 = 33779;\nconst $d5b33d7c30034067$export$19ada9bbb1af3573 = 35840;\nconst $d5b33d7c30034067$export$d0f0355bb3d948e4 = 35841;\nconst $d5b33d7c30034067$export$b82296714358084c = 35842;\nconst $d5b33d7c30034067$export$b71692456c47b6c3 = 35843;\nconst $d5b33d7c30034067$export$6ab91af2d757aee7 = 36196;\nconst $d5b33d7c30034067$export$7800993ef8106a6a = 37492;\nconst $d5b33d7c30034067$export$23ed8300a860e7d8 = 37496;\nconst $d5b33d7c30034067$export$dc5570b4a2b92d48 = 37808;\nconst $d5b33d7c30034067$export$68880cd325f8b2fb = 37809;\nconst $d5b33d7c30034067$export$7d2c0be323373d95 = 37810;\nconst $d5b33d7c30034067$export$22b52da301fc3a3e = 37811;\nconst $d5b33d7c30034067$export$c009e2cb4a66485e = 37812;\nconst $d5b33d7c30034067$export$118fff5afa255b63 = 37813;\nconst $d5b33d7c30034067$export$120713c829ae0667 = 37814;\nconst $d5b33d7c30034067$export$c79eeabbf53313e9 = 37815;\nconst $d5b33d7c30034067$export$443cf6567cdd6424 = 37816;\nconst $d5b33d7c30034067$export$6573984fc9840780 = 37817;\nconst $d5b33d7c30034067$export$e7aee563f30091de = 37818;\nconst $d5b33d7c30034067$export$2eb8634622ddeab7 = 37819;\nconst $d5b33d7c30034067$export$202b1ce7b5d25742 = 37820;\nconst $d5b33d7c30034067$export$18ab77abd087e467 = 37821;\nconst $d5b33d7c30034067$export$ce40b115e188bc81 = 36492;\nconst $d5b33d7c30034067$export$b1688df4c4c21670 = 36283;\nconst $d5b33d7c30034067$export$fc15e5d8261eed58 = 36284;\nconst $d5b33d7c30034067$export$d220f6ade8463a0f = 36285;\nconst $d5b33d7c30034067$export$768646d09dc1b6ef = 36286;\nconst $d5b33d7c30034067$export$d62fdc9d1b1cccad = 2200;\nconst $d5b33d7c30034067$export$dfaf4422ce096e29 = 2201;\nconst $d5b33d7c30034067$export$f8f6f2041b78e210 = 2202;\nconst $d5b33d7c30034067$export$995b32462a65e855 = 2300;\nconst $d5b33d7c30034067$export$30fac1aace31cf4d = 2301;\nconst $d5b33d7c30034067$export$198b11ff4c72bb30 = 2302;\nconst $d5b33d7c30034067$export$7f795934b84ab523 = 2400;\nconst $d5b33d7c30034067$export$24a4ccb5099273b5 = 2401;\nconst $d5b33d7c30034067$export$8e8c3ecdcd8e1fee = 2402;\nconst $d5b33d7c30034067$export$bcfbbdcf8de7f8cd = 2500;\nconst $d5b33d7c30034067$export$d875e029ef558d3 = 2501;\nconst $d5b33d7c30034067$export$4c28c87c2dc84758 = 0;\nconst $d5b33d7c30034067$export$b23a071aa286eb29 = 1;\nconst $d5b33d7c30034067$export$f0d8293634f88842 = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */ const $d5b33d7c30034067$export$7207336e4151a112 = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */ const $d5b33d7c30034067$export$f32388edbb32674 = 3001;\nconst $d5b33d7c30034067$export$deeb383078690b50 = 3200;\nconst $d5b33d7c30034067$export$8f910f4c4f73df11 = 3201;\nconst $d5b33d7c30034067$export$2852a58ebdac27b8 = 0;\nconst $d5b33d7c30034067$export$9990ad26f9db5b2c = 1;\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst $d5b33d7c30034067$export$bfcb490c2dd3db51 = \"\";\nconst $d5b33d7c30034067$export$561f394b24edfcaa = \"srgb\";\nconst $d5b33d7c30034067$export$42429b3acfb233a4 = \"srgb-linear\";\nconst $d5b33d7c30034067$export$626af19ae879bdf6 = \"display-p3\";\nconst $d5b33d7c30034067$export$69433f11f42d5527 = 0;\nconst $d5b33d7c30034067$export$9f542ae4b5baca34 = 7680;\nconst $d5b33d7c30034067$export$8a4f28336ef203d3 = 7681;\nconst $d5b33d7c30034067$export$2928c0231297c036 = 7682;\nconst $d5b33d7c30034067$export$c0e9611c8a15f9a8 = 7683;\nconst $d5b33d7c30034067$export$9c2c08927385dcc4 = 34055;\nconst $d5b33d7c30034067$export$7c74ea00fa1315e6 = 34056;\nconst $d5b33d7c30034067$export$22e2e5726612443 = 5386;\nconst $d5b33d7c30034067$export$1343870698229224 = 512;\nconst $d5b33d7c30034067$export$8e1d8ed281997fa6 = 513;\nconst $d5b33d7c30034067$export$55648a1cde8329a7 = 514;\nconst $d5b33d7c30034067$export$2dff107857e6aca2 = 515;\nconst $d5b33d7c30034067$export$6f93765ab2f451a2 = 516;\nconst $d5b33d7c30034067$export$6f3fb2d2440f2b76 = 517;\nconst $d5b33d7c30034067$export$4119cf7b4c98fd5a = 518;\nconst $d5b33d7c30034067$export$14cf96713ddd97a8 = 519;\nconst $d5b33d7c30034067$export$d9e2d19a747baaab = 512;\nconst $d5b33d7c30034067$export$36bcf49c713b3eb7 = 513;\nconst $d5b33d7c30034067$export$66f28d946fc6a0d5 = 514;\nconst $d5b33d7c30034067$export$64eea11eb407ddf1 = 515;\nconst $d5b33d7c30034067$export$155af022118f3a38 = 516;\nconst $d5b33d7c30034067$export$67ab95dde6bed156 = 517;\nconst $d5b33d7c30034067$export$1cdcb70d53d65f61 = 518;\nconst $d5b33d7c30034067$export$187b73a3e352c145 = 519;\nconst $d5b33d7c30034067$export$763e8360f4d7f77d = 35044;\nconst $d5b33d7c30034067$export$8505d14ac8546ca = 35048;\nconst $d5b33d7c30034067$export$721e63549e51d81e = 35040;\nconst $d5b33d7c30034067$export$415731dc4f48e299 = 35045;\nconst $d5b33d7c30034067$export$9e809946455f13bc = 35049;\nconst $d5b33d7c30034067$export$2ed9499a35b5f832 = 35041;\nconst $d5b33d7c30034067$export$32ab2503ea19469a = 35046;\nconst $d5b33d7c30034067$export$ab4022c2c3f86315 = 35050;\nconst $d5b33d7c30034067$export$ba7f1db36a76a970 = 35042;\nconst $d5b33d7c30034067$export$43600cc67fabd9f = \"100\";\nconst $d5b33d7c30034067$export$f63012db5506e7dd = \"300 es\";\nconst $d5b33d7c30034067$export$ca1dce8b5e1de74d = 1035; // fallback for WebGL 1\nconst $d5b33d7c30034067$export$5a0e9190d10875d3 = 2000;\nconst $d5b33d7c30034067$export$cc83beedcb9be9ac = 2001;\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */ class $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n addEventListener(type, listener) {\n if (this._listeners === undefined) this._listeners = {};\n const listeners = this._listeners;\n if (listeners[type] === undefined) listeners[type] = [];\n if (listeners[type].indexOf(listener) === -1) listeners[type].push(listener);\n }\n hasEventListener(type, listener) {\n if (this._listeners === undefined) return false;\n const listeners = this._listeners;\n return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;\n }\n removeEventListener(type, listener) {\n if (this._listeners === undefined) return;\n const listeners = this._listeners;\n const listenerArray = listeners[type];\n if (listenerArray !== undefined) {\n const index = listenerArray.indexOf(listener);\n if (index !== -1) listenerArray.splice(index, 1);\n }\n }\n dispatchEvent(event) {\n if (this._listeners === undefined) return;\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n if (listenerArray !== undefined) {\n event.target = this;\n // Make a copy, in case listeners are removed while iterating.\n const array = listenerArray.slice(0);\n for(let i = 0, l = array.length; i < l; i++)array[i].call(this, event);\n event.target = null;\n }\n }\n}\nconst $d5b33d7c30034067$var$_lut = [\n \"00\",\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n \"0a\",\n \"0b\",\n \"0c\",\n \"0d\",\n \"0e\",\n \"0f\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\",\n \"1a\",\n \"1b\",\n \"1c\",\n \"1d\",\n \"1e\",\n \"1f\",\n \"20\",\n \"21\",\n \"22\",\n \"23\",\n \"24\",\n \"25\",\n \"26\",\n \"27\",\n \"28\",\n \"29\",\n \"2a\",\n \"2b\",\n \"2c\",\n \"2d\",\n \"2e\",\n \"2f\",\n \"30\",\n \"31\",\n \"32\",\n \"33\",\n \"34\",\n \"35\",\n \"36\",\n \"37\",\n \"38\",\n \"39\",\n \"3a\",\n \"3b\",\n \"3c\",\n \"3d\",\n \"3e\",\n \"3f\",\n \"40\",\n \"41\",\n \"42\",\n \"43\",\n \"44\",\n \"45\",\n \"46\",\n \"47\",\n \"48\",\n \"49\",\n \"4a\",\n \"4b\",\n \"4c\",\n \"4d\",\n \"4e\",\n \"4f\",\n \"50\",\n \"51\",\n \"52\",\n \"53\",\n \"54\",\n \"55\",\n \"56\",\n \"57\",\n \"58\",\n \"59\",\n \"5a\",\n \"5b\",\n \"5c\",\n \"5d\",\n \"5e\",\n \"5f\",\n \"60\",\n \"61\",\n \"62\",\n \"63\",\n \"64\",\n \"65\",\n \"66\",\n \"67\",\n \"68\",\n \"69\",\n \"6a\",\n \"6b\",\n \"6c\",\n \"6d\",\n \"6e\",\n \"6f\",\n \"70\",\n \"71\",\n \"72\",\n \"73\",\n \"74\",\n \"75\",\n \"76\",\n \"77\",\n \"78\",\n \"79\",\n \"7a\",\n \"7b\",\n \"7c\",\n \"7d\",\n \"7e\",\n \"7f\",\n \"80\",\n \"81\",\n \"82\",\n \"83\",\n \"84\",\n \"85\",\n \"86\",\n \"87\",\n \"88\",\n \"89\",\n \"8a\",\n \"8b\",\n \"8c\",\n \"8d\",\n \"8e\",\n \"8f\",\n \"90\",\n \"91\",\n \"92\",\n \"93\",\n \"94\",\n \"95\",\n \"96\",\n \"97\",\n \"98\",\n \"99\",\n \"9a\",\n \"9b\",\n \"9c\",\n \"9d\",\n \"9e\",\n \"9f\",\n \"a0\",\n \"a1\",\n \"a2\",\n \"a3\",\n \"a4\",\n \"a5\",\n \"a6\",\n \"a7\",\n \"a8\",\n \"a9\",\n \"aa\",\n \"ab\",\n \"ac\",\n \"ad\",\n \"ae\",\n \"af\",\n \"b0\",\n \"b1\",\n \"b2\",\n \"b3\",\n \"b4\",\n \"b5\",\n \"b6\",\n \"b7\",\n \"b8\",\n \"b9\",\n \"ba\",\n \"bb\",\n \"bc\",\n \"bd\",\n \"be\",\n \"bf\",\n \"c0\",\n \"c1\",\n \"c2\",\n \"c3\",\n \"c4\",\n \"c5\",\n \"c6\",\n \"c7\",\n \"c8\",\n \"c9\",\n \"ca\",\n \"cb\",\n \"cc\",\n \"cd\",\n \"ce\",\n \"cf\",\n \"d0\",\n \"d1\",\n \"d2\",\n \"d3\",\n \"d4\",\n \"d5\",\n \"d6\",\n \"d7\",\n \"d8\",\n \"d9\",\n \"da\",\n \"db\",\n \"dc\",\n \"dd\",\n \"de\",\n \"df\",\n \"e0\",\n \"e1\",\n \"e2\",\n \"e3\",\n \"e4\",\n \"e5\",\n \"e6\",\n \"e7\",\n \"e8\",\n \"e9\",\n \"ea\",\n \"eb\",\n \"ec\",\n \"ed\",\n \"ee\",\n \"ef\",\n \"f0\",\n \"f1\",\n \"f2\",\n \"f3\",\n \"f4\",\n \"f5\",\n \"f6\",\n \"f7\",\n \"f8\",\n \"f9\",\n \"fa\",\n \"fb\",\n \"fc\",\n \"fd\",\n \"fe\",\n \"ff\"\n];\nlet $d5b33d7c30034067$var$_seed = 1234567;\nconst $d5b33d7c30034067$var$DEG2RAD = Math.PI / 180;\nconst $d5b33d7c30034067$var$RAD2DEG = 180 / Math.PI;\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction $d5b33d7c30034067$var$generateUUID() {\n const d0 = Math.random() * 0xffffffff | 0;\n const d1 = Math.random() * 0xffffffff | 0;\n const d2 = Math.random() * 0xffffffff | 0;\n const d3 = Math.random() * 0xffffffff | 0;\n const uuid = $d5b33d7c30034067$var$_lut[d0 & 0xff] + $d5b33d7c30034067$var$_lut[d0 >> 8 & 0xff] + $d5b33d7c30034067$var$_lut[d0 >> 16 & 0xff] + $d5b33d7c30034067$var$_lut[d0 >> 24 & 0xff] + \"-\" + $d5b33d7c30034067$var$_lut[d1 & 0xff] + $d5b33d7c30034067$var$_lut[d1 >> 8 & 0xff] + \"-\" + $d5b33d7c30034067$var$_lut[d1 >> 16 & 0x0f | 0x40] + $d5b33d7c30034067$var$_lut[d1 >> 24 & 0xff] + \"-\" + $d5b33d7c30034067$var$_lut[d2 & 0x3f | 0x80] + $d5b33d7c30034067$var$_lut[d2 >> 8 & 0xff] + \"-\" + $d5b33d7c30034067$var$_lut[d2 >> 16 & 0xff] + $d5b33d7c30034067$var$_lut[d2 >> 24 & 0xff] + $d5b33d7c30034067$var$_lut[d3 & 0xff] + $d5b33d7c30034067$var$_lut[d3 >> 8 & 0xff] + $d5b33d7c30034067$var$_lut[d3 >> 16 & 0xff] + $d5b33d7c30034067$var$_lut[d3 >> 24 & 0xff];\n // .toLowerCase() here flattens concatenated strings to save heap memory space.\n return uuid.toLowerCase();\n}\nfunction $d5b33d7c30034067$var$clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction $d5b33d7c30034067$var$euclideanModulo(n, m) {\n return (n % m + m) % m;\n}\n// Linear mapping from range to range \nfunction $d5b33d7c30034067$var$mapLinear(x, a1, a2, b1, b2) {\n return b1 + (x - a1) * (b2 - b1) / (a2 - a1);\n}\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction $d5b33d7c30034067$var$inverseLerp(x, y, value) {\n if (x !== y) return (value - x) / (y - x);\n else return 0;\n}\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction $d5b33d7c30034067$var$lerp(x, y, t) {\n return (1 - t) * x + t * y;\n}\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction $d5b33d7c30034067$var$damp(x, y, lambda, dt) {\n return $d5b33d7c30034067$var$lerp(x, y, 1 - Math.exp(-lambda * dt));\n}\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction $d5b33d7c30034067$var$pingpong(x, length = 1) {\n return length - Math.abs($d5b33d7c30034067$var$euclideanModulo(x, length * 2) - length);\n}\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction $d5b33d7c30034067$var$smoothstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * (3 - 2 * x);\n}\nfunction $d5b33d7c30034067$var$smootherstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * x * (x * (x * 6 - 15) + 10);\n}\n// Random integer from interval\nfunction $d5b33d7c30034067$var$randInt(low, high) {\n return low + Math.floor(Math.random() * (high - low + 1));\n}\n// Random float from interval\nfunction $d5b33d7c30034067$var$randFloat(low, high) {\n return low + Math.random() * (high - low);\n}\n// Random float from <-range/2, range/2> interval\nfunction $d5b33d7c30034067$var$randFloatSpread(range) {\n return range * (0.5 - Math.random());\n}\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction $d5b33d7c30034067$var$seededRandom(s) {\n if (s !== undefined) $d5b33d7c30034067$var$_seed = s;\n // Mulberry32 generator\n let t = $d5b33d7c30034067$var$_seed += 0x6D2B79F5;\n t = Math.imul(t ^ t >>> 15, t | 1);\n t ^= t + Math.imul(t ^ t >>> 7, t | 61);\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n}\nfunction $d5b33d7c30034067$var$degToRad(degrees) {\n return degrees * $d5b33d7c30034067$var$DEG2RAD;\n}\nfunction $d5b33d7c30034067$var$radToDeg(radians) {\n return radians * $d5b33d7c30034067$var$RAD2DEG;\n}\nfunction $d5b33d7c30034067$var$isPowerOfTwo(value) {\n return (value & value - 1) === 0 && value !== 0;\n}\nfunction $d5b33d7c30034067$var$ceilPowerOfTwo(value) {\n return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));\n}\nfunction $d5b33d7c30034067$var$floorPowerOfTwo(value) {\n return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));\n}\nfunction $d5b33d7c30034067$var$setQuaternionFromProperEuler(q, a, b, c, order) {\n // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n // rotations are applied to the axes in the order specified by 'order'\n // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n // angles are in radians\n const cos = Math.cos;\n const sin = Math.sin;\n const c2 = cos(b / 2);\n const s2 = sin(b / 2);\n const c13 = cos((a + c) / 2);\n const s13 = sin((a + c) / 2);\n const c1_3 = cos((a - c) / 2);\n const s1_3 = sin((a - c) / 2);\n const c3_1 = cos((c - a) / 2);\n const s3_1 = sin((c - a) / 2);\n switch(order){\n case \"XYX\":\n q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);\n break;\n case \"YZY\":\n q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);\n break;\n case \"ZXZ\":\n q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);\n break;\n case \"XZX\":\n q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);\n break;\n case \"YXY\":\n q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);\n break;\n case \"ZYZ\":\n q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);\n break;\n default:\n console.warn(\"THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \" + order);\n }\n}\nfunction $d5b33d7c30034067$var$denormalize(value, array) {\n switch(array.constructor){\n case Float32Array:\n return value;\n case Uint32Array:\n return value / 4294967295.0;\n case Uint16Array:\n return value / 65535.0;\n case Uint8Array:\n return value / 255.0;\n case Int32Array:\n return Math.max(value / 2147483647.0, -1);\n case Int16Array:\n return Math.max(value / 32767.0, -1);\n case Int8Array:\n return Math.max(value / 127.0, -1);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nfunction $d5b33d7c30034067$var$normalize(value, array) {\n switch(array.constructor){\n case Float32Array:\n return value;\n case Uint32Array:\n return Math.round(value * 4294967295.0);\n case Uint16Array:\n return Math.round(value * 65535.0);\n case Uint8Array:\n return Math.round(value * 255.0);\n case Int32Array:\n return Math.round(value * 2147483647.0);\n case Int16Array:\n return Math.round(value * 32767.0);\n case Int8Array:\n return Math.round(value * 127.0);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nconst $d5b33d7c30034067$export$6a7ef315a0d1ef07 = {\n DEG2RAD: $d5b33d7c30034067$var$DEG2RAD,\n RAD2DEG: $d5b33d7c30034067$var$RAD2DEG,\n generateUUID: $d5b33d7c30034067$var$generateUUID,\n clamp: $d5b33d7c30034067$var$clamp,\n euclideanModulo: $d5b33d7c30034067$var$euclideanModulo,\n mapLinear: $d5b33d7c30034067$var$mapLinear,\n inverseLerp: $d5b33d7c30034067$var$inverseLerp,\n lerp: $d5b33d7c30034067$var$lerp,\n damp: $d5b33d7c30034067$var$damp,\n pingpong: $d5b33d7c30034067$var$pingpong,\n smoothstep: $d5b33d7c30034067$var$smoothstep,\n smootherstep: $d5b33d7c30034067$var$smootherstep,\n randInt: $d5b33d7c30034067$var$randInt,\n randFloat: $d5b33d7c30034067$var$randFloat,\n randFloatSpread: $d5b33d7c30034067$var$randFloatSpread,\n seededRandom: $d5b33d7c30034067$var$seededRandom,\n degToRad: $d5b33d7c30034067$var$degToRad,\n radToDeg: $d5b33d7c30034067$var$radToDeg,\n isPowerOfTwo: $d5b33d7c30034067$var$isPowerOfTwo,\n ceilPowerOfTwo: $d5b33d7c30034067$var$ceilPowerOfTwo,\n floorPowerOfTwo: $d5b33d7c30034067$var$floorPowerOfTwo,\n setQuaternionFromProperEuler: $d5b33d7c30034067$var$setQuaternionFromProperEuler,\n normalize: $d5b33d7c30034067$var$normalize,\n denormalize: $d5b33d7c30034067$var$denormalize\n};\nclass $d5b33d7c30034067$export$c977b3e384af9ae1 {\n constructor(x = 0, y = 0){\n $d5b33d7c30034067$export$c977b3e384af9ae1.prototype.isVector2 = true;\n this.x = x;\n this.y = y;\n }\n get width() {\n return this.x;\n }\n set width(value) {\n this.x = value;\n }\n get height() {\n return this.y;\n }\n set height(value) {\n this.y = value;\n }\n set(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n return this;\n }\n divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n applyMatrix3(m) {\n const x = this.x, y = this.y;\n const e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6];\n this.y = e[1] * x + e[4] * y + e[7];\n return this;\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y;\n }\n cross(v) {\n return this.x * v.y - this.y * v.x;\n }\n lengthSq() {\n return this.x * this.x + this.y * this.y;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n angle() {\n // computes the angle in radians with respect to the positive x-axis\n const angle = Math.atan2(-this.y, -this.x) + Math.PI;\n return angle;\n }\n angleTo(v) {\n const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n const theta = this.dot(v) / denominator;\n // clamp, to handle numerical problems\n return Math.acos($d5b33d7c30034067$var$clamp(theta, -1, 1));\n }\n distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n distanceToSquared(v) {\n const dx = this.x - v.x, dy = this.y - v.y;\n return dx * dx + dy * dy;\n }\n manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n return this;\n }\n rotateAround(center, angle) {\n const c = Math.cos(angle), s = Math.sin(angle);\n const x = this.x - center.x;\n const y = this.y - center.y;\n this.x = x * c - y * s + center.x;\n this.y = x * s + y * c + center.y;\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n }\n}\nclass $d5b33d7c30034067$export$8ff26dafa08918 {\n constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33){\n $d5b33d7c30034067$export$8ff26dafa08918.prototype.isMatrix3 = true;\n this.elements = [\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ];\n if (n11 !== undefined) this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33);\n }\n set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {\n const te = this.elements;\n te[0] = n11;\n te[1] = n21;\n te[2] = n31;\n te[3] = n12;\n te[4] = n22;\n te[5] = n32;\n te[6] = n13;\n te[7] = n23;\n te[8] = n33;\n return this;\n }\n identity() {\n this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);\n return this;\n }\n copy(m) {\n const te = this.elements;\n const me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n return this;\n }\n extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrix3Column(this, 0);\n yAxis.setFromMatrix3Column(this, 1);\n zAxis.setFromMatrix3Column(this, 2);\n return this;\n }\n setFromMatrix4(m) {\n const me = m.elements;\n this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);\n return this;\n }\n multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n multiplyMatrices(a, b) {\n const ae = a.elements;\n const be = b.elements;\n const te = this.elements;\n const a11 = ae[0], a12 = ae[3], a13 = ae[6];\n const a21 = ae[1], a22 = ae[4], a23 = ae[7];\n const a31 = ae[2], a32 = ae[5], a33 = ae[8];\n const b11 = be[0], b12 = be[3], b13 = be[6];\n const b21 = be[1], b22 = be[4], b23 = be[7];\n const b31 = be[2], b32 = be[5], b33 = be[8];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31;\n te[3] = a11 * b12 + a12 * b22 + a13 * b32;\n te[6] = a11 * b13 + a12 * b23 + a13 * b33;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31;\n te[4] = a21 * b12 + a22 * b22 + a23 * b32;\n te[7] = a21 * b13 + a22 * b23 + a23 * b33;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31;\n te[5] = a31 * b12 + a32 * b22 + a33 * b32;\n te[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return this;\n }\n multiplyScalar(s) {\n const te = this.elements;\n te[0] *= s;\n te[3] *= s;\n te[6] *= s;\n te[1] *= s;\n te[4] *= s;\n te[7] *= s;\n te[2] *= s;\n te[5] *= s;\n te[8] *= s;\n return this;\n }\n determinant() {\n const te = this.elements;\n const a = te[0], b = te[1], c = te[2], d = te[3], e = te[4], f = te[5], g = te[6], h = te[7], i = te[8];\n return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n }\n invert() {\n const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n12 = te[3], n22 = te[4], n32 = te[5], n13 = te[6], n23 = te[7], n33 = te[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);\n const detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n31 * n23 - n33 * n21) * detInv;\n te[2] = (n32 * n21 - n31 * n22) * detInv;\n te[3] = t12 * detInv;\n te[4] = (n33 * n11 - n31 * n13) * detInv;\n te[5] = (n31 * n12 - n32 * n11) * detInv;\n te[6] = t13 * detInv;\n te[7] = (n21 * n13 - n23 * n11) * detInv;\n te[8] = (n22 * n11 - n21 * n12) * detInv;\n return this;\n }\n transpose() {\n let tmp;\n const m = this.elements;\n tmp = m[1];\n m[1] = m[3];\n m[3] = tmp;\n tmp = m[2];\n m[2] = m[6];\n m[6] = tmp;\n tmp = m[5];\n m[5] = m[7];\n m[7] = tmp;\n return this;\n }\n getNormalMatrix(matrix4) {\n return this.setFromMatrix4(matrix4).invert().transpose();\n }\n transposeIntoArray(r) {\n const m = this.elements;\n r[0] = m[0];\n r[1] = m[3];\n r[2] = m[6];\n r[3] = m[1];\n r[4] = m[4];\n r[5] = m[7];\n r[6] = m[2];\n r[7] = m[5];\n r[8] = m[8];\n return this;\n }\n setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {\n const c = Math.cos(rotation);\n const s = Math.sin(rotation);\n this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);\n return this;\n }\n //\n scale(sx, sy) {\n this.premultiply($d5b33d7c30034067$var$_m3.makeScale(sx, sy));\n return this;\n }\n rotate(theta) {\n this.premultiply($d5b33d7c30034067$var$_m3.makeRotation(-theta));\n return this;\n }\n translate(tx, ty) {\n this.premultiply($d5b33d7c30034067$var$_m3.makeTranslation(tx, ty));\n return this;\n }\n // for 2D Transforms\n makeTranslation(x, y) {\n if (x.isVector2) this.set(1, 0, x.x, 0, 1, x.y, 0, 0, 1);\n else this.set(1, 0, x, 0, 1, y, 0, 0, 1);\n return this;\n }\n makeRotation(theta) {\n // counterclockwise\n const c = Math.cos(theta);\n const s = Math.sin(theta);\n this.set(c, -s, 0, s, c, 0, 0, 0, 1);\n return this;\n }\n makeScale(x, y) {\n this.set(x, 0, 0, 0, y, 0, 0, 0, 1);\n return this;\n }\n //\n equals(matrix) {\n const te = this.elements;\n const me = matrix.elements;\n for(let i = 0; i < 9; i++){\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n fromArray(array, offset = 0) {\n for(let i = 0; i < 9; i++)this.elements[i] = array[i + offset];\n return this;\n }\n toArray(array = [], offset = 0) {\n const te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n return array;\n }\n clone() {\n return new this.constructor().fromArray(this.elements);\n }\n}\nconst $d5b33d7c30034067$var$_m3 = /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918();\nfunction $d5b33d7c30034067$var$arrayNeedsUint32(array) {\n // assumes larger values usually on last\n for(let i = array.length - 1; i >= 0; --i){\n if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n }\n return false;\n}\nconst $d5b33d7c30034067$var$TYPED_ARRAYS = {\n Int8Array: Int8Array,\n Uint8Array: Uint8Array,\n Uint8ClampedArray: Uint8ClampedArray,\n Int16Array: Int16Array,\n Uint16Array: Uint16Array,\n Int32Array: Int32Array,\n Uint32Array: Uint32Array,\n Float32Array: Float32Array,\n Float64Array: Float64Array\n};\nfunction $d5b33d7c30034067$var$getTypedArray(type, buffer) {\n return new $d5b33d7c30034067$var$TYPED_ARRAYS[type](buffer);\n}\nfunction $d5b33d7c30034067$var$createElementNS(name) {\n return document.createElementNS(\"http://www.w3.org/1999/xhtml\", name);\n}\nconst $d5b33d7c30034067$var$_cache = {};\nfunction $d5b33d7c30034067$var$warnOnce(message) {\n if (message in $d5b33d7c30034067$var$_cache) return;\n $d5b33d7c30034067$var$_cache[message] = true;\n console.warn(message);\n}\nfunction $d5b33d7c30034067$var$SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);\n}\nfunction $d5b33d7c30034067$var$LinearToSRGB(c) {\n return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;\n}\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */ const $d5b33d7c30034067$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918().fromArray([\n 0.8224621,\n 0.0331941,\n 0.0170827,\n 0.1775380,\n 0.9668058,\n 0.0723974,\n -0.0000001,\n 0.0000001,\n 0.9105199\n]);\nconst $d5b33d7c30034067$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918().fromArray([\n 1.2249401,\n -0.0420569,\n -0.0196376,\n -0.2249404,\n 1.0420571,\n -0.0786361,\n 0.0000001,\n 0.0000000,\n 1.0982735\n]);\nfunction $d5b33d7c30034067$var$DisplayP3ToLinearSRGB(color) {\n // Display P3 uses the sRGB transfer functions\n return color.convertSRGBToLinear().applyMatrix3($d5b33d7c30034067$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB);\n}\nfunction $d5b33d7c30034067$var$LinearSRGBToDisplayP3(color) {\n // Display P3 uses the sRGB transfer functions\n return color.applyMatrix3($d5b33d7c30034067$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB();\n}\n// Conversions from to Linear-sRGB reference space.\nconst $d5b33d7c30034067$var$TO_LINEAR = {\n [$d5b33d7c30034067$export$42429b3acfb233a4]: (color)=>color,\n [$d5b33d7c30034067$export$561f394b24edfcaa]: (color)=>color.convertSRGBToLinear(),\n [$d5b33d7c30034067$export$626af19ae879bdf6]: $d5b33d7c30034067$var$DisplayP3ToLinearSRGB\n};\n// Conversions to from Linear-sRGB reference space.\nconst $d5b33d7c30034067$var$FROM_LINEAR = {\n [$d5b33d7c30034067$export$42429b3acfb233a4]: (color)=>color,\n [$d5b33d7c30034067$export$561f394b24edfcaa]: (color)=>color.convertLinearToSRGB(),\n [$d5b33d7c30034067$export$626af19ae879bdf6]: $d5b33d7c30034067$var$LinearSRGBToDisplayP3\n};\nconst $d5b33d7c30034067$export$5e6fd513f44698c = {\n enabled: true,\n get legacyMode () {\n console.warn(\"THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.\");\n return !this.enabled;\n },\n set legacyMode (legacyMode){\n console.warn(\"THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.\");\n this.enabled = !legacyMode;\n },\n get workingColorSpace () {\n return $d5b33d7c30034067$export$42429b3acfb233a4;\n },\n set workingColorSpace (colorSpace){\n console.warn(\"THREE.ColorManagement: .workingColorSpace is readonly.\");\n },\n convert: function(color, sourceColorSpace, targetColorSpace) {\n if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) return color;\n const sourceToLinear = $d5b33d7c30034067$var$TO_LINEAR[sourceColorSpace];\n const targetFromLinear = $d5b33d7c30034067$var$FROM_LINEAR[targetColorSpace];\n if (sourceToLinear === undefined || targetFromLinear === undefined) throw new Error(`Unsupported color space conversion, \"${sourceColorSpace}\" to \"${targetColorSpace}\".`);\n return targetFromLinear(sourceToLinear(color));\n },\n fromWorkingColorSpace: function(color, targetColorSpace) {\n return this.convert(color, this.workingColorSpace, targetColorSpace);\n },\n toWorkingColorSpace: function(color, sourceColorSpace) {\n return this.convert(color, sourceColorSpace, this.workingColorSpace);\n }\n};\nlet $d5b33d7c30034067$var$_canvas;\nclass $d5b33d7c30034067$export$698882cf06df44aa {\n static getDataURL(image) {\n if (/^data:/i.test(image.src)) return image.src;\n if (typeof HTMLCanvasElement === \"undefined\") return image.src;\n let canvas;\n if (image instanceof HTMLCanvasElement) canvas = image;\n else {\n if ($d5b33d7c30034067$var$_canvas === undefined) $d5b33d7c30034067$var$_canvas = $d5b33d7c30034067$var$createElementNS(\"canvas\");\n $d5b33d7c30034067$var$_canvas.width = image.width;\n $d5b33d7c30034067$var$_canvas.height = image.height;\n const context = $d5b33d7c30034067$var$_canvas.getContext(\"2d\");\n if (image instanceof ImageData) context.putImageData(image, 0, 0);\n else context.drawImage(image, 0, 0, image.width, image.height);\n canvas = $d5b33d7c30034067$var$_canvas;\n }\n if (canvas.width > 2048 || canvas.height > 2048) {\n console.warn(\"THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons\", image);\n return canvas.toDataURL(\"image/jpeg\", 0.6);\n } else return canvas.toDataURL(\"image/png\");\n }\n static sRGBToLinear(image) {\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) {\n const canvas = $d5b33d7c30034067$var$createElementNS(\"canvas\");\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext(\"2d\");\n context.drawImage(image, 0, 0, image.width, image.height);\n const imageData = context.getImageData(0, 0, image.width, image.height);\n const data = imageData.data;\n for(let i = 0; i < data.length; i++)data[i] = $d5b33d7c30034067$var$SRGBToLinear(data[i] / 255) * 255;\n context.putImageData(imageData, 0, 0);\n return canvas;\n } else if (image.data) {\n const data = image.data.slice(0);\n for(let i = 0; i < data.length; i++)if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) data[i] = Math.floor($d5b33d7c30034067$var$SRGBToLinear(data[i] / 255) * 255);\n else // assuming float\n data[i] = $d5b33d7c30034067$var$SRGBToLinear(data[i]);\n return {\n data: data,\n width: image.width,\n height: image.height\n };\n } else {\n console.warn(\"THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.\");\n return image;\n }\n }\n}\nlet $d5b33d7c30034067$var$sourceId = 0;\nclass $d5b33d7c30034067$export$1d2df86270c81ecb {\n constructor(data = null){\n this.isSource = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$sourceId++\n });\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.data = data;\n this.version = 0;\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (!isRootObject && meta.images[this.uuid] !== undefined) return meta.images[this.uuid];\n const output = {\n uuid: this.uuid,\n url: \"\"\n };\n const data = this.data;\n if (data !== null) {\n let url;\n if (Array.isArray(data)) {\n // cube texture\n url = [];\n for(let i = 0, l = data.length; i < l; i++)if (data[i].isDataTexture) url.push($d5b33d7c30034067$var$serializeImage(data[i].image));\n else url.push($d5b33d7c30034067$var$serializeImage(data[i]));\n } else // texture\n url = $d5b33d7c30034067$var$serializeImage(data);\n output.url = url;\n }\n if (!isRootObject) meta.images[this.uuid] = output;\n return output;\n }\n}\nfunction $d5b33d7c30034067$var$serializeImage(image) {\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) // default images\n return $d5b33d7c30034067$export$698882cf06df44aa.getDataURL(image);\n else {\n if (image.data) // images of DataTexture\n return {\n data: Array.from(image.data),\n width: image.width,\n height: image.height,\n type: image.data.constructor.name\n };\n else {\n console.warn(\"THREE.Texture: Unable to serialize Texture.\");\n return {};\n }\n }\n}\nlet $d5b33d7c30034067$var$textureId = 0;\nclass $d5b33d7c30034067$export$5431306cf43de24a extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(image = $d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_IMAGE, mapping = $d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_MAPPING, wrapS = $d5b33d7c30034067$export$9d9334239a5a5e06, wrapT = $d5b33d7c30034067$export$9d9334239a5a5e06, magFilter = $d5b33d7c30034067$export$8a72f490b25c56c8, minFilter = $d5b33d7c30034067$export$5d8599b6a933fb1b, format = $d5b33d7c30034067$export$3f8bb04b555a363c, type = $d5b33d7c30034067$export$2e8ce08d3f6f5e10, anisotropy = $d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_ANISOTROPY, colorSpace1 = $d5b33d7c30034067$export$bfcb490c2dd3db51){\n super();\n this.isTexture = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$textureId++\n });\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.name = \"\";\n this.source = new $d5b33d7c30034067$export$1d2df86270c81ecb(image);\n this.mipmaps = [];\n this.mapping = mapping;\n this.channel = 0;\n this.wrapS = wrapS;\n this.wrapT = wrapT;\n this.magFilter = magFilter;\n this.minFilter = minFilter;\n this.anisotropy = anisotropy;\n this.format = format;\n this.internalFormat = null;\n this.type = type;\n this.offset = new $d5b33d7c30034067$export$c977b3e384af9ae1(0, 0);\n this.repeat = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.center = new $d5b33d7c30034067$export$c977b3e384af9ae1(0, 0);\n this.rotation = 0;\n this.matrixAutoUpdate = true;\n this.matrix = new $d5b33d7c30034067$export$8ff26dafa08918();\n this.generateMipmaps = true;\n this.premultiplyAlpha = false;\n this.flipY = true;\n this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n if (typeof colorSpace1 === \"string\") this.colorSpace = colorSpace1;\n else {\n $d5b33d7c30034067$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n this.colorSpace = colorSpace1 === $d5b33d7c30034067$export$f32388edbb32674 ? $d5b33d7c30034067$export$561f394b24edfcaa : $d5b33d7c30034067$export$bfcb490c2dd3db51;\n }\n this.userData = {};\n this.version = 0;\n this.onUpdate = null;\n this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n }\n get image() {\n return this.source.data;\n }\n set image(value = null) {\n this.source.data = value;\n }\n updateMatrix() {\n this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.name = source.name;\n this.source = source.source;\n this.mipmaps = source.mipmaps.slice(0);\n this.mapping = source.mapping;\n this.channel = source.channel;\n this.wrapS = source.wrapS;\n this.wrapT = source.wrapT;\n this.magFilter = source.magFilter;\n this.minFilter = source.minFilter;\n this.anisotropy = source.anisotropy;\n this.format = source.format;\n this.internalFormat = source.internalFormat;\n this.type = source.type;\n this.offset.copy(source.offset);\n this.repeat.copy(source.repeat);\n this.center.copy(source.center);\n this.rotation = source.rotation;\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrix.copy(source.matrix);\n this.generateMipmaps = source.generateMipmaps;\n this.premultiplyAlpha = source.premultiplyAlpha;\n this.flipY = source.flipY;\n this.unpackAlignment = source.unpackAlignment;\n this.colorSpace = source.colorSpace;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n this.needsUpdate = true;\n return this;\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (!isRootObject && meta.textures[this.uuid] !== undefined) return meta.textures[this.uuid];\n const output = {\n metadata: {\n version: 4.6,\n type: \"Texture\",\n generator: \"Texture.toJSON\"\n },\n uuid: this.uuid,\n name: this.name,\n image: this.source.toJSON(meta).uuid,\n mapping: this.mapping,\n channel: this.channel,\n repeat: [\n this.repeat.x,\n this.repeat.y\n ],\n offset: [\n this.offset.x,\n this.offset.y\n ],\n center: [\n this.center.x,\n this.center.y\n ],\n rotation: this.rotation,\n wrap: [\n this.wrapS,\n this.wrapT\n ],\n format: this.format,\n internalFormat: this.internalFormat,\n type: this.type,\n colorSpace: this.colorSpace,\n minFilter: this.minFilter,\n magFilter: this.magFilter,\n anisotropy: this.anisotropy,\n flipY: this.flipY,\n generateMipmaps: this.generateMipmaps,\n premultiplyAlpha: this.premultiplyAlpha,\n unpackAlignment: this.unpackAlignment\n };\n if (Object.keys(this.userData).length > 0) output.userData = this.userData;\n if (!isRootObject) meta.textures[this.uuid] = output;\n return output;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n transformUv(uv) {\n if (this.mapping !== $d5b33d7c30034067$export$1beec6768cbb3d2d) return uv;\n uv.applyMatrix3(this.matrix);\n if (uv.x < 0 || uv.x > 1) switch(this.wrapS){\n case $d5b33d7c30034067$export$533346c8e8dac0f5:\n uv.x = uv.x - Math.floor(uv.x);\n break;\n case $d5b33d7c30034067$export$9d9334239a5a5e06:\n uv.x = uv.x < 0 ? 0 : 1;\n break;\n case $d5b33d7c30034067$export$c7e7c00b14f51a4f:\n if (Math.abs(Math.floor(uv.x) % 2) === 1) uv.x = Math.ceil(uv.x) - uv.x;\n else uv.x = uv.x - Math.floor(uv.x);\n break;\n }\n if (uv.y < 0 || uv.y > 1) switch(this.wrapT){\n case $d5b33d7c30034067$export$533346c8e8dac0f5:\n uv.y = uv.y - Math.floor(uv.y);\n break;\n case $d5b33d7c30034067$export$9d9334239a5a5e06:\n uv.y = uv.y < 0 ? 0 : 1;\n break;\n case $d5b33d7c30034067$export$c7e7c00b14f51a4f:\n if (Math.abs(Math.floor(uv.y) % 2) === 1) uv.y = Math.ceil(uv.y) - uv.y;\n else uv.y = uv.y - Math.floor(uv.y);\n break;\n }\n if (this.flipY) uv.y = 1 - uv.y;\n return uv;\n }\n set needsUpdate(value) {\n if (value === true) {\n this.version++;\n this.source.needsUpdate = true;\n }\n }\n get encoding() {\n $d5b33d7c30034067$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n return this.colorSpace === $d5b33d7c30034067$export$561f394b24edfcaa ? $d5b33d7c30034067$export$f32388edbb32674 : $d5b33d7c30034067$export$7207336e4151a112;\n }\n set encoding(encoding) {\n $d5b33d7c30034067$var$warnOnce(\"THREE.Texture: Property .encoding has been replaced by .colorSpace.\");\n this.colorSpace = encoding === $d5b33d7c30034067$export$f32388edbb32674 ? $d5b33d7c30034067$export$561f394b24edfcaa : $d5b33d7c30034067$export$bfcb490c2dd3db51;\n }\n}\n$d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_IMAGE = null;\n$d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_MAPPING = $d5b33d7c30034067$export$1beec6768cbb3d2d;\n$d5b33d7c30034067$export$5431306cf43de24a.DEFAULT_ANISOTROPY = 1;\nclass $d5b33d7c30034067$export$fa7daccca11cdbe3 {\n constructor(x = 0, y = 0, z = 0, w = 1){\n $d5b33d7c30034067$export$fa7daccca11cdbe3.prototype.isVector4 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n get width() {\n return this.z;\n }\n set width(value) {\n this.z = value;\n }\n get height() {\n return this.w;\n }\n set height(value) {\n this.w = value;\n }\n set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n this.w = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setZ(z) {\n this.z = z;\n return this;\n }\n setW(w) {\n this.w = w;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n case 3:\n this.w = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n case 3:\n return this.w;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y, this.z, this.w);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n this.w = v.w !== undefined ? v.w : 1;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n this.w += v.w;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n this.w += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n this.w = a.w + b.w;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n this.w += v.w * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n this.w -= v.w;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n this.w -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n this.w = a.w - b.w;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n this.w *= v.w;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n this.w *= scalar;\n return this;\n }\n applyMatrix4(m) {\n const x = this.x, y = this.y, z = this.z, w = this.w;\n const e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;\n this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;\n this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;\n this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n setAxisAngleFromQuaternion(q) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n // q is assumed to be normalized\n this.w = 2 * Math.acos(q.w);\n const s = Math.sqrt(1 - q.w * q.w);\n if (s < 0.0001) {\n this.x = 1;\n this.y = 0;\n this.z = 0;\n } else {\n this.x = q.x / s;\n this.y = q.y / s;\n this.z = q.z / s;\n }\n return this;\n }\n setAxisAngleFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n let angle, x, y, z; // variables for result\n const epsilon = 0.01, epsilon2 = 0.1, te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10];\n if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {\n // singularity found\n // first check for identity matrix which must have +1 for all terms\n // in leading diagonal and zero in other terms\n if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {\n // this singularity is identity matrix so angle = 0\n this.set(1, 0, 0, 0);\n return this; // zero angle, arbitrary axis\n }\n // otherwise this singularity is angle = 180\n angle = Math.PI;\n const xx = (m11 + 1) / 2;\n const yy = (m22 + 1) / 2;\n const zz = (m33 + 1) / 2;\n const xy = (m12 + m21) / 4;\n const xz = (m13 + m31) / 4;\n const yz = (m23 + m32) / 4;\n if (xx > yy && xx > zz) {\n // m11 is the largest diagonal term\n if (xx < epsilon) {\n x = 0;\n y = 0.707106781;\n z = 0.707106781;\n } else {\n x = Math.sqrt(xx);\n y = xy / x;\n z = xz / x;\n }\n } else if (yy > zz) {\n // m22 is the largest diagonal term\n if (yy < epsilon) {\n x = 0.707106781;\n y = 0;\n z = 0.707106781;\n } else {\n y = Math.sqrt(yy);\n x = xy / y;\n z = yz / y;\n }\n } else // m33 is the largest diagonal term so base result on this\n if (zz < epsilon) {\n x = 0.707106781;\n y = 0.707106781;\n z = 0;\n } else {\n z = Math.sqrt(zz);\n x = xz / z;\n y = yz / z;\n }\n this.set(x, y, z, angle);\n return this; // return 180 deg rotation\n }\n // as we have reached here there are no singularities so we can handle normally\n let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize\n if (Math.abs(s) < 0.001) s = 1;\n // prevent divide by zero, should not happen if matrix is orthogonal and should be\n // caught by singularity test above, but I've left it in just in case\n this.x = (m32 - m23) / s;\n this.y = (m13 - m31) / s;\n this.z = (m21 - m12) / s;\n this.w = Math.acos((m11 + m22 + m33 - 1) / 2);\n return this;\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n this.w = Math.min(this.w, v.w);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n this.w = Math.max(this.w, v.w);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n this.w = Math.max(min.w, Math.min(max.w, this.w));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n this.w = Math.max(minVal, Math.min(maxVal, this.w));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n this.w = Math.floor(this.w);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n this.w = Math.ceil(this.w);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n this.w = Math.round(this.w);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n this.w = -this.w;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n }\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n this.w += (v.w - this.w) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n this.w = v1.w + (v2.w - v1.w) * alpha;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n this.w = array[offset + 3];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n array[offset + 3] = this.w;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n this.w = attribute.getW(index);\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n this.w = Math.random();\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n yield this.z;\n yield this.w;\n }\n}\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/ class $d5b33d7c30034067$export$efcb1f8bf367cbfb extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(width = 1, height = 1, options = {}){\n super();\n this.isRenderTarget = true;\n this.width = width;\n this.height = height;\n this.depth = 1;\n this.scissor = new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, width, height);\n this.scissorTest = false;\n this.viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, width, height);\n const image = {\n width: width,\n height: height,\n depth: 1\n };\n if (options.encoding !== undefined) {\n // @deprecated, r152\n $d5b33d7c30034067$var$warnOnce(\"THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.\");\n options.colorSpace = options.encoding === $d5b33d7c30034067$export$f32388edbb32674 ? $d5b33d7c30034067$export$561f394b24edfcaa : $d5b33d7c30034067$export$bfcb490c2dd3db51;\n }\n this.texture = new $d5b33d7c30034067$export$5431306cf43de24a(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace);\n this.texture.isRenderTargetTexture = true;\n this.texture.flipY = false;\n this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n this.samples = options.samples !== undefined ? options.samples : 0;\n }\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.texture.image.width = width;\n this.texture.image.height = height;\n this.texture.image.depth = depth;\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.scissor.copy(source.scissor);\n this.scissorTest = source.scissorTest;\n this.viewport.copy(source.viewport);\n this.texture = source.texture.clone();\n this.texture.isRenderTargetTexture = true;\n // ensure image object is not shared, see #20328\n const image = Object.assign({}, source.texture.image);\n this.texture.source = new $d5b33d7c30034067$export$1d2df86270c81ecb(image);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.samples = source.samples;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nclass $d5b33d7c30034067$export$3c052beb2e51e23f extends $d5b33d7c30034067$export$efcb1f8bf367cbfb {\n constructor(width = 1, height = 1, options = {}){\n super(width, height, options);\n this.isWebGLRenderTarget = true;\n }\n}\nclass $d5b33d7c30034067$export$dfac6c8e811406a3 extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, depth = 1){\n super(null);\n this.isDataArrayTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n this.magFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.minFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.wrapR = $d5b33d7c30034067$export$9d9334239a5a5e06;\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nclass $d5b33d7c30034067$export$c77a02c11ed180c7 extends $d5b33d7c30034067$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, depth = 1){\n super(width, height);\n this.isWebGLArrayRenderTarget = true;\n this.depth = depth;\n this.texture = new $d5b33d7c30034067$export$dfac6c8e811406a3(null, width, height, depth);\n this.texture.isRenderTargetTexture = true;\n }\n}\nclass $d5b33d7c30034067$export$d7a3086320f856db extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, depth = 1){\n // We're going to add .setXXX() methods for setting properties later.\n // Users can still set in DataTexture3D directly.\n //\n //\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n // \ttexture.anisotropy = 16;\n //\n // See #14839\n super(null);\n this.isData3DTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n this.magFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.minFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.wrapR = $d5b33d7c30034067$export$9d9334239a5a5e06;\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nclass $d5b33d7c30034067$export$7ee06591009639df extends $d5b33d7c30034067$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, depth = 1){\n super(width, height);\n this.isWebGL3DRenderTarget = true;\n this.depth = depth;\n this.texture = new $d5b33d7c30034067$export$d7a3086320f856db(null, width, height, depth);\n this.texture.isRenderTargetTexture = true;\n }\n}\nclass $d5b33d7c30034067$export$bd934554fb721730 extends $d5b33d7c30034067$export$3c052beb2e51e23f {\n constructor(width = 1, height = 1, count = 1, options = {}){\n super(width, height, options);\n this.isWebGLMultipleRenderTargets = true;\n const texture = this.texture;\n this.texture = [];\n for(let i = 0; i < count; i++){\n this.texture[i] = texture.clone();\n this.texture[i].isRenderTargetTexture = true;\n }\n }\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n for(let i = 0, il = this.texture.length; i < il; i++){\n this.texture[i].image.width = width;\n this.texture[i].image.height = height;\n this.texture[i].image.depth = depth;\n }\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n }\n copy(source) {\n this.dispose();\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.scissor.copy(source.scissor);\n this.scissorTest = source.scissorTest;\n this.viewport.copy(source.viewport);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.texture.length = 0;\n for(let i = 0, il = source.texture.length; i < il; i++){\n this.texture[i] = source.texture[i].clone();\n this.texture[i].isRenderTargetTexture = true;\n }\n return this;\n }\n}\nclass $d5b33d7c30034067$export$23d6a54f0bbc85a3 {\n constructor(x = 0, y = 0, z = 0, w = 1){\n this.isQuaternion = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n }\n static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {\n // fuzz-free, array-based Quaternion SLERP operation\n let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3];\n const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3];\n if (t === 0) {\n dst[dstOffset + 0] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n return;\n }\n if (t === 1) {\n dst[dstOffset + 0] = x1;\n dst[dstOffset + 1] = y1;\n dst[dstOffset + 2] = z1;\n dst[dstOffset + 3] = w1;\n return;\n }\n if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {\n let s = 1 - t;\n const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos;\n // Skip the Slerp for tiny steps to avoid numeric problems:\n if (sqrSin > Number.EPSILON) {\n const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir);\n s = Math.sin(s * len) / sin;\n t = Math.sin(t * len) / sin;\n }\n const tDir = t * dir;\n x0 = x0 * s + x1 * tDir;\n y0 = y0 * s + y1 * tDir;\n z0 = z0 * s + z1 * tDir;\n w0 = w0 * s + w1 * tDir;\n // Normalize in case we just did a lerp:\n if (s === 1 - t) {\n const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);\n x0 *= f;\n y0 *= f;\n z0 *= f;\n w0 *= f;\n }\n }\n dst[dstOffset] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n }\n static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {\n const x0 = src0[srcOffset0];\n const y0 = src0[srcOffset0 + 1];\n const z0 = src0[srcOffset0 + 2];\n const w0 = src0[srcOffset0 + 3];\n const x1 = src1[srcOffset1];\n const y1 = src1[srcOffset1 + 1];\n const z1 = src1[srcOffset1 + 2];\n const w1 = src1[srcOffset1 + 3];\n dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n return dst;\n }\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._onChangeCallback();\n }\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._onChangeCallback();\n }\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._onChangeCallback();\n }\n get w() {\n return this._w;\n }\n set w(value) {\n this._w = value;\n this._onChangeCallback();\n }\n set(x, y, z, w) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n this._onChangeCallback();\n return this;\n }\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._w);\n }\n copy(quaternion) {\n this._x = quaternion.x;\n this._y = quaternion.y;\n this._z = quaternion.z;\n this._w = quaternion.w;\n this._onChangeCallback();\n return this;\n }\n setFromEuler(euler, update) {\n const x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n //\tcontent/SpinCalc.m\n const cos = Math.cos;\n const sin = Math.sin;\n const c1 = cos(x / 2);\n const c2 = cos(y / 2);\n const c3 = cos(z / 2);\n const s1 = sin(x / 2);\n const s2 = sin(y / 2);\n const s3 = sin(z / 2);\n switch(order){\n case \"XYZ\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"YXZ\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case \"ZXY\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"ZYX\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case \"YZX\":\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case \"XZY\":\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n default:\n console.warn(\"THREE.Quaternion: .setFromEuler() encountered an unknown order: \" + order);\n }\n if (update !== false) this._onChangeCallback();\n return this;\n }\n setFromAxisAngle(axis, angle) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n const halfAngle = angle / 2, s = Math.sin(halfAngle);\n this._x = axis.x * s;\n this._y = axis.y * s;\n this._z = axis.z * s;\n this._w = Math.cos(halfAngle);\n this._onChangeCallback();\n return this;\n }\n setFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n const te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10], trace = m11 + m22 + m33;\n if (trace > 0) {\n const s = 0.5 / Math.sqrt(trace + 1.0);\n this._w = 0.25 / s;\n this._x = (m32 - m23) * s;\n this._y = (m13 - m31) * s;\n this._z = (m21 - m12) * s;\n } else if (m11 > m22 && m11 > m33) {\n const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\n this._w = (m32 - m23) / s;\n this._x = 0.25 * s;\n this._y = (m12 + m21) / s;\n this._z = (m13 + m31) / s;\n } else if (m22 > m33) {\n const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\n this._w = (m13 - m31) / s;\n this._x = (m12 + m21) / s;\n this._y = 0.25 * s;\n this._z = (m23 + m32) / s;\n } else {\n const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\n this._w = (m21 - m12) / s;\n this._x = (m13 + m31) / s;\n this._y = (m23 + m32) / s;\n this._z = 0.25 * s;\n }\n this._onChangeCallback();\n return this;\n }\n setFromUnitVectors(vFrom, vTo) {\n // assumes direction vectors vFrom and vTo are normalized\n let r = vFrom.dot(vTo) + 1;\n if (r < Number.EPSILON) {\n // vFrom and vTo point in opposite directions\n r = 0;\n if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {\n this._x = -vFrom.y;\n this._y = vFrom.x;\n this._z = 0;\n this._w = r;\n } else {\n this._x = 0;\n this._y = -vFrom.z;\n this._z = vFrom.y;\n this._w = r;\n }\n } else {\n // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n this._w = r;\n }\n return this.normalize();\n }\n angleTo(q) {\n return 2 * Math.acos(Math.abs($d5b33d7c30034067$var$clamp(this.dot(q), -1, 1)));\n }\n rotateTowards(q, step) {\n const angle = this.angleTo(q);\n if (angle === 0) return this;\n const t = Math.min(1, step / angle);\n this.slerp(q, t);\n return this;\n }\n identity() {\n return this.set(0, 0, 0, 1);\n }\n invert() {\n // quaternion is assumed to have unit length\n return this.conjugate();\n }\n conjugate() {\n this._x *= -1;\n this._y *= -1;\n this._z *= -1;\n this._onChangeCallback();\n return this;\n }\n dot(v) {\n return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n }\n lengthSq() {\n return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n }\n length() {\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);\n }\n normalize() {\n let l = this.length();\n if (l === 0) {\n this._x = 0;\n this._y = 0;\n this._z = 0;\n this._w = 1;\n } else {\n l = 1 / l;\n this._x = this._x * l;\n this._y = this._y * l;\n this._z = this._z * l;\n this._w = this._w * l;\n }\n this._onChangeCallback();\n return this;\n }\n multiply(q) {\n return this.multiplyQuaternions(this, q);\n }\n premultiply(q) {\n return this.multiplyQuaternions(q, this);\n }\n multiplyQuaternions(a, b) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n this._onChangeCallback();\n return this;\n }\n slerp(qb, t) {\n if (t === 0) return this;\n if (t === 1) return this.copy(qb);\n const x = this._x, y = this._y, z = this._z, w = this._w;\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n if (cosHalfTheta < 0) {\n this._w = -qb._w;\n this._x = -qb._x;\n this._y = -qb._y;\n this._z = -qb._z;\n cosHalfTheta = -cosHalfTheta;\n } else this.copy(qb);\n if (cosHalfTheta >= 1.0) {\n this._w = w;\n this._x = x;\n this._y = y;\n this._z = z;\n return this;\n }\n const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n if (sqrSinHalfTheta <= Number.EPSILON) {\n const s = 1 - t;\n this._w = s * w + t * this._w;\n this._x = s * x + t * this._x;\n this._y = s * y + t * this._y;\n this._z = s * z + t * this._z;\n this.normalize();\n this._onChangeCallback();\n return this;\n }\n const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);\n const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);\n const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t * halfTheta) / sinHalfTheta;\n this._w = w * ratioA + this._w * ratioB;\n this._x = x * ratioA + this._x * ratioB;\n this._y = y * ratioA + this._y * ratioB;\n this._z = z * ratioA + this._z * ratioB;\n this._onChangeCallback();\n return this;\n }\n slerpQuaternions(qa, qb, t) {\n return this.copy(qa).slerp(qb, t);\n }\n random() {\n // Derived from http://planning.cs.uiuc.edu/node198.html\n // Note, this source uses w, x, y, z ordering,\n // so we swap the order below.\n const u1 = Math.random();\n const sqrt1u1 = Math.sqrt(1 - u1);\n const sqrtu1 = Math.sqrt(u1);\n const u2 = 2 * Math.PI * Math.random();\n const u3 = 2 * Math.PI * Math.random();\n return this.set(sqrt1u1 * Math.cos(u2), sqrtu1 * Math.sin(u3), sqrtu1 * Math.cos(u3), sqrt1u1 * Math.sin(u2));\n }\n equals(quaternion) {\n return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;\n }\n fromArray(array, offset = 0) {\n this._x = array[offset];\n this._y = array[offset + 1];\n this._z = array[offset + 2];\n this._w = array[offset + 3];\n this._onChangeCallback();\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._w;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this._x = attribute.getX(index);\n this._y = attribute.getY(index);\n this._z = attribute.getZ(index);\n this._w = attribute.getW(index);\n return this;\n }\n toJSON() {\n return this.toArray();\n }\n _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n _onChangeCallback() {}\n *[Symbol.iterator]() {\n yield this._x;\n yield this._y;\n yield this._z;\n yield this._w;\n }\n}\nclass $d5b33d7c30034067$export$64b5c384219d3699 {\n constructor(x = 0, y = 0, z = 0){\n $d5b33d7c30034067$export$64b5c384219d3699.prototype.isVector3 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n set(x, y, z) {\n if (z === undefined) z = this.z; // sprite.scale.set(x,y)\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n return this;\n }\n setX(x) {\n this.x = x;\n return this;\n }\n setY(y) {\n this.y = y;\n return this;\n }\n setZ(z) {\n this.z = z;\n return this;\n }\n setComponent(index, value) {\n switch(index){\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n return this;\n }\n getComponent(index) {\n switch(index){\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n default:\n throw new Error(\"index is out of range: \" + index);\n }\n }\n clone() {\n return new this.constructor(this.x, this.y, this.z);\n }\n copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n return this;\n }\n add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n return this;\n }\n addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n return this;\n }\n addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n return this;\n }\n addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n return this;\n }\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n return this;\n }\n subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n return this;\n }\n subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n return this;\n }\n multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n return this;\n }\n multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n return this;\n }\n multiplyVectors(a, b) {\n this.x = a.x * b.x;\n this.y = a.y * b.y;\n this.z = a.z * b.z;\n return this;\n }\n applyEuler(euler) {\n return this.applyQuaternion($d5b33d7c30034067$var$_quaternion$4.setFromEuler(euler));\n }\n applyAxisAngle(axis, angle) {\n return this.applyQuaternion($d5b33d7c30034067$var$_quaternion$4.setFromAxisAngle(axis, angle));\n }\n applyMatrix3(m) {\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6] * z;\n this.y = e[1] * x + e[4] * y + e[7] * z;\n this.z = e[2] * x + e[5] * y + e[8] * z;\n return this;\n }\n applyNormalMatrix(m) {\n return this.applyMatrix3(m).normalize();\n }\n applyMatrix4(m) {\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;\n this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;\n this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;\n return this;\n }\n applyQuaternion(q) {\n const x = this.x, y = this.y, z = this.z;\n const qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n // calculate quat * vector\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n // calculate result * inverse quat\n this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return this;\n }\n project(camera) {\n return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);\n }\n unproject(camera) {\n return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);\n }\n transformDirection(m) {\n // input: THREE.Matrix4 affine matrix\n // vector interpreted as a direction\n const x = this.x, y = this.y, z = this.z;\n const e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z;\n this.y = e[1] * x + e[5] * y + e[9] * z;\n this.z = e[2] * x + e[6] * y + e[10] * z;\n return this.normalize();\n }\n divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n this.z /= v.z;\n return this;\n }\n divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n return this;\n }\n max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n return this;\n }\n clamp(min, max) {\n // assumes min < max, componentwise\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n return this;\n }\n clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n return this;\n }\n clampLength(min, max) {\n const length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n return this;\n }\n ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n return this;\n }\n round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n return this;\n }\n roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n return this;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n return this;\n }\n dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n }\n // TODO lengthSquared?\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n }\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);\n }\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n return this;\n }\n lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n return this;\n }\n cross(v) {\n return this.crossVectors(this, v);\n }\n crossVectors(a, b) {\n const ax = a.x, ay = a.y, az = a.z;\n const bx = b.x, by = b.y, bz = b.z;\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n return this;\n }\n projectOnVector(v) {\n const denominator = v.lengthSq();\n if (denominator === 0) return this.set(0, 0, 0);\n const scalar = v.dot(this) / denominator;\n return this.copy(v).multiplyScalar(scalar);\n }\n projectOnPlane(planeNormal) {\n $d5b33d7c30034067$var$_vector$b.copy(this).projectOnVector(planeNormal);\n return this.sub($d5b33d7c30034067$var$_vector$b);\n }\n reflect(normal) {\n // reflect incident vector off plane orthogonal to normal\n // normal is assumed to have unit length\n return this.sub($d5b33d7c30034067$var$_vector$b.copy(normal).multiplyScalar(2 * this.dot(normal)));\n }\n angleTo(v) {\n const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n const theta = this.dot(v) / denominator;\n // clamp, to handle numerical problems\n return Math.acos($d5b33d7c30034067$var$clamp(theta, -1, 1));\n }\n distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n distanceToSquared(v) {\n const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n return dx * dx + dy * dy + dz * dz;\n }\n manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);\n }\n setFromSpherical(s) {\n return this.setFromSphericalCoords(s.radius, s.phi, s.theta);\n }\n setFromSphericalCoords(radius, phi, theta) {\n const sinPhiRadius = Math.sin(phi) * radius;\n this.x = sinPhiRadius * Math.sin(theta);\n this.y = Math.cos(phi) * radius;\n this.z = sinPhiRadius * Math.cos(theta);\n return this;\n }\n setFromCylindrical(c) {\n return this.setFromCylindricalCoords(c.radius, c.theta, c.y);\n }\n setFromCylindricalCoords(radius, theta, y) {\n this.x = radius * Math.sin(theta);\n this.y = y;\n this.z = radius * Math.cos(theta);\n return this;\n }\n setFromMatrixPosition(m) {\n const e = m.elements;\n this.x = e[12];\n this.y = e[13];\n this.z = e[14];\n return this;\n }\n setFromMatrixScale(m) {\n const sx = this.setFromMatrixColumn(m, 0).length();\n const sy = this.setFromMatrixColumn(m, 1).length();\n const sz = this.setFromMatrixColumn(m, 2).length();\n this.x = sx;\n this.y = sy;\n this.z = sz;\n return this;\n }\n setFromMatrixColumn(m, index) {\n return this.fromArray(m.elements, index * 4);\n }\n setFromMatrix3Column(m, index) {\n return this.fromArray(m.elements, index * 3);\n }\n setFromEuler(e) {\n this.x = e._x;\n this.y = e._y;\n this.z = e._z;\n return this;\n }\n setFromColor(c) {\n this.x = c.r;\n this.y = c.g;\n this.z = c.b;\n return this;\n }\n equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z;\n }\n fromArray(array, offset = 0) {\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n return this;\n }\n random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n return this;\n }\n randomDirection() {\n // Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n const u = (Math.random() - 0.5) * 2;\n const t = Math.random() * Math.PI * 2;\n const f = Math.sqrt(1 - u ** 2);\n this.x = f * Math.cos(t);\n this.y = f * Math.sin(t);\n this.z = u;\n return this;\n }\n *[Symbol.iterator]() {\n yield this.x;\n yield this.y;\n yield this.z;\n }\n}\nconst $d5b33d7c30034067$var$_vector$b = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_quaternion$4 = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nclass $d5b33d7c30034067$export$6f7d5a9418ab2aa3 {\n constructor(min = new $d5b33d7c30034067$export$64b5c384219d3699(Infinity, Infinity, Infinity), max = new $d5b33d7c30034067$export$64b5c384219d3699(-Infinity, -Infinity, -Infinity)){\n this.isBox3 = true;\n this.min = min;\n this.max = max;\n }\n set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n setFromArray(array) {\n this.makeEmpty();\n for(let i = 0, il = array.length; i < il; i += 3)this.expandByPoint($d5b33d7c30034067$var$_vector$a.fromArray(array, i));\n return this;\n }\n setFromBufferAttribute(attribute) {\n this.makeEmpty();\n for(let i = 0, il = attribute.count; i < il; i++)this.expandByPoint($d5b33d7c30034067$var$_vector$a.fromBufferAttribute(attribute, i));\n return this;\n }\n setFromPoints(points) {\n this.makeEmpty();\n for(let i = 0, il = points.length; i < il; i++)this.expandByPoint(points[i]);\n return this;\n }\n setFromCenterAndSize(center, size) {\n const halfSize = $d5b33d7c30034067$var$_vector$a.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n setFromObject(object, precise = false) {\n this.makeEmpty();\n return this.expandByObject(object, precise);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n makeEmpty() {\n this.min.x = this.min.y = this.min.z = Infinity;\n this.max.x = this.max.y = this.max.z = -Infinity;\n return this;\n }\n isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;\n }\n getCenter(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n getSize(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);\n }\n expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n expandByObject(object, precise = false) {\n // Computes the world-axis-aligned bounding box of an object (including its children),\n // accounting for both the object's, and children's, world transforms\n object.updateWorldMatrix(false, false);\n if (object.boundingBox !== undefined) {\n if (object.boundingBox === null) object.computeBoundingBox();\n $d5b33d7c30034067$var$_box$3.copy(object.boundingBox);\n $d5b33d7c30034067$var$_box$3.applyMatrix4(object.matrixWorld);\n this.union($d5b33d7c30034067$var$_box$3);\n } else {\n const geometry = object.geometry;\n if (geometry !== undefined) {\n if (precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined) {\n const position = geometry.attributes.position;\n for(let i = 0, l = position.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$a.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld);\n this.expandByPoint($d5b33d7c30034067$var$_vector$a);\n }\n } else {\n if (geometry.boundingBox === null) geometry.computeBoundingBox();\n $d5b33d7c30034067$var$_box$3.copy(geometry.boundingBox);\n $d5b33d7c30034067$var$_box$3.applyMatrix4(object.matrixWorld);\n this.union($d5b33d7c30034067$var$_box$3);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)this.expandByObject(children[i], precise);\n return this;\n }\n containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true;\n }\n containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;\n }\n getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));\n }\n intersectsBox(box) {\n // using 6 splitting planes to rule out intersections.\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n }\n intersectsSphere(sphere) {\n // Find the point on the AABB closest to the sphere center.\n this.clampPoint(sphere.center, $d5b33d7c30034067$var$_vector$a);\n // If that point is inside the sphere, the AABB and sphere intersect.\n return $d5b33d7c30034067$var$_vector$a.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;\n }\n intersectsPlane(plane) {\n // We compute the minimum and maximum dot product values. If those values\n // are on the same side (back or front) of the plane, then there is no intersection.\n let min, max;\n if (plane.normal.x > 0) {\n min = plane.normal.x * this.min.x;\n max = plane.normal.x * this.max.x;\n } else {\n min = plane.normal.x * this.max.x;\n max = plane.normal.x * this.min.x;\n }\n if (plane.normal.y > 0) {\n min += plane.normal.y * this.min.y;\n max += plane.normal.y * this.max.y;\n } else {\n min += plane.normal.y * this.max.y;\n max += plane.normal.y * this.min.y;\n }\n if (plane.normal.z > 0) {\n min += plane.normal.z * this.min.z;\n max += plane.normal.z * this.max.z;\n } else {\n min += plane.normal.z * this.max.z;\n max += plane.normal.z * this.min.z;\n }\n return min <= -plane.constant && max >= -plane.constant;\n }\n intersectsTriangle(triangle) {\n if (this.isEmpty()) return false;\n // compute box center and extents\n this.getCenter($d5b33d7c30034067$var$_center);\n $d5b33d7c30034067$var$_extents.subVectors(this.max, $d5b33d7c30034067$var$_center);\n // translate triangle to aabb origin\n $d5b33d7c30034067$var$_v0$2.subVectors(triangle.a, $d5b33d7c30034067$var$_center);\n $d5b33d7c30034067$var$_v1$7.subVectors(triangle.b, $d5b33d7c30034067$var$_center);\n $d5b33d7c30034067$var$_v2$4.subVectors(triangle.c, $d5b33d7c30034067$var$_center);\n // compute edge vectors for triangle\n $d5b33d7c30034067$var$_f0.subVectors($d5b33d7c30034067$var$_v1$7, $d5b33d7c30034067$var$_v0$2);\n $d5b33d7c30034067$var$_f1.subVectors($d5b33d7c30034067$var$_v2$4, $d5b33d7c30034067$var$_v1$7);\n $d5b33d7c30034067$var$_f2.subVectors($d5b33d7c30034067$var$_v0$2, $d5b33d7c30034067$var$_v2$4);\n // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n let axes = [\n 0,\n -$d5b33d7c30034067$var$_f0.z,\n $d5b33d7c30034067$var$_f0.y,\n 0,\n -$d5b33d7c30034067$var$_f1.z,\n $d5b33d7c30034067$var$_f1.y,\n 0,\n -$d5b33d7c30034067$var$_f2.z,\n $d5b33d7c30034067$var$_f2.y,\n $d5b33d7c30034067$var$_f0.z,\n 0,\n -$d5b33d7c30034067$var$_f0.x,\n $d5b33d7c30034067$var$_f1.z,\n 0,\n -$d5b33d7c30034067$var$_f1.x,\n $d5b33d7c30034067$var$_f2.z,\n 0,\n -$d5b33d7c30034067$var$_f2.x,\n -$d5b33d7c30034067$var$_f0.y,\n $d5b33d7c30034067$var$_f0.x,\n 0,\n -$d5b33d7c30034067$var$_f1.y,\n $d5b33d7c30034067$var$_f1.x,\n 0,\n -$d5b33d7c30034067$var$_f2.y,\n $d5b33d7c30034067$var$_f2.x,\n 0\n ];\n if (!$d5b33d7c30034067$var$satForAxes(axes, $d5b33d7c30034067$var$_v0$2, $d5b33d7c30034067$var$_v1$7, $d5b33d7c30034067$var$_v2$4, $d5b33d7c30034067$var$_extents)) return false;\n // test 3 face normals from the aabb\n axes = [\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ];\n if (!$d5b33d7c30034067$var$satForAxes(axes, $d5b33d7c30034067$var$_v0$2, $d5b33d7c30034067$var$_v1$7, $d5b33d7c30034067$var$_v2$4, $d5b33d7c30034067$var$_extents)) return false;\n // finally testing the face normal of the triangle\n // use already existing triangle edge vectors here\n $d5b33d7c30034067$var$_triangleNormal.crossVectors($d5b33d7c30034067$var$_f0, $d5b33d7c30034067$var$_f1);\n axes = [\n $d5b33d7c30034067$var$_triangleNormal.x,\n $d5b33d7c30034067$var$_triangleNormal.y,\n $d5b33d7c30034067$var$_triangleNormal.z\n ];\n return $d5b33d7c30034067$var$satForAxes(axes, $d5b33d7c30034067$var$_v0$2, $d5b33d7c30034067$var$_v1$7, $d5b33d7c30034067$var$_v2$4, $d5b33d7c30034067$var$_extents);\n }\n clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n distanceToPoint(point) {\n return this.clampPoint(point, $d5b33d7c30034067$var$_vector$a).distanceTo(point);\n }\n getBoundingSphere(target) {\n if (this.isEmpty()) target.makeEmpty();\n else {\n this.getCenter(target.center);\n target.radius = this.getSize($d5b33d7c30034067$var$_vector$a).length() * 0.5;\n }\n return target;\n }\n intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n applyMatrix4(matrix) {\n // transform of empty box is an empty box.\n if (this.isEmpty()) return this;\n // NOTE: I am using a binary pattern to specify all 2^3 combinations below\n $d5b33d7c30034067$var$_points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000\n $d5b33d7c30034067$var$_points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001\n $d5b33d7c30034067$var$_points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010\n $d5b33d7c30034067$var$_points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011\n $d5b33d7c30034067$var$_points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100\n $d5b33d7c30034067$var$_points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101\n $d5b33d7c30034067$var$_points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110\n $d5b33d7c30034067$var$_points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111\n this.setFromPoints($d5b33d7c30034067$var$_points);\n return this;\n }\n translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n}\nconst $d5b33d7c30034067$var$_points = [\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699()\n];\nconst $d5b33d7c30034067$var$_vector$a = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_box$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\n// triangle centered vertices\nconst $d5b33d7c30034067$var$_v0$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v1$7 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v2$4 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\n// triangle edge vectors\nconst $d5b33d7c30034067$var$_f0 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_f1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_f2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_center = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_extents = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_triangleNormal = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_testAxis = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nfunction $d5b33d7c30034067$var$satForAxes(axes, v0, v1, v2, extents) {\n for(let i = 0, j = axes.length - 3; i <= j; i += 3){\n $d5b33d7c30034067$var$_testAxis.fromArray(axes, i);\n // project the aabb onto the separating axis\n const r = extents.x * Math.abs($d5b33d7c30034067$var$_testAxis.x) + extents.y * Math.abs($d5b33d7c30034067$var$_testAxis.y) + extents.z * Math.abs($d5b33d7c30034067$var$_testAxis.z);\n // project all 3 vertices of the triangle onto the separating axis\n const p0 = v0.dot($d5b33d7c30034067$var$_testAxis);\n const p1 = v1.dot($d5b33d7c30034067$var$_testAxis);\n const p2 = v2.dot($d5b33d7c30034067$var$_testAxis);\n // actual test, basically see if either of the most extreme of the triangle points intersects r\n if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) // points of the projected triangle are outside the projected half-length of the aabb\n // the axis is separating and we can exit\n return false;\n }\n return true;\n}\nconst $d5b33d7c30034067$var$_box$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\nconst $d5b33d7c30034067$var$_v1$6 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v2$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$805e8b72413ccaba {\n constructor(center = new $d5b33d7c30034067$export$64b5c384219d3699(), radius = -1){\n this.center = center;\n this.radius = radius;\n }\n set(center, radius) {\n this.center.copy(center);\n this.radius = radius;\n return this;\n }\n setFromPoints(points, optionalCenter) {\n const center = this.center;\n if (optionalCenter !== undefined) center.copy(optionalCenter);\n else $d5b33d7c30034067$var$_box$2.setFromPoints(points).getCenter(center);\n let maxRadiusSq = 0;\n for(let i = 0, il = points.length; i < il; i++)maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));\n this.radius = Math.sqrt(maxRadiusSq);\n return this;\n }\n copy(sphere) {\n this.center.copy(sphere.center);\n this.radius = sphere.radius;\n return this;\n }\n isEmpty() {\n return this.radius < 0;\n }\n makeEmpty() {\n this.center.set(0, 0, 0);\n this.radius = -1;\n return this;\n }\n containsPoint(point) {\n return point.distanceToSquared(this.center) <= this.radius * this.radius;\n }\n distanceToPoint(point) {\n return point.distanceTo(this.center) - this.radius;\n }\n intersectsSphere(sphere) {\n const radiusSum = this.radius + sphere.radius;\n return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;\n }\n intersectsBox(box) {\n return box.intersectsSphere(this);\n }\n intersectsPlane(plane) {\n return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;\n }\n clampPoint(point, target) {\n const deltaLengthSq = this.center.distanceToSquared(point);\n target.copy(point);\n if (deltaLengthSq > this.radius * this.radius) {\n target.sub(this.center).normalize();\n target.multiplyScalar(this.radius).add(this.center);\n }\n return target;\n }\n getBoundingBox(target) {\n if (this.isEmpty()) {\n // Empty sphere produces empty bounding box\n target.makeEmpty();\n return target;\n }\n target.set(this.center, this.center);\n target.expandByScalar(this.radius);\n return target;\n }\n applyMatrix4(matrix) {\n this.center.applyMatrix4(matrix);\n this.radius = this.radius * matrix.getMaxScaleOnAxis();\n return this;\n }\n translate(offset) {\n this.center.add(offset);\n return this;\n }\n expandByPoint(point) {\n if (this.isEmpty()) {\n this.center.copy(point);\n this.radius = 0;\n return this;\n }\n $d5b33d7c30034067$var$_v1$6.subVectors(point, this.center);\n const lengthSq = $d5b33d7c30034067$var$_v1$6.lengthSq();\n if (lengthSq > this.radius * this.radius) {\n // calculate the minimal sphere\n const length = Math.sqrt(lengthSq);\n const delta = (length - this.radius) * 0.5;\n this.center.addScaledVector($d5b33d7c30034067$var$_v1$6, delta / length);\n this.radius += delta;\n }\n return this;\n }\n union(sphere) {\n if (sphere.isEmpty()) return this;\n if (this.isEmpty()) {\n this.copy(sphere);\n return this;\n }\n if (this.center.equals(sphere.center) === true) this.radius = Math.max(this.radius, sphere.radius);\n else {\n $d5b33d7c30034067$var$_v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);\n this.expandByPoint($d5b33d7c30034067$var$_v1$6.copy(sphere.center).add($d5b33d7c30034067$var$_v2$3));\n this.expandByPoint($d5b33d7c30034067$var$_v1$6.copy(sphere.center).sub($d5b33d7c30034067$var$_v2$3));\n }\n return this;\n }\n equals(sphere) {\n return sphere.center.equals(this.center) && sphere.radius === this.radius;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $d5b33d7c30034067$var$_vector$9 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_segCenter = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_segDir = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_diff = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_edge1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_edge2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_normal$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$a186db52eed6d40e {\n constructor(origin = new $d5b33d7c30034067$export$64b5c384219d3699(), direction = new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, -1)){\n this.origin = origin;\n this.direction = direction;\n }\n set(origin, direction) {\n this.origin.copy(origin);\n this.direction.copy(direction);\n return this;\n }\n copy(ray) {\n this.origin.copy(ray.origin);\n this.direction.copy(ray.direction);\n return this;\n }\n at(t, target) {\n return target.copy(this.origin).addScaledVector(this.direction, t);\n }\n lookAt(v) {\n this.direction.copy(v).sub(this.origin).normalize();\n return this;\n }\n recast(t) {\n this.origin.copy(this.at(t, $d5b33d7c30034067$var$_vector$9));\n return this;\n }\n closestPointToPoint(point, target) {\n target.subVectors(point, this.origin);\n const directionDistance = target.dot(this.direction);\n if (directionDistance < 0) return target.copy(this.origin);\n return target.copy(this.origin).addScaledVector(this.direction, directionDistance);\n }\n distanceToPoint(point) {\n return Math.sqrt(this.distanceSqToPoint(point));\n }\n distanceSqToPoint(point) {\n const directionDistance = $d5b33d7c30034067$var$_vector$9.subVectors(point, this.origin).dot(this.direction);\n // point behind the ray\n if (directionDistance < 0) return this.origin.distanceToSquared(point);\n $d5b33d7c30034067$var$_vector$9.copy(this.origin).addScaledVector(this.direction, directionDistance);\n return $d5b33d7c30034067$var$_vector$9.distanceToSquared(point);\n }\n distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n // It returns the min distance between the ray and the segment\n // defined by v0 and v1\n // It can also set two optional targets :\n // - The closest point on the ray\n // - The closest point on the segment\n $d5b33d7c30034067$var$_segCenter.copy(v0).add(v1).multiplyScalar(0.5);\n $d5b33d7c30034067$var$_segDir.copy(v1).sub(v0).normalize();\n $d5b33d7c30034067$var$_diff.copy(this.origin).sub($d5b33d7c30034067$var$_segCenter);\n const segExtent = v0.distanceTo(v1) * 0.5;\n const a01 = -this.direction.dot($d5b33d7c30034067$var$_segDir);\n const b0 = $d5b33d7c30034067$var$_diff.dot(this.direction);\n const b1 = -$d5b33d7c30034067$var$_diff.dot($d5b33d7c30034067$var$_segDir);\n const c = $d5b33d7c30034067$var$_diff.lengthSq();\n const det = Math.abs(1 - a01 * a01);\n let s0, s1, sqrDist, extDet;\n if (det > 0) {\n // The ray and segment are not parallel.\n s0 = a01 * b1 - b0;\n s1 = a01 * b0 - b1;\n extDet = segExtent * det;\n if (s0 >= 0) {\n if (s1 >= -extDet) {\n if (s1 <= extDet) {\n // region 0\n // Minimum at interior points of ray and segment.\n const invDet = 1 / det;\n s0 *= invDet;\n s1 *= invDet;\n sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;\n } else {\n // region 1\n s1 = segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n // region 5\n s1 = -segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n if (s1 <= -extDet) {\n // region 4\n s0 = Math.max(0, -(-a01 * segExtent + b0));\n s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n } else if (s1 <= extDet) {\n // region 3\n s0 = 0;\n s1 = Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = s1 * (s1 + 2 * b1) + c;\n } else {\n // region 2\n s0 = Math.max(0, -(a01 * segExtent + b0));\n s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n }\n } else {\n // Ray and segment are parallel.\n s1 = a01 > 0 ? -segExtent : segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n if (optionalPointOnRay) optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0);\n if (optionalPointOnSegment) optionalPointOnSegment.copy($d5b33d7c30034067$var$_segCenter).addScaledVector($d5b33d7c30034067$var$_segDir, s1);\n return sqrDist;\n }\n intersectSphere(sphere, target) {\n $d5b33d7c30034067$var$_vector$9.subVectors(sphere.center, this.origin);\n const tca = $d5b33d7c30034067$var$_vector$9.dot(this.direction);\n const d2 = $d5b33d7c30034067$var$_vector$9.dot($d5b33d7c30034067$var$_vector$9) - tca * tca;\n const radius2 = sphere.radius * sphere.radius;\n if (d2 > radius2) return null;\n const thc = Math.sqrt(radius2 - d2);\n // t0 = first intersect point - entrance on front of sphere\n const t0 = tca - thc;\n // t1 = second intersect point - exit point on back of sphere\n const t1 = tca + thc;\n // test to see if t1 is behind the ray - if so, return null\n if (t1 < 0) return null;\n // test to see if t0 is behind the ray:\n // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n // in order to always return an intersect point that is in front of the ray.\n if (t0 < 0) return this.at(t1, target);\n // else t0 is in front of the ray, so return the first collision point scaled by t0\n return this.at(t0, target);\n }\n intersectsSphere(sphere) {\n return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;\n }\n distanceToPlane(plane) {\n const denominator = plane.normal.dot(this.direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (plane.distanceToPoint(this.origin) === 0) return 0;\n // Null is preferable to undefined since undefined means.... it is undefined\n return null;\n }\n const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator;\n // Return if the ray never intersects the plane\n return t >= 0 ? t : null;\n }\n intersectPlane(plane, target) {\n const t = this.distanceToPlane(plane);\n if (t === null) return null;\n return this.at(t, target);\n }\n intersectsPlane(plane) {\n // check if the ray lies on the plane first\n const distToPoint = plane.distanceToPoint(this.origin);\n if (distToPoint === 0) return true;\n const denominator = plane.normal.dot(this.direction);\n if (denominator * distToPoint < 0) return true;\n // ray origin is behind the plane (and is pointing behind it)\n return false;\n }\n intersectBox(box, target) {\n let tmin, tmax, tymin, tymax, tzmin, tzmax;\n const invdirx = 1 / this.direction.x, invdiry = 1 / this.direction.y, invdirz = 1 / this.direction.z;\n const origin = this.origin;\n if (invdirx >= 0) {\n tmin = (box.min.x - origin.x) * invdirx;\n tmax = (box.max.x - origin.x) * invdirx;\n } else {\n tmin = (box.max.x - origin.x) * invdirx;\n tmax = (box.min.x - origin.x) * invdirx;\n }\n if (invdiry >= 0) {\n tymin = (box.min.y - origin.y) * invdiry;\n tymax = (box.max.y - origin.y) * invdiry;\n } else {\n tymin = (box.max.y - origin.y) * invdiry;\n tymax = (box.min.y - origin.y) * invdiry;\n }\n if (tmin > tymax || tymin > tmax) return null;\n if (tymin > tmin || isNaN(tmin)) tmin = tymin;\n if (tymax < tmax || isNaN(tmax)) tmax = tymax;\n if (invdirz >= 0) {\n tzmin = (box.min.z - origin.z) * invdirz;\n tzmax = (box.max.z - origin.z) * invdirz;\n } else {\n tzmin = (box.max.z - origin.z) * invdirz;\n tzmax = (box.min.z - origin.z) * invdirz;\n }\n if (tmin > tzmax || tzmin > tmax) return null;\n if (tzmin > tmin || tmin !== tmin) tmin = tzmin;\n if (tzmax < tmax || tmax !== tmax) tmax = tzmax;\n //return point closest to the ray (positive side)\n if (tmax < 0) return null;\n return this.at(tmin >= 0 ? tmin : tmax, target);\n }\n intersectsBox(box) {\n return this.intersectBox(box, $d5b33d7c30034067$var$_vector$9) !== null;\n }\n intersectTriangle(a, b, c, backfaceCulling, target) {\n // Compute the offset origin, edges, and normal.\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n $d5b33d7c30034067$var$_edge1.subVectors(b, a);\n $d5b33d7c30034067$var$_edge2.subVectors(c, a);\n $d5b33d7c30034067$var$_normal$1.crossVectors($d5b33d7c30034067$var$_edge1, $d5b33d7c30034067$var$_edge2);\n // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n let DdN = this.direction.dot($d5b33d7c30034067$var$_normal$1);\n let sign;\n if (DdN > 0) {\n if (backfaceCulling) return null;\n sign = 1;\n } else if (DdN < 0) {\n sign = -1;\n DdN = -DdN;\n } else return null;\n $d5b33d7c30034067$var$_diff.subVectors(this.origin, a);\n const DdQxE2 = sign * this.direction.dot($d5b33d7c30034067$var$_edge2.crossVectors($d5b33d7c30034067$var$_diff, $d5b33d7c30034067$var$_edge2));\n // b1 < 0, no intersection\n if (DdQxE2 < 0) return null;\n const DdE1xQ = sign * this.direction.dot($d5b33d7c30034067$var$_edge1.cross($d5b33d7c30034067$var$_diff));\n // b2 < 0, no intersection\n if (DdE1xQ < 0) return null;\n // b1+b2 > 1, no intersection\n if (DdQxE2 + DdE1xQ > DdN) return null;\n // Line intersects triangle, check if ray does.\n const QdN = -sign * $d5b33d7c30034067$var$_diff.dot($d5b33d7c30034067$var$_normal$1);\n // t < 0, no intersection\n if (QdN < 0) return null;\n // Ray intersects triangle.\n return this.at(QdN / DdN, target);\n }\n applyMatrix4(matrix4) {\n this.origin.applyMatrix4(matrix4);\n this.direction.transformDirection(matrix4);\n return this;\n }\n equals(ray) {\n return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $d5b33d7c30034067$export$2ae72fc923e5eb5 {\n constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44){\n $d5b33d7c30034067$export$2ae72fc923e5eb5.prototype.isMatrix4 = true;\n this.elements = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n if (n11 !== undefined) this.set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44);\n }\n set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {\n const te = this.elements;\n te[0] = n11;\n te[4] = n12;\n te[8] = n13;\n te[12] = n14;\n te[1] = n21;\n te[5] = n22;\n te[9] = n23;\n te[13] = n24;\n te[2] = n31;\n te[6] = n32;\n te[10] = n33;\n te[14] = n34;\n te[3] = n41;\n te[7] = n42;\n te[11] = n43;\n te[15] = n44;\n return this;\n }\n identity() {\n this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n clone() {\n return new $d5b33d7c30034067$export$2ae72fc923e5eb5().fromArray(this.elements);\n }\n copy(m) {\n const te = this.elements;\n const me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n te[9] = me[9];\n te[10] = me[10];\n te[11] = me[11];\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n te[15] = me[15];\n return this;\n }\n copyPosition(m) {\n const te = this.elements, me = m.elements;\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n return this;\n }\n setFromMatrix3(m) {\n const me = m.elements;\n this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);\n return this;\n }\n extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrixColumn(this, 0);\n yAxis.setFromMatrixColumn(this, 1);\n zAxis.setFromMatrixColumn(this, 2);\n return this;\n }\n makeBasis(xAxis, yAxis, zAxis) {\n this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);\n return this;\n }\n extractRotation(m) {\n // this method does not support reflection matrices\n const te = this.elements;\n const me = m.elements;\n const scaleX = 1 / $d5b33d7c30034067$var$_v1$5.setFromMatrixColumn(m, 0).length();\n const scaleY = 1 / $d5b33d7c30034067$var$_v1$5.setFromMatrixColumn(m, 1).length();\n const scaleZ = 1 / $d5b33d7c30034067$var$_v1$5.setFromMatrixColumn(m, 2).length();\n te[0] = me[0] * scaleX;\n te[1] = me[1] * scaleX;\n te[2] = me[2] * scaleX;\n te[3] = 0;\n te[4] = me[4] * scaleY;\n te[5] = me[5] * scaleY;\n te[6] = me[6] * scaleY;\n te[7] = 0;\n te[8] = me[8] * scaleZ;\n te[9] = me[9] * scaleZ;\n te[10] = me[10] * scaleZ;\n te[11] = 0;\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n makeRotationFromEuler(euler) {\n const te = this.elements;\n const x = euler.x, y = euler.y, z = euler.z;\n const a = Math.cos(x), b = Math.sin(x);\n const c = Math.cos(y), d = Math.sin(y);\n const e = Math.cos(z), f = Math.sin(z);\n if (euler.order === \"XYZ\") {\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\n te[0] = c * e;\n te[4] = -c * f;\n te[8] = d;\n te[1] = af + be * d;\n te[5] = ae - bf * d;\n te[9] = -b * c;\n te[2] = bf - ae * d;\n te[6] = be + af * d;\n te[10] = a * c;\n } else if (euler.order === \"YXZ\") {\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\n te[0] = ce + df * b;\n te[4] = de * b - cf;\n te[8] = a * d;\n te[1] = a * f;\n te[5] = a * e;\n te[9] = -b;\n te[2] = cf * b - de;\n te[6] = df + ce * b;\n te[10] = a * c;\n } else if (euler.order === \"ZXY\") {\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\n te[0] = ce - df * b;\n te[4] = -a * f;\n te[8] = de + cf * b;\n te[1] = cf + de * b;\n te[5] = a * e;\n te[9] = df - ce * b;\n te[2] = -a * d;\n te[6] = b;\n te[10] = a * c;\n } else if (euler.order === \"ZYX\") {\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\n te[0] = c * e;\n te[4] = be * d - af;\n te[8] = ae * d + bf;\n te[1] = c * f;\n te[5] = bf * d + ae;\n te[9] = af * d - be;\n te[2] = -d;\n te[6] = b * c;\n te[10] = a * c;\n } else if (euler.order === \"YZX\") {\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n te[0] = c * e;\n te[4] = bd - ac * f;\n te[8] = bc * f + ad;\n te[1] = f;\n te[5] = a * e;\n te[9] = -b * e;\n te[2] = -d * e;\n te[6] = ad * f + bc;\n te[10] = ac - bd * f;\n } else if (euler.order === \"XZY\") {\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n te[0] = c * e;\n te[4] = -f;\n te[8] = d * e;\n te[1] = ac * f + bd;\n te[5] = a * e;\n te[9] = ad * f - bc;\n te[2] = bc * f - ad;\n te[6] = b * e;\n te[10] = bd * f + ac;\n }\n // bottom row\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n // last column\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n makeRotationFromQuaternion(q) {\n return this.compose($d5b33d7c30034067$var$_zero, q, $d5b33d7c30034067$var$_one);\n }\n lookAt(eye, target, up) {\n const te = this.elements;\n $d5b33d7c30034067$var$_z.subVectors(eye, target);\n if ($d5b33d7c30034067$var$_z.lengthSq() === 0) // eye and target are in the same position\n $d5b33d7c30034067$var$_z.z = 1;\n $d5b33d7c30034067$var$_z.normalize();\n $d5b33d7c30034067$var$_x.crossVectors(up, $d5b33d7c30034067$var$_z);\n if ($d5b33d7c30034067$var$_x.lengthSq() === 0) {\n // up and z are parallel\n if (Math.abs(up.z) === 1) $d5b33d7c30034067$var$_z.x += 0.0001;\n else $d5b33d7c30034067$var$_z.z += 0.0001;\n $d5b33d7c30034067$var$_z.normalize();\n $d5b33d7c30034067$var$_x.crossVectors(up, $d5b33d7c30034067$var$_z);\n }\n $d5b33d7c30034067$var$_x.normalize();\n $d5b33d7c30034067$var$_y.crossVectors($d5b33d7c30034067$var$_z, $d5b33d7c30034067$var$_x);\n te[0] = $d5b33d7c30034067$var$_x.x;\n te[4] = $d5b33d7c30034067$var$_y.x;\n te[8] = $d5b33d7c30034067$var$_z.x;\n te[1] = $d5b33d7c30034067$var$_x.y;\n te[5] = $d5b33d7c30034067$var$_y.y;\n te[9] = $d5b33d7c30034067$var$_z.y;\n te[2] = $d5b33d7c30034067$var$_x.z;\n te[6] = $d5b33d7c30034067$var$_y.z;\n te[10] = $d5b33d7c30034067$var$_z.z;\n return this;\n }\n multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n multiplyMatrices(a, b) {\n const ae = a.elements;\n const be = b.elements;\n const te = this.elements;\n const a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12];\n const a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13];\n const a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14];\n const a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15];\n const b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12];\n const b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13];\n const b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14];\n const b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n return this;\n }\n multiplyScalar(s) {\n const te = this.elements;\n te[0] *= s;\n te[4] *= s;\n te[8] *= s;\n te[12] *= s;\n te[1] *= s;\n te[5] *= s;\n te[9] *= s;\n te[13] *= s;\n te[2] *= s;\n te[6] *= s;\n te[10] *= s;\n te[14] *= s;\n te[3] *= s;\n te[7] *= s;\n te[11] *= s;\n te[15] *= s;\n return this;\n }\n determinant() {\n const te = this.elements;\n const n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12];\n const n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];\n const n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];\n const n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];\n //TODO: make this more efficient\n //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);\n }\n transpose() {\n const te = this.elements;\n let tmp;\n tmp = te[1];\n te[1] = te[4];\n te[4] = tmp;\n tmp = te[2];\n te[2] = te[8];\n te[8] = tmp;\n tmp = te[6];\n te[6] = te[9];\n te[9] = tmp;\n tmp = te[3];\n te[3] = te[12];\n te[12] = tmp;\n tmp = te[7];\n te[7] = te[13];\n te[13] = tmp;\n tmp = te[11];\n te[11] = te[14];\n te[14] = tmp;\n return this;\n }\n setPosition(x, y, z) {\n const te = this.elements;\n if (x.isVector3) {\n te[12] = x.x;\n te[13] = x.y;\n te[14] = x.z;\n } else {\n te[12] = x;\n te[13] = y;\n te[14] = z;\n }\n return this;\n }\n invert() {\n // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n41 = te[3], n12 = te[4], n22 = te[5], n32 = te[6], n42 = te[7], n13 = te[8], n23 = te[9], n33 = te[10], n43 = te[11], n14 = te[12], n24 = te[13], n34 = te[14], n44 = te[15], t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n const detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;\n te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;\n te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;\n te[4] = t12 * detInv;\n te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;\n te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;\n te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;\n te[8] = t13 * detInv;\n te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;\n te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;\n te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;\n te[12] = t14 * detInv;\n te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;\n te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;\n te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;\n return this;\n }\n scale(v) {\n const te = this.elements;\n const x = v.x, y = v.y, z = v.z;\n te[0] *= x;\n te[4] *= y;\n te[8] *= z;\n te[1] *= x;\n te[5] *= y;\n te[9] *= z;\n te[2] *= x;\n te[6] *= y;\n te[10] *= z;\n te[3] *= x;\n te[7] *= y;\n te[11] *= z;\n return this;\n }\n getMaxScaleOnAxis() {\n const te = this.elements;\n const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];\n const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];\n const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];\n return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));\n }\n makeTranslation(x, y, z) {\n if (x.isVector3) this.set(1, 0, 0, x.x, 0, 1, 0, x.y, 0, 0, 1, x.z, 0, 0, 0, 1);\n else this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);\n return this;\n }\n makeRotationX(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationY(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationZ(theta) {\n const c = Math.cos(theta), s = Math.sin(theta);\n this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n makeRotationAxis(axis, angle) {\n // Based on http://www.gamedev.net/reference/articles/article1199.asp\n const c = Math.cos(angle);\n const s = Math.sin(angle);\n const t = 1 - c;\n const x = axis.x, y = axis.y, z = axis.z;\n const tx = t * x, ty = t * y;\n this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);\n return this;\n }\n makeScale(x, y, z) {\n this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);\n return this;\n }\n makeShear(xy, xz, yx, yz, zx, zy) {\n this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);\n return this;\n }\n compose(position, quaternion, scale) {\n const te = this.elements;\n const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n const x2 = x + x, y2 = y + y, z2 = z + z;\n const xx = x * x2, xy = x * y2, xz = x * z2;\n const yy = y * y2, yz = y * z2, zz = z * z2;\n const wx = w * x2, wy = w * y2, wz = w * z2;\n const sx = scale.x, sy = scale.y, sz = scale.z;\n te[0] = (1 - (yy + zz)) * sx;\n te[1] = (xy + wz) * sx;\n te[2] = (xz - wy) * sx;\n te[3] = 0;\n te[4] = (xy - wz) * sy;\n te[5] = (1 - (xx + zz)) * sy;\n te[6] = (yz + wx) * sy;\n te[7] = 0;\n te[8] = (xz + wy) * sz;\n te[9] = (yz - wx) * sz;\n te[10] = (1 - (xx + yy)) * sz;\n te[11] = 0;\n te[12] = position.x;\n te[13] = position.y;\n te[14] = position.z;\n te[15] = 1;\n return this;\n }\n decompose(position, quaternion, scale) {\n const te = this.elements;\n let sx = $d5b33d7c30034067$var$_v1$5.set(te[0], te[1], te[2]).length();\n const sy = $d5b33d7c30034067$var$_v1$5.set(te[4], te[5], te[6]).length();\n const sz = $d5b33d7c30034067$var$_v1$5.set(te[8], te[9], te[10]).length();\n // if determine is negative, we need to invert one scale\n const det = this.determinant();\n if (det < 0) sx = -sx;\n position.x = te[12];\n position.y = te[13];\n position.z = te[14];\n // scale the rotation part\n $d5b33d7c30034067$var$_m1$2.copy(this);\n const invSX = 1 / sx;\n const invSY = 1 / sy;\n const invSZ = 1 / sz;\n $d5b33d7c30034067$var$_m1$2.elements[0] *= invSX;\n $d5b33d7c30034067$var$_m1$2.elements[1] *= invSX;\n $d5b33d7c30034067$var$_m1$2.elements[2] *= invSX;\n $d5b33d7c30034067$var$_m1$2.elements[4] *= invSY;\n $d5b33d7c30034067$var$_m1$2.elements[5] *= invSY;\n $d5b33d7c30034067$var$_m1$2.elements[6] *= invSY;\n $d5b33d7c30034067$var$_m1$2.elements[8] *= invSZ;\n $d5b33d7c30034067$var$_m1$2.elements[9] *= invSZ;\n $d5b33d7c30034067$var$_m1$2.elements[10] *= invSZ;\n quaternion.setFromRotationMatrix($d5b33d7c30034067$var$_m1$2);\n scale.x = sx;\n scale.y = sy;\n scale.z = sz;\n return this;\n }\n makePerspective(left, right, top, bottom, near, far, coordinateSystem = $d5b33d7c30034067$export$5a0e9190d10875d3) {\n const te = this.elements;\n const x = 2 * near / (right - left);\n const y = 2 * near / (top - bottom);\n const a = (right + left) / (right - left);\n const b = (top + bottom) / (top - bottom);\n let c, d;\n if (coordinateSystem === $d5b33d7c30034067$export$5a0e9190d10875d3) {\n c = -(far + near) / (far - near);\n d = -2 * far * near / (far - near);\n } else if (coordinateSystem === $d5b33d7c30034067$export$cc83beedcb9be9ac) {\n c = -far / (far - near);\n d = -far * near / (far - near);\n } else throw new Error(\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \" + coordinateSystem);\n te[0] = x;\n te[4] = 0;\n te[8] = a;\n te[12] = 0;\n te[1] = 0;\n te[5] = y;\n te[9] = b;\n te[13] = 0;\n te[2] = 0;\n te[6] = 0;\n te[10] = c;\n te[14] = d;\n te[3] = 0;\n te[7] = 0;\n te[11] = -1;\n te[15] = 0;\n return this;\n }\n makeOrthographic(left, right, top, bottom, near, far, coordinateSystem = $d5b33d7c30034067$export$5a0e9190d10875d3) {\n const te = this.elements;\n const w = 1.0 / (right - left);\n const h = 1.0 / (top - bottom);\n const p = 1.0 / (far - near);\n const x = (right + left) * w;\n const y = (top + bottom) * h;\n let z, zInv;\n if (coordinateSystem === $d5b33d7c30034067$export$5a0e9190d10875d3) {\n z = (far + near) * p;\n zInv = -2 * p;\n } else if (coordinateSystem === $d5b33d7c30034067$export$cc83beedcb9be9ac) {\n z = near * p;\n zInv = -1 * p;\n } else throw new Error(\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \" + coordinateSystem);\n te[0] = 2 * w;\n te[4] = 0;\n te[8] = 0;\n te[12] = -x;\n te[1] = 0;\n te[5] = 2 * h;\n te[9] = 0;\n te[13] = -y;\n te[2] = 0;\n te[6] = 0;\n te[10] = zInv;\n te[14] = -z;\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n te[15] = 1;\n return this;\n }\n equals(matrix) {\n const te = this.elements;\n const me = matrix.elements;\n for(let i = 0; i < 16; i++){\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n fromArray(array, offset = 0) {\n for(let i = 0; i < 16; i++)this.elements[i] = array[i + offset];\n return this;\n }\n toArray(array = [], offset = 0) {\n const te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n array[offset + 9] = te[9];\n array[offset + 10] = te[10];\n array[offset + 11] = te[11];\n array[offset + 12] = te[12];\n array[offset + 13] = te[13];\n array[offset + 14] = te[14];\n array[offset + 15] = te[15];\n return array;\n }\n}\nconst $d5b33d7c30034067$var$_v1$5 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_m1$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_zero = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 0);\nconst $d5b33d7c30034067$var$_one = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(1, 1, 1);\nconst $d5b33d7c30034067$var$_x = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_y = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_z = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_matrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_quaternion$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nclass $d5b33d7c30034067$export$d93cc409a0768c5f {\n constructor(x = 0, y = 0, z = 0, order = $d5b33d7c30034067$export$d93cc409a0768c5f.DEFAULT_ORDER){\n this.isEuler = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n }\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._onChangeCallback();\n }\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._onChangeCallback();\n }\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._onChangeCallback();\n }\n get order() {\n return this._order;\n }\n set order(value) {\n this._order = value;\n this._onChangeCallback();\n }\n set(x, y, z, order = this._order) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n this._onChangeCallback();\n return this;\n }\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._order);\n }\n copy(euler) {\n this._x = euler._x;\n this._y = euler._y;\n this._z = euler._z;\n this._order = euler._order;\n this._onChangeCallback();\n return this;\n }\n setFromRotationMatrix(m, order = this._order, update = true) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n const te = m.elements;\n const m11 = te[0], m12 = te[4], m13 = te[8];\n const m21 = te[1], m22 = te[5], m23 = te[9];\n const m31 = te[2], m32 = te[6], m33 = te[10];\n switch(order){\n case \"XYZ\":\n this._y = Math.asin($d5b33d7c30034067$var$clamp(m13, -1, 1));\n if (Math.abs(m13) < 0.9999999) {\n this._x = Math.atan2(-m23, m33);\n this._z = Math.atan2(-m12, m11);\n } else {\n this._x = Math.atan2(m32, m22);\n this._z = 0;\n }\n break;\n case \"YXZ\":\n this._x = Math.asin(-$d5b33d7c30034067$var$clamp(m23, -1, 1));\n if (Math.abs(m23) < 0.9999999) {\n this._y = Math.atan2(m13, m33);\n this._z = Math.atan2(m21, m22);\n } else {\n this._y = Math.atan2(-m31, m11);\n this._z = 0;\n }\n break;\n case \"ZXY\":\n this._x = Math.asin($d5b33d7c30034067$var$clamp(m32, -1, 1));\n if (Math.abs(m32) < 0.9999999) {\n this._y = Math.atan2(-m31, m33);\n this._z = Math.atan2(-m12, m22);\n } else {\n this._y = 0;\n this._z = Math.atan2(m21, m11);\n }\n break;\n case \"ZYX\":\n this._y = Math.asin(-$d5b33d7c30034067$var$clamp(m31, -1, 1));\n if (Math.abs(m31) < 0.9999999) {\n this._x = Math.atan2(m32, m33);\n this._z = Math.atan2(m21, m11);\n } else {\n this._x = 0;\n this._z = Math.atan2(-m12, m22);\n }\n break;\n case \"YZX\":\n this._z = Math.asin($d5b33d7c30034067$var$clamp(m21, -1, 1));\n if (Math.abs(m21) < 0.9999999) {\n this._x = Math.atan2(-m23, m22);\n this._y = Math.atan2(-m31, m11);\n } else {\n this._x = 0;\n this._y = Math.atan2(m13, m33);\n }\n break;\n case \"XZY\":\n this._z = Math.asin(-$d5b33d7c30034067$var$clamp(m12, -1, 1));\n if (Math.abs(m12) < 0.9999999) {\n this._x = Math.atan2(m32, m22);\n this._y = Math.atan2(m13, m11);\n } else {\n this._x = Math.atan2(-m23, m33);\n this._y = 0;\n }\n break;\n default:\n console.warn(\"THREE.Euler: .setFromRotationMatrix() encountered an unknown order: \" + order);\n }\n this._order = order;\n if (update === true) this._onChangeCallback();\n return this;\n }\n setFromQuaternion(q, order, update) {\n $d5b33d7c30034067$var$_matrix.makeRotationFromQuaternion(q);\n return this.setFromRotationMatrix($d5b33d7c30034067$var$_matrix, order, update);\n }\n setFromVector3(v, order = this._order) {\n return this.set(v.x, v.y, v.z, order);\n }\n reorder(newOrder) {\n // WARNING: this discards revolution information -bhouston\n $d5b33d7c30034067$var$_quaternion$3.setFromEuler(this);\n return this.setFromQuaternion($d5b33d7c30034067$var$_quaternion$3, newOrder);\n }\n equals(euler) {\n return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;\n }\n fromArray(array) {\n this._x = array[0];\n this._y = array[1];\n this._z = array[2];\n if (array[3] !== undefined) this._order = array[3];\n this._onChangeCallback();\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._order;\n return array;\n }\n _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n _onChangeCallback() {}\n *[Symbol.iterator]() {\n yield this._x;\n yield this._y;\n yield this._z;\n yield this._order;\n }\n}\n$d5b33d7c30034067$export$d93cc409a0768c5f.DEFAULT_ORDER = \"XYZ\";\nclass $d5b33d7c30034067$export$89312ce47c0ca777 {\n constructor(){\n this.mask = 1;\n }\n set(channel) {\n this.mask = (1 << channel | 0) >>> 0;\n }\n enable(channel) {\n this.mask |= 1 << channel | 0;\n }\n enableAll() {\n this.mask = -1;\n }\n toggle(channel) {\n this.mask ^= 1 << channel | 0;\n }\n disable(channel) {\n this.mask &= ~(1 << channel | 0);\n }\n disableAll() {\n this.mask = 0;\n }\n test(layers) {\n return (this.mask & layers.mask) !== 0;\n }\n isEnabled(channel) {\n return (this.mask & (1 << channel | 0)) !== 0;\n }\n}\nlet $d5b33d7c30034067$var$_object3DId = 0;\nconst $d5b33d7c30034067$var$_v1$4 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_q1 = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nconst $d5b33d7c30034067$var$_m1$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_target = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_position$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_scale$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_quaternion$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nconst $d5b33d7c30034067$var$_xAxis = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(1, 0, 0);\nconst $d5b33d7c30034067$var$_yAxis = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0);\nconst $d5b33d7c30034067$var$_zAxis = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 1);\nconst $d5b33d7c30034067$var$_addedEvent = {\n type: \"added\"\n};\nconst $d5b33d7c30034067$var$_removedEvent = {\n type: \"removed\"\n};\nclass $d5b33d7c30034067$export$e4dd07dff30cc924 extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isObject3D = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$_object3DId++\n });\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.name = \"\";\n this.type = \"Object3D\";\n this.parent = null;\n this.children = [];\n this.up = $d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_UP.clone();\n const position = new $d5b33d7c30034067$export$64b5c384219d3699();\n const rotation = new $d5b33d7c30034067$export$d93cc409a0768c5f();\n const quaternion = new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\n const scale = new $d5b33d7c30034067$export$64b5c384219d3699(1, 1, 1);\n function onRotationChange() {\n quaternion.setFromEuler(rotation, false);\n }\n function onQuaternionChange() {\n rotation.setFromQuaternion(quaternion, undefined, false);\n }\n rotation._onChange(onRotationChange);\n quaternion._onChange(onQuaternionChange);\n Object.defineProperties(this, {\n position: {\n configurable: true,\n enumerable: true,\n value: position\n },\n rotation: {\n configurable: true,\n enumerable: true,\n value: rotation\n },\n quaternion: {\n configurable: true,\n enumerable: true,\n value: quaternion\n },\n scale: {\n configurable: true,\n enumerable: true,\n value: scale\n },\n modelViewMatrix: {\n value: new $d5b33d7c30034067$export$2ae72fc923e5eb5()\n },\n normalMatrix: {\n value: new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n });\n this.matrix = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.matrixWorld = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.matrixAutoUpdate = $d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_MATRIX_AUTO_UPDATE;\n this.matrixWorldNeedsUpdate = false;\n this.matrixWorldAutoUpdate = $d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n this.layers = new $d5b33d7c30034067$export$89312ce47c0ca777();\n this.visible = true;\n this.castShadow = false;\n this.receiveShadow = false;\n this.frustumCulled = true;\n this.renderOrder = 0;\n this.animations = [];\n this.userData = {};\n }\n onBeforeRender() {}\n onAfterRender() {}\n applyMatrix4(matrix) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n this.matrix.premultiply(matrix);\n this.matrix.decompose(this.position, this.quaternion, this.scale);\n }\n applyQuaternion(q) {\n this.quaternion.premultiply(q);\n return this;\n }\n setRotationFromAxisAngle(axis, angle) {\n // assumes axis is normalized\n this.quaternion.setFromAxisAngle(axis, angle);\n }\n setRotationFromEuler(euler) {\n this.quaternion.setFromEuler(euler, true);\n }\n setRotationFromMatrix(m) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n this.quaternion.setFromRotationMatrix(m);\n }\n setRotationFromQuaternion(q) {\n // assumes q is normalized\n this.quaternion.copy(q);\n }\n rotateOnAxis(axis, angle) {\n // rotate object on axis in object space\n // axis is assumed to be normalized\n $d5b33d7c30034067$var$_q1.setFromAxisAngle(axis, angle);\n this.quaternion.multiply($d5b33d7c30034067$var$_q1);\n return this;\n }\n rotateOnWorldAxis(axis, angle) {\n // rotate object on axis in world space\n // axis is assumed to be normalized\n // method assumes no rotated parent\n $d5b33d7c30034067$var$_q1.setFromAxisAngle(axis, angle);\n this.quaternion.premultiply($d5b33d7c30034067$var$_q1);\n return this;\n }\n rotateX(angle) {\n return this.rotateOnAxis($d5b33d7c30034067$var$_xAxis, angle);\n }\n rotateY(angle) {\n return this.rotateOnAxis($d5b33d7c30034067$var$_yAxis, angle);\n }\n rotateZ(angle) {\n return this.rotateOnAxis($d5b33d7c30034067$var$_zAxis, angle);\n }\n translateOnAxis(axis, distance) {\n // translate object by distance along axis in object space\n // axis is assumed to be normalized\n $d5b33d7c30034067$var$_v1$4.copy(axis).applyQuaternion(this.quaternion);\n this.position.add($d5b33d7c30034067$var$_v1$4.multiplyScalar(distance));\n return this;\n }\n translateX(distance) {\n return this.translateOnAxis($d5b33d7c30034067$var$_xAxis, distance);\n }\n translateY(distance) {\n return this.translateOnAxis($d5b33d7c30034067$var$_yAxis, distance);\n }\n translateZ(distance) {\n return this.translateOnAxis($d5b33d7c30034067$var$_zAxis, distance);\n }\n localToWorld(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4(this.matrixWorld);\n }\n worldToLocal(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4($d5b33d7c30034067$var$_m1$1.copy(this.matrixWorld).invert());\n }\n lookAt(x, y, z) {\n // This method does not support objects having non-uniformly-scaled parent(s)\n if (x.isVector3) $d5b33d7c30034067$var$_target.copy(x);\n else $d5b33d7c30034067$var$_target.set(x, y, z);\n const parent = this.parent;\n this.updateWorldMatrix(true, false);\n $d5b33d7c30034067$var$_position$3.setFromMatrixPosition(this.matrixWorld);\n if (this.isCamera || this.isLight) $d5b33d7c30034067$var$_m1$1.lookAt($d5b33d7c30034067$var$_position$3, $d5b33d7c30034067$var$_target, this.up);\n else $d5b33d7c30034067$var$_m1$1.lookAt($d5b33d7c30034067$var$_target, $d5b33d7c30034067$var$_position$3, this.up);\n this.quaternion.setFromRotationMatrix($d5b33d7c30034067$var$_m1$1);\n if (parent) {\n $d5b33d7c30034067$var$_m1$1.extractRotation(parent.matrixWorld);\n $d5b33d7c30034067$var$_q1.setFromRotationMatrix($d5b33d7c30034067$var$_m1$1);\n this.quaternion.premultiply($d5b33d7c30034067$var$_q1.invert());\n }\n }\n add(object) {\n if (arguments.length > 1) {\n for(let i = 0; i < arguments.length; i++)this.add(arguments[i]);\n return this;\n }\n if (object === this) {\n console.error(\"THREE.Object3D.add: object can't be added as a child of itself.\", object);\n return this;\n }\n if (object && object.isObject3D) {\n if (object.parent !== null) object.parent.remove(object);\n object.parent = this;\n this.children.push(object);\n object.dispatchEvent($d5b33d7c30034067$var$_addedEvent);\n } else console.error(\"THREE.Object3D.add: object not an instance of THREE.Object3D.\", object);\n return this;\n }\n remove(object) {\n if (arguments.length > 1) {\n for(let i = 0; i < arguments.length; i++)this.remove(arguments[i]);\n return this;\n }\n const index = this.children.indexOf(object);\n if (index !== -1) {\n object.parent = null;\n this.children.splice(index, 1);\n object.dispatchEvent($d5b33d7c30034067$var$_removedEvent);\n }\n return this;\n }\n removeFromParent() {\n const parent = this.parent;\n if (parent !== null) parent.remove(this);\n return this;\n }\n clear() {\n for(let i = 0; i < this.children.length; i++){\n const object = this.children[i];\n object.parent = null;\n object.dispatchEvent($d5b33d7c30034067$var$_removedEvent);\n }\n this.children.length = 0;\n return this;\n }\n attach(object) {\n // adds object as a child of this, while maintaining the object's world transform\n // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n this.updateWorldMatrix(true, false);\n $d5b33d7c30034067$var$_m1$1.copy(this.matrixWorld).invert();\n if (object.parent !== null) {\n object.parent.updateWorldMatrix(true, false);\n $d5b33d7c30034067$var$_m1$1.multiply(object.parent.matrixWorld);\n }\n object.applyMatrix4($d5b33d7c30034067$var$_m1$1);\n this.add(object);\n object.updateWorldMatrix(false, true);\n return this;\n }\n getObjectById(id) {\n return this.getObjectByProperty(\"id\", id);\n }\n getObjectByName(name) {\n return this.getObjectByProperty(\"name\", name);\n }\n getObjectByProperty(name, value) {\n if (this[name] === value) return this;\n for(let i = 0, l = this.children.length; i < l; i++){\n const child = this.children[i];\n const object = child.getObjectByProperty(name, value);\n if (object !== undefined) return object;\n }\n return undefined;\n }\n getObjectsByProperty(name, value) {\n let result = [];\n if (this[name] === value) result.push(this);\n for(let i = 0, l = this.children.length; i < l; i++){\n const childResult = this.children[i].getObjectsByProperty(name, value);\n if (childResult.length > 0) result = result.concat(childResult);\n }\n return result;\n }\n getWorldPosition(target) {\n this.updateWorldMatrix(true, false);\n return target.setFromMatrixPosition(this.matrixWorld);\n }\n getWorldQuaternion(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose($d5b33d7c30034067$var$_position$3, target, $d5b33d7c30034067$var$_scale$2);\n return target;\n }\n getWorldScale(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose($d5b33d7c30034067$var$_position$3, $d5b33d7c30034067$var$_quaternion$2, target);\n return target;\n }\n getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n const e = this.matrixWorld.elements;\n return target.set(e[8], e[9], e[10]).normalize();\n }\n raycast() {}\n traverse(callback) {\n callback(this);\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].traverse(callback);\n }\n traverseVisible(callback) {\n if (this.visible === false) return;\n callback(this);\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].traverseVisible(callback);\n }\n traverseAncestors(callback) {\n const parent = this.parent;\n if (parent !== null) {\n callback(parent);\n parent.traverseAncestors(callback);\n }\n }\n updateMatrix() {\n this.matrix.compose(this.position, this.quaternion, this.scale);\n this.matrixWorldNeedsUpdate = true;\n }\n updateMatrixWorld(force) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent === null) this.matrixWorld.copy(this.matrix);\n else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n this.matrixWorldNeedsUpdate = false;\n force = true;\n }\n // update children\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++){\n const child = children[i];\n if (child.matrixWorldAutoUpdate === true || force === true) child.updateMatrixWorld(force);\n }\n }\n updateWorldMatrix(updateParents, updateChildren) {\n const parent = this.parent;\n if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) parent.updateWorldMatrix(true, false);\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.parent === null) this.matrixWorld.copy(this.matrix);\n else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n // update children\n if (updateChildren === true) {\n const children = this.children;\n for(let i = 0, l = children.length; i < l; i++){\n const child = children[i];\n if (child.matrixWorldAutoUpdate === true) child.updateWorldMatrix(false, true);\n }\n }\n }\n toJSON(meta) {\n // meta is a string when called from JSON.stringify\n const isRootObject = meta === undefined || typeof meta === \"string\";\n const output = {};\n // meta is a hash used to collect geometries, materials.\n // not providing it implies that this is the root object\n // being serialized.\n if (isRootObject) {\n // initialize meta obj\n meta = {\n geometries: {},\n materials: {},\n textures: {},\n images: {},\n shapes: {},\n skeletons: {},\n animations: {},\n nodes: {}\n };\n output.metadata = {\n version: 4.6,\n type: \"Object\",\n generator: \"Object3D.toJSON\"\n };\n }\n // standard Object3D serialization\n const object = {};\n object.uuid = this.uuid;\n object.type = this.type;\n if (this.name !== \"\") object.name = this.name;\n if (this.castShadow === true) object.castShadow = true;\n if (this.receiveShadow === true) object.receiveShadow = true;\n if (this.visible === false) object.visible = false;\n if (this.frustumCulled === false) object.frustumCulled = false;\n if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;\n if (Object.keys(this.userData).length > 0) object.userData = this.userData;\n object.layers = this.layers.mask;\n object.matrix = this.matrix.toArray();\n object.up = this.up.toArray();\n if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;\n // object specific properties\n if (this.isInstancedMesh) {\n object.type = \"InstancedMesh\";\n object.count = this.count;\n object.instanceMatrix = this.instanceMatrix.toJSON();\n if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();\n }\n //\n function serialize(library, element) {\n if (library[element.uuid] === undefined) library[element.uuid] = element.toJSON(meta);\n return element.uuid;\n }\n if (this.isScene) {\n if (this.background) {\n if (this.background.isColor) object.background = this.background.toJSON();\n else if (this.background.isTexture) object.background = this.background.toJSON(meta).uuid;\n }\n if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) object.environment = this.environment.toJSON(meta).uuid;\n } else if (this.isMesh || this.isLine || this.isPoints) {\n object.geometry = serialize(meta.geometries, this.geometry);\n const parameters = this.geometry.parameters;\n if (parameters !== undefined && parameters.shapes !== undefined) {\n const shapes = parameters.shapes;\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n serialize(meta.shapes, shape);\n }\n else serialize(meta.shapes, shapes);\n }\n }\n if (this.isSkinnedMesh) {\n object.bindMode = this.bindMode;\n object.bindMatrix = this.bindMatrix.toArray();\n if (this.skeleton !== undefined) {\n serialize(meta.skeletons, this.skeleton);\n object.skeleton = this.skeleton.uuid;\n }\n }\n if (this.material !== undefined) {\n if (Array.isArray(this.material)) {\n const uuids = [];\n for(let i = 0, l = this.material.length; i < l; i++)uuids.push(serialize(meta.materials, this.material[i]));\n object.material = uuids;\n } else object.material = serialize(meta.materials, this.material);\n }\n //\n if (this.children.length > 0) {\n object.children = [];\n for(let i = 0; i < this.children.length; i++)object.children.push(this.children[i].toJSON(meta).object);\n }\n //\n if (this.animations.length > 0) {\n object.animations = [];\n for(let i = 0; i < this.animations.length; i++){\n const animation = this.animations[i];\n object.animations.push(serialize(meta.animations, animation));\n }\n }\n if (isRootObject) {\n const geometries = extractFromCache(meta.geometries);\n const materials = extractFromCache(meta.materials);\n const textures = extractFromCache(meta.textures);\n const images = extractFromCache(meta.images);\n const shapes = extractFromCache(meta.shapes);\n const skeletons = extractFromCache(meta.skeletons);\n const animations = extractFromCache(meta.animations);\n const nodes = extractFromCache(meta.nodes);\n if (geometries.length > 0) output.geometries = geometries;\n if (materials.length > 0) output.materials = materials;\n if (textures.length > 0) output.textures = textures;\n if (images.length > 0) output.images = images;\n if (shapes.length > 0) output.shapes = shapes;\n if (skeletons.length > 0) output.skeletons = skeletons;\n if (animations.length > 0) output.animations = animations;\n if (nodes.length > 0) output.nodes = nodes;\n }\n output.object = object;\n return output;\n // extract data from the cache hash\n // remove metadata on each item\n // and return as array\n function extractFromCache(cache) {\n const values = [];\n for(const key in cache){\n const data = cache[key];\n delete data.metadata;\n values.push(data);\n }\n return values;\n }\n }\n clone(recursive) {\n return new this.constructor().copy(this, recursive);\n }\n copy(source, recursive = true) {\n this.name = source.name;\n this.up.copy(source.up);\n this.position.copy(source.position);\n this.rotation.order = source.rotation.order;\n this.quaternion.copy(source.quaternion);\n this.scale.copy(source.scale);\n this.matrix.copy(source.matrix);\n this.matrixWorld.copy(source.matrixWorld);\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n this.layers.mask = source.layers.mask;\n this.visible = source.visible;\n this.castShadow = source.castShadow;\n this.receiveShadow = source.receiveShadow;\n this.frustumCulled = source.frustumCulled;\n this.renderOrder = source.renderOrder;\n this.animations = source.animations.slice();\n this.userData = JSON.parse(JSON.stringify(source.userData));\n if (recursive === true) for(let i = 0; i < source.children.length; i++){\n const child = source.children[i];\n this.add(child.clone());\n }\n return this;\n }\n}\n$d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_UP = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0);\n$d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_MATRIX_AUTO_UPDATE = true;\n$d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\nconst $d5b33d7c30034067$var$_v0$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v1$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v2$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v3$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vab = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vac = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vbc = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vap = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vbp = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vcp = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nlet $d5b33d7c30034067$var$warnedGetUV = false;\nclass $d5b33d7c30034067$export$5a465592bfe74b48 {\n constructor(a = new $d5b33d7c30034067$export$64b5c384219d3699(), b = new $d5b33d7c30034067$export$64b5c384219d3699(), c = new $d5b33d7c30034067$export$64b5c384219d3699()){\n this.a = a;\n this.b = b;\n this.c = c;\n }\n static getNormal(a, b, c, target) {\n target.subVectors(c, b);\n $d5b33d7c30034067$var$_v0$1.subVectors(a, b);\n target.cross($d5b33d7c30034067$var$_v0$1);\n const targetLengthSq = target.lengthSq();\n if (targetLengthSq > 0) return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));\n return target.set(0, 0, 0);\n }\n // static/instance method to calculate barycentric coordinates\n // based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n static getBarycoord(point, a, b, c, target) {\n $d5b33d7c30034067$var$_v0$1.subVectors(c, a);\n $d5b33d7c30034067$var$_v1$3.subVectors(b, a);\n $d5b33d7c30034067$var$_v2$2.subVectors(point, a);\n const dot00 = $d5b33d7c30034067$var$_v0$1.dot($d5b33d7c30034067$var$_v0$1);\n const dot01 = $d5b33d7c30034067$var$_v0$1.dot($d5b33d7c30034067$var$_v1$3);\n const dot02 = $d5b33d7c30034067$var$_v0$1.dot($d5b33d7c30034067$var$_v2$2);\n const dot11 = $d5b33d7c30034067$var$_v1$3.dot($d5b33d7c30034067$var$_v1$3);\n const dot12 = $d5b33d7c30034067$var$_v1$3.dot($d5b33d7c30034067$var$_v2$2);\n const denom = dot00 * dot11 - dot01 * dot01;\n // collinear or singular triangle\n if (denom === 0) // arbitrary location outside of triangle?\n // not sure if this is the best idea, maybe should be returning undefined\n return target.set(-2, -1, -1);\n const invDenom = 1 / denom;\n const u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n const v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n // barycentric coordinates must always sum to 1\n return target.set(1 - u - v, v, u);\n }\n static containsPoint(point, a, b, c) {\n this.getBarycoord(point, a, b, c, $d5b33d7c30034067$var$_v3$1);\n return $d5b33d7c30034067$var$_v3$1.x >= 0 && $d5b33d7c30034067$var$_v3$1.y >= 0 && $d5b33d7c30034067$var$_v3$1.x + $d5b33d7c30034067$var$_v3$1.y <= 1;\n }\n static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) {\n if ($d5b33d7c30034067$var$warnedGetUV === false) {\n console.warn(\"THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().\");\n $d5b33d7c30034067$var$warnedGetUV = true;\n }\n return this.getInterpolation(point, p1, p2, p3, uv1, uv2, uv3, target);\n }\n static getInterpolation(point, p1, p2, p3, v1, v2, v3, target) {\n this.getBarycoord(point, p1, p2, p3, $d5b33d7c30034067$var$_v3$1);\n target.setScalar(0);\n target.addScaledVector(v1, $d5b33d7c30034067$var$_v3$1.x);\n target.addScaledVector(v2, $d5b33d7c30034067$var$_v3$1.y);\n target.addScaledVector(v3, $d5b33d7c30034067$var$_v3$1.z);\n return target;\n }\n static isFrontFacing(a, b, c, direction) {\n $d5b33d7c30034067$var$_v0$1.subVectors(c, b);\n $d5b33d7c30034067$var$_v1$3.subVectors(a, b);\n // strictly front facing\n return $d5b33d7c30034067$var$_v0$1.cross($d5b33d7c30034067$var$_v1$3).dot(direction) < 0 ? true : false;\n }\n set(a, b, c) {\n this.a.copy(a);\n this.b.copy(b);\n this.c.copy(c);\n return this;\n }\n setFromPointsAndIndices(points, i0, i1, i2) {\n this.a.copy(points[i0]);\n this.b.copy(points[i1]);\n this.c.copy(points[i2]);\n return this;\n }\n setFromAttributeAndIndices(attribute, i0, i1, i2) {\n this.a.fromBufferAttribute(attribute, i0);\n this.b.fromBufferAttribute(attribute, i1);\n this.c.fromBufferAttribute(attribute, i2);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(triangle) {\n this.a.copy(triangle.a);\n this.b.copy(triangle.b);\n this.c.copy(triangle.c);\n return this;\n }\n getArea() {\n $d5b33d7c30034067$var$_v0$1.subVectors(this.c, this.b);\n $d5b33d7c30034067$var$_v1$3.subVectors(this.a, this.b);\n return $d5b33d7c30034067$var$_v0$1.cross($d5b33d7c30034067$var$_v1$3).length() * 0.5;\n }\n getMidpoint(target) {\n return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);\n }\n getNormal(target) {\n return $d5b33d7c30034067$export$5a465592bfe74b48.getNormal(this.a, this.b, this.c, target);\n }\n getPlane(target) {\n return target.setFromCoplanarPoints(this.a, this.b, this.c);\n }\n getBarycoord(point, target) {\n return $d5b33d7c30034067$export$5a465592bfe74b48.getBarycoord(point, this.a, this.b, this.c, target);\n }\n getUV(point, uv1, uv2, uv3, target) {\n if ($d5b33d7c30034067$var$warnedGetUV === false) {\n console.warn(\"THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().\");\n $d5b33d7c30034067$var$warnedGetUV = true;\n }\n return $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation(point, this.a, this.b, this.c, uv1, uv2, uv3, target);\n }\n getInterpolation(point, v1, v2, v3, target) {\n return $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target);\n }\n containsPoint(point) {\n return $d5b33d7c30034067$export$5a465592bfe74b48.containsPoint(point, this.a, this.b, this.c);\n }\n isFrontFacing(direction) {\n return $d5b33d7c30034067$export$5a465592bfe74b48.isFrontFacing(this.a, this.b, this.c, direction);\n }\n intersectsBox(box) {\n return box.intersectsTriangle(this);\n }\n closestPointToPoint(p, target) {\n const a = this.a, b = this.b, c = this.c;\n let v, w;\n // algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n // under the accompanying license; see chapter 5.1.5 for detailed explanation.\n // basically, we're distinguishing which of the voronoi regions of the triangle\n // the point lies in with the minimum amount of redundant computation.\n $d5b33d7c30034067$var$_vab.subVectors(b, a);\n $d5b33d7c30034067$var$_vac.subVectors(c, a);\n $d5b33d7c30034067$var$_vap.subVectors(p, a);\n const d1 = $d5b33d7c30034067$var$_vab.dot($d5b33d7c30034067$var$_vap);\n const d2 = $d5b33d7c30034067$var$_vac.dot($d5b33d7c30034067$var$_vap);\n if (d1 <= 0 && d2 <= 0) // vertex region of A; barycentric coords (1, 0, 0)\n return target.copy(a);\n $d5b33d7c30034067$var$_vbp.subVectors(p, b);\n const d3 = $d5b33d7c30034067$var$_vab.dot($d5b33d7c30034067$var$_vbp);\n const d4 = $d5b33d7c30034067$var$_vac.dot($d5b33d7c30034067$var$_vbp);\n if (d3 >= 0 && d4 <= d3) // vertex region of B; barycentric coords (0, 1, 0)\n return target.copy(b);\n const vc = d1 * d4 - d3 * d2;\n if (vc <= 0 && d1 >= 0 && d3 <= 0) {\n v = d1 / (d1 - d3);\n // edge region of AB; barycentric coords (1-v, v, 0)\n return target.copy(a).addScaledVector($d5b33d7c30034067$var$_vab, v);\n }\n $d5b33d7c30034067$var$_vcp.subVectors(p, c);\n const d5 = $d5b33d7c30034067$var$_vab.dot($d5b33d7c30034067$var$_vcp);\n const d6 = $d5b33d7c30034067$var$_vac.dot($d5b33d7c30034067$var$_vcp);\n if (d6 >= 0 && d5 <= d6) // vertex region of C; barycentric coords (0, 0, 1)\n return target.copy(c);\n const vb = d5 * d2 - d1 * d6;\n if (vb <= 0 && d2 >= 0 && d6 <= 0) {\n w = d2 / (d2 - d6);\n // edge region of AC; barycentric coords (1-w, 0, w)\n return target.copy(a).addScaledVector($d5b33d7c30034067$var$_vac, w);\n }\n const va = d3 * d6 - d5 * d4;\n if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {\n $d5b33d7c30034067$var$_vbc.subVectors(c, b);\n w = (d4 - d3) / (d4 - d3 + (d5 - d6));\n // edge region of BC; barycentric coords (0, 1-w, w)\n return target.copy(b).addScaledVector($d5b33d7c30034067$var$_vbc, w); // edge region of BC\n }\n // face region\n const denom = 1 / (va + vb + vc);\n // u = va * denom\n v = vb * denom;\n w = vc * denom;\n return target.copy(a).addScaledVector($d5b33d7c30034067$var$_vab, v).addScaledVector($d5b33d7c30034067$var$_vac, w);\n }\n equals(triangle) {\n return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);\n }\n}\nlet $d5b33d7c30034067$var$materialId = 0;\nclass $d5b33d7c30034067$export$a2d8b23205c25948 extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isMaterial = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$materialId++\n });\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.name = \"\";\n this.type = \"Material\";\n this.blending = $d5b33d7c30034067$export$5b29a26d96ee6af0;\n this.side = $d5b33d7c30034067$export$2ede184fc2998901;\n this.vertexColors = false;\n this.opacity = 1;\n this.transparent = false;\n this.alphaHash = false;\n this.blendSrc = $d5b33d7c30034067$export$d5773124e86cf28c;\n this.blendDst = $d5b33d7c30034067$export$11d468cc7f19e971;\n this.blendEquation = $d5b33d7c30034067$export$20183a0484ce21a0;\n this.blendSrcAlpha = null;\n this.blendDstAlpha = null;\n this.blendEquationAlpha = null;\n this.depthFunc = $d5b33d7c30034067$export$296f78a0b892f81a;\n this.depthTest = true;\n this.depthWrite = true;\n this.stencilWriteMask = 0xff;\n this.stencilFunc = $d5b33d7c30034067$export$14cf96713ddd97a8;\n this.stencilRef = 0;\n this.stencilFuncMask = 0xff;\n this.stencilFail = $d5b33d7c30034067$export$9f542ae4b5baca34;\n this.stencilZFail = $d5b33d7c30034067$export$9f542ae4b5baca34;\n this.stencilZPass = $d5b33d7c30034067$export$9f542ae4b5baca34;\n this.stencilWrite = false;\n this.clippingPlanes = null;\n this.clipIntersection = false;\n this.clipShadows = false;\n this.shadowSide = null;\n this.colorWrite = true;\n this.precision = null; // override the renderer's default precision for this material\n this.polygonOffset = false;\n this.polygonOffsetFactor = 0;\n this.polygonOffsetUnits = 0;\n this.dithering = false;\n this.alphaToCoverage = false;\n this.premultipliedAlpha = false;\n this.forceSinglePass = false;\n this.visible = true;\n this.toneMapped = true;\n this.userData = {};\n this.version = 0;\n this._alphaTest = 0;\n }\n get alphaTest() {\n return this._alphaTest;\n }\n set alphaTest(value) {\n if (this._alphaTest > 0 !== value > 0) this.version++;\n this._alphaTest = value;\n }\n onBuild() {}\n onBeforeRender() {}\n onBeforeCompile() {}\n customProgramCacheKey() {\n return this.onBeforeCompile.toString();\n }\n setValues(values) {\n if (values === undefined) return;\n for(const key in values){\n const newValue = values[key];\n if (newValue === undefined) {\n console.warn(`THREE.Material: parameter '${key}' has value of undefined.`);\n continue;\n }\n const currentValue = this[key];\n if (currentValue === undefined) {\n console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`);\n continue;\n }\n if (currentValue && currentValue.isColor) currentValue.set(newValue);\n else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) currentValue.copy(newValue);\n else this[key] = newValue;\n }\n }\n toJSON(meta) {\n const isRootObject = meta === undefined || typeof meta === \"string\";\n if (isRootObject) meta = {\n textures: {},\n images: {}\n };\n const data = {\n metadata: {\n version: 4.6,\n type: \"Material\",\n generator: \"Material.toJSON\"\n }\n };\n // standard Material serialization\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== \"\") data.name = this.name;\n if (this.color && this.color.isColor) data.color = this.color.getHex();\n if (this.roughness !== undefined) data.roughness = this.roughness;\n if (this.metalness !== undefined) data.metalness = this.metalness;\n if (this.sheen !== undefined) data.sheen = this.sheen;\n if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();\n if (this.sheenRoughness !== undefined) data.sheenRoughness = this.sheenRoughness;\n if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();\n if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;\n if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();\n if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;\n if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();\n if (this.shininess !== undefined) data.shininess = this.shininess;\n if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;\n if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;\n if (this.clearcoatMap && this.clearcoatMap.isTexture) data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;\n if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;\n if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {\n data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;\n data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n }\n if (this.iridescence !== undefined) data.iridescence = this.iridescence;\n if (this.iridescenceIOR !== undefined) data.iridescenceIOR = this.iridescenceIOR;\n if (this.iridescenceThicknessRange !== undefined) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n if (this.iridescenceMap && this.iridescenceMap.isTexture) data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid;\n if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid;\n if (this.anisotropy !== undefined) data.anisotropy = this.anisotropy;\n if (this.anisotropyRotation !== undefined) data.anisotropyRotation = this.anisotropyRotation;\n if (this.anisotropyMap && this.anisotropyMap.isTexture) data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid;\n if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;\n if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;\n if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;\n if (this.lightMap && this.lightMap.isTexture) {\n data.lightMap = this.lightMap.toJSON(meta).uuid;\n data.lightMapIntensity = this.lightMapIntensity;\n }\n if (this.aoMap && this.aoMap.isTexture) {\n data.aoMap = this.aoMap.toJSON(meta).uuid;\n data.aoMapIntensity = this.aoMapIntensity;\n }\n if (this.bumpMap && this.bumpMap.isTexture) {\n data.bumpMap = this.bumpMap.toJSON(meta).uuid;\n data.bumpScale = this.bumpScale;\n }\n if (this.normalMap && this.normalMap.isTexture) {\n data.normalMap = this.normalMap.toJSON(meta).uuid;\n data.normalMapType = this.normalMapType;\n data.normalScale = this.normalScale.toArray();\n }\n if (this.displacementMap && this.displacementMap.isTexture) {\n data.displacementMap = this.displacementMap.toJSON(meta).uuid;\n data.displacementScale = this.displacementScale;\n data.displacementBias = this.displacementBias;\n }\n if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;\n if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;\n if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;\n if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;\n if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;\n if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;\n if (this.envMap && this.envMap.isTexture) {\n data.envMap = this.envMap.toJSON(meta).uuid;\n if (this.combine !== undefined) data.combine = this.combine;\n }\n if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;\n if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;\n if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;\n if (this.gradientMap && this.gradientMap.isTexture) data.gradientMap = this.gradientMap.toJSON(meta).uuid;\n if (this.transmission !== undefined) data.transmission = this.transmission;\n if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;\n if (this.thickness !== undefined) data.thickness = this.thickness;\n if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;\n if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;\n if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();\n if (this.size !== undefined) data.size = this.size;\n if (this.shadowSide !== null) data.shadowSide = this.shadowSide;\n if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;\n if (this.blending !== $d5b33d7c30034067$export$5b29a26d96ee6af0) data.blending = this.blending;\n if (this.side !== $d5b33d7c30034067$export$2ede184fc2998901) data.side = this.side;\n if (this.vertexColors) data.vertexColors = true;\n if (this.opacity < 1) data.opacity = this.opacity;\n if (this.transparent === true) data.transparent = this.transparent;\n data.depthFunc = this.depthFunc;\n data.depthTest = this.depthTest;\n data.depthWrite = this.depthWrite;\n data.colorWrite = this.colorWrite;\n data.stencilWrite = this.stencilWrite;\n data.stencilWriteMask = this.stencilWriteMask;\n data.stencilFunc = this.stencilFunc;\n data.stencilRef = this.stencilRef;\n data.stencilFuncMask = this.stencilFuncMask;\n data.stencilFail = this.stencilFail;\n data.stencilZFail = this.stencilZFail;\n data.stencilZPass = this.stencilZPass;\n // rotation (SpriteMaterial)\n if (this.rotation !== undefined && this.rotation !== 0) data.rotation = this.rotation;\n if (this.polygonOffset === true) data.polygonOffset = true;\n if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;\n if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;\n if (this.linewidth !== undefined && this.linewidth !== 1) data.linewidth = this.linewidth;\n if (this.dashSize !== undefined) data.dashSize = this.dashSize;\n if (this.gapSize !== undefined) data.gapSize = this.gapSize;\n if (this.scale !== undefined) data.scale = this.scale;\n if (this.dithering === true) data.dithering = true;\n if (this.alphaTest > 0) data.alphaTest = this.alphaTest;\n if (this.alphaHash === true) data.alphaHash = this.alphaHash;\n if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;\n if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;\n if (this.forceSinglePass === true) data.forceSinglePass = this.forceSinglePass;\n if (this.wireframe === true) data.wireframe = this.wireframe;\n if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;\n if (this.wireframeLinecap !== \"round\") data.wireframeLinecap = this.wireframeLinecap;\n if (this.wireframeLinejoin !== \"round\") data.wireframeLinejoin = this.wireframeLinejoin;\n if (this.flatShading === true) data.flatShading = this.flatShading;\n if (this.visible === false) data.visible = false;\n if (this.toneMapped === false) data.toneMapped = false;\n if (this.fog === false) data.fog = false;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n // TODO: Copied from Object3D.toJSON\n function extractFromCache(cache) {\n const values = [];\n for(const key in cache){\n const data = cache[key];\n delete data.metadata;\n values.push(data);\n }\n return values;\n }\n if (isRootObject) {\n const textures = extractFromCache(meta.textures);\n const images = extractFromCache(meta.images);\n if (textures.length > 0) data.textures = textures;\n if (images.length > 0) data.images = images;\n }\n return data;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.name = source.name;\n this.blending = source.blending;\n this.side = source.side;\n this.vertexColors = source.vertexColors;\n this.opacity = source.opacity;\n this.transparent = source.transparent;\n this.blendSrc = source.blendSrc;\n this.blendDst = source.blendDst;\n this.blendEquation = source.blendEquation;\n this.blendSrcAlpha = source.blendSrcAlpha;\n this.blendDstAlpha = source.blendDstAlpha;\n this.blendEquationAlpha = source.blendEquationAlpha;\n this.depthFunc = source.depthFunc;\n this.depthTest = source.depthTest;\n this.depthWrite = source.depthWrite;\n this.stencilWriteMask = source.stencilWriteMask;\n this.stencilFunc = source.stencilFunc;\n this.stencilRef = source.stencilRef;\n this.stencilFuncMask = source.stencilFuncMask;\n this.stencilFail = source.stencilFail;\n this.stencilZFail = source.stencilZFail;\n this.stencilZPass = source.stencilZPass;\n this.stencilWrite = source.stencilWrite;\n const srcPlanes = source.clippingPlanes;\n let dstPlanes = null;\n if (srcPlanes !== null) {\n const n = srcPlanes.length;\n dstPlanes = new Array(n);\n for(let i = 0; i !== n; ++i)dstPlanes[i] = srcPlanes[i].clone();\n }\n this.clippingPlanes = dstPlanes;\n this.clipIntersection = source.clipIntersection;\n this.clipShadows = source.clipShadows;\n this.shadowSide = source.shadowSide;\n this.colorWrite = source.colorWrite;\n this.precision = source.precision;\n this.polygonOffset = source.polygonOffset;\n this.polygonOffsetFactor = source.polygonOffsetFactor;\n this.polygonOffsetUnits = source.polygonOffsetUnits;\n this.dithering = source.dithering;\n this.alphaTest = source.alphaTest;\n this.alphaHash = source.alphaHash;\n this.alphaToCoverage = source.alphaToCoverage;\n this.premultipliedAlpha = source.premultipliedAlpha;\n this.forceSinglePass = source.forceSinglePass;\n this.visible = source.visible;\n this.toneMapped = source.toneMapped;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n}\nconst $d5b33d7c30034067$var$_colorKeywords = {\n \"aliceblue\": 0xF0F8FF,\n \"antiquewhite\": 0xFAEBD7,\n \"aqua\": 0x00FFFF,\n \"aquamarine\": 0x7FFFD4,\n \"azure\": 0xF0FFFF,\n \"beige\": 0xF5F5DC,\n \"bisque\": 0xFFE4C4,\n \"black\": 0x000000,\n \"blanchedalmond\": 0xFFEBCD,\n \"blue\": 0x0000FF,\n \"blueviolet\": 0x8A2BE2,\n \"brown\": 0xA52A2A,\n \"burlywood\": 0xDEB887,\n \"cadetblue\": 0x5F9EA0,\n \"chartreuse\": 0x7FFF00,\n \"chocolate\": 0xD2691E,\n \"coral\": 0xFF7F50,\n \"cornflowerblue\": 0x6495ED,\n \"cornsilk\": 0xFFF8DC,\n \"crimson\": 0xDC143C,\n \"cyan\": 0x00FFFF,\n \"darkblue\": 0x00008B,\n \"darkcyan\": 0x008B8B,\n \"darkgoldenrod\": 0xB8860B,\n \"darkgray\": 0xA9A9A9,\n \"darkgreen\": 0x006400,\n \"darkgrey\": 0xA9A9A9,\n \"darkkhaki\": 0xBDB76B,\n \"darkmagenta\": 0x8B008B,\n \"darkolivegreen\": 0x556B2F,\n \"darkorange\": 0xFF8C00,\n \"darkorchid\": 0x9932CC,\n \"darkred\": 0x8B0000,\n \"darksalmon\": 0xE9967A,\n \"darkseagreen\": 0x8FBC8F,\n \"darkslateblue\": 0x483D8B,\n \"darkslategray\": 0x2F4F4F,\n \"darkslategrey\": 0x2F4F4F,\n \"darkturquoise\": 0x00CED1,\n \"darkviolet\": 0x9400D3,\n \"deeppink\": 0xFF1493,\n \"deepskyblue\": 0x00BFFF,\n \"dimgray\": 0x696969,\n \"dimgrey\": 0x696969,\n \"dodgerblue\": 0x1E90FF,\n \"firebrick\": 0xB22222,\n \"floralwhite\": 0xFFFAF0,\n \"forestgreen\": 0x228B22,\n \"fuchsia\": 0xFF00FF,\n \"gainsboro\": 0xDCDCDC,\n \"ghostwhite\": 0xF8F8FF,\n \"gold\": 0xFFD700,\n \"goldenrod\": 0xDAA520,\n \"gray\": 0x808080,\n \"green\": 0x008000,\n \"greenyellow\": 0xADFF2F,\n \"grey\": 0x808080,\n \"honeydew\": 0xF0FFF0,\n \"hotpink\": 0xFF69B4,\n \"indianred\": 0xCD5C5C,\n \"indigo\": 0x4B0082,\n \"ivory\": 0xFFFFF0,\n \"khaki\": 0xF0E68C,\n \"lavender\": 0xE6E6FA,\n \"lavenderblush\": 0xFFF0F5,\n \"lawngreen\": 0x7CFC00,\n \"lemonchiffon\": 0xFFFACD,\n \"lightblue\": 0xADD8E6,\n \"lightcoral\": 0xF08080,\n \"lightcyan\": 0xE0FFFF,\n \"lightgoldenrodyellow\": 0xFAFAD2,\n \"lightgray\": 0xD3D3D3,\n \"lightgreen\": 0x90EE90,\n \"lightgrey\": 0xD3D3D3,\n \"lightpink\": 0xFFB6C1,\n \"lightsalmon\": 0xFFA07A,\n \"lightseagreen\": 0x20B2AA,\n \"lightskyblue\": 0x87CEFA,\n \"lightslategray\": 0x778899,\n \"lightslategrey\": 0x778899,\n \"lightsteelblue\": 0xB0C4DE,\n \"lightyellow\": 0xFFFFE0,\n \"lime\": 0x00FF00,\n \"limegreen\": 0x32CD32,\n \"linen\": 0xFAF0E6,\n \"magenta\": 0xFF00FF,\n \"maroon\": 0x800000,\n \"mediumaquamarine\": 0x66CDAA,\n \"mediumblue\": 0x0000CD,\n \"mediumorchid\": 0xBA55D3,\n \"mediumpurple\": 0x9370DB,\n \"mediumseagreen\": 0x3CB371,\n \"mediumslateblue\": 0x7B68EE,\n \"mediumspringgreen\": 0x00FA9A,\n \"mediumturquoise\": 0x48D1CC,\n \"mediumvioletred\": 0xC71585,\n \"midnightblue\": 0x191970,\n \"mintcream\": 0xF5FFFA,\n \"mistyrose\": 0xFFE4E1,\n \"moccasin\": 0xFFE4B5,\n \"navajowhite\": 0xFFDEAD,\n \"navy\": 0x000080,\n \"oldlace\": 0xFDF5E6,\n \"olive\": 0x808000,\n \"olivedrab\": 0x6B8E23,\n \"orange\": 0xFFA500,\n \"orangered\": 0xFF4500,\n \"orchid\": 0xDA70D6,\n \"palegoldenrod\": 0xEEE8AA,\n \"palegreen\": 0x98FB98,\n \"paleturquoise\": 0xAFEEEE,\n \"palevioletred\": 0xDB7093,\n \"papayawhip\": 0xFFEFD5,\n \"peachpuff\": 0xFFDAB9,\n \"peru\": 0xCD853F,\n \"pink\": 0xFFC0CB,\n \"plum\": 0xDDA0DD,\n \"powderblue\": 0xB0E0E6,\n \"purple\": 0x800080,\n \"rebeccapurple\": 0x663399,\n \"red\": 0xFF0000,\n \"rosybrown\": 0xBC8F8F,\n \"royalblue\": 0x4169E1,\n \"saddlebrown\": 0x8B4513,\n \"salmon\": 0xFA8072,\n \"sandybrown\": 0xF4A460,\n \"seagreen\": 0x2E8B57,\n \"seashell\": 0xFFF5EE,\n \"sienna\": 0xA0522D,\n \"silver\": 0xC0C0C0,\n \"skyblue\": 0x87CEEB,\n \"slateblue\": 0x6A5ACD,\n \"slategray\": 0x708090,\n \"slategrey\": 0x708090,\n \"snow\": 0xFFFAFA,\n \"springgreen\": 0x00FF7F,\n \"steelblue\": 0x4682B4,\n \"tan\": 0xD2B48C,\n \"teal\": 0x008080,\n \"thistle\": 0xD8BFD8,\n \"tomato\": 0xFF6347,\n \"turquoise\": 0x40E0D0,\n \"violet\": 0xEE82EE,\n \"wheat\": 0xF5DEB3,\n \"white\": 0xFFFFFF,\n \"whitesmoke\": 0xF5F5F5,\n \"yellow\": 0xFFFF00,\n \"yellowgreen\": 0x9ACD32\n};\nconst $d5b33d7c30034067$var$_hslA = {\n h: 0,\n s: 0,\n l: 0\n};\nconst $d5b33d7c30034067$var$_hslB = {\n h: 0,\n s: 0,\n l: 0\n};\nfunction $d5b33d7c30034067$var$hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 0.5) return q;\n if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);\n return p;\n}\nclass $d5b33d7c30034067$export$892596cec99bc70e {\n constructor(r, g, b){\n this.isColor = true;\n this.r = 1;\n this.g = 1;\n this.b = 1;\n return this.set(r, g, b);\n }\n set(r, g, b) {\n if (g === undefined && b === undefined) {\n // r is THREE.Color, hex or string\n const value = r;\n if (value && value.isColor) this.copy(value);\n else if (typeof value === \"number\") this.setHex(value);\n else if (typeof value === \"string\") this.setStyle(value);\n } else this.setRGB(r, g, b);\n return this;\n }\n setScalar(scalar) {\n this.r = scalar;\n this.g = scalar;\n this.b = scalar;\n return this;\n }\n setHex(hex, colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n hex = Math.floor(hex);\n this.r = (hex >> 16 & 255) / 255;\n this.g = (hex >> 8 & 255) / 255;\n this.b = (hex & 255) / 255;\n $d5b33d7c30034067$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setRGB(r, g, b, colorSpace1 = $d5b33d7c30034067$export$5e6fd513f44698c.workingColorSpace) {\n this.r = r;\n this.g = g;\n this.b = b;\n $d5b33d7c30034067$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setHSL(h, s, l, colorSpace1 = $d5b33d7c30034067$export$5e6fd513f44698c.workingColorSpace) {\n // h,s,l ranges are in 0.0 - 1.0\n h = $d5b33d7c30034067$var$euclideanModulo(h, 1);\n s = $d5b33d7c30034067$var$clamp(s, 0, 1);\n l = $d5b33d7c30034067$var$clamp(l, 0, 1);\n if (s === 0) this.r = this.g = this.b = l;\n else {\n const p = l <= 0.5 ? l * (1 + s) : l + s - l * s;\n const q = 2 * l - p;\n this.r = $d5b33d7c30034067$var$hue2rgb(q, p, h + 1 / 3);\n this.g = $d5b33d7c30034067$var$hue2rgb(q, p, h);\n this.b = $d5b33d7c30034067$var$hue2rgb(q, p, h - 1 / 3);\n }\n $d5b33d7c30034067$export$5e6fd513f44698c.toWorkingColorSpace(this, colorSpace1);\n return this;\n }\n setStyle(style, colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n function handleAlpha(string) {\n if (string === undefined) return;\n if (parseFloat(string) < 1) console.warn(\"THREE.Color: Alpha component of \" + style + \" will be ignored.\");\n }\n let m;\n if (m = /^(\\w+)\\(([^\\)]*)\\)/.exec(style)) {\n // rgb / hsl\n let color;\n const name = m[1];\n const components = m[2];\n switch(name){\n case \"rgb\":\n case \"rgba\":\n if (color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(255,0,0) rgba(255,0,0,0.5)\n handleAlpha(color[4]);\n return this.setRGB(Math.min(255, parseInt(color[1], 10)) / 255, Math.min(255, parseInt(color[2], 10)) / 255, Math.min(255, parseInt(color[3], 10)) / 255, colorSpace1);\n }\n if (color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n handleAlpha(color[4]);\n return this.setRGB(Math.min(100, parseInt(color[1], 10)) / 100, Math.min(100, parseInt(color[2], 10)) / 100, Math.min(100, parseInt(color[3], 10)) / 100, colorSpace1);\n }\n break;\n case \"hsl\":\n case \"hsla\":\n if (color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n handleAlpha(color[4]);\n return this.setHSL(parseFloat(color[1]) / 360, parseFloat(color[2]) / 100, parseFloat(color[3]) / 100, colorSpace1);\n }\n break;\n default:\n console.warn(\"THREE.Color: Unknown color model \" + style);\n }\n } else if (m = /^\\#([A-Fa-f\\d]+)$/.exec(style)) {\n // hex color\n const hex = m[1];\n const size = hex.length;\n if (size === 3) // #ff0\n return this.setRGB(parseInt(hex.charAt(0), 16) / 15, parseInt(hex.charAt(1), 16) / 15, parseInt(hex.charAt(2), 16) / 15, colorSpace1);\n else if (size === 6) // #ff0000\n return this.setHex(parseInt(hex, 16), colorSpace1);\n else console.warn(\"THREE.Color: Invalid hex color \" + style);\n } else if (style && style.length > 0) return this.setColorName(style, colorSpace1);\n return this;\n }\n setColorName(style, colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n // color keywords\n const hex = $d5b33d7c30034067$var$_colorKeywords[style.toLowerCase()];\n if (hex !== undefined) // red\n this.setHex(hex, colorSpace1);\n else // unknown color\n console.warn(\"THREE.Color: Unknown color \" + style);\n return this;\n }\n clone() {\n return new this.constructor(this.r, this.g, this.b);\n }\n copy(color) {\n this.r = color.r;\n this.g = color.g;\n this.b = color.b;\n return this;\n }\n copySRGBToLinear(color) {\n this.r = $d5b33d7c30034067$var$SRGBToLinear(color.r);\n this.g = $d5b33d7c30034067$var$SRGBToLinear(color.g);\n this.b = $d5b33d7c30034067$var$SRGBToLinear(color.b);\n return this;\n }\n copyLinearToSRGB(color) {\n this.r = $d5b33d7c30034067$var$LinearToSRGB(color.r);\n this.g = $d5b33d7c30034067$var$LinearToSRGB(color.g);\n this.b = $d5b33d7c30034067$var$LinearToSRGB(color.b);\n return this;\n }\n convertSRGBToLinear() {\n this.copySRGBToLinear(this);\n return this;\n }\n convertLinearToSRGB() {\n this.copyLinearToSRGB(this);\n return this;\n }\n getHex(colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n $d5b33d7c30034067$export$5e6fd513f44698c.fromWorkingColorSpace($d5b33d7c30034067$var$_color.copy(this), colorSpace1);\n return Math.round($d5b33d7c30034067$var$clamp($d5b33d7c30034067$var$_color.r * 255, 0, 255)) * 65536 + Math.round($d5b33d7c30034067$var$clamp($d5b33d7c30034067$var$_color.g * 255, 0, 255)) * 256 + Math.round($d5b33d7c30034067$var$clamp($d5b33d7c30034067$var$_color.b * 255, 0, 255));\n }\n getHexString(colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n return (\"000000\" + this.getHex(colorSpace1).toString(16)).slice(-6);\n }\n getHSL(target, colorSpace1 = $d5b33d7c30034067$export$5e6fd513f44698c.workingColorSpace) {\n // h,s,l ranges are in 0.0 - 1.0\n $d5b33d7c30034067$export$5e6fd513f44698c.fromWorkingColorSpace($d5b33d7c30034067$var$_color.copy(this), colorSpace1);\n const r = $d5b33d7c30034067$var$_color.r, g = $d5b33d7c30034067$var$_color.g, b = $d5b33d7c30034067$var$_color.b;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let hue, saturation;\n const lightness = (min + max) / 2.0;\n if (min === max) {\n hue = 0;\n saturation = 0;\n } else {\n const delta = max - min;\n saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);\n switch(max){\n case r:\n hue = (g - b) / delta + (g < b ? 6 : 0);\n break;\n case g:\n hue = (b - r) / delta + 2;\n break;\n case b:\n hue = (r - g) / delta + 4;\n break;\n }\n hue /= 6;\n }\n target.h = hue;\n target.s = saturation;\n target.l = lightness;\n return target;\n }\n getRGB(target, colorSpace1 = $d5b33d7c30034067$export$5e6fd513f44698c.workingColorSpace) {\n $d5b33d7c30034067$export$5e6fd513f44698c.fromWorkingColorSpace($d5b33d7c30034067$var$_color.copy(this), colorSpace1);\n target.r = $d5b33d7c30034067$var$_color.r;\n target.g = $d5b33d7c30034067$var$_color.g;\n target.b = $d5b33d7c30034067$var$_color.b;\n return target;\n }\n getStyle(colorSpace1 = $d5b33d7c30034067$export$561f394b24edfcaa) {\n $d5b33d7c30034067$export$5e6fd513f44698c.fromWorkingColorSpace($d5b33d7c30034067$var$_color.copy(this), colorSpace1);\n const r = $d5b33d7c30034067$var$_color.r, g = $d5b33d7c30034067$var$_color.g, b = $d5b33d7c30034067$var$_color.b;\n if (colorSpace1 !== $d5b33d7c30034067$export$561f394b24edfcaa) // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n return `color(${colorSpace1} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`;\n return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`;\n }\n offsetHSL(h, s, l) {\n this.getHSL($d5b33d7c30034067$var$_hslA);\n $d5b33d7c30034067$var$_hslA.h += h;\n $d5b33d7c30034067$var$_hslA.s += s;\n $d5b33d7c30034067$var$_hslA.l += l;\n this.setHSL($d5b33d7c30034067$var$_hslA.h, $d5b33d7c30034067$var$_hslA.s, $d5b33d7c30034067$var$_hslA.l);\n return this;\n }\n add(color) {\n this.r += color.r;\n this.g += color.g;\n this.b += color.b;\n return this;\n }\n addColors(color1, color2) {\n this.r = color1.r + color2.r;\n this.g = color1.g + color2.g;\n this.b = color1.b + color2.b;\n return this;\n }\n addScalar(s) {\n this.r += s;\n this.g += s;\n this.b += s;\n return this;\n }\n sub(color) {\n this.r = Math.max(0, this.r - color.r);\n this.g = Math.max(0, this.g - color.g);\n this.b = Math.max(0, this.b - color.b);\n return this;\n }\n multiply(color) {\n this.r *= color.r;\n this.g *= color.g;\n this.b *= color.b;\n return this;\n }\n multiplyScalar(s) {\n this.r *= s;\n this.g *= s;\n this.b *= s;\n return this;\n }\n lerp(color, alpha) {\n this.r += (color.r - this.r) * alpha;\n this.g += (color.g - this.g) * alpha;\n this.b += (color.b - this.b) * alpha;\n return this;\n }\n lerpColors(color1, color2, alpha) {\n this.r = color1.r + (color2.r - color1.r) * alpha;\n this.g = color1.g + (color2.g - color1.g) * alpha;\n this.b = color1.b + (color2.b - color1.b) * alpha;\n return this;\n }\n lerpHSL(color, alpha) {\n this.getHSL($d5b33d7c30034067$var$_hslA);\n color.getHSL($d5b33d7c30034067$var$_hslB);\n const h = $d5b33d7c30034067$var$lerp($d5b33d7c30034067$var$_hslA.h, $d5b33d7c30034067$var$_hslB.h, alpha);\n const s = $d5b33d7c30034067$var$lerp($d5b33d7c30034067$var$_hslA.s, $d5b33d7c30034067$var$_hslB.s, alpha);\n const l = $d5b33d7c30034067$var$lerp($d5b33d7c30034067$var$_hslA.l, $d5b33d7c30034067$var$_hslB.l, alpha);\n this.setHSL(h, s, l);\n return this;\n }\n setFromVector3(v) {\n this.r = v.x;\n this.g = v.y;\n this.b = v.z;\n return this;\n }\n applyMatrix3(m) {\n const r = this.r, g = this.g, b = this.b;\n const e = m.elements;\n this.r = e[0] * r + e[3] * g + e[6] * b;\n this.g = e[1] * r + e[4] * g + e[7] * b;\n this.b = e[2] * r + e[5] * g + e[8] * b;\n return this;\n }\n equals(c) {\n return c.r === this.r && c.g === this.g && c.b === this.b;\n }\n fromArray(array, offset = 0) {\n this.r = array[offset];\n this.g = array[offset + 1];\n this.b = array[offset + 2];\n return this;\n }\n toArray(array = [], offset = 0) {\n array[offset] = this.r;\n array[offset + 1] = this.g;\n array[offset + 2] = this.b;\n return array;\n }\n fromBufferAttribute(attribute, index) {\n this.r = attribute.getX(index);\n this.g = attribute.getY(index);\n this.b = attribute.getZ(index);\n return this;\n }\n toJSON() {\n return this.getHex();\n }\n *[Symbol.iterator]() {\n yield this.r;\n yield this.g;\n yield this.b;\n }\n}\nconst $d5b33d7c30034067$var$_color = /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e();\n$d5b33d7c30034067$export$892596cec99bc70e.NAMES = $d5b33d7c30034067$var$_colorKeywords;\nclass $d5b33d7c30034067$export$55cbcc9b622fe1f5 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshBasicMaterial = true;\n this.type = \"MeshBasicMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff); // emissive\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $d5b33d7c30034067$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n}\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\nconst $d5b33d7c30034067$var$_tables = /*@__PURE__*/ $d5b33d7c30034067$var$_generateTables();\nfunction $d5b33d7c30034067$var$_generateTables() {\n // float32 to float16 helpers\n const buffer = new ArrayBuffer(4);\n const floatView = new Float32Array(buffer);\n const uint32View = new Uint32Array(buffer);\n const baseTable = new Uint32Array(512);\n const shiftTable = new Uint32Array(512);\n for(let i = 0; i < 256; ++i){\n const e = i - 127;\n // very small number (0, -0)\n if (e < -27) {\n baseTable[i] = 0x0000;\n baseTable[i | 0x100] = 0x8000;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n // small number (denorm)\n } else if (e < -14) {\n baseTable[i] = 0x0400 >> -e - 14;\n baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;\n shiftTable[i] = -e - 1;\n shiftTable[i | 0x100] = -e - 1;\n // normal number\n } else if (e <= 15) {\n baseTable[i] = e + 15 << 10;\n baseTable[i | 0x100] = e + 15 << 10 | 0x8000;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n // large number (Infinity, -Infinity)\n } else if (e < 128) {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n // stay (NaN, Infinity, -Infinity)\n } else {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n }\n }\n // float16 to float32 helpers\n const mantissaTable = new Uint32Array(2048);\n const exponentTable = new Uint32Array(64);\n const offsetTable = new Uint32Array(64);\n for(let i = 1; i < 1024; ++i){\n let m = i << 13; // zero pad mantissa bits\n let e = 0; // zero exponent\n // normalized\n while((m & 0x00800000) === 0){\n m <<= 1;\n e -= 0x00800000; // decrement exponent\n }\n m &= -8388609; // clear leading 1 bit\n e += 0x38800000; // adjust bias\n mantissaTable[i] = m | e;\n }\n for(let i = 1024; i < 2048; ++i)mantissaTable[i] = 0x38000000 + (i - 1024 << 13);\n for(let i = 1; i < 31; ++i)exponentTable[i] = i << 23;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n for(let i = 33; i < 63; ++i)exponentTable[i] = 0x80000000 + (i - 32 << 23);\n exponentTable[63] = 0xc7800000;\n for(let i = 1; i < 64; ++i)if (i !== 32) offsetTable[i] = 1024;\n return {\n floatView: floatView,\n uint32View: uint32View,\n baseTable: baseTable,\n shiftTable: shiftTable,\n mantissaTable: mantissaTable,\n exponentTable: exponentTable,\n offsetTable: offsetTable\n };\n}\n// float32 to float16\nfunction $d5b33d7c30034067$var$toHalfFloat(val) {\n if (Math.abs(val) > 65504) console.warn(\"THREE.DataUtils.toHalfFloat(): Value out of range.\");\n val = $d5b33d7c30034067$var$clamp(val, -65504, 65504);\n $d5b33d7c30034067$var$_tables.floatView[0] = val;\n const f = $d5b33d7c30034067$var$_tables.uint32View[0];\n const e = f >> 23 & 0x1ff;\n return $d5b33d7c30034067$var$_tables.baseTable[e] + ((f & 0x007fffff) >> $d5b33d7c30034067$var$_tables.shiftTable[e]);\n}\n// float16 to float32\nfunction $d5b33d7c30034067$var$fromHalfFloat(val) {\n const m = val >> 10;\n $d5b33d7c30034067$var$_tables.uint32View[0] = $d5b33d7c30034067$var$_tables.mantissaTable[$d5b33d7c30034067$var$_tables.offsetTable[m] + (val & 0x3ff)] + $d5b33d7c30034067$var$_tables.exponentTable[m];\n return $d5b33d7c30034067$var$_tables.floatView[0];\n}\nconst $d5b33d7c30034067$export$11ce8b759162cc80 = {\n toHalfFloat: $d5b33d7c30034067$var$toHalfFloat,\n fromHalfFloat: $d5b33d7c30034067$var$fromHalfFloat\n};\nconst $d5b33d7c30034067$var$_vector$8 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vector2$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nclass $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized = false){\n if (Array.isArray(array)) throw new TypeError(\"THREE.BufferAttribute: array should be a Typed Array.\");\n this.isBufferAttribute = true;\n this.name = \"\";\n this.array = array;\n this.itemSize = itemSize;\n this.count = array !== undefined ? array.length / itemSize : 0;\n this.normalized = normalized;\n this.usage = $d5b33d7c30034067$export$763e8360f4d7f77d;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.gpuType = $d5b33d7c30034067$export$f6d331659b644596;\n this.version = 0;\n }\n onUploadCallback() {}\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n copy(source) {\n this.name = source.name;\n this.array = new source.array.constructor(source.array);\n this.itemSize = source.itemSize;\n this.count = source.count;\n this.normalized = source.normalized;\n this.usage = source.usage;\n this.gpuType = source.gpuType;\n return this;\n }\n copyAt(index1, attribute, index2) {\n index1 *= this.itemSize;\n index2 *= attribute.itemSize;\n for(let i = 0, l = this.itemSize; i < l; i++)this.array[index1 + i] = attribute.array[index2 + i];\n return this;\n }\n copyArray(array) {\n this.array.set(array);\n return this;\n }\n applyMatrix3(m) {\n if (this.itemSize === 2) for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector2$1.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector2$1.applyMatrix3(m);\n this.setXY(i, $d5b33d7c30034067$var$_vector2$1.x, $d5b33d7c30034067$var$_vector2$1.y);\n }\n else if (this.itemSize === 3) for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$8.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$8.applyMatrix3(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$8.x, $d5b33d7c30034067$var$_vector$8.y, $d5b33d7c30034067$var$_vector$8.z);\n }\n return this;\n }\n applyMatrix4(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$8.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$8.applyMatrix4(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$8.x, $d5b33d7c30034067$var$_vector$8.y, $d5b33d7c30034067$var$_vector$8.z);\n }\n return this;\n }\n applyNormalMatrix(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$8.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$8.applyNormalMatrix(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$8.x, $d5b33d7c30034067$var$_vector$8.y, $d5b33d7c30034067$var$_vector$8.z);\n }\n return this;\n }\n transformDirection(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$8.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$8.transformDirection(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$8.x, $d5b33d7c30034067$var$_vector$8.y, $d5b33d7c30034067$var$_vector$8.z);\n }\n return this;\n }\n set(value, offset = 0) {\n // Matching BufferAttribute constructor, do not normalize the array.\n this.array.set(value, offset);\n return this;\n }\n getComponent(index, component) {\n let value = this.array[index * this.itemSize + component];\n if (this.normalized) value = $d5b33d7c30034067$var$denormalize(value, this.array);\n return value;\n }\n setComponent(index, component, value) {\n if (this.normalized) value = $d5b33d7c30034067$var$normalize(value, this.array);\n this.array[index * this.itemSize + component] = value;\n return this;\n }\n getX(index) {\n let x = this.array[index * this.itemSize];\n if (this.normalized) x = $d5b33d7c30034067$var$denormalize(x, this.array);\n return x;\n }\n setX(index, x) {\n if (this.normalized) x = $d5b33d7c30034067$var$normalize(x, this.array);\n this.array[index * this.itemSize] = x;\n return this;\n }\n getY(index) {\n let y = this.array[index * this.itemSize + 1];\n if (this.normalized) y = $d5b33d7c30034067$var$denormalize(y, this.array);\n return y;\n }\n setY(index, y) {\n if (this.normalized) y = $d5b33d7c30034067$var$normalize(y, this.array);\n this.array[index * this.itemSize + 1] = y;\n return this;\n }\n getZ(index) {\n let z = this.array[index * this.itemSize + 2];\n if (this.normalized) z = $d5b33d7c30034067$var$denormalize(z, this.array);\n return z;\n }\n setZ(index, z) {\n if (this.normalized) z = $d5b33d7c30034067$var$normalize(z, this.array);\n this.array[index * this.itemSize + 2] = z;\n return this;\n }\n getW(index) {\n let w = this.array[index * this.itemSize + 3];\n if (this.normalized) w = $d5b33d7c30034067$var$denormalize(w, this.array);\n return w;\n }\n setW(index, w) {\n if (this.normalized) w = $d5b33d7c30034067$var$normalize(w, this.array);\n this.array[index * this.itemSize + 3] = w;\n return this;\n }\n setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n return this;\n }\n setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n w = $d5b33d7c30034067$var$normalize(w, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n this.array[index + 3] = w;\n return this;\n }\n onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n clone() {\n return new this.constructor(this.array, this.itemSize).copy(this);\n }\n toJSON() {\n const data = {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: Array.from(this.array),\n normalized: this.normalized\n };\n if (this.name !== \"\") data.name = this.name;\n if (this.usage !== $d5b33d7c30034067$export$763e8360f4d7f77d) data.usage = this.usage;\n if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;\n return data;\n }\n}\n//\nclass $d5b33d7c30034067$export$f9ff2d6a20248cbf extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int8Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$cacc90cf35d11cdd extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint8Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$baaa85a1a812c157 extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint8ClampedArray(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$2b755a102ccdcefe extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int16Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$640a853f68025f2e extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint16Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$46b369aed2968a0a extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Int32Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$7eb8c9fa25cd5bd6 extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint32Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$dbd3698c64958d69 extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Uint16Array(array), itemSize, normalized);\n this.isFloat16BufferAttribute = true;\n }\n getX(index) {\n let x = $d5b33d7c30034067$var$fromHalfFloat(this.array[index * this.itemSize]);\n if (this.normalized) x = $d5b33d7c30034067$var$denormalize(x, this.array);\n return x;\n }\n setX(index, x) {\n if (this.normalized) x = $d5b33d7c30034067$var$normalize(x, this.array);\n this.array[index * this.itemSize] = $d5b33d7c30034067$var$toHalfFloat(x);\n return this;\n }\n getY(index) {\n let y = $d5b33d7c30034067$var$fromHalfFloat(this.array[index * this.itemSize + 1]);\n if (this.normalized) y = $d5b33d7c30034067$var$denormalize(y, this.array);\n return y;\n }\n setY(index, y) {\n if (this.normalized) y = $d5b33d7c30034067$var$normalize(y, this.array);\n this.array[index * this.itemSize + 1] = $d5b33d7c30034067$var$toHalfFloat(y);\n return this;\n }\n getZ(index) {\n let z = $d5b33d7c30034067$var$fromHalfFloat(this.array[index * this.itemSize + 2]);\n if (this.normalized) z = $d5b33d7c30034067$var$denormalize(z, this.array);\n return z;\n }\n setZ(index, z) {\n if (this.normalized) z = $d5b33d7c30034067$var$normalize(z, this.array);\n this.array[index * this.itemSize + 2] = $d5b33d7c30034067$var$toHalfFloat(z);\n return this;\n }\n getW(index) {\n let w = $d5b33d7c30034067$var$fromHalfFloat(this.array[index * this.itemSize + 3]);\n if (this.normalized) w = $d5b33d7c30034067$var$denormalize(w, this.array);\n return w;\n }\n setW(index, w) {\n if (this.normalized) w = $d5b33d7c30034067$var$normalize(w, this.array);\n this.array[index * this.itemSize + 3] = $d5b33d7c30034067$var$toHalfFloat(w);\n return this;\n }\n setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n }\n this.array[index + 0] = $d5b33d7c30034067$var$toHalfFloat(x);\n this.array[index + 1] = $d5b33d7c30034067$var$toHalfFloat(y);\n return this;\n }\n setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n }\n this.array[index + 0] = $d5b33d7c30034067$var$toHalfFloat(x);\n this.array[index + 1] = $d5b33d7c30034067$var$toHalfFloat(y);\n this.array[index + 2] = $d5b33d7c30034067$var$toHalfFloat(z);\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n w = $d5b33d7c30034067$var$normalize(w, this.array);\n }\n this.array[index + 0] = $d5b33d7c30034067$var$toHalfFloat(x);\n this.array[index + 1] = $d5b33d7c30034067$var$toHalfFloat(y);\n this.array[index + 2] = $d5b33d7c30034067$var$toHalfFloat(z);\n this.array[index + 3] = $d5b33d7c30034067$var$toHalfFloat(w);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$cbe7a62641830ebd extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Float32Array(array), itemSize, normalized);\n }\n}\nclass $d5b33d7c30034067$export$9e0ade74842adbb8 extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized){\n super(new Float64Array(array), itemSize, normalized);\n }\n}\nlet $d5b33d7c30034067$var$_id$1 = 0;\nconst $d5b33d7c30034067$var$_m1 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_obj = /*@__PURE__*/ new $d5b33d7c30034067$export$e4dd07dff30cc924();\nconst $d5b33d7c30034067$var$_offset = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_box$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\nconst $d5b33d7c30034067$var$_boxMorphTargets = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\nconst $d5b33d7c30034067$var$_vector$7 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$b7be63a67df8959 extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isBufferGeometry = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$_id$1++\n });\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.name = \"\";\n this.type = \"BufferGeometry\";\n this.index = null;\n this.attributes = {};\n this.morphAttributes = {};\n this.morphTargetsRelative = false;\n this.groups = [];\n this.boundingBox = null;\n this.boundingSphere = null;\n this.drawRange = {\n start: 0,\n count: Infinity\n };\n this.userData = {};\n }\n getIndex() {\n return this.index;\n }\n setIndex(index) {\n if (Array.isArray(index)) this.index = new ($d5b33d7c30034067$var$arrayNeedsUint32(index) ? $d5b33d7c30034067$export$7eb8c9fa25cd5bd6 : $d5b33d7c30034067$export$640a853f68025f2e)(index, 1);\n else this.index = index;\n return this;\n }\n getAttribute(name) {\n return this.attributes[name];\n }\n setAttribute(name, attribute) {\n this.attributes[name] = attribute;\n return this;\n }\n deleteAttribute(name) {\n delete this.attributes[name];\n return this;\n }\n hasAttribute(name) {\n return this.attributes[name] !== undefined;\n }\n addGroup(start, count, materialIndex = 0) {\n this.groups.push({\n start: start,\n count: count,\n materialIndex: materialIndex\n });\n }\n clearGroups() {\n this.groups = [];\n }\n setDrawRange(start, count) {\n this.drawRange.start = start;\n this.drawRange.count = count;\n }\n applyMatrix4(matrix) {\n const position = this.attributes.position;\n if (position !== undefined) {\n position.applyMatrix4(matrix);\n position.needsUpdate = true;\n }\n const normal = this.attributes.normal;\n if (normal !== undefined) {\n const normalMatrix = new $d5b33d7c30034067$export$8ff26dafa08918().getNormalMatrix(matrix);\n normal.applyNormalMatrix(normalMatrix);\n normal.needsUpdate = true;\n }\n const tangent = this.attributes.tangent;\n if (tangent !== undefined) {\n tangent.transformDirection(matrix);\n tangent.needsUpdate = true;\n }\n if (this.boundingBox !== null) this.computeBoundingBox();\n if (this.boundingSphere !== null) this.computeBoundingSphere();\n return this;\n }\n applyQuaternion(q) {\n $d5b33d7c30034067$var$_m1.makeRotationFromQuaternion(q);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n rotateX(angle) {\n // rotate geometry around world x-axis\n $d5b33d7c30034067$var$_m1.makeRotationX(angle);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n rotateY(angle) {\n // rotate geometry around world y-axis\n $d5b33d7c30034067$var$_m1.makeRotationY(angle);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n rotateZ(angle) {\n // rotate geometry around world z-axis\n $d5b33d7c30034067$var$_m1.makeRotationZ(angle);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n translate(x, y, z) {\n // translate geometry\n $d5b33d7c30034067$var$_m1.makeTranslation(x, y, z);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n scale(x, y, z) {\n // scale geometry\n $d5b33d7c30034067$var$_m1.makeScale(x, y, z);\n this.applyMatrix4($d5b33d7c30034067$var$_m1);\n return this;\n }\n lookAt(vector) {\n $d5b33d7c30034067$var$_obj.lookAt(vector);\n $d5b33d7c30034067$var$_obj.updateMatrix();\n this.applyMatrix4($d5b33d7c30034067$var$_obj.matrix);\n return this;\n }\n center() {\n this.computeBoundingBox();\n this.boundingBox.getCenter($d5b33d7c30034067$var$_offset).negate();\n this.translate($d5b33d7c30034067$var$_offset.x, $d5b33d7c30034067$var$_offset.y, $d5b33d7c30034067$var$_offset.z);\n return this;\n }\n setFromPoints(points) {\n const position = [];\n for(let i = 0, l = points.length; i < l; i++){\n const point = points[i];\n position.push(point.x, point.y, point.z || 0);\n }\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(position, 3));\n return this;\n }\n computeBoundingBox() {\n if (this.boundingBox === null) this.boundingBox = new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\n const position = this.attributes.position;\n const morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingBox.set(new $d5b33d7c30034067$export$64b5c384219d3699(-Infinity, -Infinity, -Infinity), new $d5b33d7c30034067$export$64b5c384219d3699(Infinity, Infinity, Infinity));\n return;\n }\n if (position !== undefined) {\n this.boundingBox.setFromBufferAttribute(position);\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n $d5b33d7c30034067$var$_box$1.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n $d5b33d7c30034067$var$_vector$7.addVectors(this.boundingBox.min, $d5b33d7c30034067$var$_box$1.min);\n this.boundingBox.expandByPoint($d5b33d7c30034067$var$_vector$7);\n $d5b33d7c30034067$var$_vector$7.addVectors(this.boundingBox.max, $d5b33d7c30034067$var$_box$1.max);\n this.boundingBox.expandByPoint($d5b33d7c30034067$var$_vector$7);\n } else {\n this.boundingBox.expandByPoint($d5b33d7c30034067$var$_box$1.min);\n this.boundingBox.expandByPoint($d5b33d7c30034067$var$_box$1.max);\n }\n }\n } else this.boundingBox.makeEmpty();\n if (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);\n }\n computeBoundingSphere() {\n if (this.boundingSphere === null) this.boundingSphere = new $d5b33d7c30034067$export$805e8b72413ccaba();\n const position = this.attributes.position;\n const morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingSphere.set(new $d5b33d7c30034067$export$64b5c384219d3699(), Infinity);\n return;\n }\n if (position) {\n // first, find the center of the bounding sphere\n const center = this.boundingSphere.center;\n $d5b33d7c30034067$var$_box$1.setFromBufferAttribute(position);\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n $d5b33d7c30034067$var$_boxMorphTargets.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n $d5b33d7c30034067$var$_vector$7.addVectors($d5b33d7c30034067$var$_box$1.min, $d5b33d7c30034067$var$_boxMorphTargets.min);\n $d5b33d7c30034067$var$_box$1.expandByPoint($d5b33d7c30034067$var$_vector$7);\n $d5b33d7c30034067$var$_vector$7.addVectors($d5b33d7c30034067$var$_box$1.max, $d5b33d7c30034067$var$_boxMorphTargets.max);\n $d5b33d7c30034067$var$_box$1.expandByPoint($d5b33d7c30034067$var$_vector$7);\n } else {\n $d5b33d7c30034067$var$_box$1.expandByPoint($d5b33d7c30034067$var$_boxMorphTargets.min);\n $d5b33d7c30034067$var$_box$1.expandByPoint($d5b33d7c30034067$var$_boxMorphTargets.max);\n }\n }\n $d5b33d7c30034067$var$_box$1.getCenter(center);\n // second, try to find a boundingSphere with a radius smaller than the\n // boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n let maxRadiusSq = 0;\n for(let i = 0, il = position.count; i < il; i++){\n $d5b33d7c30034067$var$_vector$7.fromBufferAttribute(position, i);\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared($d5b33d7c30034067$var$_vector$7));\n }\n // process morph attributes if present\n if (morphAttributesPosition) for(let i = 0, il = morphAttributesPosition.length; i < il; i++){\n const morphAttribute = morphAttributesPosition[i];\n const morphTargetsRelative = this.morphTargetsRelative;\n for(let j = 0, jl = morphAttribute.count; j < jl; j++){\n $d5b33d7c30034067$var$_vector$7.fromBufferAttribute(morphAttribute, j);\n if (morphTargetsRelative) {\n $d5b33d7c30034067$var$_offset.fromBufferAttribute(position, j);\n $d5b33d7c30034067$var$_vector$7.add($d5b33d7c30034067$var$_offset);\n }\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared($d5b33d7c30034067$var$_vector$7));\n }\n }\n this.boundingSphere.radius = Math.sqrt(maxRadiusSq);\n if (isNaN(this.boundingSphere.radius)) console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this);\n }\n }\n computeTangents() {\n const index = this.index;\n const attributes = this.attributes;\n // based on http://www.terathon.com/code/tangent.html\n // (per vertex tangents)\n if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {\n console.error(\"THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)\");\n return;\n }\n const indices = index.array;\n const positions = attributes.position.array;\n const normals = attributes.normal.array;\n const uvs = attributes.uv.array;\n const nVertices = positions.length / 3;\n if (this.hasAttribute(\"tangent\") === false) this.setAttribute(\"tangent\", new $d5b33d7c30034067$export$8dea267bd6bde117(new Float32Array(4 * nVertices), 4));\n const tangents = this.getAttribute(\"tangent\").array;\n const tan1 = [], tan2 = [];\n for(let i = 0; i < nVertices; i++){\n tan1[i] = new $d5b33d7c30034067$export$64b5c384219d3699();\n tan2[i] = new $d5b33d7c30034067$export$64b5c384219d3699();\n }\n const vA = new $d5b33d7c30034067$export$64b5c384219d3699(), vB = new $d5b33d7c30034067$export$64b5c384219d3699(), vC = new $d5b33d7c30034067$export$64b5c384219d3699(), uvA = new $d5b33d7c30034067$export$c977b3e384af9ae1(), uvB = new $d5b33d7c30034067$export$c977b3e384af9ae1(), uvC = new $d5b33d7c30034067$export$c977b3e384af9ae1(), sdir = new $d5b33d7c30034067$export$64b5c384219d3699(), tdir = new $d5b33d7c30034067$export$64b5c384219d3699();\n function handleTriangle(a, b, c) {\n vA.fromArray(positions, a * 3);\n vB.fromArray(positions, b * 3);\n vC.fromArray(positions, c * 3);\n uvA.fromArray(uvs, a * 2);\n uvB.fromArray(uvs, b * 2);\n uvC.fromArray(uvs, c * 2);\n vB.sub(vA);\n vC.sub(vA);\n uvB.sub(uvA);\n uvC.sub(uvA);\n const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y);\n // silently ignore degenerate uv triangles having coincident or colinear vertices\n if (!isFinite(r)) return;\n sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);\n tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);\n tan1[a].add(sdir);\n tan1[b].add(sdir);\n tan1[c].add(sdir);\n tan2[a].add(tdir);\n tan2[b].add(tdir);\n tan2[c].add(tdir);\n }\n let groups = this.groups;\n if (groups.length === 0) groups = [\n {\n start: 0,\n count: indices.length\n }\n ];\n for(let i = 0, il = groups.length; i < il; ++i){\n const group = groups[i];\n const start = group.start;\n const count = group.count;\n for(let j = start, jl = start + count; j < jl; j += 3)handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);\n }\n const tmp = new $d5b33d7c30034067$export$64b5c384219d3699(), tmp2 = new $d5b33d7c30034067$export$64b5c384219d3699();\n const n = new $d5b33d7c30034067$export$64b5c384219d3699(), n2 = new $d5b33d7c30034067$export$64b5c384219d3699();\n function handleVertex(v) {\n n.fromArray(normals, v * 3);\n n2.copy(n);\n const t = tan1[v];\n // Gram-Schmidt orthogonalize\n tmp.copy(t);\n tmp.sub(n.multiplyScalar(n.dot(t))).normalize();\n // Calculate handedness\n tmp2.crossVectors(n2, t);\n const test = tmp2.dot(tan2[v]);\n const w = test < 0.0 ? -1 : 1.0;\n tangents[v * 4] = tmp.x;\n tangents[v * 4 + 1] = tmp.y;\n tangents[v * 4 + 2] = tmp.z;\n tangents[v * 4 + 3] = w;\n }\n for(let i = 0, il = groups.length; i < il; ++i){\n const group = groups[i];\n const start = group.start;\n const count = group.count;\n for(let j = start, jl = start + count; j < jl; j += 3){\n handleVertex(indices[j + 0]);\n handleVertex(indices[j + 1]);\n handleVertex(indices[j + 2]);\n }\n }\n }\n computeVertexNormals() {\n const index = this.index;\n const positionAttribute = this.getAttribute(\"position\");\n if (positionAttribute !== undefined) {\n let normalAttribute = this.getAttribute(\"normal\");\n if (normalAttribute === undefined) {\n normalAttribute = new $d5b33d7c30034067$export$8dea267bd6bde117(new Float32Array(positionAttribute.count * 3), 3);\n this.setAttribute(\"normal\", normalAttribute);\n } else // reset existing normals to zero\n for(let i = 0, il = normalAttribute.count; i < il; i++)normalAttribute.setXYZ(i, 0, 0, 0);\n const pA = new $d5b33d7c30034067$export$64b5c384219d3699(), pB = new $d5b33d7c30034067$export$64b5c384219d3699(), pC = new $d5b33d7c30034067$export$64b5c384219d3699();\n const nA = new $d5b33d7c30034067$export$64b5c384219d3699(), nB = new $d5b33d7c30034067$export$64b5c384219d3699(), nC = new $d5b33d7c30034067$export$64b5c384219d3699();\n const cb = new $d5b33d7c30034067$export$64b5c384219d3699(), ab = new $d5b33d7c30034067$export$64b5c384219d3699();\n // indexed elements\n if (index) for(let i = 0, il = index.count; i < il; i += 3){\n const vA = index.getX(i + 0);\n const vB = index.getX(i + 1);\n const vC = index.getX(i + 2);\n pA.fromBufferAttribute(positionAttribute, vA);\n pB.fromBufferAttribute(positionAttribute, vB);\n pC.fromBufferAttribute(positionAttribute, vC);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n nA.fromBufferAttribute(normalAttribute, vA);\n nB.fromBufferAttribute(normalAttribute, vB);\n nC.fromBufferAttribute(normalAttribute, vC);\n nA.add(cb);\n nB.add(cb);\n nC.add(cb);\n normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);\n normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);\n normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);\n }\n else // non-indexed elements (unconnected triangle soup)\n for(let i = 0, il = positionAttribute.count; i < il; i += 3){\n pA.fromBufferAttribute(positionAttribute, i + 0);\n pB.fromBufferAttribute(positionAttribute, i + 1);\n pC.fromBufferAttribute(positionAttribute, i + 2);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z);\n }\n this.normalizeNormals();\n normalAttribute.needsUpdate = true;\n }\n }\n normalizeNormals() {\n const normals = this.attributes.normal;\n for(let i = 0, il = normals.count; i < il; i++){\n $d5b33d7c30034067$var$_vector$7.fromBufferAttribute(normals, i);\n $d5b33d7c30034067$var$_vector$7.normalize();\n normals.setXYZ(i, $d5b33d7c30034067$var$_vector$7.x, $d5b33d7c30034067$var$_vector$7.y, $d5b33d7c30034067$var$_vector$7.z);\n }\n }\n toNonIndexed() {\n function convertBufferAttribute(attribute, indices) {\n const array = attribute.array;\n const itemSize = attribute.itemSize;\n const normalized = attribute.normalized;\n const array2 = new array.constructor(indices.length * itemSize);\n let index = 0, index2 = 0;\n for(let i = 0, l = indices.length; i < l; i++){\n if (attribute.isInterleavedBufferAttribute) index = indices[i] * attribute.data.stride + attribute.offset;\n else index = indices[i] * itemSize;\n for(let j = 0; j < itemSize; j++)array2[index2++] = array[index++];\n }\n return new $d5b33d7c30034067$export$8dea267bd6bde117(array2, itemSize, normalized);\n }\n //\n if (this.index === null) {\n console.warn(\"THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.\");\n return this;\n }\n const geometry2 = new $d5b33d7c30034067$export$b7be63a67df8959();\n const indices = this.index.array;\n const attributes = this.attributes;\n // attributes\n for(const name in attributes){\n const attribute = attributes[name];\n const newAttribute = convertBufferAttribute(attribute, indices);\n geometry2.setAttribute(name, newAttribute);\n }\n // morph attributes\n const morphAttributes = this.morphAttributes;\n for(const name in morphAttributes){\n const morphArray = [];\n const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes\n for(let i = 0, il = morphAttribute.length; i < il; i++){\n const attribute = morphAttribute[i];\n const newAttribute = convertBufferAttribute(attribute, indices);\n morphArray.push(newAttribute);\n }\n geometry2.morphAttributes[name] = morphArray;\n }\n geometry2.morphTargetsRelative = this.morphTargetsRelative;\n // groups\n const groups = this.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n geometry2.addGroup(group.start, group.count, group.materialIndex);\n }\n return geometry2;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"BufferGeometry\",\n generator: \"BufferGeometry.toJSON\"\n }\n };\n // standard BufferGeometry serialization\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== \"\") data.name = this.name;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n if (this.parameters !== undefined) {\n const parameters = this.parameters;\n for(const key in parameters)if (parameters[key] !== undefined) data[key] = parameters[key];\n return data;\n }\n // for simplicity the code assumes attributes are not shared across geometries, see #15811\n data.data = {\n attributes: {}\n };\n const index = this.index;\n if (index !== null) data.data.index = {\n type: index.array.constructor.name,\n array: Array.prototype.slice.call(index.array)\n };\n const attributes = this.attributes;\n for(const key in attributes){\n const attribute = attributes[key];\n data.data.attributes[key] = attribute.toJSON(data.data);\n }\n const morphAttributes = {};\n let hasMorphAttributes = false;\n for(const key in this.morphAttributes){\n const attributeArray = this.morphAttributes[key];\n const array = [];\n for(let i = 0, il = attributeArray.length; i < il; i++){\n const attribute = attributeArray[i];\n array.push(attribute.toJSON(data.data));\n }\n if (array.length > 0) {\n morphAttributes[key] = array;\n hasMorphAttributes = true;\n }\n }\n if (hasMorphAttributes) {\n data.data.morphAttributes = morphAttributes;\n data.data.morphTargetsRelative = this.morphTargetsRelative;\n }\n const groups = this.groups;\n if (groups.length > 0) data.data.groups = JSON.parse(JSON.stringify(groups));\n const boundingSphere = this.boundingSphere;\n if (boundingSphere !== null) data.data.boundingSphere = {\n center: boundingSphere.center.toArray(),\n radius: boundingSphere.radius\n };\n return data;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n // reset\n this.index = null;\n this.attributes = {};\n this.morphAttributes = {};\n this.groups = [];\n this.boundingBox = null;\n this.boundingSphere = null;\n // used for storing cloned, shared data\n const data = {};\n // name\n this.name = source.name;\n // index\n const index = source.index;\n if (index !== null) this.setIndex(index.clone(data));\n // attributes\n const attributes = source.attributes;\n for(const name in attributes){\n const attribute = attributes[name];\n this.setAttribute(name, attribute.clone(data));\n }\n // morph attributes\n const morphAttributes = source.morphAttributes;\n for(const name in morphAttributes){\n const array = [];\n const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes\n for(let i = 0, l = morphAttribute.length; i < l; i++)array.push(morphAttribute[i].clone(data));\n this.morphAttributes[name] = array;\n }\n this.morphTargetsRelative = source.morphTargetsRelative;\n // groups\n const groups = source.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n this.addGroup(group.start, group.count, group.materialIndex);\n }\n // bounding box\n const boundingBox = source.boundingBox;\n if (boundingBox !== null) this.boundingBox = boundingBox.clone();\n // bounding sphere\n const boundingSphere = source.boundingSphere;\n if (boundingSphere !== null) this.boundingSphere = boundingSphere.clone();\n // draw range\n this.drawRange.start = source.drawRange.start;\n this.drawRange.count = source.drawRange.count;\n // user data\n this.userData = source.userData;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nconst $d5b33d7c30034067$var$_inverseMatrix$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_ray$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$a186db52eed6d40e();\nconst $d5b33d7c30034067$var$_sphere$5 = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nconst $d5b33d7c30034067$var$_sphereHitAt = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vA$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vB$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vC$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_tempA = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_morphA = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_uvA$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_uvB$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_uvC$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_normalA = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_normalB = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_normalC = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_intersectionPoint = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_intersectionPointWorld = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$e176487c05830cc5 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(geometry = new $d5b33d7c30034067$export$b7be63a67df8959(), material = new $d5b33d7c30034067$export$55cbcc9b622fe1f5()){\n super();\n this.isMesh = true;\n this.type = \"Mesh\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.morphTargetInfluences !== undefined) this.morphTargetInfluences = source.morphTargetInfluences.slice();\n if (source.morphTargetDictionary !== undefined) this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n getVertexPosition(index, target) {\n const geometry = this.geometry;\n const position = geometry.attributes.position;\n const morphPosition = geometry.morphAttributes.position;\n const morphTargetsRelative = geometry.morphTargetsRelative;\n target.fromBufferAttribute(position, index);\n const morphInfluences = this.morphTargetInfluences;\n if (morphPosition && morphInfluences) {\n $d5b33d7c30034067$var$_morphA.set(0, 0, 0);\n for(let i = 0, il = morphPosition.length; i < il; i++){\n const influence = morphInfluences[i];\n const morphAttribute = morphPosition[i];\n if (influence === 0) continue;\n $d5b33d7c30034067$var$_tempA.fromBufferAttribute(morphAttribute, index);\n if (morphTargetsRelative) $d5b33d7c30034067$var$_morphA.addScaledVector($d5b33d7c30034067$var$_tempA, influence);\n else $d5b33d7c30034067$var$_morphA.addScaledVector($d5b33d7c30034067$var$_tempA.sub(target), influence);\n }\n target.add($d5b33d7c30034067$var$_morphA);\n }\n return target;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const material = this.material;\n const matrixWorld = this.matrixWorld;\n if (material === undefined) return;\n // test with bounding sphere in world space\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$5.copy(geometry.boundingSphere);\n $d5b33d7c30034067$var$_sphere$5.applyMatrix4(matrixWorld);\n // check distance from ray origin to bounding sphere\n $d5b33d7c30034067$var$_ray$3.copy(raycaster.ray).recast(raycaster.near);\n if ($d5b33d7c30034067$var$_sphere$5.containsPoint($d5b33d7c30034067$var$_ray$3.origin) === false) {\n if ($d5b33d7c30034067$var$_ray$3.intersectSphere($d5b33d7c30034067$var$_sphere$5, $d5b33d7c30034067$var$_sphereHitAt) === null) return;\n if ($d5b33d7c30034067$var$_ray$3.origin.distanceToSquared($d5b33d7c30034067$var$_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) return;\n }\n // convert ray to local space of mesh\n $d5b33d7c30034067$var$_inverseMatrix$3.copy(matrixWorld).invert();\n $d5b33d7c30034067$var$_ray$3.copy(raycaster.ray).applyMatrix4($d5b33d7c30034067$var$_inverseMatrix$3);\n // test with bounding box in local space\n if (geometry.boundingBox !== null) {\n if ($d5b33d7c30034067$var$_ray$3.intersectsBox(geometry.boundingBox) === false) return;\n }\n // test for intersections with geometry\n this._computeIntersections(raycaster, intersects, $d5b33d7c30034067$var$_ray$3);\n }\n _computeIntersections(raycaster, intersects, rayLocalSpace) {\n let intersection;\n const geometry = this.geometry;\n const material = this.material;\n const index = geometry.index;\n const position = geometry.attributes.position;\n const uv = geometry.attributes.uv;\n const uv1 = geometry.attributes.uv1;\n const normal = geometry.attributes.normal;\n const groups = geometry.groups;\n const drawRange = geometry.drawRange;\n if (index !== null) {\n // indexed buffer geometry\n if (Array.isArray(material)) for(let i = 0, il = groups.length; i < il; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n const start = Math.max(group.start, drawRange.start);\n const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));\n for(let j = start, jl = end; j < jl; j += 3){\n const a = index.getX(j);\n const b = index.getX(j + 1);\n const c = index.getX(j + 2);\n intersection = $d5b33d7c30034067$var$checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics\n intersection.face.materialIndex = group.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i += 3){\n const a = index.getX(i);\n const b = index.getX(i + 1);\n const c = index.getX(i + 2);\n intersection = $d5b33d7c30034067$var$checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n } else if (position !== undefined) {\n // non-indexed buffer geometry\n if (Array.isArray(material)) for(let i = 0, il = groups.length; i < il; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n const start = Math.max(group.start, drawRange.start);\n const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));\n for(let j = start, jl = end; j < jl; j += 3){\n const a = j;\n const b = j + 1;\n const c = j + 2;\n intersection = $d5b33d7c30034067$var$checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics\n intersection.face.materialIndex = group.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(position.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i += 3){\n const a = i;\n const b = i + 1;\n const c = i + 2;\n intersection = $d5b33d7c30034067$var$checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n }\n }\n}\nfunction $d5b33d7c30034067$var$checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {\n let intersect;\n if (material.side === $d5b33d7c30034067$export$d9f0486e75b5ace) intersect = ray.intersectTriangle(pC, pB, pA, true, point);\n else intersect = ray.intersectTriangle(pA, pB, pC, material.side === $d5b33d7c30034067$export$2ede184fc2998901, point);\n if (intersect === null) return null;\n $d5b33d7c30034067$var$_intersectionPointWorld.copy(point);\n $d5b33d7c30034067$var$_intersectionPointWorld.applyMatrix4(object.matrixWorld);\n const distance = raycaster.ray.origin.distanceTo($d5b33d7c30034067$var$_intersectionPointWorld);\n if (distance < raycaster.near || distance > raycaster.far) return null;\n return {\n distance: distance,\n point: $d5b33d7c30034067$var$_intersectionPointWorld.clone(),\n object: object\n };\n}\nfunction $d5b33d7c30034067$var$checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) {\n object.getVertexPosition(a, $d5b33d7c30034067$var$_vA$1);\n object.getVertexPosition(b, $d5b33d7c30034067$var$_vB$1);\n object.getVertexPosition(c, $d5b33d7c30034067$var$_vC$1);\n const intersection = $d5b33d7c30034067$var$checkIntersection(object, material, raycaster, ray, $d5b33d7c30034067$var$_vA$1, $d5b33d7c30034067$var$_vB$1, $d5b33d7c30034067$var$_vC$1, $d5b33d7c30034067$var$_intersectionPoint);\n if (intersection) {\n if (uv) {\n $d5b33d7c30034067$var$_uvA$1.fromBufferAttribute(uv, a);\n $d5b33d7c30034067$var$_uvB$1.fromBufferAttribute(uv, b);\n $d5b33d7c30034067$var$_uvC$1.fromBufferAttribute(uv, c);\n intersection.uv = $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation($d5b33d7c30034067$var$_intersectionPoint, $d5b33d7c30034067$var$_vA$1, $d5b33d7c30034067$var$_vB$1, $d5b33d7c30034067$var$_vC$1, $d5b33d7c30034067$var$_uvA$1, $d5b33d7c30034067$var$_uvB$1, $d5b33d7c30034067$var$_uvC$1, new $d5b33d7c30034067$export$c977b3e384af9ae1());\n }\n if (uv1) {\n $d5b33d7c30034067$var$_uvA$1.fromBufferAttribute(uv1, a);\n $d5b33d7c30034067$var$_uvB$1.fromBufferAttribute(uv1, b);\n $d5b33d7c30034067$var$_uvC$1.fromBufferAttribute(uv1, c);\n intersection.uv1 = $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation($d5b33d7c30034067$var$_intersectionPoint, $d5b33d7c30034067$var$_vA$1, $d5b33d7c30034067$var$_vB$1, $d5b33d7c30034067$var$_vC$1, $d5b33d7c30034067$var$_uvA$1, $d5b33d7c30034067$var$_uvB$1, $d5b33d7c30034067$var$_uvC$1, new $d5b33d7c30034067$export$c977b3e384af9ae1());\n intersection.uv2 = intersection.uv1; // @deprecated, r152\n }\n if (normal) {\n $d5b33d7c30034067$var$_normalA.fromBufferAttribute(normal, a);\n $d5b33d7c30034067$var$_normalB.fromBufferAttribute(normal, b);\n $d5b33d7c30034067$var$_normalC.fromBufferAttribute(normal, c);\n intersection.normal = $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation($d5b33d7c30034067$var$_intersectionPoint, $d5b33d7c30034067$var$_vA$1, $d5b33d7c30034067$var$_vB$1, $d5b33d7c30034067$var$_vC$1, $d5b33d7c30034067$var$_normalA, $d5b33d7c30034067$var$_normalB, $d5b33d7c30034067$var$_normalC, new $d5b33d7c30034067$export$64b5c384219d3699());\n if (intersection.normal.dot(ray.direction) > 0) intersection.normal.multiplyScalar(-1);\n }\n const face = {\n a: a,\n b: b,\n c: c,\n normal: new $d5b33d7c30034067$export$64b5c384219d3699(),\n materialIndex: 0\n };\n $d5b33d7c30034067$export$5a465592bfe74b48.getNormal($d5b33d7c30034067$var$_vA$1, $d5b33d7c30034067$var$_vB$1, $d5b33d7c30034067$var$_vC$1, face.normal);\n intersection.face = face;\n }\n return intersection;\n}\nclass $d5b33d7c30034067$export$33e43285f7406bd5 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1){\n super();\n this.type = \"BoxGeometry\";\n this.parameters = {\n width: width,\n height: height,\n depth: depth,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n depthSegments: depthSegments\n };\n const scope = this;\n // segments\n widthSegments = Math.floor(widthSegments);\n heightSegments = Math.floor(heightSegments);\n depthSegments = Math.floor(depthSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let numberOfVertices = 0;\n let groupStart = 0;\n // build each side of the box geometry\n buildPlane(\"z\", \"y\", \"x\", -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px\n buildPlane(\"z\", \"y\", \"x\", 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx\n buildPlane(\"x\", \"z\", \"y\", 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py\n buildPlane(\"x\", \"z\", \"y\", 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny\n buildPlane(\"x\", \"y\", \"z\", 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz\n buildPlane(\"x\", \"y\", \"z\", -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) {\n const segmentWidth = width / gridX;\n const segmentHeight = height / gridY;\n const widthHalf = width / 2;\n const heightHalf = height / 2;\n const depthHalf = depth / 2;\n const gridX1 = gridX + 1;\n const gridY1 = gridY + 1;\n let vertexCounter = 0;\n let groupCount = 0;\n const vector = new $d5b33d7c30034067$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let iy = 0; iy < gridY1; iy++){\n const y = iy * segmentHeight - heightHalf;\n for(let ix = 0; ix < gridX1; ix++){\n const x = ix * segmentWidth - widthHalf;\n // set values to correct vector component\n vector[u] = x * udir;\n vector[v] = y * vdir;\n vector[w] = depthHalf;\n // now apply vector to vertex buffer\n vertices.push(vector.x, vector.y, vector.z);\n // set values to correct vector component\n vector[u] = 0;\n vector[v] = 0;\n vector[w] = depth > 0 ? 1 : -1;\n // now apply vector to normal buffer\n normals.push(vector.x, vector.y, vector.z);\n // uvs\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n // counters\n vertexCounter += 1;\n }\n }\n // indices\n // 1. you need three indices to draw a single face\n // 2. a single segment consists of two faces\n // 3. so we need to generate six (2*3) indices per segment\n for(let iy = 0; iy < gridY; iy++)for(let ix = 0; ix < gridX; ix++){\n const a = numberOfVertices + ix + gridX1 * iy;\n const b = numberOfVertices + ix + gridX1 * (iy + 1);\n const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1);\n const d = numberOfVertices + (ix + 1) + gridX1 * iy;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n // increase counter\n groupCount += 6;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, materialIndex);\n // calculate new start value for groups\n groupStart += groupCount;\n // update total number of vertices\n numberOfVertices += vertexCounter;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$33e43285f7406bd5(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);\n }\n}\n/**\n * Uniform Utilities\n */ function $d5b33d7c30034067$var$cloneUniforms(src) {\n const dst = {};\n for(const u in src){\n dst[u] = {};\n for(const p in src[u]){\n const property = src[u][p];\n if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {\n if (property.isRenderTargetTexture) {\n console.warn(\"UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().\");\n dst[u][p] = null;\n } else dst[u][p] = property.clone();\n } else if (Array.isArray(property)) dst[u][p] = property.slice();\n else dst[u][p] = property;\n }\n }\n return dst;\n}\nfunction $d5b33d7c30034067$var$mergeUniforms(uniforms) {\n const merged = {};\n for(let u = 0; u < uniforms.length; u++){\n const tmp = $d5b33d7c30034067$var$cloneUniforms(uniforms[u]);\n for(const p in tmp)merged[p] = tmp[p];\n }\n return merged;\n}\nfunction $d5b33d7c30034067$var$cloneUniformsGroups(src) {\n const dst = [];\n for(let u = 0; u < src.length; u++)dst.push(src[u].clone());\n return dst;\n}\nfunction $d5b33d7c30034067$var$getUnlitUniformColorSpace(renderer) {\n if (renderer.getRenderTarget() === null) // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n return renderer.outputColorSpace;\n return $d5b33d7c30034067$export$42429b3acfb233a4;\n}\n// Legacy\nconst $d5b33d7c30034067$export$d8ecdf8615bfea69 = {\n clone: $d5b33d7c30034067$var$cloneUniforms,\n merge: $d5b33d7c30034067$var$mergeUniforms\n};\nvar $d5b33d7c30034067$var$default_vertex = \"void main() {\\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\nvar $d5b33d7c30034067$var$default_fragment = \"void main() {\\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\nclass $d5b33d7c30034067$export$83c7d75d550a8b0d extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isShaderMaterial = true;\n this.type = \"ShaderMaterial\";\n this.defines = {};\n this.uniforms = {};\n this.uniformsGroups = [];\n this.vertexShader = $d5b33d7c30034067$var$default_vertex;\n this.fragmentShader = $d5b33d7c30034067$var$default_fragment;\n this.linewidth = 1;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.fog = false; // set to use scene fog\n this.lights = false; // set to use scene lights\n this.clipping = false; // set to use user-defined clipping planes\n this.forceSinglePass = true;\n this.extensions = {\n derivatives: false,\n fragDepth: false,\n drawBuffers: false,\n shaderTextureLOD: false // set to use shader texture LOD\n };\n // When rendered geometry doesn't include these attributes but the material does,\n // use these default values in WebGL. This avoids errors when buffer data is missing.\n this.defaultAttributeValues = {\n \"color\": [\n 1,\n 1,\n 1\n ],\n \"uv\": [\n 0,\n 0\n ],\n \"uv1\": [\n 0,\n 0\n ]\n };\n this.index0AttributeName = undefined;\n this.uniformsNeedUpdate = false;\n this.glslVersion = null;\n if (parameters !== undefined) this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.fragmentShader = source.fragmentShader;\n this.vertexShader = source.vertexShader;\n this.uniforms = $d5b33d7c30034067$var$cloneUniforms(source.uniforms);\n this.uniformsGroups = $d5b33d7c30034067$var$cloneUniformsGroups(source.uniformsGroups);\n this.defines = Object.assign({}, source.defines);\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.fog = source.fog;\n this.lights = source.lights;\n this.clipping = source.clipping;\n this.extensions = Object.assign({}, source.extensions);\n this.glslVersion = source.glslVersion;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.glslVersion = this.glslVersion;\n data.uniforms = {};\n for(const name in this.uniforms){\n const uniform = this.uniforms[name];\n const value = uniform.value;\n if (value && value.isTexture) data.uniforms[name] = {\n type: \"t\",\n value: value.toJSON(meta).uuid\n };\n else if (value && value.isColor) data.uniforms[name] = {\n type: \"c\",\n value: value.getHex()\n };\n else if (value && value.isVector2) data.uniforms[name] = {\n type: \"v2\",\n value: value.toArray()\n };\n else if (value && value.isVector3) data.uniforms[name] = {\n type: \"v3\",\n value: value.toArray()\n };\n else if (value && value.isVector4) data.uniforms[name] = {\n type: \"v4\",\n value: value.toArray()\n };\n else if (value && value.isMatrix3) data.uniforms[name] = {\n type: \"m3\",\n value: value.toArray()\n };\n else if (value && value.isMatrix4) data.uniforms[name] = {\n type: \"m4\",\n value: value.toArray()\n };\n else data.uniforms[name] = {\n value: value\n };\n }\n if (Object.keys(this.defines).length > 0) data.defines = this.defines;\n data.vertexShader = this.vertexShader;\n data.fragmentShader = this.fragmentShader;\n data.lights = this.lights;\n data.clipping = this.clipping;\n const extensions = {};\n for(const key in this.extensions)if (this.extensions[key] === true) extensions[key] = true;\n if (Object.keys(extensions).length > 0) data.extensions = extensions;\n return data;\n }\n}\nclass $d5b33d7c30034067$export$79f141de891a5fed extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isCamera = true;\n this.type = \"Camera\";\n this.matrixWorldInverse = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.projectionMatrix = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.projectionMatrixInverse = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.coordinateSystem = $d5b33d7c30034067$export$5a0e9190d10875d3;\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.matrixWorldInverse.copy(source.matrixWorldInverse);\n this.projectionMatrix.copy(source.projectionMatrix);\n this.projectionMatrixInverse.copy(source.projectionMatrixInverse);\n this.coordinateSystem = source.coordinateSystem;\n return this;\n }\n getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n const e = this.matrixWorld.elements;\n return target.set(-e[8], -e[9], -e[10]).normalize();\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n updateWorldMatrix(updateParents, updateChildren) {\n super.updateWorldMatrix(updateParents, updateChildren);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $d5b33d7c30034067$export$74e4ae24825f68d7 extends $d5b33d7c30034067$export$79f141de891a5fed {\n constructor(fov = 50, aspect = 1, near = 0.1, far = 2000){\n super();\n this.isPerspectiveCamera = true;\n this.type = \"PerspectiveCamera\";\n this.fov = fov;\n this.zoom = 1;\n this.near = near;\n this.far = far;\n this.focus = 10;\n this.aspect = aspect;\n this.view = null;\n this.filmGauge = 35; // width of the film (default in millimeters)\n this.filmOffset = 0; // horizontal film offset (same unit as gauge)\n this.updateProjectionMatrix();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.fov = source.fov;\n this.zoom = source.zoom;\n this.near = source.near;\n this.far = source.far;\n this.focus = source.focus;\n this.aspect = source.aspect;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n this.filmGauge = source.filmGauge;\n this.filmOffset = source.filmOffset;\n return this;\n }\n /**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */ setFocalLength(focalLength) {\n /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n this.fov = $d5b33d7c30034067$var$RAD2DEG * 2 * Math.atan(vExtentSlope);\n this.updateProjectionMatrix();\n }\n /**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */ getFocalLength() {\n const vExtentSlope = Math.tan($d5b33d7c30034067$var$DEG2RAD * 0.5 * this.fov);\n return 0.5 * this.getFilmHeight() / vExtentSlope;\n }\n getEffectiveFOV() {\n return $d5b33d7c30034067$var$RAD2DEG * 2 * Math.atan(Math.tan($d5b33d7c30034067$var$DEG2RAD * 0.5 * this.fov) / this.zoom);\n }\n getFilmWidth() {\n // film not completely covered in portrait format (aspect < 1)\n return this.filmGauge * Math.min(this.aspect, 1);\n }\n getFilmHeight() {\n // film not completely covered in landscape format (aspect > 1)\n return this.filmGauge / Math.max(this.aspect, 1);\n }\n /**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */ setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n this.aspect = fullWidth / fullHeight;\n if (this.view === null) this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n clearViewOffset() {\n if (this.view !== null) this.view.enabled = false;\n this.updateProjectionMatrix();\n }\n updateProjectionMatrix() {\n const near = this.near;\n let top = near * Math.tan($d5b33d7c30034067$var$DEG2RAD * 0.5 * this.fov) / this.zoom;\n let height = 2 * top;\n let width = this.aspect * height;\n let left = -0.5 * width;\n const view = this.view;\n if (this.view !== null && this.view.enabled) {\n const fullWidth = view.fullWidth, fullHeight = view.fullHeight;\n left += view.offsetX * width / fullWidth;\n top -= view.offsetY * height / fullHeight;\n width *= view.width / fullWidth;\n height *= view.height / fullHeight;\n }\n const skew = this.filmOffset;\n if (skew !== 0) left += near * skew / this.getFilmWidth();\n this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.fov = this.fov;\n data.object.zoom = this.zoom;\n data.object.near = this.near;\n data.object.far = this.far;\n data.object.focus = this.focus;\n data.object.aspect = this.aspect;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n data.object.filmGauge = this.filmGauge;\n data.object.filmOffset = this.filmOffset;\n return data;\n }\n}\nconst $d5b33d7c30034067$var$fov = -90; // negative fov is not an error\nconst $d5b33d7c30034067$var$aspect = 1;\nclass $d5b33d7c30034067$export$d0cdd0bd804995de extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(near, far, renderTarget){\n super();\n this.type = \"CubeCamera\";\n this.renderTarget = renderTarget;\n this.coordinateSystem = null;\n const cameraPX = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraPX.layers = this.layers;\n this.add(cameraPX);\n const cameraNX = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraNX.layers = this.layers;\n this.add(cameraNX);\n const cameraPY = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraPY.layers = this.layers;\n this.add(cameraPY);\n const cameraNY = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraNY.layers = this.layers;\n this.add(cameraNY);\n const cameraPZ = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraPZ.layers = this.layers;\n this.add(cameraPZ);\n const cameraNZ = new $d5b33d7c30034067$export$74e4ae24825f68d7($d5b33d7c30034067$var$fov, $d5b33d7c30034067$var$aspect, near, far);\n cameraNZ.layers = this.layers;\n this.add(cameraNZ);\n }\n updateCoordinateSystem() {\n const coordinateSystem = this.coordinateSystem;\n const cameras = this.children.concat();\n const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = cameras;\n for (const camera of cameras)this.remove(camera);\n if (coordinateSystem === $d5b33d7c30034067$export$5a0e9190d10875d3) {\n cameraPX.up.set(0, 1, 0);\n cameraPX.lookAt(1, 0, 0);\n cameraNX.up.set(0, 1, 0);\n cameraNX.lookAt(-1, 0, 0);\n cameraPY.up.set(0, 0, -1);\n cameraPY.lookAt(0, 1, 0);\n cameraNY.up.set(0, 0, 1);\n cameraNY.lookAt(0, -1, 0);\n cameraPZ.up.set(0, 1, 0);\n cameraPZ.lookAt(0, 0, 1);\n cameraNZ.up.set(0, 1, 0);\n cameraNZ.lookAt(0, 0, -1);\n } else if (coordinateSystem === $d5b33d7c30034067$export$cc83beedcb9be9ac) {\n cameraPX.up.set(0, -1, 0);\n cameraPX.lookAt(-1, 0, 0);\n cameraNX.up.set(0, -1, 0);\n cameraNX.lookAt(1, 0, 0);\n cameraPY.up.set(0, 0, 1);\n cameraPY.lookAt(0, 1, 0);\n cameraNY.up.set(0, 0, -1);\n cameraNY.lookAt(0, -1, 0);\n cameraPZ.up.set(0, -1, 0);\n cameraPZ.lookAt(0, 0, 1);\n cameraNZ.up.set(0, -1, 0);\n cameraNZ.lookAt(0, 0, -1);\n } else throw new Error(\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \" + coordinateSystem);\n for (const camera of cameras){\n this.add(camera);\n camera.updateMatrixWorld();\n }\n }\n update(renderer, scene) {\n if (this.parent === null) this.updateMatrixWorld();\n const renderTarget = this.renderTarget;\n if (this.coordinateSystem !== renderer.coordinateSystem) {\n this.coordinateSystem = renderer.coordinateSystem;\n this.updateCoordinateSystem();\n }\n const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children;\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n renderer.xr.enabled = false;\n const generateMipmaps = renderTarget.texture.generateMipmaps;\n renderTarget.texture.generateMipmaps = false;\n renderer.setRenderTarget(renderTarget, 0);\n renderer.render(scene, cameraPX);\n renderer.setRenderTarget(renderTarget, 1);\n renderer.render(scene, cameraNX);\n renderer.setRenderTarget(renderTarget, 2);\n renderer.render(scene, cameraPY);\n renderer.setRenderTarget(renderTarget, 3);\n renderer.render(scene, cameraNY);\n renderer.setRenderTarget(renderTarget, 4);\n renderer.render(scene, cameraPZ);\n renderTarget.texture.generateMipmaps = generateMipmaps;\n renderer.setRenderTarget(renderTarget, 5);\n renderer.render(scene, cameraNZ);\n renderer.setRenderTarget(currentRenderTarget);\n renderer.xr.enabled = currentXrEnabled;\n renderTarget.texture.needsPMREMUpdate = true;\n }\n}\nclass $d5b33d7c30034067$export$ee2e5a18258a4049 extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1){\n images = images !== undefined ? images : [];\n mapping = mapping !== undefined ? mapping : $d5b33d7c30034067$export$8759762a6477f2c4;\n super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isCubeTexture = true;\n this.flipY = false;\n }\n get images() {\n return this.image;\n }\n set images(value) {\n this.image = value;\n }\n}\nclass $d5b33d7c30034067$export$ac386671d651941e extends $d5b33d7c30034067$export$3c052beb2e51e23f {\n constructor(size = 1, options = {}){\n super(size, size, options);\n this.isWebGLCubeRenderTarget = true;\n const image = {\n width: size,\n height: size,\n depth: 1\n };\n const images = [\n image,\n image,\n image,\n image,\n image,\n image\n ];\n if (options.encoding !== undefined) {\n // @deprecated, r152\n $d5b33d7c30034067$var$warnOnce(\"THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.\");\n options.colorSpace = options.encoding === $d5b33d7c30034067$export$f32388edbb32674 ? $d5b33d7c30034067$export$561f394b24edfcaa : $d5b33d7c30034067$export$bfcb490c2dd3db51;\n }\n this.texture = new $d5b33d7c30034067$export$ee2e5a18258a4049(images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace);\n // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n this.texture.isRenderTargetTexture = true;\n this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n }\n fromEquirectangularTexture(renderer, texture) {\n this.texture.type = texture.type;\n this.texture.colorSpace = texture.colorSpace;\n this.texture.generateMipmaps = texture.generateMipmaps;\n this.texture.minFilter = texture.minFilter;\n this.texture.magFilter = texture.magFilter;\n const shader = {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n fragmentShader: /* glsl */ `\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n };\n const geometry = new $d5b33d7c30034067$export$33e43285f7406bd5(5, 5, 5);\n const material = new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"CubemapFromEquirect\",\n uniforms: $d5b33d7c30034067$var$cloneUniforms(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n side: $d5b33d7c30034067$export$d9f0486e75b5ace,\n blending: $d5b33d7c30034067$export$63b8d6b580fc65ba\n });\n material.uniforms.tEquirect.value = texture;\n const mesh = new $d5b33d7c30034067$export$e176487c05830cc5(geometry, material);\n const currentMinFilter = texture.minFilter;\n // Avoid blurred poles\n if (texture.minFilter === $d5b33d7c30034067$export$5d8599b6a933fb1b) texture.minFilter = $d5b33d7c30034067$export$8a72f490b25c56c8;\n const camera = new $d5b33d7c30034067$export$d0cdd0bd804995de(1, 10, this);\n camera.update(renderer, mesh);\n texture.minFilter = currentMinFilter;\n mesh.geometry.dispose();\n mesh.material.dispose();\n return this;\n }\n clear(renderer, color, depth, stencil) {\n const currentRenderTarget = renderer.getRenderTarget();\n for(let i = 0; i < 6; i++){\n renderer.setRenderTarget(this, i);\n renderer.clear(color, depth, stencil);\n }\n renderer.setRenderTarget(currentRenderTarget);\n }\n}\nconst $d5b33d7c30034067$var$_vector1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vector2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_normalMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918();\nclass $d5b33d7c30034067$export$7ff5ac152ef991b0 {\n constructor(normal = new $d5b33d7c30034067$export$64b5c384219d3699(1, 0, 0), constant = 0){\n this.isPlane = true;\n // normal is assumed to be normalized\n this.normal = normal;\n this.constant = constant;\n }\n set(normal, constant) {\n this.normal.copy(normal);\n this.constant = constant;\n return this;\n }\n setComponents(x, y, z, w) {\n this.normal.set(x, y, z);\n this.constant = w;\n return this;\n }\n setFromNormalAndCoplanarPoint(normal, point) {\n this.normal.copy(normal);\n this.constant = -point.dot(this.normal);\n return this;\n }\n setFromCoplanarPoints(a, b, c) {\n const normal = $d5b33d7c30034067$var$_vector1.subVectors(c, b).cross($d5b33d7c30034067$var$_vector2.subVectors(a, b)).normalize();\n // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n this.setFromNormalAndCoplanarPoint(normal, a);\n return this;\n }\n copy(plane) {\n this.normal.copy(plane.normal);\n this.constant = plane.constant;\n return this;\n }\n normalize() {\n // Note: will lead to a divide by zero if the plane is invalid.\n const inverseNormalLength = 1.0 / this.normal.length();\n this.normal.multiplyScalar(inverseNormalLength);\n this.constant *= inverseNormalLength;\n return this;\n }\n negate() {\n this.constant *= -1;\n this.normal.negate();\n return this;\n }\n distanceToPoint(point) {\n return this.normal.dot(point) + this.constant;\n }\n distanceToSphere(sphere) {\n return this.distanceToPoint(sphere.center) - sphere.radius;\n }\n projectPoint(point, target) {\n return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));\n }\n intersectLine(line, target) {\n const direction = line.delta($d5b33d7c30034067$var$_vector1);\n const denominator = this.normal.dot(direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (this.distanceToPoint(line.start) === 0) return target.copy(line.start);\n // Unsure if this is the correct method to handle this case.\n return null;\n }\n const t = -(line.start.dot(this.normal) + this.constant) / denominator;\n if (t < 0 || t > 1) return null;\n return target.copy(line.start).addScaledVector(direction, t);\n }\n intersectsLine(line) {\n // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n const startSign = this.distanceToPoint(line.start);\n const endSign = this.distanceToPoint(line.end);\n return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;\n }\n intersectsBox(box) {\n return box.intersectsPlane(this);\n }\n intersectsSphere(sphere) {\n return sphere.intersectsPlane(this);\n }\n coplanarPoint(target) {\n return target.copy(this.normal).multiplyScalar(-this.constant);\n }\n applyMatrix4(matrix, optionalNormalMatrix) {\n const normalMatrix = optionalNormalMatrix || $d5b33d7c30034067$var$_normalMatrix.getNormalMatrix(matrix);\n const referencePoint = this.coplanarPoint($d5b33d7c30034067$var$_vector1).applyMatrix4(matrix);\n const normal = this.normal.applyMatrix3(normalMatrix).normalize();\n this.constant = -referencePoint.dot(normal);\n return this;\n }\n translate(offset) {\n this.constant -= offset.dot(this.normal);\n return this;\n }\n equals(plane) {\n return plane.normal.equals(this.normal) && plane.constant === this.constant;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $d5b33d7c30034067$var$_sphere$4 = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nconst $d5b33d7c30034067$var$_vector$6 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$35efe6f4c85463d2 {\n constructor(p0 = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), p1 = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), p2 = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), p3 = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), p4 = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), p5 = new $d5b33d7c30034067$export$7ff5ac152ef991b0()){\n this.planes = [\n p0,\n p1,\n p2,\n p3,\n p4,\n p5\n ];\n }\n set(p0, p1, p2, p3, p4, p5) {\n const planes = this.planes;\n planes[0].copy(p0);\n planes[1].copy(p1);\n planes[2].copy(p2);\n planes[3].copy(p3);\n planes[4].copy(p4);\n planes[5].copy(p5);\n return this;\n }\n copy(frustum) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++)planes[i].copy(frustum.planes[i]);\n return this;\n }\n setFromProjectionMatrix(m, coordinateSystem = $d5b33d7c30034067$export$5a0e9190d10875d3) {\n const planes = this.planes;\n const me = m.elements;\n const me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3];\n const me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7];\n const me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11];\n const me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15];\n planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize();\n planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize();\n planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize();\n planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize();\n planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize();\n if (coordinateSystem === $d5b33d7c30034067$export$5a0e9190d10875d3) planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize();\n else if (coordinateSystem === $d5b33d7c30034067$export$cc83beedcb9be9ac) planes[5].setComponents(me2, me6, me10, me14).normalize();\n else throw new Error(\"THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: \" + coordinateSystem);\n return this;\n }\n intersectsObject(object) {\n if (object.boundingSphere !== undefined) {\n if (object.boundingSphere === null) object.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$4.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);\n } else {\n const geometry = object.geometry;\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$4.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);\n }\n return this.intersectsSphere($d5b33d7c30034067$var$_sphere$4);\n }\n intersectsSprite(sprite) {\n $d5b33d7c30034067$var$_sphere$4.center.set(0, 0, 0);\n $d5b33d7c30034067$var$_sphere$4.radius = 0.7071067811865476;\n $d5b33d7c30034067$var$_sphere$4.applyMatrix4(sprite.matrixWorld);\n return this.intersectsSphere($d5b33d7c30034067$var$_sphere$4);\n }\n intersectsSphere(sphere) {\n const planes = this.planes;\n const center = sphere.center;\n const negRadius = -sphere.radius;\n for(let i = 0; i < 6; i++){\n const distance = planes[i].distanceToPoint(center);\n if (distance < negRadius) return false;\n }\n return true;\n }\n intersectsBox(box) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++){\n const plane = planes[i];\n // corner at max distance\n $d5b33d7c30034067$var$_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n $d5b33d7c30034067$var$_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n $d5b33d7c30034067$var$_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n if (plane.distanceToPoint($d5b33d7c30034067$var$_vector$6) < 0) return false;\n }\n return true;\n }\n containsPoint(point) {\n const planes = this.planes;\n for(let i = 0; i < 6; i++){\n if (planes[i].distanceToPoint(point) < 0) return false;\n }\n return true;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nfunction $d5b33d7c30034067$var$WebGLAnimation() {\n let context = null;\n let isAnimating = false;\n let animationLoop = null;\n let requestId = null;\n function onAnimationFrame(time, frame) {\n animationLoop(time, frame);\n requestId = context.requestAnimationFrame(onAnimationFrame);\n }\n return {\n start: function() {\n if (isAnimating === true) return;\n if (animationLoop === null) return;\n requestId = context.requestAnimationFrame(onAnimationFrame);\n isAnimating = true;\n },\n stop: function() {\n context.cancelAnimationFrame(requestId);\n isAnimating = false;\n },\n setAnimationLoop: function(callback) {\n animationLoop = callback;\n },\n setContext: function(value) {\n context = value;\n }\n };\n}\nfunction $d5b33d7c30034067$var$WebGLAttributes(gl, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n const buffers = new WeakMap();\n function createBuffer(attribute, bufferType) {\n const array = attribute.array;\n const usage = attribute.usage;\n const buffer = gl.createBuffer();\n gl.bindBuffer(bufferType, buffer);\n gl.bufferData(bufferType, array, usage);\n attribute.onUploadCallback();\n let type;\n if (array instanceof Float32Array) type = gl.FLOAT;\n else if (array instanceof Uint16Array) {\n if (attribute.isFloat16BufferAttribute) {\n if (isWebGL2) type = gl.HALF_FLOAT;\n else throw new Error(\"THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.\");\n } else type = gl.UNSIGNED_SHORT;\n } else if (array instanceof Int16Array) type = gl.SHORT;\n else if (array instanceof Uint32Array) type = gl.UNSIGNED_INT;\n else if (array instanceof Int32Array) type = gl.INT;\n else if (array instanceof Int8Array) type = gl.BYTE;\n else if (array instanceof Uint8Array) type = gl.UNSIGNED_BYTE;\n else if (array instanceof Uint8ClampedArray) type = gl.UNSIGNED_BYTE;\n else throw new Error(\"THREE.WebGLAttributes: Unsupported buffer data format: \" + array);\n return {\n buffer: buffer,\n type: type,\n bytesPerElement: array.BYTES_PER_ELEMENT,\n version: attribute.version\n };\n }\n function updateBuffer(buffer, attribute, bufferType) {\n const array = attribute.array;\n const updateRange = attribute.updateRange;\n gl.bindBuffer(bufferType, buffer);\n if (updateRange.count === -1) // Not using update ranges\n gl.bufferSubData(bufferType, 0, array);\n else {\n if (isWebGL2) gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array, updateRange.offset, updateRange.count);\n else gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count));\n updateRange.count = -1; // reset range\n }\n attribute.onUploadCallback();\n }\n //\n function get(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n return buffers.get(attribute);\n }\n function remove(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n const data = buffers.get(attribute);\n if (data) {\n gl.deleteBuffer(data.buffer);\n buffers.delete(attribute);\n }\n }\n function update(attribute, bufferType) {\n if (attribute.isGLBufferAttribute) {\n const cached = buffers.get(attribute);\n if (!cached || cached.version < attribute.version) buffers.set(attribute, {\n buffer: attribute.buffer,\n type: attribute.type,\n bytesPerElement: attribute.elementSize,\n version: attribute.version\n });\n return;\n }\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n const data = buffers.get(attribute);\n if (data === undefined) buffers.set(attribute, createBuffer(attribute, bufferType));\n else if (data.version < attribute.version) {\n updateBuffer(data.buffer, attribute, bufferType);\n data.version = attribute.version;\n }\n }\n return {\n get: get,\n remove: remove,\n update: update\n };\n}\nclass $d5b33d7c30034067$export$967d831af31f69ce extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1){\n super();\n this.type = \"PlaneGeometry\";\n this.parameters = {\n width: width,\n height: height,\n widthSegments: widthSegments,\n heightSegments: heightSegments\n };\n const width_half = width / 2;\n const height_half = height / 2;\n const gridX = Math.floor(widthSegments);\n const gridY = Math.floor(heightSegments);\n const gridX1 = gridX + 1;\n const gridY1 = gridY + 1;\n const segment_width = width / gridX;\n const segment_height = height / gridY;\n //\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n for(let iy = 0; iy < gridY1; iy++){\n const y = iy * segment_height - height_half;\n for(let ix = 0; ix < gridX1; ix++){\n const x = ix * segment_width - width_half;\n vertices.push(x, -y, 0);\n normals.push(0, 0, 1);\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n }\n }\n for(let iy = 0; iy < gridY; iy++)for(let ix = 0; ix < gridX; ix++){\n const a = ix + gridX1 * iy;\n const b = ix + gridX1 * (iy + 1);\n const c = ix + 1 + gridX1 * (iy + 1);\n const d = ix + 1 + gridX1 * iy;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$967d831af31f69ce(data.width, data.height, data.widthSegments, data.heightSegments);\n }\n}\nvar $d5b33d7c30034067$var$alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\nvar $d5b33d7c30034067$var$alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\tconst float ALPHA_HASH_SCALE = 0.05;\\n\tfloat hash2D( vec2 value ) {\\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\t}\\n\tfloat hash3D( vec3 value ) {\\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\t}\\n\tfloat getAlphaHashThreshold( vec3 position ) {\\n\t\tfloat maxDeriv = max(\\n\t\t\tlength( dFdx( position.xyz ) ),\\n\t\t\tlength( dFdy( position.xyz ) )\\n\t\t);\\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\t\tvec2 pixScales = vec2(\\n\t\t\texp2( floor( log2( pixScale ) ) ),\\n\t\t\texp2( ceil( log2( pixScale ) ) )\\n\t\t);\\n\t\tvec2 alpha = vec2(\\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\\n\t\t);\\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\t\tvec3 cases = vec3(\\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\t\t);\\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\\n\t\t\t: cases.z;\\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\nvar $d5b33d7c30034067$var$alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\tuniform sampler2D alphaMap;\\n#endif\";\nvar $d5b33d7c30034067$var$alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\nvar $d5b33d7c30034067$var$alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\tuniform float alphaTest;\\n#endif\";\nvar $d5b33d7c30034067$var$aomap_fragment = \"#ifdef USE_AOMAP\\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\tuniform sampler2D aoMap;\\n\tuniform float aoMapIntensity;\\n#endif\";\nvar $d5b33d7c30034067$var$begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\tvPosition = vec3( position );\\n#endif\";\nvar $d5b33d7c30034067$var$beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\nvar $d5b33d7c30034067$var$bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\tfloat G = G_BlinnPhong_Implicit( );\\n\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\treturn F * ( G * D );\\n} // validated\";\nvar $d5b33d7c30034067$var$iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\tconst mat3 XYZ_TO_REC709 = mat3(\\n\t\t 3.2404542, -0.9692660, 0.0556434,\\n\t\t-1.5371385, 1.8760108, -0.2040259,\\n\t\t-0.4985314, 0.0415560, 1.0572252\\n\t);\\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\t}\\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\t}\\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\t}\\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\t\txyz /= 1.0685e-7;\\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\t\treturn rgb;\\n\t}\\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\t\tvec3 I;\\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\t\tif ( cosTheta2Sq < 0.0 ) {\\n\t\t\treturn vec3( 1.0 );\\n\t\t}\\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\t\tfloat T121 = 1.0 - R12;\\n\t\tfloat phi12 = 0.0;\\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\t\tfloat phi21 = PI - phi12;\\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\t\tvec3 phi23 = vec3( 0.0 );\\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\t\tvec3 phi = vec3( phi21 ) + phi23;\\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\t\tvec3 r123 = sqrt( R123 );\\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\t\tvec3 C0 = R12 + Rs;\\n\t\tI = C0;\\n\t\tvec3 Cm = Rs - T121;\\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\\n\t\t\tCm *= r123;\\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\t\t\tI += Cm * Sm;\\n\t\t}\\n\t\treturn max( I, vec3( 0.0 ) );\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\tuniform sampler2D bumpMap;\\n\tuniform float bumpScale;\\n\tvec2 dHdxy_fwd() {\\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\t\treturn vec2( dBx, dBy );\\n\t}\\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\\n\t\tvec3 vN = surf_norm;\\n\t\tvec3 R1 = cross( vSigmaY, vN );\\n\t\tvec3 R2 = cross( vN, vSigmaX );\\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\tvarying vec3 vClipPosition;\\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\nvar $d5b33d7c30034067$var$clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\tvarying vec3 vClipPosition;\\n#endif\";\nvar $d5b33d7c30034067$var$clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\tvClipPosition = - mvPosition.xyz;\\n#endif\";\nvar $d5b33d7c30034067$var$color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\tdiffuseColor.rgb *= vColor;\\n#endif\";\nvar $d5b33d7c30034067$var$color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\tvarying vec3 vColor;\\n#endif\";\nvar $d5b33d7c30034067$var$color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\tvarying vec3 vColor;\\n#endif\";\nvar $d5b33d7c30034067$var$color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\nvar $d5b33d7c30034067$var$common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\tfloat precisionSafeLength( vec3 v ) {\\n\t\tfloat maxComponent = max3( abs( v ) );\\n\t\treturn length( v / maxComponent ) * maxComponent;\\n\t}\\n#endif\\nstruct IncidentLight {\\n\tvec3 color;\\n\tvec3 direction;\\n\tbool visible;\\n};\\nstruct ReflectedLight {\\n\tvec3 directDiffuse;\\n\tvec3 directSpecular;\\n\tvec3 indirectDiffuse;\\n\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\tvec3 position;\\n\tvec3 normal;\\n\tvec3 viewDir;\\n#ifdef USE_CLEARCOAT\\n\tvec3 clearcoatNormal;\\n#endif\\n};\\n#ifdef USE_ALPHAHASH\\n\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\tmat3 tmp;\\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\nvar $d5b33d7c30034067$var$cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\t#define cubeUV_minMipLevel 4.0\\n\t#define cubeUV_minTileSize 16.0\\n\tfloat getFace( vec3 direction ) {\\n\t\tvec3 absDirection = abs( direction );\\n\t\tfloat face = - 1.0;\\n\t\tif ( absDirection.x > absDirection.z ) {\\n\t\t\tif ( absDirection.x > absDirection.y )\\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\t\t\telse\\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\t\t} else {\\n\t\t\tif ( absDirection.z > absDirection.y )\\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\t\t\telse\\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\t\t}\\n\t\treturn face;\\n\t}\\n\tvec2 getUV( vec3 direction, float face ) {\\n\t\tvec2 uv;\\n\t\tif ( face == 0.0 ) {\\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\t\t} else if ( face == 1.0 ) {\\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\t\t} else if ( face == 2.0 ) {\\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\t\t} else if ( face == 3.0 ) {\\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\t\t} else if ( face == 4.0 ) {\\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\t\t} else {\\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\t\t}\\n\t\treturn 0.5 * ( uv + 1.0 );\\n\t}\\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\t\tfloat face = getFace( direction );\\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\t\tfloat faceSize = exp2( mipInt );\\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\t\tif ( face > 2.0 ) {\\n\t\t\tuv.y += faceSize;\\n\t\t\tface -= 3.0;\\n\t\t}\\n\t\tuv.x += face * faceSize;\\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\t\t#ifdef texture2DGradEXT\\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\t\t#else\\n\t\t\treturn texture2D( envMap, uv ).rgb;\\n\t\t#endif\\n\t}\\n\t#define cubeUV_r0 1.0\\n\t#define cubeUV_v0 0.339\\n\t#define cubeUV_m0 - 2.0\\n\t#define cubeUV_r1 0.8\\n\t#define cubeUV_v1 0.276\\n\t#define cubeUV_m1 - 1.0\\n\t#define cubeUV_r4 0.4\\n\t#define cubeUV_v4 0.046\\n\t#define cubeUV_m4 2.0\\n\t#define cubeUV_r5 0.305\\n\t#define cubeUV_v5 0.016\\n\t#define cubeUV_m5 3.0\\n\t#define cubeUV_r6 0.21\\n\t#define cubeUV_v6 0.0038\\n\t#define cubeUV_m6 4.0\\n\tfloat roughnessToMip( float roughness ) {\\n\t\tfloat mip = 0.0;\\n\t\tif ( roughness >= cubeUV_r1 ) {\\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\t\t} else if ( roughness >= cubeUV_r4 ) {\\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\t\t} else if ( roughness >= cubeUV_r5 ) {\\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\t\t} else if ( roughness >= cubeUV_r6 ) {\\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\t\t} else {\\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\\n\t\treturn mip;\\n\t}\\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\t\tfloat mipF = fract( mip );\\n\t\tfloat mipInt = floor( mip );\\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\t\tif ( mipF == 0.0 ) {\\n\t\t\treturn vec4( color0, 1.0 );\\n\t\t} else {\\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\t\t}\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\tuniform sampler2D displacementMap;\\n\tuniform float displacementScale;\\n\tuniform float displacementBias;\\n#endif\";\nvar $d5b33d7c30034067$var$displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\nvar $d5b33d7c30034067$var$emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\nvar $d5b33d7c30034067$var$emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\tuniform sampler2D emissiveMap;\\n#endif\";\nvar $d5b33d7c30034067$var$colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\nvar $d5b33d7c30034067$var$colorspace_pars_fragment = \"vec4 LinearToLinear( in vec4 value ) {\\n\treturn value;\\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}\";\nvar $d5b33d7c30034067$var$envmap_fragment = \"#ifdef USE_ENVMAP\\n\t#ifdef ENV_WORLDPOS\\n\t\tvec3 cameraToFrag;\\n\t\tif ( isOrthographic ) {\\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\t\t} else {\\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\t\t}\\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\t\t#ifdef ENVMAP_MODE_REFLECTION\\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\t\t#else\\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\t\t#endif\\n\t#else\\n\t\tvec3 reflectVec = vReflect;\\n\t#endif\\n\t#ifdef ENVMAP_TYPE_CUBE\\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\t#else\\n\t\tvec4 envColor = vec4( 0.0 );\\n\t#endif\\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\t#elif defined( ENVMAP_BLENDING_MIX )\\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\t#elif defined( ENVMAP_BLENDING_ADD )\\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\tuniform float envMapIntensity;\\n\tuniform float flipEnvMap;\\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\";\nvar $d5b33d7c30034067$var$envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\tuniform float reflectivity;\\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\nvar $d5b33d7c30034067$var$envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$fog_vertex = \"#ifdef USE_FOG\\n\tvFogDepth = - mvPosition.z;\\n#endif\";\nvar $d5b33d7c30034067$var$fog_pars_vertex = \"#ifdef USE_FOG\\n\tvarying float vFogDepth;\\n#endif\";\nvar $d5b33d7c30034067$var$fog_fragment = \"#ifdef USE_FOG\\n\t#ifdef FOG_EXP2\\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\t#else\\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\t#endif\\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\nvar $d5b33d7c30034067$var$fog_pars_fragment = \"#ifdef USE_FOG\\n\tuniform vec3 fogColor;\\n\tvarying float vFogDepth;\\n\t#ifdef FOG_EXP2\\n\t\tuniform float fogDensity;\\n\t#else\\n\t\tuniform float fogNear;\\n\t\tuniform float fogFar;\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$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 vec3( texture2D( gradientMap, coord ).r );\\n\t#else\\n\t\tvec2 fw = fwidth( coord ) * 0.5;\\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\t#endif\\n}\";\nvar $d5b33d7c30034067$var$lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\nvar $d5b33d7c30034067$var$lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\tuniform sampler2D lightMap;\\n\tuniform float lightMapIntensity;\\n#endif\";\nvar $d5b33d7c30034067$var$lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\nvar $d5b33d7c30034067$var$lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\tvec3 diffuseColor;\\n\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\";\nvar $d5b33d7c30034067$var$lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\tvec3 irradiance = ambientLightColor;\\n\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\t#if defined ( LEGACY_LIGHTS )\\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\t\t}\\n\t\treturn 1.0;\\n\t#else\\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\t\tif ( cutoffDistance > 0.0 ) {\\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\t\t}\\n\t\treturn distanceFalloff;\\n\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\tstruct DirectionalLight {\\n\t\tvec3 direction;\\n\t\tvec3 color;\\n\t};\\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tlight.color = directionalLight.color;\\n\t\tlight.direction = directionalLight.direction;\\n\t\tlight.visible = true;\\n\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\tstruct PointLight {\\n\t\tvec3 position;\\n\t\tvec3 color;\\n\t\tfloat distance;\\n\t\tfloat decay;\\n\t};\\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tvec3 lVector = pointLight.position - geometry.position;\\n\t\tlight.direction = normalize( lVector );\\n\t\tfloat lightDistance = length( lVector );\\n\t\tlight.color = pointLight.color;\\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\tstruct SpotLight {\\n\t\tvec3 position;\\n\t\tvec3 direction;\\n\t\tvec3 color;\\n\t\tfloat distance;\\n\t\tfloat decay;\\n\t\tfloat coneCos;\\n\t\tfloat penumbraCos;\\n\t};\\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\t\tvec3 lVector = spotLight.position - geometry.position;\\n\t\tlight.direction = normalize( lVector );\\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\t\tif ( spotAttenuation > 0.0 ) {\\n\t\t\tfloat lightDistance = length( lVector );\\n\t\t\tlight.color = spotLight.color * spotAttenuation;\\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\t\t} else {\\n\t\t\tlight.color = vec3( 0.0 );\\n\t\t\tlight.visible = false;\\n\t\t}\\n\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\tstruct RectAreaLight {\\n\t\tvec3 color;\\n\t\tvec3 position;\\n\t\tvec3 halfWidth;\\n\t\tvec3 halfHeight;\\n\t};\\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\tstruct HemisphereLight {\\n\t\tvec3 direction;\\n\t\tvec3 skyColor;\\n\t\tvec3 groundColor;\\n\t};\\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\t\treturn irradiance;\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\\n\t\t#else\\n\t\t\treturn vec3( 0.0 );\\n\t\t#endif\\n\t}\\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\t\t\treturn envMapColor.rgb * envMapIntensity;\\n\t\t#else\\n\t\t\treturn vec3( 0.0 );\\n\t\t#endif\\n\t}\\n\t#ifdef USE_ANISOTROPY\\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\t\t\t#else\\n\t\t\t\treturn vec3( 0.0 );\\n\t\t\t#endif\\n\t\t}\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\nvar $d5b33d7c30034067$var$lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\";\nvar $d5b33d7c30034067$var$lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\nvar $d5b33d7c30034067$var$lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\tvec3 diffuseColor;\\n\tvec3 specularColor;\\n\tfloat specularShininess;\\n\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\";\nvar $d5b33d7c30034067$var$lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\tmaterial.ior = ior;\\n\t#ifdef USE_SPECULAR\\n\t\tfloat specularIntensityFactor = specularIntensity;\\n\t\tvec3 specularColorFactor = specularColor;\\n\t\t#ifdef USE_SPECULAR_COLORMAP\\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\t\t#endif\\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\t\t#endif\\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\t#else\\n\t\tfloat specularIntensityFactor = 1.0;\\n\t\tvec3 specularColorFactor = vec3( 1.0 );\\n\t\tmaterial.specularF90 = 1.0;\\n\t#endif\\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tmaterial.clearcoat = clearcoat;\\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\tmaterial.clearcoatF90 = 1.0;\\n\t#ifdef USE_CLEARCOATMAP\\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\t#endif\\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_IRIDESCENCE\\n\tmaterial.iridescence = iridescence;\\n\tmaterial.iridescenceIOR = iridescenceIOR;\\n\t#ifdef USE_IRIDESCENCEMAP\\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\t#endif\\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\t#else\\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\tmaterial.sheenColor = sheenColor;\\n\t#ifdef USE_SHEEN_COLORMAP\\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\t#endif\\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\t#ifdef USE_ANISOTROPYMAP\\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\t#else\\n\t\tvec2 anisotropyV = anisotropyVector;\\n\t#endif\\n\tmaterial.anisotropy = length( anisotropyV );\\n\tanisotropyV /= material.anisotropy;\\n\tmaterial.anisotropy = saturate( material.anisotropy );\\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\\n#endif\";\nvar $d5b33d7c30034067$var$lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\tvec3 diffuseColor;\\n\tfloat roughness;\\n\tvec3 specularColor;\\n\tfloat specularF90;\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat clearcoat;\\n\t\tfloat clearcoatRoughness;\\n\t\tvec3 clearcoatF0;\\n\t\tfloat clearcoatF90;\\n\t#endif\\n\t#ifdef USE_IRIDESCENCE\\n\t\tfloat iridescence;\\n\t\tfloat iridescenceIOR;\\n\t\tfloat iridescenceThickness;\\n\t\tvec3 iridescenceFresnel;\\n\t\tvec3 iridescenceF0;\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tvec3 sheenColor;\\n\t\tfloat sheenRoughness;\\n\t#endif\\n\t#ifdef IOR\\n\t\tfloat ior;\\n\t#endif\\n\t#ifdef USE_TRANSMISSION\\n\t\tfloat transmission;\\n\t\tfloat transmissionAlpha;\\n\t\tfloat thickness;\\n\t\tfloat attenuationDistance;\\n\t\tvec3 attenuationColor;\\n\t#endif\\n\t#ifdef USE_ANISOTROPY\\n\t\tfloat anisotropy;\\n\t\tfloat alphaT;\\n\t\tvec3 anisotropyT;\\n\t\tvec3 anisotropyB;\\n\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec3 sheenSpecular = vec3( 0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\tfloat a2 = pow2( alpha );\\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\tfloat a2 = pow2( alpha );\\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\t\tfloat v = 0.5 / ( gv + gl );\\n\t\treturn saturate(v);\\n\t}\\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\t\tfloat a2 = alphaT * alphaB;\\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\t\thighp float v2 = dot( v, v );\\n\t\tfloat w2 = a2 / v2;\\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\t\tvec3 f0 = material.clearcoatF0;\\n\t\tfloat f90 = material.clearcoatF90;\\n\t\tfloat roughness = material.clearcoatRoughness;\\n\t\tfloat alpha = pow2( roughness );\\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\t\tfloat D = D_GGX( alpha, dotNH );\\n\t\treturn F * ( V * D );\\n\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\tvec3 f0 = material.specularColor;\\n\tfloat f90 = material.specularF90;\\n\tfloat roughness = material.roughness;\\n\tfloat alpha = pow2( roughness );\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\t#ifdef USE_IRIDESCENCE\\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\t#endif\\n\t#ifdef USE_ANISOTROPY\\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\t#else\\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\t\tfloat D = D_GGX( alpha, dotNH );\\n\t#endif\\n\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\tconst float LUT_SIZE = 64.0;\\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\tfloat dotNV = saturate( dot( N, V ) );\\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\tfloat l = length( f );\\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\tfloat x = dot( v1, v2 );\\n\tfloat y = abs( x );\\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\tfloat v = a / b;\\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\tvec3 lightNormal = cross( v1, v2 );\\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\tvec3 T1, T2;\\n\tT1 = normalize( V - N * dot( V, N ) );\\n\tT2 = - cross( N, T1 );\\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\tvec3 coords[ 4 ];\\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\tvec3 vectorFormFactor = vec3( 0.0 );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\tfloat alpha = pow2( roughness );\\n\tfloat invAlpha = 1.0 / alpha;\\n\tfloat cos2h = dotNH * dotNH;\\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\tfloat V = V_Neubelt( dotNV, dotNL );\\n\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat r2 = roughness * roughness;\\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\tvec4 r = roughness * c0 + c1;\\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\t#ifdef USE_IRIDESCENCE\\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\t#else\\n\t\tvec3 Fr = specularColor;\\n\t#endif\\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\tfloat Ess = fab.x + fab.y;\\n\tfloat Ems = 1.0 - Ess;\\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\tsingleScatter += FssEss;\\n\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\t\tvec3 normal = geometry.normal;\\n\t\tvec3 viewDir = geometry.viewDir;\\n\t\tvec3 position = geometry.position;\\n\t\tvec3 lightPos = rectAreaLight.position;\\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\t\tvec3 lightColor = rectAreaLight.color;\\n\t\tfloat roughness = material.roughness;\\n\t\tvec3 rectCoords[ 4 ];\\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\t\tvec4 t1 = texture2D( ltc_1, uv );\\n\t\tvec4 t2 = texture2D( ltc_2, uv );\\n\t\tmat3 mInv = mat3(\\n\t\t\tvec3( t1.x, 0, t1.y ),\\n\t\t\tvec3( 0, 1, 0 ),\\n\t\t\tvec3( t1.z, 0, t1.w )\\n\t\t);\\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\tvec3 irradiance = dotNL * directLight.color;\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\t#endif\\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\t#ifdef USE_CLEARCOAT\\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\t#endif\\n\t#ifdef USE_SHEEN\\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\\n\t#endif\\n\tvec3 singleScattering = vec3( 0.0 );\\n\tvec3 multiScattering = vec3( 0.0 );\\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\t#ifdef USE_IRIDESCENCE\\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\t#else\\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\t#endif\\n\tvec3 totalScattering = singleScattering + multiScattering;\\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\t\t\t\tRE_Direct_Physical\\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\nvar $d5b33d7c30034067$var$lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\\n\tif ( material.iridescenceThickness == 0.0 ) {\\n\t\tmaterial.iridescence = 0.0;\\n\t} else {\\n\t\tmaterial.iridescence = saturate( material.iridescence );\\n\t}\\n\tif ( material.iridescence > 0.0 ) {\\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\tPointLight pointLight;\\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\tPointLightShadow pointLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\t\tpointLight = pointLights[ i ];\\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\t\tpointLightShadow = pointLightShadows[ i ];\\n\t\tdirectLight.color *= ( 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\tvec4 spotColor;\\n\tvec3 spotLightCoord;\\n\tbool inSpotLightMap;\\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\tSpotLightShadow spotLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\t\tspotLight = spotLights[ i ];\\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\t\t#else\\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\t\t#endif\\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\t\t#endif\\n\t\t#undef SPOT_LIGHT_MAP_INDEX\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\tspotLightShadow = spotLightShadows[ i ];\\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\t\t#endif\\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\tDirectionalLight directionalLight;\\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\tDirectionalLightShadow directionalLightShadow;\\n\t#endif\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\t\tdirectionalLight = directionalLights[ i ];\\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\t\t#endif\\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\tRectAreaLight rectAreaLight;\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\t\trectAreaLight = rectAreaLights[ i ];\\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\tvec3 iblIrradiance = vec3( 0.0 );\\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\tvec3 radiance = vec3( 0.0 );\\n\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\nvar $d5b33d7c30034067$var$lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\t#ifdef USE_LIGHTMAP\\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\t\tirradiance += lightMapIrradiance;\\n\t#endif\\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\t#ifdef USE_ANISOTROPY\\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\\n\t#else\\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\t#endif\\n\t#ifdef USE_CLEARCOAT\\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$map_fragment = \"#ifdef USE_MAP\\n\tdiffuseColor *= texture2D( map, vMapUv );\\n#endif\";\nvar $d5b33d7c30034067$var$map_pars_fragment = \"#ifdef USE_MAP\\n\tuniform sampler2D map;\\n#endif\";\nvar $d5b33d7c30034067$var$map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\t#if defined( USE_POINTS_UV )\\n\t\tvec2 uv = vUv;\\n\t#else\\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\t#endif\\n#endif\\n#ifdef USE_MAP\\n\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\nvar $d5b33d7c30034067$var$map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\tvarying vec2 vUv;\\n#else\\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\t\tuniform mat3 uvTransform;\\n\t#endif\\n#endif\\n#ifdef USE_MAP\\n\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tuniform sampler2D alphaMap;\\n#endif\";\nvar $d5b33d7c30034067$var$metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\nvar $d5b33d7c30034067$var$metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\tuniform sampler2D metalnessMap;\\n#endif\";\nvar $d5b33d7c30034067$var$morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\tvColor *= morphTargetBaseInfluence;\\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t#if defined( USE_COLOR_ALPHA )\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\t\t#elif defined( USE_COLOR )\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\t\t#endif\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\tobjectNormal *= morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\t\t}\\n\t#else\\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\tuniform float morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\t\tuniform sampler2DArray morphTargetsTexture;\\n\t\tuniform ivec2 morphTargetsTextureSize;\\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\t\t}\\n\t#else\\n\t\t#ifndef USE_MORPHNORMALS\\n\t\t\tuniform float morphTargetInfluences[ 8 ];\\n\t\t#else\\n\t\t\tuniform float morphTargetInfluences[ 4 ];\\n\t\t#endif\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\ttransformed *= morphTargetBaseInfluence;\\n\t#ifdef MORPHTARGETS_TEXTURE\\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\t\t}\\n\t#else\\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\t\t#ifndef USE_MORPHNORMALS\\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\t\t#endif\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\tvec3 fdx = dFdx( vViewPosition );\\n\tvec3 fdy = dFdy( vViewPosition );\\n\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\tvec3 normal = normalize( vNormal );\\n\t#ifdef DOUBLE_SIDED\\n\t\tnormal *= faceDirection;\\n\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\t#ifdef USE_TANGENT\\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\t#else\\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\t\t#if defined( USE_NORMALMAP )\\n\t\t\tvNormalMapUv\\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\t\t\tvClearcoatNormalMapUv\\n\t\t#else\\n\t\t\tvUv\\n\t\t#endif\\n\t\t);\\n\t#endif\\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\t\ttbn[0] *= faceDirection;\\n\t\ttbn[1] *= faceDirection;\\n\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\t#ifdef USE_TANGENT\\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\t#else\\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\t#endif\\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\t\ttbn2[0] *= faceDirection;\\n\t\ttbn2[1] *= faceDirection;\\n\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\nvar $d5b33d7c30034067$var$normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\t#ifdef FLIP_SIDED\\n\t\tnormal = - normal;\\n\t#endif\\n\t#ifdef DOUBLE_SIDED\\n\t\tnormal = normal * faceDirection;\\n\t#endif\\n\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\tmapN.xy *= normalScale;\\n\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\nvar $d5b33d7c30034067$var$normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n\t#ifdef USE_TANGENT\\n\t\tvarying vec3 vTangent;\\n\t\tvarying vec3 vBitangent;\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n\t#ifdef USE_TANGENT\\n\t\tvarying vec3 vTangent;\\n\t\tvarying vec3 vBitangent;\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$normal_vertex = \"#ifndef FLAT_SHADED\\n\tvNormal = normalize( transformedNormal );\\n\t#ifdef USE_TANGENT\\n\t\tvTangent = normalize( transformedTangent );\\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\tuniform sampler2D normalMap;\\n\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\\n\t\tvec2 st0 = dFdx( uv.st );\\n\t\tvec2 st1 = dFdy( uv.st );\\n\t\tvec3 N = surf_norm;\\n\t\tvec3 q1perp = cross( q1, N );\\n\t\tvec3 q0perp = cross( N, q0 );\\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\t\treturn mat3( T * scale, B * scale, N );\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\nvar $d5b33d7c30034067$var$clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\nvar $d5b33d7c30034067$var$clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tuniform sampler2D clearcoatNormalMap;\\n\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\nvar $d5b33d7c30034067$var$iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\nvar $d5b33d7c30034067$var$opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\nvar $d5b33d7c30034067$var$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}\\nvec2 packDepthToRG( in highp float v ) {\\n\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\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 depth, const in float near, const in float far ) {\\n\treturn depth * ( 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 depth, const in float near, const in float far ) {\\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\nvar $d5b33d7c30034067$var$premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\nvar $d5b33d7c30034067$var$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;\";\nvar $d5b33d7c30034067$var$dithering_fragment = \"#ifdef DITHERING\\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\troughnessFactor *= texelRoughness.g;\\n#endif\";\nvar $d5b33d7c30034067$var$roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\tuniform sampler2D roughnessMap;\\n#endif\";\nvar $d5b33d7c30034067$var$shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tstruct DirectionalLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t\tstruct SpotLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tstruct PointLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t\tfloat shadowCameraNear;\\n\t\t\tfloat shadowCameraFar;\\n\t\t};\\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\t#endif\\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\t}\\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\t}\\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\t\tfloat occlusion = 1.0;\\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\t\tfloat hard_shadow = step( compare , distribution.x );\\n\t\tif (hard_shadow != 1.0 ) {\\n\t\t\tfloat distance = compare - distribution.x ;\\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\t\t}\\n\t\treturn occlusion;\\n\t}\\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\t\tfloat shadow = 1.0;\\n\t\tshadowCoord.xyz /= shadowCoord.w;\\n\t\tshadowCoord.z += shadowBias;\\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\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\";\nvar $d5b33d7c30034067$var$shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\t\tstruct DirectionalLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\t\tstruct SpotLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t};\\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\t\tstruct PointLightShadow {\\n\t\t\tfloat shadowBias;\\n\t\t\tfloat shadowNormalBias;\\n\t\t\tfloat shadowRadius;\\n\t\t\tvec2 shadowMapSize;\\n\t\t\tfloat shadowCameraNear;\\n\t\t\tfloat shadowCameraFar;\\n\t\t};\\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\t#endif\\n#endif\";\nvar $d5b33d7c30034067$var$shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\t\t#pragma unroll_loop_start\\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\t\t}\\n\t\t#pragma unroll_loop_end\\n\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\t#pragma unroll_loop_start\\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\t\tshadowWorldPosition = worldPosition;\\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\t\t#endif\\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\t}\\n\t#pragma unroll_loop_end\\n#endif\";\nvar $d5b33d7c30034067$var$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, vSpotLightCoord[ 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}\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\tuniform mat4 bindMatrix;\\n\tuniform mat4 bindMatrixInverse;\\n\tuniform highp sampler2D boneTexture;\\n\tuniform int boneTextureSize;\\n\tmat4 getBoneMatrix( const in float i ) {\\n\t\tfloat j = i * 4.0;\\n\t\tfloat x = mod( j, float( boneTextureSize ) );\\n\t\tfloat y = floor( j / float( boneTextureSize ) );\\n\t\tfloat dx = 1.0 / float( boneTextureSize );\\n\t\tfloat dy = 1.0 / float( boneTextureSize );\\n\t\ty = dy * ( y + 0.5 );\\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\t\treturn bone;\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$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\";\nvar $d5b33d7c30034067$var$specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\tspecularStrength = texelSpecular.r;\\n#else\\n\tspecularStrength = 1.0;\\n#endif\";\nvar $d5b33d7c30034067$var$specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\tuniform sampler2D specularMap;\\n#endif\";\nvar $d5b33d7c30034067$var$tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\nvar $d5b33d7c30034067$var$tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\tcolor *= toneMappingExposure;\\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\tcolor *= toneMappingExposure;\\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\tconst mat3 ACESInputMat = mat3(\\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\\n\t);\\n\tconst mat3 ACESOutputMat = mat3(\\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\\n\t);\\n\tcolor *= toneMappingExposure / 0.6;\\n\tcolor = ACESInputMat * color;\\n\tcolor = RRTAndODTFit( color );\\n\tcolor = ACESOutputMat * color;\\n\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\nvar $d5b33d7c30034067$var$transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\tmaterial.transmission = transmission;\\n\tmaterial.transmissionAlpha = 1.0;\\n\tmaterial.thickness = thickness;\\n\tmaterial.attenuationDistance = attenuationDistance;\\n\tmaterial.attenuationColor = attenuationColor;\\n\t#ifdef USE_TRANSMISSIONMAP\\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\t#endif\\n\t#ifdef USE_THICKNESSMAP\\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\t#endif\\n\tvec3 pos = vWorldPosition;\\n\tvec3 v = normalize( cameraPosition - pos );\\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\tvec4 transmitted = getIBLVolumeRefraction(\\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\t\tmaterial.attenuationColor, material.attenuationDistance );\\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\nvar $d5b33d7c30034067$var$transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\tuniform float transmission;\\n\tuniform float thickness;\\n\tuniform float attenuationDistance;\\n\tuniform vec3 attenuationColor;\\n\t#ifdef USE_TRANSMISSIONMAP\\n\t\tuniform sampler2D transmissionMap;\\n\t#endif\\n\t#ifdef USE_THICKNESSMAP\\n\t\tuniform sampler2D thicknessMap;\\n\t#endif\\n\tuniform vec2 transmissionSamplerSize;\\n\tuniform sampler2D transmissionSamplerMap;\\n\tuniform mat4 modelMatrix;\\n\tuniform mat4 projectionMatrix;\\n\tvarying vec3 vWorldPosition;\\n\tfloat w0( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\t}\\n\tfloat w1( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\t}\\n\tfloat w2( float a ){\\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\t}\\n\tfloat w3( float a ) {\\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\t}\\n\tfloat g0( float a ) {\\n\t\treturn w0( a ) + w1( a );\\n\t}\\n\tfloat g1( float a ) {\\n\t\treturn w2( a ) + w3( a );\\n\t}\\n\tfloat h0( float a ) {\\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\t}\\n\tfloat h1( float a ) {\\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\t}\\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\t\tuv = uv * texelSize.zw + 0.5;\\n\t\tvec2 iuv = floor( uv );\\n\t\tvec2 fuv = fract( uv );\\n\t\tfloat g0x = g0( fuv.x );\\n\t\tfloat g1x = g1( fuv.x );\\n\t\tfloat h0x = h0( fuv.x );\\n\t\tfloat h1x = h1( fuv.x );\\n\t\tfloat h0y = h0( fuv.y );\\n\t\tfloat h1y = h1( fuv.y );\\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\t}\\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\t\treturn mix( fSample, cSample, fract( lod ) );\\n\t}\\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\t\tvec3 modelScale;\\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\\n\t}\\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\t}\\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\t}\\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\t\tif ( isinf( attenuationDistance ) ) {\\n\t\t\treturn vec3( 1.0 );\\n\t\t} else {\\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\\n\t\t}\\n\t}\\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\t\tvec3 refractedRayExit = position + transmissionRay;\\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\t\trefractionCoords += 1.0;\\n\t\trefractionCoords /= 2.0;\\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\t}\\n#endif\";\nvar $d5b33d7c30034067$var$uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tuniform mat3 transmissionMapTransform;\\n\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tuniform mat3 thicknessMapTransform;\\n\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar $d5b33d7c30034067$var$uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\tuniform mat3 mapTransform;\\n\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tuniform mat3 alphaMapTransform;\\n\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tuniform mat3 lightMapTransform;\\n\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\tuniform mat3 aoMapTransform;\\n\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tuniform mat3 bumpMapTransform;\\n\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tuniform mat3 normalMapTransform;\\n\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\tuniform mat3 displacementMapTransform;\\n\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tuniform mat3 emissiveMapTransform;\\n\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tuniform mat3 metalnessMapTransform;\\n\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tuniform mat3 roughnessMapTransform;\\n\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tuniform mat3 anisotropyMapTransform;\\n\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tuniform mat3 clearcoatMapTransform;\\n\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tuniform mat3 clearcoatNormalMapTransform;\\n\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tuniform mat3 clearcoatRoughnessMapTransform;\\n\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tuniform mat3 sheenColorMapTransform;\\n\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tuniform mat3 sheenRoughnessMapTransform;\\n\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tuniform mat3 iridescenceMapTransform;\\n\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tuniform mat3 iridescenceThicknessMapTransform;\\n\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tuniform mat3 specularMapTransform;\\n\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tuniform mat3 specularColorMapTransform;\\n\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tuniform mat3 specularIntensityMapTransform;\\n\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tuniform mat3 transmissionMapTransform;\\n\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tuniform mat3 thicknessMapTransform;\\n\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar $d5b33d7c30034067$var$uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\nvar $d5b33d7c30034067$var$worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\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\";\nconst $d5b33d7c30034067$var$vertex$h = \"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}\";\nconst $d5b33d7c30034067$var$fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\tvec4 texColor = texture2D( t2D, vUv );\\n\ttexColor.rgb *= backgroundIntensity;\\n\tgl_FragColor = texColor;\\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n\tgl_Position.z = gl_Position.w;\\n}\";\nconst $d5b33d7c30034067$var$fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\t#ifdef ENVMAP_TYPE_CUBE\\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\t#else\\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\t#endif\\n\ttexColor.rgb *= backgroundIntensity;\\n\tgl_FragColor = texColor;\\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n\tgl_Position.z = gl_Position.w;\\n}\";\nconst $d5b33d7c30034067$var$fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\tgl_FragColor = texColor;\\n\tgl_FragColor.a *= opacity;\\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\t#include \\n\t#include \\n\t#ifdef USE_DISPLACEMENTMAP\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvHighPrecisionZW = gl_Position.zw;\\n}\";\nconst $d5b33d7c30034067$var$fragment$e = \"#if DEPTH_PACKING == 3200\\n\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( 1.0 );\\n\t#if DEPTH_PACKING == 3200\\n\t\tdiffuseColor.a = opacity;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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}\";\nconst $d5b33d7c30034067$var$vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#ifdef USE_DISPLACEMENTMAP\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvWorldPosition = worldPosition.xyz;\\n}\";\nconst $d5b33d7c30034067$var$fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\t#include \\n\tvec4 diffuseColor = vec4( 1.0 );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tfloat dist = length( vWorldPosition - referencePosition );\\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\tdist = saturate( dist );\\n\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\nconst $d5b33d7c30034067$var$vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvWorldDirection = transformDirection( position, modelMatrix );\\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\tvec3 direction = normalize( vWorldDirection );\\n\tvec2 sampleUV = equirectUv( direction );\\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\tvLineDistance = scale * lineDistance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t\t#include \\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\t#ifdef USE_LIGHTMAP\\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\t#else\\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\t#endif\\n\t#include \\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n}\";\nconst $d5b33d7c30034067$var$fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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#else\\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\t#endif\\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\nconst $d5b33d7c30034067$var$fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\t#ifdef OPAQUE\\n\t\tgl_FragColor.a = 1.0;\\n\t#endif\\n}\";\nconst $d5b33d7c30034067$var$vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n#ifdef USE_TRANSMISSION\\n\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\nconst $d5b33d7c30034067$var$fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\t#define IOR\\n\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\tuniform float specularIntensity;\\n\tuniform vec3 specularColor;\\n\t#ifdef USE_SPECULAR_COLORMAP\\n\t\tuniform sampler2D specularColorMap;\\n\t#endif\\n\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\t\tuniform sampler2D specularIntensityMap;\\n\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\tuniform float clearcoat;\\n\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\tuniform float iridescence;\\n\tuniform float iridescenceIOR;\\n\tuniform float iridescenceThicknessMinimum;\\n\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\tuniform vec3 sheenColor;\\n\tuniform float sheenRoughness;\\n\t#ifdef USE_SHEEN_COLORMAP\\n\t\tuniform sampler2D sheenColorMap;\\n\t#endif\\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\t\tuniform sampler2D sheenRoughnessMap;\\n\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\tuniform vec2 anisotropyVector;\\n\t#ifdef USE_ANISOTROPYMAP\\n\t\tuniform sampler2D anisotropyMap;\\n\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\t#include \\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\t#ifdef USE_SHEEN\\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\\n\t#endif\\n\t#ifdef USE_CLEARCOAT\\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvViewPosition = - mvPosition.xyz;\\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\tvarying vec2 vUv;\\n\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\t#ifdef USE_POINTS_UV\\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\t#endif\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\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 \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec3 outgoingLight = vec3( 0.0 );\\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\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 \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$var$fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\t#include \\n\tvec3 outgoingLight = vec3( 0.0 );\\n\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n\toutgoingLight = diffuseColor.rgb;\\n\t#include \\n\t#include \\n\t#include \\n\t#include \\n}\";\nconst $d5b33d7c30034067$export$955f9f2e84c43c8b = {\n alphahash_fragment: $d5b33d7c30034067$var$alphahash_fragment,\n alphahash_pars_fragment: $d5b33d7c30034067$var$alphahash_pars_fragment,\n alphamap_fragment: $d5b33d7c30034067$var$alphamap_fragment,\n alphamap_pars_fragment: $d5b33d7c30034067$var$alphamap_pars_fragment,\n alphatest_fragment: $d5b33d7c30034067$var$alphatest_fragment,\n alphatest_pars_fragment: $d5b33d7c30034067$var$alphatest_pars_fragment,\n aomap_fragment: $d5b33d7c30034067$var$aomap_fragment,\n aomap_pars_fragment: $d5b33d7c30034067$var$aomap_pars_fragment,\n begin_vertex: $d5b33d7c30034067$var$begin_vertex,\n beginnormal_vertex: $d5b33d7c30034067$var$beginnormal_vertex,\n bsdfs: $d5b33d7c30034067$var$bsdfs,\n iridescence_fragment: $d5b33d7c30034067$var$iridescence_fragment,\n bumpmap_pars_fragment: $d5b33d7c30034067$var$bumpmap_pars_fragment,\n clipping_planes_fragment: $d5b33d7c30034067$var$clipping_planes_fragment,\n clipping_planes_pars_fragment: $d5b33d7c30034067$var$clipping_planes_pars_fragment,\n clipping_planes_pars_vertex: $d5b33d7c30034067$var$clipping_planes_pars_vertex,\n clipping_planes_vertex: $d5b33d7c30034067$var$clipping_planes_vertex,\n color_fragment: $d5b33d7c30034067$var$color_fragment,\n color_pars_fragment: $d5b33d7c30034067$var$color_pars_fragment,\n color_pars_vertex: $d5b33d7c30034067$var$color_pars_vertex,\n color_vertex: $d5b33d7c30034067$var$color_vertex,\n common: $d5b33d7c30034067$var$common,\n cube_uv_reflection_fragment: $d5b33d7c30034067$var$cube_uv_reflection_fragment,\n defaultnormal_vertex: $d5b33d7c30034067$var$defaultnormal_vertex,\n displacementmap_pars_vertex: $d5b33d7c30034067$var$displacementmap_pars_vertex,\n displacementmap_vertex: $d5b33d7c30034067$var$displacementmap_vertex,\n emissivemap_fragment: $d5b33d7c30034067$var$emissivemap_fragment,\n emissivemap_pars_fragment: $d5b33d7c30034067$var$emissivemap_pars_fragment,\n colorspace_fragment: $d5b33d7c30034067$var$colorspace_fragment,\n colorspace_pars_fragment: $d5b33d7c30034067$var$colorspace_pars_fragment,\n envmap_fragment: $d5b33d7c30034067$var$envmap_fragment,\n envmap_common_pars_fragment: $d5b33d7c30034067$var$envmap_common_pars_fragment,\n envmap_pars_fragment: $d5b33d7c30034067$var$envmap_pars_fragment,\n envmap_pars_vertex: $d5b33d7c30034067$var$envmap_pars_vertex,\n envmap_physical_pars_fragment: $d5b33d7c30034067$var$envmap_physical_pars_fragment,\n envmap_vertex: $d5b33d7c30034067$var$envmap_vertex,\n fog_vertex: $d5b33d7c30034067$var$fog_vertex,\n fog_pars_vertex: $d5b33d7c30034067$var$fog_pars_vertex,\n fog_fragment: $d5b33d7c30034067$var$fog_fragment,\n fog_pars_fragment: $d5b33d7c30034067$var$fog_pars_fragment,\n gradientmap_pars_fragment: $d5b33d7c30034067$var$gradientmap_pars_fragment,\n lightmap_fragment: $d5b33d7c30034067$var$lightmap_fragment,\n lightmap_pars_fragment: $d5b33d7c30034067$var$lightmap_pars_fragment,\n lights_lambert_fragment: $d5b33d7c30034067$var$lights_lambert_fragment,\n lights_lambert_pars_fragment: $d5b33d7c30034067$var$lights_lambert_pars_fragment,\n lights_pars_begin: $d5b33d7c30034067$var$lights_pars_begin,\n lights_toon_fragment: $d5b33d7c30034067$var$lights_toon_fragment,\n lights_toon_pars_fragment: $d5b33d7c30034067$var$lights_toon_pars_fragment,\n lights_phong_fragment: $d5b33d7c30034067$var$lights_phong_fragment,\n lights_phong_pars_fragment: $d5b33d7c30034067$var$lights_phong_pars_fragment,\n lights_physical_fragment: $d5b33d7c30034067$var$lights_physical_fragment,\n lights_physical_pars_fragment: $d5b33d7c30034067$var$lights_physical_pars_fragment,\n lights_fragment_begin: $d5b33d7c30034067$var$lights_fragment_begin,\n lights_fragment_maps: $d5b33d7c30034067$var$lights_fragment_maps,\n lights_fragment_end: $d5b33d7c30034067$var$lights_fragment_end,\n logdepthbuf_fragment: $d5b33d7c30034067$var$logdepthbuf_fragment,\n logdepthbuf_pars_fragment: $d5b33d7c30034067$var$logdepthbuf_pars_fragment,\n logdepthbuf_pars_vertex: $d5b33d7c30034067$var$logdepthbuf_pars_vertex,\n logdepthbuf_vertex: $d5b33d7c30034067$var$logdepthbuf_vertex,\n map_fragment: $d5b33d7c30034067$var$map_fragment,\n map_pars_fragment: $d5b33d7c30034067$var$map_pars_fragment,\n map_particle_fragment: $d5b33d7c30034067$var$map_particle_fragment,\n map_particle_pars_fragment: $d5b33d7c30034067$var$map_particle_pars_fragment,\n metalnessmap_fragment: $d5b33d7c30034067$var$metalnessmap_fragment,\n metalnessmap_pars_fragment: $d5b33d7c30034067$var$metalnessmap_pars_fragment,\n morphcolor_vertex: $d5b33d7c30034067$var$morphcolor_vertex,\n morphnormal_vertex: $d5b33d7c30034067$var$morphnormal_vertex,\n morphtarget_pars_vertex: $d5b33d7c30034067$var$morphtarget_pars_vertex,\n morphtarget_vertex: $d5b33d7c30034067$var$morphtarget_vertex,\n normal_fragment_begin: $d5b33d7c30034067$var$normal_fragment_begin,\n normal_fragment_maps: $d5b33d7c30034067$var$normal_fragment_maps,\n normal_pars_fragment: $d5b33d7c30034067$var$normal_pars_fragment,\n normal_pars_vertex: $d5b33d7c30034067$var$normal_pars_vertex,\n normal_vertex: $d5b33d7c30034067$var$normal_vertex,\n normalmap_pars_fragment: $d5b33d7c30034067$var$normalmap_pars_fragment,\n clearcoat_normal_fragment_begin: $d5b33d7c30034067$var$clearcoat_normal_fragment_begin,\n clearcoat_normal_fragment_maps: $d5b33d7c30034067$var$clearcoat_normal_fragment_maps,\n clearcoat_pars_fragment: $d5b33d7c30034067$var$clearcoat_pars_fragment,\n iridescence_pars_fragment: $d5b33d7c30034067$var$iridescence_pars_fragment,\n opaque_fragment: $d5b33d7c30034067$var$opaque_fragment,\n packing: $d5b33d7c30034067$var$packing,\n premultiplied_alpha_fragment: $d5b33d7c30034067$var$premultiplied_alpha_fragment,\n project_vertex: $d5b33d7c30034067$var$project_vertex,\n dithering_fragment: $d5b33d7c30034067$var$dithering_fragment,\n dithering_pars_fragment: $d5b33d7c30034067$var$dithering_pars_fragment,\n roughnessmap_fragment: $d5b33d7c30034067$var$roughnessmap_fragment,\n roughnessmap_pars_fragment: $d5b33d7c30034067$var$roughnessmap_pars_fragment,\n shadowmap_pars_fragment: $d5b33d7c30034067$var$shadowmap_pars_fragment,\n shadowmap_pars_vertex: $d5b33d7c30034067$var$shadowmap_pars_vertex,\n shadowmap_vertex: $d5b33d7c30034067$var$shadowmap_vertex,\n shadowmask_pars_fragment: $d5b33d7c30034067$var$shadowmask_pars_fragment,\n skinbase_vertex: $d5b33d7c30034067$var$skinbase_vertex,\n skinning_pars_vertex: $d5b33d7c30034067$var$skinning_pars_vertex,\n skinning_vertex: $d5b33d7c30034067$var$skinning_vertex,\n skinnormal_vertex: $d5b33d7c30034067$var$skinnormal_vertex,\n specularmap_fragment: $d5b33d7c30034067$var$specularmap_fragment,\n specularmap_pars_fragment: $d5b33d7c30034067$var$specularmap_pars_fragment,\n tonemapping_fragment: $d5b33d7c30034067$var$tonemapping_fragment,\n tonemapping_pars_fragment: $d5b33d7c30034067$var$tonemapping_pars_fragment,\n transmission_fragment: $d5b33d7c30034067$var$transmission_fragment,\n transmission_pars_fragment: $d5b33d7c30034067$var$transmission_pars_fragment,\n uv_pars_fragment: $d5b33d7c30034067$var$uv_pars_fragment,\n uv_pars_vertex: $d5b33d7c30034067$var$uv_pars_vertex,\n uv_vertex: $d5b33d7c30034067$var$uv_vertex,\n worldpos_vertex: $d5b33d7c30034067$var$worldpos_vertex,\n background_vert: $d5b33d7c30034067$var$vertex$h,\n background_frag: $d5b33d7c30034067$var$fragment$h,\n backgroundCube_vert: $d5b33d7c30034067$var$vertex$g,\n backgroundCube_frag: $d5b33d7c30034067$var$fragment$g,\n cube_vert: $d5b33d7c30034067$var$vertex$f,\n cube_frag: $d5b33d7c30034067$var$fragment$f,\n depth_vert: $d5b33d7c30034067$var$vertex$e,\n depth_frag: $d5b33d7c30034067$var$fragment$e,\n distanceRGBA_vert: $d5b33d7c30034067$var$vertex$d,\n distanceRGBA_frag: $d5b33d7c30034067$var$fragment$d,\n equirect_vert: $d5b33d7c30034067$var$vertex$c,\n equirect_frag: $d5b33d7c30034067$var$fragment$c,\n linedashed_vert: $d5b33d7c30034067$var$vertex$b,\n linedashed_frag: $d5b33d7c30034067$var$fragment$b,\n meshbasic_vert: $d5b33d7c30034067$var$vertex$a,\n meshbasic_frag: $d5b33d7c30034067$var$fragment$a,\n meshlambert_vert: $d5b33d7c30034067$var$vertex$9,\n meshlambert_frag: $d5b33d7c30034067$var$fragment$9,\n meshmatcap_vert: $d5b33d7c30034067$var$vertex$8,\n meshmatcap_frag: $d5b33d7c30034067$var$fragment$8,\n meshnormal_vert: $d5b33d7c30034067$var$vertex$7,\n meshnormal_frag: $d5b33d7c30034067$var$fragment$7,\n meshphong_vert: $d5b33d7c30034067$var$vertex$6,\n meshphong_frag: $d5b33d7c30034067$var$fragment$6,\n meshphysical_vert: $d5b33d7c30034067$var$vertex$5,\n meshphysical_frag: $d5b33d7c30034067$var$fragment$5,\n meshtoon_vert: $d5b33d7c30034067$var$vertex$4,\n meshtoon_frag: $d5b33d7c30034067$var$fragment$4,\n points_vert: $d5b33d7c30034067$var$vertex$3,\n points_frag: $d5b33d7c30034067$var$fragment$3,\n shadow_vert: $d5b33d7c30034067$var$vertex$2,\n shadow_frag: $d5b33d7c30034067$var$fragment$2,\n sprite_vert: $d5b33d7c30034067$var$vertex$1,\n sprite_frag: $d5b33d7c30034067$var$fragment$1\n};\n/**\n * Uniforms library for shared webgl shaders\n */ const $d5b33d7c30034067$export$6643083551874bf5 = {\n common: {\n diffuse: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n }\n },\n specularmap: {\n specularMap: {\n value: null\n },\n specularMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n envmap: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n reflectivity: {\n value: 1.0\n },\n ior: {\n value: 1.5\n },\n refractionRatio: {\n value: 0.98\n }\n },\n aomap: {\n aoMap: {\n value: null\n },\n aoMapIntensity: {\n value: 1\n },\n aoMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n lightmap: {\n lightMap: {\n value: null\n },\n lightMapIntensity: {\n value: 1\n },\n lightMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n bumpmap: {\n bumpMap: {\n value: null\n },\n bumpMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n bumpScale: {\n value: 1\n }\n },\n normalmap: {\n normalMap: {\n value: null\n },\n normalMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n normalScale: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1)\n }\n },\n displacementmap: {\n displacementMap: {\n value: null\n },\n displacementMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n displacementScale: {\n value: 1\n },\n displacementBias: {\n value: 0\n }\n },\n emissivemap: {\n emissiveMap: {\n value: null\n },\n emissiveMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n metalnessmap: {\n metalnessMap: {\n value: null\n },\n metalnessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n roughnessmap: {\n roughnessMap: {\n value: null\n },\n roughnessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n gradientmap: {\n gradientMap: {\n value: null\n }\n },\n fog: {\n fogDensity: {\n value: 0.00025\n },\n fogNear: {\n value: 1\n },\n fogFar: {\n value: 2000\n },\n fogColor: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff)\n }\n },\n lights: {\n ambientLightColor: {\n value: []\n },\n lightProbe: {\n value: []\n },\n directionalLights: {\n value: [],\n properties: {\n direction: {},\n color: {}\n }\n },\n directionalLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n directionalShadowMap: {\n value: []\n },\n directionalShadowMatrix: {\n value: []\n },\n spotLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n direction: {},\n distance: {},\n coneCos: {},\n penumbraCos: {},\n decay: {}\n }\n },\n spotLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n spotLightMap: {\n value: []\n },\n spotShadowMap: {\n value: []\n },\n spotLightMatrix: {\n value: []\n },\n pointLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n decay: {},\n distance: {}\n }\n },\n pointLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {},\n shadowCameraNear: {},\n shadowCameraFar: {}\n }\n },\n pointShadowMap: {\n value: []\n },\n pointShadowMatrix: {\n value: []\n },\n hemisphereLights: {\n value: [],\n properties: {\n direction: {},\n skyColor: {},\n groundColor: {}\n }\n },\n // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n rectAreaLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n width: {},\n height: {}\n }\n },\n ltc_1: {\n value: null\n },\n ltc_2: {\n value: null\n }\n },\n points: {\n diffuse: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n size: {\n value: 1.0\n },\n scale: {\n value: 1.0\n },\n map: {\n value: null\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n },\n uvTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n },\n sprite: {\n diffuse: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n center: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, 0.5)\n },\n rotation: {\n value: 0.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n alphaTest: {\n value: 0\n }\n }\n};\nconst $d5b33d7c30034067$export$bee4a7d47f8f5014 = {\n basic: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.specularmap,\n $d5b33d7c30034067$export$6643083551874bf5.envmap,\n $d5b33d7c30034067$export$6643083551874bf5.aomap,\n $d5b33d7c30034067$export$6643083551874bf5.lightmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshbasic_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshbasic_frag\n },\n lambert: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.specularmap,\n $d5b33d7c30034067$export$6643083551874bf5.envmap,\n $d5b33d7c30034067$export$6643083551874bf5.aomap,\n $d5b33d7c30034067$export$6643083551874bf5.lightmap,\n $d5b33d7c30034067$export$6643083551874bf5.emissivemap,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n $d5b33d7c30034067$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshlambert_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshlambert_frag\n },\n phong: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.specularmap,\n $d5b33d7c30034067$export$6643083551874bf5.envmap,\n $d5b33d7c30034067$export$6643083551874bf5.aomap,\n $d5b33d7c30034067$export$6643083551874bf5.lightmap,\n $d5b33d7c30034067$export$6643083551874bf5.emissivemap,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n $d5b33d7c30034067$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n },\n specular: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x111111)\n },\n shininess: {\n value: 30\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphong_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphong_frag\n },\n standard: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.envmap,\n $d5b33d7c30034067$export$6643083551874bf5.aomap,\n $d5b33d7c30034067$export$6643083551874bf5.lightmap,\n $d5b33d7c30034067$export$6643083551874bf5.emissivemap,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n $d5b33d7c30034067$export$6643083551874bf5.roughnessmap,\n $d5b33d7c30034067$export$6643083551874bf5.metalnessmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n $d5b33d7c30034067$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n },\n roughness: {\n value: 1.0\n },\n metalness: {\n value: 0.0\n },\n envMapIntensity: {\n value: 1\n } // temporary\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphysical_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphysical_frag\n },\n toon: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.aomap,\n $d5b33d7c30034067$export$6643083551874bf5.lightmap,\n $d5b33d7c30034067$export$6643083551874bf5.emissivemap,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n $d5b33d7c30034067$export$6643083551874bf5.gradientmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n $d5b33d7c30034067$export$6643083551874bf5.lights,\n {\n emissive: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshtoon_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshtoon_frag\n },\n matcap: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n {\n matcap: {\n value: null\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshmatcap_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshmatcap_frag\n },\n points: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.points,\n $d5b33d7c30034067$export$6643083551874bf5.fog\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.points_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.points_frag\n },\n dashed: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n {\n scale: {\n value: 1\n },\n dashSize: {\n value: 1\n },\n totalSize: {\n value: 2\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.linedashed_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.linedashed_frag\n },\n depth: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.depth_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.depth_frag\n },\n normal: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.bumpmap,\n $d5b33d7c30034067$export$6643083551874bf5.normalmap,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n {\n opacity: {\n value: 1.0\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshnormal_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshnormal_frag\n },\n sprite: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.sprite,\n $d5b33d7c30034067$export$6643083551874bf5.fog\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.sprite_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.sprite_frag\n },\n background: {\n uniforms: {\n uvTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n t2D: {\n value: null\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.background_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.background_frag\n },\n backgroundCube: {\n uniforms: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n backgroundBlurriness: {\n value: 0\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.backgroundCube_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.backgroundCube_frag\n },\n cube: {\n uniforms: {\n tCube: {\n value: null\n },\n tFlip: {\n value: -1\n },\n opacity: {\n value: 1.0\n }\n },\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.cube_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.cube_frag\n },\n equirect: {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.equirect_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.equirect_frag\n },\n distanceRGBA: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.common,\n $d5b33d7c30034067$export$6643083551874bf5.displacementmap,\n {\n referencePosition: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699()\n },\n nearDistance: {\n value: 1\n },\n farDistance: {\n value: 1000\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.distanceRGBA_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.distanceRGBA_frag\n },\n shadow: {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$6643083551874bf5.lights,\n $d5b33d7c30034067$export$6643083551874bf5.fog,\n {\n color: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x00000)\n },\n opacity: {\n value: 1.0\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.shadow_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.shadow_frag\n }\n};\n$d5b33d7c30034067$export$bee4a7d47f8f5014.physical = {\n uniforms: /*@__PURE__*/ $d5b33d7c30034067$var$mergeUniforms([\n $d5b33d7c30034067$export$bee4a7d47f8f5014.standard.uniforms,\n {\n clearcoat: {\n value: 0\n },\n clearcoatMap: {\n value: null\n },\n clearcoatMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n clearcoatNormalMap: {\n value: null\n },\n clearcoatNormalMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n clearcoatNormalScale: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1)\n },\n clearcoatRoughness: {\n value: 0\n },\n clearcoatRoughnessMap: {\n value: null\n },\n clearcoatRoughnessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n iridescence: {\n value: 0\n },\n iridescenceMap: {\n value: null\n },\n iridescenceMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n iridescenceIOR: {\n value: 1.3\n },\n iridescenceThicknessMinimum: {\n value: 100\n },\n iridescenceThicknessMaximum: {\n value: 400\n },\n iridescenceThicknessMap: {\n value: null\n },\n iridescenceThicknessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n sheen: {\n value: 0\n },\n sheenColor: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n },\n sheenColorMap: {\n value: null\n },\n sheenColorMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n sheenRoughness: {\n value: 1\n },\n sheenRoughnessMap: {\n value: null\n },\n sheenRoughnessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n transmission: {\n value: 0\n },\n transmissionMap: {\n value: null\n },\n transmissionMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n transmissionSamplerSize: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1()\n },\n transmissionSamplerMap: {\n value: null\n },\n thickness: {\n value: 0\n },\n thicknessMap: {\n value: null\n },\n thicknessMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n attenuationDistance: {\n value: 0\n },\n attenuationColor: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(0x000000)\n },\n specularColor: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e(1, 1, 1)\n },\n specularColorMap: {\n value: null\n },\n specularColorMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n specularIntensity: {\n value: 1\n },\n specularIntensityMap: {\n value: null\n },\n specularIntensityMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n },\n anisotropyVector: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1()\n },\n anisotropyMap: {\n value: null\n },\n anisotropyMapTransform: {\n value: /*@__PURE__*/ new $d5b33d7c30034067$export$8ff26dafa08918()\n }\n }\n ]),\n vertexShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphysical_vert,\n fragmentShader: $d5b33d7c30034067$export$955f9f2e84c43c8b.meshphysical_frag\n};\nconst $d5b33d7c30034067$var$_rgb = {\n r: 0,\n b: 0,\n g: 0\n};\nfunction $d5b33d7c30034067$var$WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) {\n const clearColor = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n let clearAlpha = alpha === true ? 0 : 1;\n let planeMesh;\n let boxMesh;\n let currentBackground = null;\n let currentBackgroundVersion = 0;\n let currentTonemapping = null;\n function render(renderList, scene) {\n let forceClear = false;\n let background = scene.isScene === true ? scene.background : null;\n if (background && background.isTexture) {\n const usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n background = (usePMREM ? cubeuvmaps : cubemaps).get(background);\n }\n if (background === null) setClear(clearColor, clearAlpha);\n else if (background && background.isColor) {\n setClear(background, 1);\n forceClear = true;\n }\n const xr = renderer.xr;\n const environmentBlendMode = xr.getEnvironmentBlendMode();\n switch(environmentBlendMode){\n case \"opaque\":\n forceClear = true;\n break;\n case \"additive\":\n state.buffers.color.setClear(0, 0, 0, 1, premultipliedAlpha);\n forceClear = true;\n break;\n case \"alpha-blend\":\n state.buffers.color.setClear(0, 0, 0, 0, premultipliedAlpha);\n forceClear = true;\n break;\n }\n if (renderer.autoClear || forceClear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);\n if (background && (background.isCubeTexture || background.mapping === $d5b33d7c30034067$export$dbf3e70ff37af79)) {\n if (boxMesh === undefined) {\n boxMesh = new $d5b33d7c30034067$export$e176487c05830cc5(new $d5b33d7c30034067$export$33e43285f7406bd5(1, 1, 1), new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"BackgroundCubeMaterial\",\n uniforms: $d5b33d7c30034067$var$cloneUniforms($d5b33d7c30034067$export$bee4a7d47f8f5014.backgroundCube.uniforms),\n vertexShader: $d5b33d7c30034067$export$bee4a7d47f8f5014.backgroundCube.vertexShader,\n fragmentShader: $d5b33d7c30034067$export$bee4a7d47f8f5014.backgroundCube.fragmentShader,\n side: $d5b33d7c30034067$export$d9f0486e75b5ace,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n boxMesh.geometry.deleteAttribute(\"normal\");\n boxMesh.geometry.deleteAttribute(\"uv\");\n boxMesh.onBeforeRender = function(renderer, scene, camera) {\n this.matrixWorld.copyPosition(camera.matrixWorld);\n };\n // add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(boxMesh.material, \"envMap\", {\n get: function() {\n return this.uniforms.envMap.value;\n }\n });\n objects.update(boxMesh);\n }\n boxMesh.material.uniforms.envMap.value = background;\n boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;\n boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n boxMesh.material.toneMapped = background.colorSpace === $d5b33d7c30034067$export$561f394b24edfcaa ? false : true;\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n boxMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n boxMesh.layers.enableAll();\n // push to the pre-sorted opaque render list\n renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null);\n } else if (background && background.isTexture) {\n if (planeMesh === undefined) {\n planeMesh = new $d5b33d7c30034067$export$e176487c05830cc5(new $d5b33d7c30034067$export$967d831af31f69ce(2, 2), new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"BackgroundMaterial\",\n uniforms: $d5b33d7c30034067$var$cloneUniforms($d5b33d7c30034067$export$bee4a7d47f8f5014.background.uniforms),\n vertexShader: $d5b33d7c30034067$export$bee4a7d47f8f5014.background.vertexShader,\n fragmentShader: $d5b33d7c30034067$export$bee4a7d47f8f5014.background.fragmentShader,\n side: $d5b33d7c30034067$export$2ede184fc2998901,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n planeMesh.geometry.deleteAttribute(\"normal\");\n // add \"map\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(planeMesh.material, \"map\", {\n get: function() {\n return this.uniforms.t2D.value;\n }\n });\n objects.update(planeMesh);\n }\n planeMesh.material.uniforms.t2D.value = background;\n planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n planeMesh.material.toneMapped = background.colorSpace === $d5b33d7c30034067$export$561f394b24edfcaa ? false : true;\n if (background.matrixAutoUpdate === true) background.updateMatrix();\n planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n planeMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n planeMesh.layers.enableAll();\n // push to the pre-sorted opaque render list\n renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null);\n }\n }\n function setClear(color, alpha) {\n color.getRGB($d5b33d7c30034067$var$_rgb, $d5b33d7c30034067$var$getUnlitUniformColorSpace(renderer));\n state.buffers.color.setClear($d5b33d7c30034067$var$_rgb.r, $d5b33d7c30034067$var$_rgb.g, $d5b33d7c30034067$var$_rgb.b, alpha, premultipliedAlpha);\n }\n return {\n getClearColor: function() {\n return clearColor;\n },\n setClearColor: function(color, alpha = 1) {\n clearColor.set(color);\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n getClearAlpha: function() {\n return clearAlpha;\n },\n setClearAlpha: function(alpha) {\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n render: render\n };\n}\nfunction $d5b33d7c30034067$var$WebGLBindingStates(gl, extensions, attributes, capabilities) {\n const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n const extension = capabilities.isWebGL2 ? null : extensions.get(\"OES_vertex_array_object\");\n const vaoAvailable = capabilities.isWebGL2 || extension !== null;\n const bindingStates = {};\n const defaultState = createBindingState(null);\n let currentState = defaultState;\n let forceUpdate = false;\n function setup(object, material, program, geometry, index) {\n let updateBuffers = false;\n if (vaoAvailable) {\n const state = getBindingState(geometry, program, material);\n if (currentState !== state) {\n currentState = state;\n bindVertexArrayObject(currentState.object);\n }\n updateBuffers = needsUpdate(object, geometry, program, index);\n if (updateBuffers) saveCache(object, geometry, program, index);\n } else {\n const wireframe = material.wireframe === true;\n if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) {\n currentState.geometry = geometry.id;\n currentState.program = program.id;\n currentState.wireframe = wireframe;\n updateBuffers = true;\n }\n }\n if (index !== null) attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);\n if (updateBuffers || forceUpdate) {\n forceUpdate = false;\n setupVertexAttributes(object, material, program, geometry);\n if (index !== null) gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer);\n }\n }\n function createVertexArrayObject() {\n if (capabilities.isWebGL2) return gl.createVertexArray();\n return extension.createVertexArrayOES();\n }\n function bindVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.bindVertexArray(vao);\n return extension.bindVertexArrayOES(vao);\n }\n function deleteVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.deleteVertexArray(vao);\n return extension.deleteVertexArrayOES(vao);\n }\n function getBindingState(geometry, program, material) {\n const wireframe = material.wireframe === true;\n let programMap = bindingStates[geometry.id];\n if (programMap === undefined) {\n programMap = {};\n bindingStates[geometry.id] = programMap;\n }\n let stateMap = programMap[program.id];\n if (stateMap === undefined) {\n stateMap = {};\n programMap[program.id] = stateMap;\n }\n let state = stateMap[wireframe];\n if (state === undefined) {\n state = createBindingState(createVertexArrayObject());\n stateMap[wireframe] = state;\n }\n return state;\n }\n function createBindingState(vao) {\n const newAttributes = [];\n const enabledAttributes = [];\n const attributeDivisors = [];\n for(let i = 0; i < maxVertexAttributes; i++){\n newAttributes[i] = 0;\n enabledAttributes[i] = 0;\n attributeDivisors[i] = 0;\n }\n return {\n // for backward compatibility on non-VAO support browser\n geometry: null,\n program: null,\n wireframe: false,\n newAttributes: newAttributes,\n enabledAttributes: enabledAttributes,\n attributeDivisors: attributeDivisors,\n object: vao,\n attributes: {},\n index: null\n };\n }\n function needsUpdate(object, geometry, program, index) {\n const cachedAttributes = currentState.attributes;\n const geometryAttributes = geometry.attributes;\n let attributesNum = 0;\n const programAttributes = program.getAttributes();\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n const cachedAttribute = cachedAttributes[name];\n let geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (cachedAttribute === undefined) return true;\n if (cachedAttribute.attribute !== geometryAttribute) return true;\n if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true;\n attributesNum++;\n }\n }\n if (currentState.attributesNum !== attributesNum) return true;\n if (currentState.index !== index) return true;\n return false;\n }\n function saveCache(object, geometry, program, index) {\n const cache = {};\n const attributes = geometry.attributes;\n let attributesNum = 0;\n const programAttributes = program.getAttributes();\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n let attribute = attributes[name];\n if (attribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) attribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) attribute = object.instanceColor;\n }\n const data = {};\n data.attribute = attribute;\n if (attribute && attribute.data) data.data = attribute.data;\n cache[name] = data;\n attributesNum++;\n }\n }\n currentState.attributes = cache;\n currentState.attributesNum = attributesNum;\n currentState.index = index;\n }\n function initAttributes() {\n const newAttributes = currentState.newAttributes;\n for(let i = 0, il = newAttributes.length; i < il; i++)newAttributes[i] = 0;\n }\n function enableAttribute(attribute) {\n enableAttributeAndDivisor(attribute, 0);\n }\n function enableAttributeAndDivisor(attribute, meshPerAttribute) {\n const newAttributes = currentState.newAttributes;\n const enabledAttributes = currentState.enabledAttributes;\n const attributeDivisors = currentState.attributeDivisors;\n newAttributes[attribute] = 1;\n if (enabledAttributes[attribute] === 0) {\n gl.enableVertexAttribArray(attribute);\n enabledAttributes[attribute] = 1;\n }\n if (attributeDivisors[attribute] !== meshPerAttribute) {\n const extension = capabilities.isWebGL2 ? gl : extensions.get(\"ANGLE_instanced_arrays\");\n extension[capabilities.isWebGL2 ? \"vertexAttribDivisor\" : \"vertexAttribDivisorANGLE\"](attribute, meshPerAttribute);\n attributeDivisors[attribute] = meshPerAttribute;\n }\n }\n function disableUnusedAttributes() {\n const newAttributes = currentState.newAttributes;\n const enabledAttributes = currentState.enabledAttributes;\n for(let i = 0, il = enabledAttributes.length; i < il; i++)if (enabledAttributes[i] !== newAttributes[i]) {\n gl.disableVertexAttribArray(i);\n enabledAttributes[i] = 0;\n }\n }\n function vertexAttribPointer(index, size, type, normalized, stride, offset, integer) {\n if (integer === true) gl.vertexAttribIPointer(index, size, type, stride, offset);\n else gl.vertexAttribPointer(index, size, type, normalized, stride, offset);\n }\n function setupVertexAttributes(object, material, program, geometry) {\n if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) {\n if (extensions.get(\"ANGLE_instanced_arrays\") === null) return;\n }\n initAttributes();\n const geometryAttributes = geometry.attributes;\n const programAttributes = program.getAttributes();\n const materialDefaultAttributeValues = material.defaultAttributeValues;\n for(const name in programAttributes){\n const programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n let geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === \"instanceMatrix\" && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === \"instanceColor\" && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (geometryAttribute !== undefined) {\n const normalized = geometryAttribute.normalized;\n const size = geometryAttribute.itemSize;\n const attribute = attributes.get(geometryAttribute);\n // TODO Attribute may not be available on context restore\n if (attribute === undefined) continue;\n const buffer = attribute.buffer;\n const type = attribute.type;\n const bytesPerElement = attribute.bytesPerElement;\n // check for integer attributes (WebGL 2 only)\n const integer = capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === $d5b33d7c30034067$export$5c612977753abe2);\n if (geometryAttribute.isInterleavedBufferAttribute) {\n const data = geometryAttribute.data;\n const stride = data.stride;\n const offset = geometryAttribute.offset;\n if (data.isInstancedInterleavedBuffer) {\n for(let i = 0; i < programAttribute.locationSize; i++)enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute);\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) geometry._maxInstanceCount = data.meshPerAttribute * data.count;\n } else for(let i = 0; i < programAttribute.locationSize; i++)enableAttribute(programAttribute.location + i);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n for(let i = 0; i < programAttribute.locationSize; i++)vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement, integer);\n } else {\n if (geometryAttribute.isInstancedBufferAttribute) {\n for(let i = 0; i < programAttribute.locationSize; i++)enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute);\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n } else for(let i = 0; i < programAttribute.locationSize; i++)enableAttribute(programAttribute.location + i);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n for(let i = 0; i < programAttribute.locationSize; i++)vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement, integer);\n }\n } else if (materialDefaultAttributeValues !== undefined) {\n const value = materialDefaultAttributeValues[name];\n if (value !== undefined) switch(value.length){\n case 2:\n gl.vertexAttrib2fv(programAttribute.location, value);\n break;\n case 3:\n gl.vertexAttrib3fv(programAttribute.location, value);\n break;\n case 4:\n gl.vertexAttrib4fv(programAttribute.location, value);\n break;\n default:\n gl.vertexAttrib1fv(programAttribute.location, value);\n }\n }\n }\n }\n disableUnusedAttributes();\n }\n function dispose() {\n reset();\n for(const geometryId in bindingStates){\n const programMap = bindingStates[geometryId];\n for(const programId in programMap){\n const stateMap = programMap[programId];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometryId];\n }\n }\n function releaseStatesOfGeometry(geometry) {\n if (bindingStates[geometry.id] === undefined) return;\n const programMap = bindingStates[geometry.id];\n for(const programId in programMap){\n const stateMap = programMap[programId];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometry.id];\n }\n function releaseStatesOfProgram(program) {\n for(const geometryId in bindingStates){\n const programMap = bindingStates[geometryId];\n if (programMap[program.id] === undefined) continue;\n const stateMap = programMap[program.id];\n for(const wireframe in stateMap){\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[program.id];\n }\n }\n function reset() {\n resetDefaultState();\n forceUpdate = true;\n if (currentState === defaultState) return;\n currentState = defaultState;\n bindVertexArrayObject(currentState.object);\n }\n // for backward-compatibility\n function resetDefaultState() {\n defaultState.geometry = null;\n defaultState.program = null;\n defaultState.wireframe = false;\n }\n return {\n setup: setup,\n reset: reset,\n resetDefaultState: resetDefaultState,\n dispose: dispose,\n releaseStatesOfGeometry: releaseStatesOfGeometry,\n releaseStatesOfProgram: releaseStatesOfProgram,\n initAttributes: initAttributes,\n enableAttribute: enableAttribute,\n disableUnusedAttributes: disableUnusedAttributes\n };\n}\nfunction $d5b33d7c30034067$var$WebGLBufferRenderer(gl, extensions, info, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n let mode;\n function setMode(value) {\n mode = value;\n }\n function render(start, count) {\n gl.drawArrays(mode, start, count);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n let extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = \"drawArraysInstanced\";\n } else {\n extension = extensions.get(\"ANGLE_instanced_arrays\");\n methodName = \"drawArraysInstancedANGLE\";\n if (extension === null) {\n console.error(\"THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");\n return;\n }\n }\n extension[methodName](mode, start, count, primcount);\n info.update(count, mode, primcount);\n }\n //\n this.setMode = setMode;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction $d5b33d7c30034067$var$WebGLCapabilities(gl, extensions, parameters) {\n let maxAnisotropy;\n function getMaxAnisotropy() {\n if (maxAnisotropy !== undefined) return maxAnisotropy;\n if (extensions.has(\"EXT_texture_filter_anisotropic\") === true) {\n const extension = extensions.get(\"EXT_texture_filter_anisotropic\");\n maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n } else maxAnisotropy = 0;\n return maxAnisotropy;\n }\n function getMaxPrecision(precision) {\n if (precision === \"highp\") {\n if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) return \"highp\";\n precision = \"mediump\";\n }\n if (precision === \"mediump\") {\n if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) return \"mediump\";\n }\n return \"lowp\";\n }\n const isWebGL2 = typeof WebGL2RenderingContext !== \"undefined\" && gl.constructor.name === \"WebGL2RenderingContext\";\n let precision = parameters.precision !== undefined ? parameters.precision : \"highp\";\n const maxPrecision = getMaxPrecision(precision);\n if (maxPrecision !== precision) {\n console.warn(\"THREE.WebGLRenderer:\", precision, \"not supported, using\", maxPrecision, \"instead.\");\n precision = maxPrecision;\n }\n const drawBuffers = isWebGL2 || extensions.has(\"WEBGL_draw_buffers\");\n const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS);\n const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n const vertexTextures = maxVertexTextures > 0;\n const floatFragmentTextures = isWebGL2 || extensions.has(\"OES_texture_float\");\n const floatVertexTextures = vertexTextures && floatFragmentTextures;\n const maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;\n return {\n isWebGL2: isWebGL2,\n drawBuffers: drawBuffers,\n getMaxAnisotropy: getMaxAnisotropy,\n getMaxPrecision: getMaxPrecision,\n precision: precision,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n maxTextures: maxTextures,\n maxVertexTextures: maxVertexTextures,\n maxTextureSize: maxTextureSize,\n maxCubemapSize: maxCubemapSize,\n maxAttributes: maxAttributes,\n maxVertexUniforms: maxVertexUniforms,\n maxVaryings: maxVaryings,\n maxFragmentUniforms: maxFragmentUniforms,\n vertexTextures: vertexTextures,\n floatFragmentTextures: floatFragmentTextures,\n floatVertexTextures: floatVertexTextures,\n maxSamples: maxSamples\n };\n}\nfunction $d5b33d7c30034067$var$WebGLClipping(properties) {\n const scope = this;\n let globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false;\n const plane = new $d5b33d7c30034067$export$7ff5ac152ef991b0(), viewNormalMatrix = new $d5b33d7c30034067$export$8ff26dafa08918(), uniform = {\n value: null,\n needsUpdate: false\n };\n this.uniform = uniform;\n this.numPlanes = 0;\n this.numIntersection = 0;\n this.init = function(planes, enableLocalClipping) {\n const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to\n // run another frame in order to reset the state:\n numGlobalPlanes !== 0 || localClippingEnabled;\n localClippingEnabled = enableLocalClipping;\n numGlobalPlanes = planes.length;\n return enabled;\n };\n this.beginShadows = function() {\n renderingShadows = true;\n projectPlanes(null);\n };\n this.endShadows = function() {\n renderingShadows = false;\n };\n this.setGlobalState = function(planes, camera) {\n globalState = projectPlanes(planes, camera, 0);\n };\n this.setState = function(material, camera, useCache) {\n const planes = material.clippingPlanes, clipIntersection = material.clipIntersection, clipShadows = material.clipShadows;\n const materialProperties = properties.get(material);\n if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) {\n // there's no local clipping\n if (renderingShadows) // there's no global clipping\n projectPlanes(null);\n else resetGlobalState();\n } else {\n const nGlobal = renderingShadows ? 0 : numGlobalPlanes, lGlobal = nGlobal * 4;\n let dstArray = materialProperties.clippingState || null;\n uniform.value = dstArray; // ensure unique state\n dstArray = projectPlanes(planes, camera, lGlobal, useCache);\n for(let i = 0; i !== lGlobal; ++i)dstArray[i] = globalState[i];\n materialProperties.clippingState = dstArray;\n this.numIntersection = clipIntersection ? this.numPlanes : 0;\n this.numPlanes += nGlobal;\n }\n };\n function resetGlobalState() {\n if (uniform.value !== globalState) {\n uniform.value = globalState;\n uniform.needsUpdate = numGlobalPlanes > 0;\n }\n scope.numPlanes = numGlobalPlanes;\n scope.numIntersection = 0;\n }\n function projectPlanes(planes, camera, dstOffset, skipTransform) {\n const nPlanes = planes !== null ? planes.length : 0;\n let dstArray = null;\n if (nPlanes !== 0) {\n dstArray = uniform.value;\n if (skipTransform !== true || dstArray === null) {\n const flatSize = dstOffset + nPlanes * 4, viewMatrix = camera.matrixWorldInverse;\n viewNormalMatrix.getNormalMatrix(viewMatrix);\n if (dstArray === null || dstArray.length < flatSize) dstArray = new Float32Array(flatSize);\n for(let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4){\n plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);\n plane.normal.toArray(dstArray, i4);\n dstArray[i4 + 3] = plane.constant;\n }\n }\n uniform.value = dstArray;\n uniform.needsUpdate = true;\n }\n scope.numPlanes = nPlanes;\n scope.numIntersection = 0;\n return dstArray;\n }\n}\nfunction $d5b33d7c30034067$var$WebGLCubeMaps(renderer) {\n let cubemaps = new WeakMap();\n function mapTextureMapping(texture, mapping) {\n if (mapping === $d5b33d7c30034067$export$d64030b316d3b087) texture.mapping = $d5b33d7c30034067$export$8759762a6477f2c4;\n else if (mapping === $d5b33d7c30034067$export$ee99d97d46898098) texture.mapping = $d5b33d7c30034067$export$dc59f8aed047f61d;\n return texture;\n }\n function get(texture) {\n if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {\n const mapping = texture.mapping;\n if (mapping === $d5b33d7c30034067$export$d64030b316d3b087 || mapping === $d5b33d7c30034067$export$ee99d97d46898098) {\n if (cubemaps.has(texture)) {\n const cubemap = cubemaps.get(texture).texture;\n return mapTextureMapping(cubemap, texture.mapping);\n } else {\n const image = texture.image;\n if (image && image.height > 0) {\n const renderTarget = new $d5b33d7c30034067$export$ac386671d651941e(image.height / 2);\n renderTarget.fromEquirectangularTexture(renderer, texture);\n cubemaps.set(texture, renderTarget);\n texture.addEventListener(\"dispose\", onTextureDispose);\n return mapTextureMapping(renderTarget.texture, texture.mapping);\n } else // image not yet ready. try the conversion next frame\n return null;\n }\n }\n }\n return texture;\n }\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n const cubemap = cubemaps.get(texture);\n if (cubemap !== undefined) {\n cubemaps.delete(texture);\n cubemap.dispose();\n }\n }\n function dispose() {\n cubemaps = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nclass $d5b33d7c30034067$export$9ebf355ee4ed261b extends $d5b33d7c30034067$export$79f141de891a5fed {\n constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000){\n super();\n this.isOrthographicCamera = true;\n this.type = \"OrthographicCamera\";\n this.zoom = 1;\n this.view = null;\n this.left = left;\n this.right = right;\n this.top = top;\n this.bottom = bottom;\n this.near = near;\n this.far = far;\n this.updateProjectionMatrix();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.left = source.left;\n this.right = source.right;\n this.top = source.top;\n this.bottom = source.bottom;\n this.near = source.near;\n this.far = source.far;\n this.zoom = source.zoom;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n return this;\n }\n setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n if (this.view === null) this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n clearViewOffset() {\n if (this.view !== null) this.view.enabled = false;\n this.updateProjectionMatrix();\n }\n updateProjectionMatrix() {\n const dx = (this.right - this.left) / (2 * this.zoom);\n const dy = (this.top - this.bottom) / (2 * this.zoom);\n const cx = (this.right + this.left) / 2;\n const cy = (this.top + this.bottom) / 2;\n let left = cx - dx;\n let right = cx + dx;\n let top = cy + dy;\n let bottom = cy - dy;\n if (this.view !== null && this.view.enabled) {\n const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;\n const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;\n left += scaleW * this.view.offsetX;\n right = left + scaleW * this.view.width;\n top -= scaleH * this.view.offsetY;\n bottom = top - scaleH * this.view.height;\n }\n this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far, this.coordinateSystem);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.zoom = this.zoom;\n data.object.left = this.left;\n data.object.right = this.right;\n data.object.top = this.top;\n data.object.bottom = this.bottom;\n data.object.near = this.near;\n data.object.far = this.far;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n return data;\n }\n}\nconst $d5b33d7c30034067$var$LOD_MIN = 4;\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst $d5b33d7c30034067$var$EXTRA_LOD_SIGMA = [\n 0.125,\n 0.215,\n 0.35,\n 0.446,\n 0.526,\n 0.582\n];\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst $d5b33d7c30034067$var$MAX_SAMPLES = 20;\nconst $d5b33d7c30034067$var$_flatCamera = /*@__PURE__*/ new $d5b33d7c30034067$export$9ebf355ee4ed261b();\nconst $d5b33d7c30034067$var$_clearColor = /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e();\nlet $d5b33d7c30034067$var$_oldTarget = null;\n// Golden Ratio\nconst $d5b33d7c30034067$var$PHI = (1 + Math.sqrt(5)) / 2;\nconst $d5b33d7c30034067$var$INV_PHI = 1 / $d5b33d7c30034067$var$PHI;\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst $d5b33d7c30034067$var$_axisDirections = [\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(1, 1, 1),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(-1, 1, 1),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(1, 1, -1),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(-1, 1, -1),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, $d5b33d7c30034067$var$PHI, $d5b33d7c30034067$var$INV_PHI),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(0, $d5b33d7c30034067$var$PHI, -$d5b33d7c30034067$var$INV_PHI),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699($d5b33d7c30034067$var$INV_PHI, 0, $d5b33d7c30034067$var$PHI),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(-$d5b33d7c30034067$var$INV_PHI, 0, $d5b33d7c30034067$var$PHI),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699($d5b33d7c30034067$var$PHI, $d5b33d7c30034067$var$INV_PHI, 0),\n /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699(-$d5b33d7c30034067$var$PHI, $d5b33d7c30034067$var$INV_PHI, 0)\n];\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/ class $d5b33d7c30034067$export$6add42717753e221 {\n constructor(renderer){\n this._renderer = renderer;\n this._pingPongRenderTarget = null;\n this._lodMax = 0;\n this._cubeSize = 0;\n this._lodPlanes = [];\n this._sizeLods = [];\n this._sigmas = [];\n this._blurMaterial = null;\n this._cubemapMaterial = null;\n this._equirectMaterial = null;\n this._compileMaterial(this._blurMaterial);\n }\n /**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */ fromScene(scene, sigma = 0, near = 0.1, far = 100) {\n $d5b33d7c30034067$var$_oldTarget = this._renderer.getRenderTarget();\n this._setSize(256);\n const cubeUVRenderTarget = this._allocateTargets();\n cubeUVRenderTarget.depthBuffer = true;\n this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget);\n if (sigma > 0) this._blur(cubeUVRenderTarget, 0, 0, sigma);\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n /**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */ fromEquirectangular(equirectangular, renderTarget = null) {\n return this._fromTexture(equirectangular, renderTarget);\n }\n /**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */ fromCubemap(cubemap, renderTarget = null) {\n return this._fromTexture(cubemap, renderTarget);\n }\n /**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */ compileCubemapShader() {\n if (this._cubemapMaterial === null) {\n this._cubemapMaterial = $d5b33d7c30034067$var$_getCubemapMaterial();\n this._compileMaterial(this._cubemapMaterial);\n }\n }\n /**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */ compileEquirectangularShader() {\n if (this._equirectMaterial === null) {\n this._equirectMaterial = $d5b33d7c30034067$var$_getEquirectMaterial();\n this._compileMaterial(this._equirectMaterial);\n }\n }\n /**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */ dispose() {\n this._dispose();\n if (this._cubemapMaterial !== null) this._cubemapMaterial.dispose();\n if (this._equirectMaterial !== null) this._equirectMaterial.dispose();\n }\n // private interface\n _setSize(cubeSize) {\n this._lodMax = Math.floor(Math.log2(cubeSize));\n this._cubeSize = Math.pow(2, this._lodMax);\n }\n _dispose() {\n if (this._blurMaterial !== null) this._blurMaterial.dispose();\n if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose();\n for(let i = 0; i < this._lodPlanes.length; i++)this._lodPlanes[i].dispose();\n }\n _cleanup(outputTarget) {\n this._renderer.setRenderTarget($d5b33d7c30034067$var$_oldTarget);\n outputTarget.scissorTest = false;\n $d5b33d7c30034067$var$_setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height);\n }\n _fromTexture(texture, renderTarget) {\n if (texture.mapping === $d5b33d7c30034067$export$8759762a6477f2c4 || texture.mapping === $d5b33d7c30034067$export$dc59f8aed047f61d) this._setSize(texture.image.length === 0 ? 16 : texture.image[0].width || texture.image[0].image.width);\n else this._setSize(texture.image.width / 4);\n $d5b33d7c30034067$var$_oldTarget = this._renderer.getRenderTarget();\n const cubeUVRenderTarget = renderTarget || this._allocateTargets();\n this._textureToCubeUV(texture, cubeUVRenderTarget);\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n _allocateTargets() {\n const width = 3 * Math.max(this._cubeSize, 112);\n const height = 4 * this._cubeSize;\n const params = {\n magFilter: $d5b33d7c30034067$export$8a72f490b25c56c8,\n minFilter: $d5b33d7c30034067$export$8a72f490b25c56c8,\n generateMipmaps: false,\n type: $d5b33d7c30034067$export$2697304443f382bc,\n format: $d5b33d7c30034067$export$3f8bb04b555a363c,\n colorSpace: $d5b33d7c30034067$export$42429b3acfb233a4,\n depthBuffer: false\n };\n const cubeUVRenderTarget = $d5b33d7c30034067$var$_createRenderTarget(width, height, params);\n if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height) {\n if (this._pingPongRenderTarget !== null) this._dispose();\n this._pingPongRenderTarget = $d5b33d7c30034067$var$_createRenderTarget(width, height, params);\n const { _lodMax: _lodMax } = this;\n ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = $d5b33d7c30034067$var$_createPlanes(_lodMax));\n this._blurMaterial = $d5b33d7c30034067$var$_getBlurShader(_lodMax, width, height);\n }\n return cubeUVRenderTarget;\n }\n _compileMaterial(material) {\n const tmpMesh = new $d5b33d7c30034067$export$e176487c05830cc5(this._lodPlanes[0], material);\n this._renderer.compile(tmpMesh, $d5b33d7c30034067$var$_flatCamera);\n }\n _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) {\n const fov = 90;\n const aspect = 1;\n const cubeCamera = new $d5b33d7c30034067$export$74e4ae24825f68d7(fov, aspect, near, far);\n const upSign = [\n 1,\n -1,\n 1,\n 1,\n 1,\n 1\n ];\n const forwardSign = [\n 1,\n 1,\n 1,\n -1,\n -1,\n -1\n ];\n const renderer = this._renderer;\n const originalAutoClear = renderer.autoClear;\n const toneMapping = renderer.toneMapping;\n renderer.getClearColor($d5b33d7c30034067$var$_clearColor);\n renderer.toneMapping = $d5b33d7c30034067$export$9fcb6b4294603b2;\n renderer.autoClear = false;\n const backgroundMaterial = new $d5b33d7c30034067$export$55cbcc9b622fe1f5({\n name: \"PMREM.Background\",\n side: $d5b33d7c30034067$export$d9f0486e75b5ace,\n depthWrite: false,\n depthTest: false\n });\n const backgroundBox = new $d5b33d7c30034067$export$e176487c05830cc5(new $d5b33d7c30034067$export$33e43285f7406bd5(), backgroundMaterial);\n let useSolidColor = false;\n const background = scene.background;\n if (background) {\n if (background.isColor) {\n backgroundMaterial.color.copy(background);\n scene.background = null;\n useSolidColor = true;\n }\n } else {\n backgroundMaterial.color.copy($d5b33d7c30034067$var$_clearColor);\n useSolidColor = true;\n }\n for(let i = 0; i < 6; i++){\n const col = i % 3;\n if (col === 0) {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(forwardSign[i], 0, 0);\n } else if (col === 1) {\n cubeCamera.up.set(0, 0, upSign[i]);\n cubeCamera.lookAt(0, forwardSign[i], 0);\n } else {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(0, 0, forwardSign[i]);\n }\n const size = this._cubeSize;\n $d5b33d7c30034067$var$_setViewport(cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n if (useSolidColor) renderer.render(backgroundBox, cubeCamera);\n renderer.render(scene, cubeCamera);\n }\n backgroundBox.geometry.dispose();\n backgroundBox.material.dispose();\n renderer.toneMapping = toneMapping;\n renderer.autoClear = originalAutoClear;\n scene.background = background;\n }\n _textureToCubeUV(texture, cubeUVRenderTarget) {\n const renderer = this._renderer;\n const isCubeTexture = texture.mapping === $d5b33d7c30034067$export$8759762a6477f2c4 || texture.mapping === $d5b33d7c30034067$export$dc59f8aed047f61d;\n if (isCubeTexture) {\n if (this._cubemapMaterial === null) this._cubemapMaterial = $d5b33d7c30034067$var$_getCubemapMaterial();\n this._cubemapMaterial.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1;\n } else if (this._equirectMaterial === null) this._equirectMaterial = $d5b33d7c30034067$var$_getEquirectMaterial();\n const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n const mesh = new $d5b33d7c30034067$export$e176487c05830cc5(this._lodPlanes[0], material);\n const uniforms = material.uniforms;\n uniforms[\"envMap\"].value = texture;\n const size = this._cubeSize;\n $d5b33d7c30034067$var$_setViewport(cubeUVRenderTarget, 0, 0, 3 * size, 2 * size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n renderer.render(mesh, $d5b33d7c30034067$var$_flatCamera);\n }\n _applyPMREM(cubeUVRenderTarget) {\n const renderer = this._renderer;\n const autoClear = renderer.autoClear;\n renderer.autoClear = false;\n for(let i = 1; i < this._lodPlanes.length; i++){\n const sigma = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]);\n const poleAxis = $d5b33d7c30034067$var$_axisDirections[(i - 1) % $d5b33d7c30034067$var$_axisDirections.length];\n this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis);\n }\n renderer.autoClear = autoClear;\n }\n /**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */ _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {\n const pingPongRenderTarget = this._pingPongRenderTarget;\n this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, \"latitudinal\", poleAxis);\n this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, \"longitudinal\", poleAxis);\n }\n _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {\n const renderer = this._renderer;\n const blurMaterial = this._blurMaterial;\n if (direction !== \"latitudinal\" && direction !== \"longitudinal\") console.error(\"blur direction must be either latitudinal or longitudinal!\");\n // Number of standard deviations at which to cut off the discrete approximation.\n const STANDARD_DEVIATIONS = 3;\n const blurMesh = new $d5b33d7c30034067$export$e176487c05830cc5(this._lodPlanes[lodOut], blurMaterial);\n const blurUniforms = blurMaterial.uniforms;\n const pixels = this._sizeLods[lodIn] - 1;\n const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * $d5b33d7c30034067$var$MAX_SAMPLES - 1);\n const sigmaPixels = sigmaRadians / radiansPerPixel;\n const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : $d5b33d7c30034067$var$MAX_SAMPLES;\n if (samples > $d5b33d7c30034067$var$MAX_SAMPLES) console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${$d5b33d7c30034067$var$MAX_SAMPLES}`);\n const weights = [];\n let sum = 0;\n for(let i = 0; i < $d5b33d7c30034067$var$MAX_SAMPLES; ++i){\n const x = i / sigmaPixels;\n const weight = Math.exp(-x * x / 2);\n weights.push(weight);\n if (i === 0) sum += weight;\n else if (i < samples) sum += 2 * weight;\n }\n for(let i = 0; i < weights.length; i++)weights[i] = weights[i] / sum;\n blurUniforms[\"envMap\"].value = targetIn.texture;\n blurUniforms[\"samples\"].value = samples;\n blurUniforms[\"weights\"].value = weights;\n blurUniforms[\"latitudinal\"].value = direction === \"latitudinal\";\n if (poleAxis) blurUniforms[\"poleAxis\"].value = poleAxis;\n const { _lodMax: _lodMax } = this;\n blurUniforms[\"dTheta\"].value = radiansPerPixel;\n blurUniforms[\"mipInt\"].value = _lodMax - lodIn;\n const outputSize = this._sizeLods[lodOut];\n const x = 3 * outputSize * (lodOut > _lodMax - $d5b33d7c30034067$var$LOD_MIN ? lodOut - _lodMax + $d5b33d7c30034067$var$LOD_MIN : 0);\n const y = 4 * (this._cubeSize - outputSize);\n $d5b33d7c30034067$var$_setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);\n renderer.setRenderTarget(targetOut);\n renderer.render(blurMesh, $d5b33d7c30034067$var$_flatCamera);\n }\n}\nfunction $d5b33d7c30034067$var$_createPlanes(lodMax) {\n const lodPlanes = [];\n const sizeLods = [];\n const sigmas = [];\n let lod = lodMax;\n const totalLods = lodMax - $d5b33d7c30034067$var$LOD_MIN + 1 + $d5b33d7c30034067$var$EXTRA_LOD_SIGMA.length;\n for(let i = 0; i < totalLods; i++){\n const sizeLod = Math.pow(2, lod);\n sizeLods.push(sizeLod);\n let sigma = 1.0 / sizeLod;\n if (i > lodMax - $d5b33d7c30034067$var$LOD_MIN) sigma = $d5b33d7c30034067$var$EXTRA_LOD_SIGMA[i - lodMax + $d5b33d7c30034067$var$LOD_MIN - 1];\n else if (i === 0) sigma = 0;\n sigmas.push(sigma);\n const texelSize = 1.0 / (sizeLod - 2);\n const min = -texelSize;\n const max = 1 + texelSize;\n const uv1 = [\n min,\n min,\n max,\n min,\n max,\n max,\n min,\n min,\n max,\n max,\n min,\n max\n ];\n const cubeFaces = 6;\n const vertices = 6;\n const positionSize = 3;\n const uvSize = 2;\n const faceIndexSize = 1;\n const position = new Float32Array(positionSize * vertices * cubeFaces);\n const uv = new Float32Array(uvSize * vertices * cubeFaces);\n const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);\n for(let face = 0; face < cubeFaces; face++){\n const x = face % 3 * 2 / 3 - 1;\n const y = face > 2 ? 0 : -1;\n const coordinates = [\n x,\n y,\n 0,\n x + 2 / 3,\n y,\n 0,\n x + 2 / 3,\n y + 1,\n 0,\n x,\n y,\n 0,\n x + 2 / 3,\n y + 1,\n 0,\n x,\n y + 1,\n 0\n ];\n position.set(coordinates, positionSize * vertices * face);\n uv.set(uv1, uvSize * vertices * face);\n const fill = [\n face,\n face,\n face,\n face,\n face,\n face\n ];\n faceIndex.set(fill, faceIndexSize * vertices * face);\n }\n const planes = new $d5b33d7c30034067$export$b7be63a67df8959();\n planes.setAttribute(\"position\", new $d5b33d7c30034067$export$8dea267bd6bde117(position, positionSize));\n planes.setAttribute(\"uv\", new $d5b33d7c30034067$export$8dea267bd6bde117(uv, uvSize));\n planes.setAttribute(\"faceIndex\", new $d5b33d7c30034067$export$8dea267bd6bde117(faceIndex, faceIndexSize));\n lodPlanes.push(planes);\n if (lod > $d5b33d7c30034067$var$LOD_MIN) lod--;\n }\n return {\n lodPlanes: lodPlanes,\n sizeLods: sizeLods,\n sigmas: sigmas\n };\n}\nfunction $d5b33d7c30034067$var$_createRenderTarget(width, height, params) {\n const cubeUVRenderTarget = new $d5b33d7c30034067$export$3c052beb2e51e23f(width, height, params);\n cubeUVRenderTarget.texture.mapping = $d5b33d7c30034067$export$dbf3e70ff37af79;\n cubeUVRenderTarget.texture.name = \"PMREM.cubeUv\";\n cubeUVRenderTarget.scissorTest = true;\n return cubeUVRenderTarget;\n}\nfunction $d5b33d7c30034067$var$_setViewport(target, x, y, width, height) {\n target.viewport.set(x, y, width, height);\n target.scissor.set(x, y, width, height);\n}\nfunction $d5b33d7c30034067$var$_getBlurShader(lodMax, width, height) {\n const weights = new Float32Array($d5b33d7c30034067$var$MAX_SAMPLES);\n const poleAxis = new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0);\n const shaderMaterial = new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"SphericalGaussianBlur\",\n defines: {\n \"n\": $d5b33d7c30034067$var$MAX_SAMPLES,\n \"CUBEUV_TEXEL_WIDTH\": 1.0 / width,\n \"CUBEUV_TEXEL_HEIGHT\": 1.0 / height,\n \"CUBEUV_MAX_MIP\": `${lodMax}.0`\n },\n uniforms: {\n \"envMap\": {\n value: null\n },\n \"samples\": {\n value: 1\n },\n \"weights\": {\n value: weights\n },\n \"latitudinal\": {\n value: false\n },\n \"dTheta\": {\n value: 0\n },\n \"mipInt\": {\n value: 0\n },\n \"poleAxis\": {\n value: poleAxis\n }\n },\n vertexShader: $d5b33d7c30034067$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n blending: $d5b33d7c30034067$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n return shaderMaterial;\n}\nfunction $d5b33d7c30034067$var$_getEquirectMaterial() {\n return new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"EquirectangularToCubeUV\",\n uniforms: {\n \"envMap\": {\n value: null\n }\n },\n vertexShader: $d5b33d7c30034067$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n blending: $d5b33d7c30034067$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction $d5b33d7c30034067$var$_getCubemapMaterial() {\n return new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n name: \"CubemapToCubeUV\",\n uniforms: {\n \"envMap\": {\n value: null\n },\n \"flipEnvMap\": {\n value: -1\n }\n },\n vertexShader: $d5b33d7c30034067$var$_getCommonVertexShader(),\n fragmentShader: /* glsl */ `\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n blending: $d5b33d7c30034067$export$63b8d6b580fc65ba,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction $d5b33d7c30034067$var$_getCommonVertexShader() {\n return /* glsl */ `\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n}\nfunction $d5b33d7c30034067$var$WebGLCubeUVMaps(renderer) {\n let cubeUVmaps = new WeakMap();\n let pmremGenerator = null;\n function get(texture) {\n if (texture && texture.isTexture) {\n const mapping = texture.mapping;\n const isEquirectMap = mapping === $d5b33d7c30034067$export$d64030b316d3b087 || mapping === $d5b33d7c30034067$export$ee99d97d46898098;\n const isCubeMap = mapping === $d5b33d7c30034067$export$8759762a6477f2c4 || mapping === $d5b33d7c30034067$export$dc59f8aed047f61d;\n // equirect/cube map to cubeUV conversion\n if (isEquirectMap || isCubeMap) {\n if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) {\n texture.needsPMREMUpdate = false;\n let renderTarget = cubeUVmaps.get(texture);\n if (pmremGenerator === null) pmremGenerator = new $d5b33d7c30034067$export$6add42717753e221(renderer);\n renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture, renderTarget) : pmremGenerator.fromCubemap(texture, renderTarget);\n cubeUVmaps.set(texture, renderTarget);\n return renderTarget.texture;\n } else {\n if (cubeUVmaps.has(texture)) return cubeUVmaps.get(texture).texture;\n else {\n const image = texture.image;\n if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) {\n if (pmremGenerator === null) pmremGenerator = new $d5b33d7c30034067$export$6add42717753e221(renderer);\n const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture);\n cubeUVmaps.set(texture, renderTarget);\n texture.addEventListener(\"dispose\", onTextureDispose);\n return renderTarget.texture;\n } else // image not yet ready. try the conversion next frame\n return null;\n }\n }\n }\n }\n return texture;\n }\n function isCubeTextureComplete(image) {\n let count = 0;\n const length = 6;\n for(let i = 0; i < length; i++)if (image[i] !== undefined) count++;\n return count === length;\n }\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n const cubemapUV = cubeUVmaps.get(texture);\n if (cubemapUV !== undefined) {\n cubeUVmaps.delete(texture);\n cubemapUV.dispose();\n }\n }\n function dispose() {\n cubeUVmaps = new WeakMap();\n if (pmremGenerator !== null) {\n pmremGenerator.dispose();\n pmremGenerator = null;\n }\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction $d5b33d7c30034067$var$WebGLExtensions(gl) {\n const extensions = {};\n function getExtension(name) {\n if (extensions[name] !== undefined) return extensions[name];\n let extension;\n switch(name){\n case \"WEBGL_depth_texture\":\n extension = gl.getExtension(\"WEBGL_depth_texture\") || gl.getExtension(\"MOZ_WEBGL_depth_texture\") || gl.getExtension(\"WEBKIT_WEBGL_depth_texture\");\n break;\n case \"EXT_texture_filter_anisotropic\":\n extension = gl.getExtension(\"EXT_texture_filter_anisotropic\") || gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\") || gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\");\n break;\n case \"WEBGL_compressed_texture_s3tc\":\n extension = gl.getExtension(\"WEBGL_compressed_texture_s3tc\") || gl.getExtension(\"MOZ_WEBGL_compressed_texture_s3tc\") || gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc\");\n break;\n case \"WEBGL_compressed_texture_pvrtc\":\n extension = gl.getExtension(\"WEBGL_compressed_texture_pvrtc\") || gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\");\n break;\n default:\n extension = gl.getExtension(name);\n }\n extensions[name] = extension;\n return extension;\n }\n return {\n has: function(name) {\n return getExtension(name) !== null;\n },\n init: function(capabilities) {\n if (capabilities.isWebGL2) getExtension(\"EXT_color_buffer_float\");\n else {\n getExtension(\"WEBGL_depth_texture\");\n getExtension(\"OES_texture_float\");\n getExtension(\"OES_texture_half_float\");\n getExtension(\"OES_texture_half_float_linear\");\n getExtension(\"OES_standard_derivatives\");\n getExtension(\"OES_element_index_uint\");\n getExtension(\"OES_vertex_array_object\");\n getExtension(\"ANGLE_instanced_arrays\");\n }\n getExtension(\"OES_texture_float_linear\");\n getExtension(\"EXT_color_buffer_half_float\");\n getExtension(\"WEBGL_multisampled_render_to_texture\");\n },\n get: function(name) {\n const extension = getExtension(name);\n if (extension === null) console.warn(\"THREE.WebGLRenderer: \" + name + \" extension not supported.\");\n return extension;\n }\n };\n}\nfunction $d5b33d7c30034067$var$WebGLGeometries(gl, attributes, info, bindingStates) {\n const geometries = {};\n const wireframeAttributes = new WeakMap();\n function onGeometryDispose(event) {\n const geometry = event.target;\n if (geometry.index !== null) attributes.remove(geometry.index);\n for(const name in geometry.attributes)attributes.remove(geometry.attributes[name]);\n for(const name in geometry.morphAttributes){\n const array = geometry.morphAttributes[name];\n for(let i = 0, l = array.length; i < l; i++)attributes.remove(array[i]);\n }\n geometry.removeEventListener(\"dispose\", onGeometryDispose);\n delete geometries[geometry.id];\n const attribute = wireframeAttributes.get(geometry);\n if (attribute) {\n attributes.remove(attribute);\n wireframeAttributes.delete(geometry);\n }\n bindingStates.releaseStatesOfGeometry(geometry);\n if (geometry.isInstancedBufferGeometry === true) delete geometry._maxInstanceCount;\n //\n info.memory.geometries--;\n }\n function get(object, geometry) {\n if (geometries[geometry.id] === true) return geometry;\n geometry.addEventListener(\"dispose\", onGeometryDispose);\n geometries[geometry.id] = true;\n info.memory.geometries++;\n return geometry;\n }\n function update(geometry) {\n const geometryAttributes = geometry.attributes;\n // Updating index buffer in VAO now. See WebGLBindingStates.\n for(const name in geometryAttributes)attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER);\n // morph targets\n const morphAttributes = geometry.morphAttributes;\n for(const name in morphAttributes){\n const array = morphAttributes[name];\n for(let i = 0, l = array.length; i < l; i++)attributes.update(array[i], gl.ARRAY_BUFFER);\n }\n }\n function updateWireframeAttribute(geometry) {\n const indices = [];\n const geometryIndex = geometry.index;\n const geometryPosition = geometry.attributes.position;\n let version = 0;\n if (geometryIndex !== null) {\n const array = geometryIndex.array;\n version = geometryIndex.version;\n for(let i = 0, l = array.length; i < l; i += 3){\n const a = array[i + 0];\n const b = array[i + 1];\n const c = array[i + 2];\n indices.push(a, b, b, c, c, a);\n }\n } else if (geometryPosition !== undefined) {\n const array = geometryPosition.array;\n version = geometryPosition.version;\n for(let i = 0, l = array.length / 3 - 1; i < l; i += 3){\n const a = i + 0;\n const b = i + 1;\n const c = i + 2;\n indices.push(a, b, b, c, c, a);\n }\n } else return;\n const attribute = new ($d5b33d7c30034067$var$arrayNeedsUint32(indices) ? $d5b33d7c30034067$export$7eb8c9fa25cd5bd6 : $d5b33d7c30034067$export$640a853f68025f2e)(indices, 1);\n attribute.version = version;\n // Updating index buffer in VAO now. See WebGLBindingStates\n //\n const previousAttribute = wireframeAttributes.get(geometry);\n if (previousAttribute) attributes.remove(previousAttribute);\n //\n wireframeAttributes.set(geometry, attribute);\n }\n function getWireframeAttribute(geometry) {\n const currentAttribute = wireframeAttributes.get(geometry);\n if (currentAttribute) {\n const geometryIndex = geometry.index;\n if (geometryIndex !== null) // if the attribute is obsolete, create a new one\n {\n if (currentAttribute.version < geometryIndex.version) updateWireframeAttribute(geometry);\n }\n } else updateWireframeAttribute(geometry);\n return wireframeAttributes.get(geometry);\n }\n return {\n get: get,\n update: update,\n getWireframeAttribute: getWireframeAttribute\n };\n}\nfunction $d5b33d7c30034067$var$WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n let mode;\n function setMode(value) {\n mode = value;\n }\n let type, bytesPerElement;\n function setIndex(value) {\n type = value.type;\n bytesPerElement = value.bytesPerElement;\n }\n function render(start, count) {\n gl.drawElements(mode, count, type, start * bytesPerElement);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n let extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = \"drawElementsInstanced\";\n } else {\n extension = extensions.get(\"ANGLE_instanced_arrays\");\n methodName = \"drawElementsInstancedANGLE\";\n if (extension === null) {\n console.error(\"THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");\n return;\n }\n }\n extension[methodName](mode, count, type, start * bytesPerElement, primcount);\n info.update(count, mode, primcount);\n }\n //\n this.setMode = setMode;\n this.setIndex = setIndex;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction $d5b33d7c30034067$var$WebGLInfo(gl) {\n const memory = {\n geometries: 0,\n textures: 0\n };\n const render = {\n frame: 0,\n calls: 0,\n triangles: 0,\n points: 0,\n lines: 0\n };\n function update(count, mode, instanceCount) {\n render.calls++;\n switch(mode){\n case gl.TRIANGLES:\n render.triangles += instanceCount * (count / 3);\n break;\n case gl.LINES:\n render.lines += instanceCount * (count / 2);\n break;\n case gl.LINE_STRIP:\n render.lines += instanceCount * (count - 1);\n break;\n case gl.LINE_LOOP:\n render.lines += instanceCount * count;\n break;\n case gl.POINTS:\n render.points += instanceCount * count;\n break;\n default:\n console.error(\"THREE.WebGLInfo: Unknown draw mode:\", mode);\n break;\n }\n }\n function reset() {\n render.calls = 0;\n render.triangles = 0;\n render.points = 0;\n render.lines = 0;\n }\n return {\n memory: memory,\n render: render,\n programs: null,\n autoReset: true,\n reset: reset,\n update: update\n };\n}\nfunction $d5b33d7c30034067$var$numericalSort(a, b) {\n return a[0] - b[0];\n}\nfunction $d5b33d7c30034067$var$absNumericalSort(a, b) {\n return Math.abs(b[1]) - Math.abs(a[1]);\n}\nfunction $d5b33d7c30034067$var$WebGLMorphtargets(gl, capabilities, textures) {\n const influencesList = {};\n const morphInfluences = new Float32Array(8);\n const morphTextures = new WeakMap();\n const morph = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n const workInfluences = [];\n for(let i = 0; i < 8; i++)workInfluences[i] = [\n i,\n 0\n ];\n function update(object, geometry, program) {\n const objectInfluences = object.morphTargetInfluences;\n if (capabilities.isWebGL2 === true) {\n // instead of using attributes, the WebGL 2 code path encodes morph targets\n // into an array of data textures. Each layer represents a single morph target.\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n let entry = morphTextures.get(geometry);\n if (entry === undefined || entry.count !== morphTargetsCount) {\n if (entry !== undefined) entry.texture.dispose();\n const hasMorphPosition = geometry.morphAttributes.position !== undefined;\n const hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n const hasMorphColors = geometry.morphAttributes.color !== undefined;\n const morphTargets = geometry.morphAttributes.position || [];\n const morphNormals = geometry.morphAttributes.normal || [];\n const morphColors = geometry.morphAttributes.color || [];\n let vertexDataCount = 0;\n if (hasMorphPosition === true) vertexDataCount = 1;\n if (hasMorphNormals === true) vertexDataCount = 2;\n if (hasMorphColors === true) vertexDataCount = 3;\n let width = geometry.attributes.position.count * vertexDataCount;\n let height = 1;\n if (width > capabilities.maxTextureSize) {\n height = Math.ceil(width / capabilities.maxTextureSize);\n width = capabilities.maxTextureSize;\n }\n const buffer = new Float32Array(width * height * 4 * morphTargetsCount);\n const texture = new $d5b33d7c30034067$export$dfac6c8e811406a3(buffer, width, height, morphTargetsCount);\n texture.type = $d5b33d7c30034067$export$f6d331659b644596;\n texture.needsUpdate = true;\n // fill buffer\n const vertexDataStride = vertexDataCount * 4;\n for(let i = 0; i < morphTargetsCount; i++){\n const morphTarget = morphTargets[i];\n const morphNormal = morphNormals[i];\n const morphColor = morphColors[i];\n const offset = width * height * 4 * i;\n for(let j = 0; j < morphTarget.count; j++){\n const stride = j * vertexDataStride;\n if (hasMorphPosition === true) {\n morph.fromBufferAttribute(morphTarget, j);\n buffer[offset + stride + 0] = morph.x;\n buffer[offset + stride + 1] = morph.y;\n buffer[offset + stride + 2] = morph.z;\n buffer[offset + stride + 3] = 0;\n }\n if (hasMorphNormals === true) {\n morph.fromBufferAttribute(morphNormal, j);\n buffer[offset + stride + 4] = morph.x;\n buffer[offset + stride + 5] = morph.y;\n buffer[offset + stride + 6] = morph.z;\n buffer[offset + stride + 7] = 0;\n }\n if (hasMorphColors === true) {\n morph.fromBufferAttribute(morphColor, j);\n buffer[offset + stride + 8] = morph.x;\n buffer[offset + stride + 9] = morph.y;\n buffer[offset + stride + 10] = morph.z;\n buffer[offset + stride + 11] = morphColor.itemSize === 4 ? morph.w : 1;\n }\n }\n }\n entry = {\n count: morphTargetsCount,\n texture: texture,\n size: new $d5b33d7c30034067$export$c977b3e384af9ae1(width, height)\n };\n morphTextures.set(geometry, entry);\n function disposeTexture() {\n texture.dispose();\n morphTextures.delete(geometry);\n geometry.removeEventListener(\"dispose\", disposeTexture);\n }\n geometry.addEventListener(\"dispose\", disposeTexture);\n }\n //\n let morphInfluencesSum = 0;\n for(let i = 0; i < objectInfluences.length; i++)morphInfluencesSum += objectInfluences[i];\n const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n program.getUniforms().setValue(gl, \"morphTargetBaseInfluence\", morphBaseInfluence);\n program.getUniforms().setValue(gl, \"morphTargetInfluences\", objectInfluences);\n program.getUniforms().setValue(gl, \"morphTargetsTexture\", entry.texture, textures);\n program.getUniforms().setValue(gl, \"morphTargetsTextureSize\", entry.size);\n } else {\n // When object doesn't have morph target influences defined, we treat it as a 0-length array\n // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n const length = objectInfluences === undefined ? 0 : objectInfluences.length;\n let influences = influencesList[geometry.id];\n if (influences === undefined || influences.length !== length) {\n // initialise list\n influences = [];\n for(let i = 0; i < length; i++)influences[i] = [\n i,\n 0\n ];\n influencesList[geometry.id] = influences;\n }\n // Collect influences\n for(let i = 0; i < length; i++){\n const influence = influences[i];\n influence[0] = i;\n influence[1] = objectInfluences[i];\n }\n influences.sort($d5b33d7c30034067$var$absNumericalSort);\n for(let i = 0; i < 8; i++)if (i < length && influences[i][1]) {\n workInfluences[i][0] = influences[i][0];\n workInfluences[i][1] = influences[i][1];\n } else {\n workInfluences[i][0] = Number.MAX_SAFE_INTEGER;\n workInfluences[i][1] = 0;\n }\n workInfluences.sort($d5b33d7c30034067$var$numericalSort);\n const morphTargets = geometry.morphAttributes.position;\n const morphNormals = geometry.morphAttributes.normal;\n let morphInfluencesSum = 0;\n for(let i = 0; i < 8; i++){\n const influence = workInfluences[i];\n const index = influence[0];\n const value = influence[1];\n if (index !== Number.MAX_SAFE_INTEGER && value) {\n if (morphTargets && geometry.getAttribute(\"morphTarget\" + i) !== morphTargets[index]) geometry.setAttribute(\"morphTarget\" + i, morphTargets[index]);\n if (morphNormals && geometry.getAttribute(\"morphNormal\" + i) !== morphNormals[index]) geometry.setAttribute(\"morphNormal\" + i, morphNormals[index]);\n morphInfluences[i] = value;\n morphInfluencesSum += value;\n } else {\n if (morphTargets && geometry.hasAttribute(\"morphTarget\" + i) === true) geometry.deleteAttribute(\"morphTarget\" + i);\n if (morphNormals && geometry.hasAttribute(\"morphNormal\" + i) === true) geometry.deleteAttribute(\"morphNormal\" + i);\n morphInfluences[i] = 0;\n }\n }\n // GLSL shader uses formula baseinfluence * base + sum(target * influence)\n // This allows us to switch between absolute morphs and relative morphs without changing shader code\n // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n program.getUniforms().setValue(gl, \"morphTargetBaseInfluence\", morphBaseInfluence);\n program.getUniforms().setValue(gl, \"morphTargetInfluences\", morphInfluences);\n }\n }\n return {\n update: update\n };\n}\nfunction $d5b33d7c30034067$var$WebGLObjects(gl, geometries, attributes, info) {\n let updateMap = new WeakMap();\n function update(object) {\n const frame = info.render.frame;\n const geometry = object.geometry;\n const buffergeometry = geometries.get(object, geometry);\n // Update once per frame\n if (updateMap.get(buffergeometry) !== frame) {\n geometries.update(buffergeometry);\n updateMap.set(buffergeometry, frame);\n }\n if (object.isInstancedMesh) {\n if (object.hasEventListener(\"dispose\", onInstancedMeshDispose) === false) object.addEventListener(\"dispose\", onInstancedMeshDispose);\n if (updateMap.get(object) !== frame) {\n attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER);\n if (object.instanceColor !== null) attributes.update(object.instanceColor, gl.ARRAY_BUFFER);\n updateMap.set(object, frame);\n }\n }\n if (object.isSkinnedMesh) {\n const skeleton = object.skeleton;\n if (updateMap.get(skeleton) !== frame) {\n skeleton.update();\n updateMap.set(skeleton, frame);\n }\n }\n return buffergeometry;\n }\n function dispose() {\n updateMap = new WeakMap();\n }\n function onInstancedMeshDispose(event) {\n const instancedMesh = event.target;\n instancedMesh.removeEventListener(\"dispose\", onInstancedMeshDispose);\n attributes.remove(instancedMesh.instanceMatrix);\n if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor);\n }\n return {\n update: update,\n dispose: dispose\n };\n}\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */ const $d5b33d7c30034067$var$emptyTexture = /*@__PURE__*/ new $d5b33d7c30034067$export$5431306cf43de24a();\nconst $d5b33d7c30034067$var$emptyArrayTexture = /*@__PURE__*/ new $d5b33d7c30034067$export$dfac6c8e811406a3();\nconst $d5b33d7c30034067$var$empty3dTexture = /*@__PURE__*/ new $d5b33d7c30034067$export$d7a3086320f856db();\nconst $d5b33d7c30034067$var$emptyCubeTexture = /*@__PURE__*/ new $d5b33d7c30034067$export$ee2e5a18258a4049();\n// --- Utilities ---\n// Array Caches (provide typed arrays for temporary by size)\nconst $d5b33d7c30034067$var$arrayCacheF32 = [];\nconst $d5b33d7c30034067$var$arrayCacheI32 = [];\n// Float32Array caches used for uploading Matrix uniforms\nconst $d5b33d7c30034067$var$mat4array = new Float32Array(16);\nconst $d5b33d7c30034067$var$mat3array = new Float32Array(9);\nconst $d5b33d7c30034067$var$mat2array = new Float32Array(4);\n// Flattening for arrays of vectors and matrices\nfunction $d5b33d7c30034067$var$flatten(array, nBlocks, blockSize) {\n const firstElem = array[0];\n if (firstElem <= 0 || firstElem > 0) return array;\n // unoptimized: ! isNaN( firstElem )\n // see http://jacksondunstan.com/articles/983\n const n = nBlocks * blockSize;\n let r = $d5b33d7c30034067$var$arrayCacheF32[n];\n if (r === undefined) {\n r = new Float32Array(n);\n $d5b33d7c30034067$var$arrayCacheF32[n] = r;\n }\n if (nBlocks !== 0) {\n firstElem.toArray(r, 0);\n for(let i = 1, offset = 0; i !== nBlocks; ++i){\n offset += blockSize;\n array[i].toArray(r, offset);\n }\n }\n return r;\n}\nfunction $d5b33d7c30034067$var$arraysEqual(a, b) {\n if (a.length !== b.length) return false;\n for(let i = 0, l = a.length; i < l; i++){\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\nfunction $d5b33d7c30034067$var$copyArray(a, b) {\n for(let i = 0, l = b.length; i < l; i++)a[i] = b[i];\n}\n// Texture unit allocation\nfunction $d5b33d7c30034067$var$allocTexUnits(textures, n) {\n let r = $d5b33d7c30034067$var$arrayCacheI32[n];\n if (r === undefined) {\n r = new Int32Array(n);\n $d5b33d7c30034067$var$arrayCacheI32[n] = r;\n }\n for(let i = 0; i !== n; ++i)r[i] = textures.allocateTextureUnit();\n return r;\n}\n// --- Setters ---\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n// Single scalar\nfunction $d5b33d7c30034067$var$setValueV1f(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1f(this.addr, v);\n cache[0] = v;\n}\n// Single float vector (from flat array or THREE.VectorN)\nfunction $d5b33d7c30034067$var$setValueV2f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2f(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform2fv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV3f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3f(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else if (v.r !== undefined) {\n if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) {\n gl.uniform3f(this.addr, v.r, v.g, v.b);\n cache[0] = v.r;\n cache[1] = v.g;\n cache[2] = v.b;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform3fv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV4f(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4f(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform4fv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\n// Single matrix (from flat array or THREE.MatrixN)\nfunction $d5b33d7c30034067$var$setValueM2(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix2fv(this.addr, false, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, elements)) return;\n $d5b33d7c30034067$var$mat2array.set(elements);\n gl.uniformMatrix2fv(this.addr, false, $d5b33d7c30034067$var$mat2array);\n $d5b33d7c30034067$var$copyArray(cache, elements);\n }\n}\nfunction $d5b33d7c30034067$var$setValueM3(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix3fv(this.addr, false, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, elements)) return;\n $d5b33d7c30034067$var$mat3array.set(elements);\n gl.uniformMatrix3fv(this.addr, false, $d5b33d7c30034067$var$mat3array);\n $d5b33d7c30034067$var$copyArray(cache, elements);\n }\n}\nfunction $d5b33d7c30034067$var$setValueM4(gl, v) {\n const cache = this.cache;\n const elements = v.elements;\n if (elements === undefined) {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniformMatrix4fv(this.addr, false, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, elements)) return;\n $d5b33d7c30034067$var$mat4array.set(elements);\n gl.uniformMatrix4fv(this.addr, false, $d5b33d7c30034067$var$mat4array);\n $d5b33d7c30034067$var$copyArray(cache, elements);\n }\n}\n// Single integer / boolean\nfunction $d5b33d7c30034067$var$setValueV1i(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1i(this.addr, v);\n cache[0] = v;\n}\n// Single integer / boolean vector (from flat array or THREE.VectorN)\nfunction $d5b33d7c30034067$var$setValueV2i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2i(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform2iv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV3i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3i(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform3iv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV4i(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform4iv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\n// Single unsigned integer\nfunction $d5b33d7c30034067$var$setValueV1ui(gl, v) {\n const cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1ui(this.addr, v);\n cache[0] = v;\n}\n// Single unsigned integer vector (from flat array or THREE.VectorN)\nfunction $d5b33d7c30034067$var$setValueV2ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2ui(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform2uiv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV3ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3ui(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform3uiv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\nfunction $d5b33d7c30034067$var$setValueV4ui(gl, v) {\n const cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if ($d5b33d7c30034067$var$arraysEqual(cache, v)) return;\n gl.uniform4uiv(this.addr, v);\n $d5b33d7c30034067$var$copyArray(cache, v);\n }\n}\n// Single texture (2D / Cube)\nfunction $d5b33d7c30034067$var$setValueT1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2D(v || $d5b33d7c30034067$var$emptyTexture, unit);\n}\nfunction $d5b33d7c30034067$var$setValueT3D1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture3D(v || $d5b33d7c30034067$var$empty3dTexture, unit);\n}\nfunction $d5b33d7c30034067$var$setValueT6(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTextureCube(v || $d5b33d7c30034067$var$emptyCubeTexture, unit);\n}\nfunction $d5b33d7c30034067$var$setValueT2DArray1(gl, v, textures) {\n const cache = this.cache;\n const unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2DArray(v || $d5b33d7c30034067$var$emptyArrayTexture, unit);\n}\n// Helper to pick the right setter for the singular case\nfunction $d5b33d7c30034067$var$getSingularSetter(type) {\n switch(type){\n case 0x1406:\n return $d5b33d7c30034067$var$setValueV1f; // FLOAT\n case 0x8b50:\n return $d5b33d7c30034067$var$setValueV2f; // _VEC2\n case 0x8b51:\n return $d5b33d7c30034067$var$setValueV3f; // _VEC3\n case 0x8b52:\n return $d5b33d7c30034067$var$setValueV4f; // _VEC4\n case 0x8b5a:\n return $d5b33d7c30034067$var$setValueM2; // _MAT2\n case 0x8b5b:\n return $d5b33d7c30034067$var$setValueM3; // _MAT3\n case 0x8b5c:\n return $d5b33d7c30034067$var$setValueM4; // _MAT4\n case 0x1404:\n case 0x8b56:\n return $d5b33d7c30034067$var$setValueV1i; // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return $d5b33d7c30034067$var$setValueV2i; // _VEC2\n case 0x8b54:\n case 0x8b58:\n return $d5b33d7c30034067$var$setValueV3i; // _VEC3\n case 0x8b55:\n case 0x8b59:\n return $d5b33d7c30034067$var$setValueV4i; // _VEC4\n case 0x1405:\n return $d5b33d7c30034067$var$setValueV1ui; // UINT\n case 0x8dc6:\n return $d5b33d7c30034067$var$setValueV2ui; // _VEC2\n case 0x8dc7:\n return $d5b33d7c30034067$var$setValueV3ui; // _VEC3\n case 0x8dc8:\n return $d5b33d7c30034067$var$setValueV4ui; // _VEC4\n case 0x8b5e:\n case 0x8d66:\n case 0x8dca:\n case 0x8dd2:\n case 0x8b62:\n return $d5b33d7c30034067$var$setValueT1;\n case 0x8b5f:\n case 0x8dcb:\n case 0x8dd3:\n return $d5b33d7c30034067$var$setValueT3D1;\n case 0x8b60:\n case 0x8dcc:\n case 0x8dd4:\n case 0x8dc5:\n return $d5b33d7c30034067$var$setValueT6;\n case 0x8dc1:\n case 0x8dcf:\n case 0x8dd7:\n case 0x8dc4:\n return $d5b33d7c30034067$var$setValueT2DArray1;\n }\n}\n// Array of scalars\nfunction $d5b33d7c30034067$var$setValueV1fArray(gl, v) {\n gl.uniform1fv(this.addr, v);\n}\n// Array of vectors (from flat array or array of THREE.VectorN)\nfunction $d5b33d7c30034067$var$setValueV2fArray(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 2);\n gl.uniform2fv(this.addr, data);\n}\nfunction $d5b33d7c30034067$var$setValueV3fArray(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 3);\n gl.uniform3fv(this.addr, data);\n}\nfunction $d5b33d7c30034067$var$setValueV4fArray(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 4);\n gl.uniform4fv(this.addr, data);\n}\n// Array of matrices (from flat array or array of THREE.MatrixN)\nfunction $d5b33d7c30034067$var$setValueM2Array(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 4);\n gl.uniformMatrix2fv(this.addr, false, data);\n}\nfunction $d5b33d7c30034067$var$setValueM3Array(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 9);\n gl.uniformMatrix3fv(this.addr, false, data);\n}\nfunction $d5b33d7c30034067$var$setValueM4Array(gl, v) {\n const data = $d5b33d7c30034067$var$flatten(v, this.size, 16);\n gl.uniformMatrix4fv(this.addr, false, data);\n}\n// Array of integer / boolean\nfunction $d5b33d7c30034067$var$setValueV1iArray(gl, v) {\n gl.uniform1iv(this.addr, v);\n}\n// Array of integer / boolean vectors (from flat array)\nfunction $d5b33d7c30034067$var$setValueV2iArray(gl, v) {\n gl.uniform2iv(this.addr, v);\n}\nfunction $d5b33d7c30034067$var$setValueV3iArray(gl, v) {\n gl.uniform3iv(this.addr, v);\n}\nfunction $d5b33d7c30034067$var$setValueV4iArray(gl, v) {\n gl.uniform4iv(this.addr, v);\n}\n// Array of unsigned integer\nfunction $d5b33d7c30034067$var$setValueV1uiArray(gl, v) {\n gl.uniform1uiv(this.addr, v);\n}\n// Array of unsigned integer vectors (from flat array)\nfunction $d5b33d7c30034067$var$setValueV2uiArray(gl, v) {\n gl.uniform2uiv(this.addr, v);\n}\nfunction $d5b33d7c30034067$var$setValueV3uiArray(gl, v) {\n gl.uniform3uiv(this.addr, v);\n}\nfunction $d5b33d7c30034067$var$setValueV4uiArray(gl, v) {\n gl.uniform4uiv(this.addr, v);\n}\n// Array of textures (2D / 3D / Cube / 2DArray)\nfunction $d5b33d7c30034067$var$setValueT1Array(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $d5b33d7c30034067$var$allocTexUnits(textures, n);\n if (!$d5b33d7c30034067$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $d5b33d7c30034067$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture2D(v[i] || $d5b33d7c30034067$var$emptyTexture, units[i]);\n}\nfunction $d5b33d7c30034067$var$setValueT3DArray(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $d5b33d7c30034067$var$allocTexUnits(textures, n);\n if (!$d5b33d7c30034067$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $d5b33d7c30034067$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture3D(v[i] || $d5b33d7c30034067$var$empty3dTexture, units[i]);\n}\nfunction $d5b33d7c30034067$var$setValueT6Array(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $d5b33d7c30034067$var$allocTexUnits(textures, n);\n if (!$d5b33d7c30034067$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $d5b33d7c30034067$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTextureCube(v[i] || $d5b33d7c30034067$var$emptyCubeTexture, units[i]);\n}\nfunction $d5b33d7c30034067$var$setValueT2DArrayArray(gl, v, textures) {\n const cache = this.cache;\n const n = v.length;\n const units = $d5b33d7c30034067$var$allocTexUnits(textures, n);\n if (!$d5b33d7c30034067$var$arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n $d5b33d7c30034067$var$copyArray(cache, units);\n }\n for(let i = 0; i !== n; ++i)textures.setTexture2DArray(v[i] || $d5b33d7c30034067$var$emptyArrayTexture, units[i]);\n}\n// Helper to pick the right setter for a pure (bottom-level) array\nfunction $d5b33d7c30034067$var$getPureArraySetter(type) {\n switch(type){\n case 0x1406:\n return $d5b33d7c30034067$var$setValueV1fArray; // FLOAT\n case 0x8b50:\n return $d5b33d7c30034067$var$setValueV2fArray; // _VEC2\n case 0x8b51:\n return $d5b33d7c30034067$var$setValueV3fArray; // _VEC3\n case 0x8b52:\n return $d5b33d7c30034067$var$setValueV4fArray; // _VEC4\n case 0x8b5a:\n return $d5b33d7c30034067$var$setValueM2Array; // _MAT2\n case 0x8b5b:\n return $d5b33d7c30034067$var$setValueM3Array; // _MAT3\n case 0x8b5c:\n return $d5b33d7c30034067$var$setValueM4Array; // _MAT4\n case 0x1404:\n case 0x8b56:\n return $d5b33d7c30034067$var$setValueV1iArray; // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return $d5b33d7c30034067$var$setValueV2iArray; // _VEC2\n case 0x8b54:\n case 0x8b58:\n return $d5b33d7c30034067$var$setValueV3iArray; // _VEC3\n case 0x8b55:\n case 0x8b59:\n return $d5b33d7c30034067$var$setValueV4iArray; // _VEC4\n case 0x1405:\n return $d5b33d7c30034067$var$setValueV1uiArray; // UINT\n case 0x8dc6:\n return $d5b33d7c30034067$var$setValueV2uiArray; // _VEC2\n case 0x8dc7:\n return $d5b33d7c30034067$var$setValueV3uiArray; // _VEC3\n case 0x8dc8:\n return $d5b33d7c30034067$var$setValueV4uiArray; // _VEC4\n case 0x8b5e:\n case 0x8d66:\n case 0x8dca:\n case 0x8dd2:\n case 0x8b62:\n return $d5b33d7c30034067$var$setValueT1Array;\n case 0x8b5f:\n case 0x8dcb:\n case 0x8dd3:\n return $d5b33d7c30034067$var$setValueT3DArray;\n case 0x8b60:\n case 0x8dcc:\n case 0x8dd4:\n case 0x8dc5:\n return $d5b33d7c30034067$var$setValueT6Array;\n case 0x8dc1:\n case 0x8dcf:\n case 0x8dd7:\n case 0x8dc4:\n return $d5b33d7c30034067$var$setValueT2DArrayArray;\n }\n}\n// --- Uniform Classes ---\nclass $d5b33d7c30034067$var$SingleUniform {\n constructor(id, activeInfo, addr){\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.setValue = $d5b33d7c30034067$var$getSingularSetter(activeInfo.type);\n // this.path = activeInfo.name; // DEBUG\n }\n}\nclass $d5b33d7c30034067$var$PureArrayUniform {\n constructor(id, activeInfo, addr){\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.size = activeInfo.size;\n this.setValue = $d5b33d7c30034067$var$getPureArraySetter(activeInfo.type);\n // this.path = activeInfo.name; // DEBUG\n }\n}\nclass $d5b33d7c30034067$var$StructuredUniform {\n constructor(id){\n this.id = id;\n this.seq = [];\n this.map = {};\n }\n setValue(gl, value, textures) {\n const seq = this.seq;\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i];\n u.setValue(gl, value[u.id], textures);\n }\n }\n}\n// --- Top-level ---\n// Parser - builds up the property tree from the path strings\nconst $d5b33d7c30034067$var$RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\nfunction $d5b33d7c30034067$var$addUniform(container, uniformObject) {\n container.seq.push(uniformObject);\n container.map[uniformObject.id] = uniformObject;\n}\nfunction $d5b33d7c30034067$var$parseUniform(activeInfo, addr, container) {\n const path = activeInfo.name, pathLength = path.length;\n // reset RegExp object, because of the early exit of a previous run\n $d5b33d7c30034067$var$RePathPart.lastIndex = 0;\n while(true){\n const match = $d5b33d7c30034067$var$RePathPart.exec(path), matchEnd = $d5b33d7c30034067$var$RePathPart.lastIndex;\n let id = match[1];\n const idIsIndex = match[2] === \"]\", subscript = match[3];\n if (idIsIndex) id = id | 0; // convert to integer\n if (subscript === undefined || subscript === \"[\" && matchEnd + 2 === pathLength) {\n // bare name or \"pure\" bottom-level array \"[0]\" suffix\n $d5b33d7c30034067$var$addUniform(container, subscript === undefined ? new $d5b33d7c30034067$var$SingleUniform(id, activeInfo, addr) : new $d5b33d7c30034067$var$PureArrayUniform(id, activeInfo, addr));\n break;\n } else {\n // step into inner node / create it in case it doesn't exist\n const map = container.map;\n let next = map[id];\n if (next === undefined) {\n next = new $d5b33d7c30034067$var$StructuredUniform(id);\n $d5b33d7c30034067$var$addUniform(container, next);\n }\n container = next;\n }\n }\n}\n// Root Container\nclass $d5b33d7c30034067$var$WebGLUniforms {\n constructor(gl, program){\n this.seq = [];\n this.map = {};\n const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n for(let i = 0; i < n; ++i){\n const info = gl.getActiveUniform(program, i), addr = gl.getUniformLocation(program, info.name);\n $d5b33d7c30034067$var$parseUniform(info, addr, this);\n }\n }\n setValue(gl, name, value, textures) {\n const u = this.map[name];\n if (u !== undefined) u.setValue(gl, value, textures);\n }\n setOptional(gl, object, name) {\n const v = object[name];\n if (v !== undefined) this.setValue(gl, name, v);\n }\n static upload(gl, seq, values, textures) {\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i], v = values[u.id];\n if (v.needsUpdate !== false) // note: always updating when .needsUpdate is undefined\n u.setValue(gl, v.value, textures);\n }\n }\n static seqWithValue(seq, values) {\n const r = [];\n for(let i = 0, n = seq.length; i !== n; ++i){\n const u = seq[i];\n if (u.id in values) r.push(u);\n }\n return r;\n }\n}\nfunction $d5b33d7c30034067$var$WebGLShader(gl, type, string) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, string);\n gl.compileShader(shader);\n return shader;\n}\nlet $d5b33d7c30034067$var$programIdCount = 0;\nfunction $d5b33d7c30034067$var$handleSource(string, errorLine) {\n const lines = string.split(\"\\n\");\n const lines2 = [];\n const from = Math.max(errorLine - 6, 0);\n const to = Math.min(errorLine + 6, lines.length);\n for(let i = from; i < to; i++){\n const line = i + 1;\n lines2.push(`${line === errorLine ? \">\" : \" \"} ${line}: ${lines[i]}`);\n }\n return lines2.join(\"\\n\");\n}\nfunction $d5b33d7c30034067$var$getEncodingComponents(colorSpace1) {\n switch(colorSpace1){\n case $d5b33d7c30034067$export$42429b3acfb233a4:\n return [\n \"Linear\",\n \"( value )\"\n ];\n case $d5b33d7c30034067$export$561f394b24edfcaa:\n return [\n \"sRGB\",\n \"( value )\"\n ];\n default:\n console.warn(\"THREE.WebGLProgram: Unsupported color space:\", colorSpace1);\n return [\n \"Linear\",\n \"( value )\"\n ];\n }\n}\nfunction $d5b33d7c30034067$var$getShaderErrors(gl, shader, type) {\n const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n const errors = gl.getShaderInfoLog(shader).trim();\n if (status && errors === \"\") return \"\";\n const errorMatches = /ERROR: 0:(\\d+)/.exec(errors);\n if (errorMatches) {\n // --enable-privileged-webgl-extension\n // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n const errorLine = parseInt(errorMatches[1]);\n return type.toUpperCase() + \"\\n\\n\" + errors + \"\\n\\n\" + $d5b33d7c30034067$var$handleSource(gl.getShaderSource(shader), errorLine);\n } else return errors;\n}\nfunction $d5b33d7c30034067$var$getTexelEncodingFunction(functionName, colorSpace1) {\n const components = $d5b33d7c30034067$var$getEncodingComponents(colorSpace1);\n return \"vec4 \" + functionName + \"( vec4 value ) { return LinearTo\" + components[0] + components[1] + \"; }\";\n}\nfunction $d5b33d7c30034067$var$getToneMappingFunction(functionName, toneMapping) {\n let toneMappingName;\n switch(toneMapping){\n case $d5b33d7c30034067$export$98f52c2a46c598ca:\n toneMappingName = \"Linear\";\n break;\n case $d5b33d7c30034067$export$74b25e54b3bcd548:\n toneMappingName = \"Reinhard\";\n break;\n case $d5b33d7c30034067$export$932b3dd283d4a366:\n toneMappingName = \"OptimizedCineon\";\n break;\n case $d5b33d7c30034067$export$a0d98fe6d7e4af64:\n toneMappingName = \"ACESFilmic\";\n break;\n case $d5b33d7c30034067$export$2c7b09c1e9abfb5e:\n toneMappingName = \"Custom\";\n break;\n default:\n console.warn(\"THREE.WebGLProgram: Unsupported toneMapping:\", toneMapping);\n toneMappingName = \"Linear\";\n }\n return \"vec3 \" + functionName + \"( vec3 color ) { return \" + toneMappingName + \"ToneMapping( color ); }\";\n}\nfunction $d5b33d7c30034067$var$generateExtensions(parameters) {\n const chunks = [\n parameters.extensionDerivatives || !!parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === \"physical\" ? \"#extension GL_OES_standard_derivatives : enable\" : \"\",\n (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? \"#extension GL_EXT_frag_depth : enable\" : \"\",\n parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? \"#extension GL_EXT_draw_buffers : require\" : \"\",\n (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? \"#extension GL_EXT_shader_texture_lod : enable\" : \"\"\n ];\n return chunks.filter($d5b33d7c30034067$var$filterEmptyLine).join(\"\\n\");\n}\nfunction $d5b33d7c30034067$var$generateDefines(defines) {\n const chunks = [];\n for(const name in defines){\n const value = defines[name];\n if (value === false) continue;\n chunks.push(\"#define \" + name + \" \" + value);\n }\n return chunks.join(\"\\n\");\n}\nfunction $d5b33d7c30034067$var$fetchAttributeLocations(gl, program) {\n const attributes = {};\n const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n for(let i = 0; i < n; i++){\n const info = gl.getActiveAttrib(program, i);\n const name = info.name;\n let locationSize = 1;\n if (info.type === gl.FLOAT_MAT2) locationSize = 2;\n if (info.type === gl.FLOAT_MAT3) locationSize = 3;\n if (info.type === gl.FLOAT_MAT4) locationSize = 4;\n // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n attributes[name] = {\n type: info.type,\n location: gl.getAttribLocation(program, name),\n locationSize: locationSize\n };\n }\n return attributes;\n}\nfunction $d5b33d7c30034067$var$filterEmptyLine(string) {\n return string !== \"\";\n}\nfunction $d5b33d7c30034067$var$replaceLightNums(string, parameters) {\n const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);\n}\nfunction $d5b33d7c30034067$var$replaceClippingPlaneNums(string, parameters) {\n return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);\n}\n// Resolve Includes\nconst $d5b33d7c30034067$var$includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\nfunction $d5b33d7c30034067$var$resolveIncludes(string) {\n return string.replace($d5b33d7c30034067$var$includePattern, $d5b33d7c30034067$var$includeReplacer);\n}\nconst $d5b33d7c30034067$var$shaderChunkMap = new Map([\n [\n \"encodings_fragment\",\n \"colorspace_fragment\"\n ],\n [\n \"encodings_pars_fragment\",\n \"colorspace_pars_fragment\"\n ],\n [\n \"output_fragment\",\n \"opaque_fragment\"\n ]\n]);\nfunction $d5b33d7c30034067$var$includeReplacer(match, include) {\n let string = $d5b33d7c30034067$export$955f9f2e84c43c8b[include];\n if (string === undefined) {\n const newInclude = $d5b33d7c30034067$var$shaderChunkMap.get(include);\n if (newInclude !== undefined) {\n string = $d5b33d7c30034067$export$955f9f2e84c43c8b[newInclude];\n console.warn('THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude);\n } else throw new Error(\"Can not resolve #include <\" + include + \">\");\n }\n return $d5b33d7c30034067$var$resolveIncludes(string);\n}\n// Unroll Loops\nconst $d5b33d7c30034067$var$unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\nfunction $d5b33d7c30034067$var$unrollLoops(string) {\n return string.replace($d5b33d7c30034067$var$unrollLoopPattern, $d5b33d7c30034067$var$loopReplacer);\n}\nfunction $d5b33d7c30034067$var$loopReplacer(match, start, end, snippet) {\n let string = \"\";\n for(let i = parseInt(start); i < parseInt(end); i++)string += snippet.replace(/\\[\\s*i\\s*\\]/g, \"[ \" + i + \" ]\").replace(/UNROLLED_LOOP_INDEX/g, i);\n return string;\n}\n//\nfunction $d5b33d7c30034067$var$generatePrecision(parameters) {\n let precisionstring = \"precision \" + parameters.precision + \" float;\\nprecision \" + parameters.precision + \" int;\";\n if (parameters.precision === \"highp\") precisionstring += \"\\n#define HIGH_PRECISION\";\n else if (parameters.precision === \"mediump\") precisionstring += \"\\n#define MEDIUM_PRECISION\";\n else if (parameters.precision === \"lowp\") precisionstring += \"\\n#define LOW_PRECISION\";\n return precisionstring;\n}\nfunction $d5b33d7c30034067$var$generateShadowMapTypeDefine(parameters) {\n let shadowMapTypeDefine = \"SHADOWMAP_TYPE_BASIC\";\n if (parameters.shadowMapType === $d5b33d7c30034067$export$5813f879eee7cd88) shadowMapTypeDefine = \"SHADOWMAP_TYPE_PCF\";\n else if (parameters.shadowMapType === $d5b33d7c30034067$export$a47c4b43a1be34f0) shadowMapTypeDefine = \"SHADOWMAP_TYPE_PCF_SOFT\";\n else if (parameters.shadowMapType === $d5b33d7c30034067$export$896ae1ade6c829c4) shadowMapTypeDefine = \"SHADOWMAP_TYPE_VSM\";\n return shadowMapTypeDefine;\n}\nfunction $d5b33d7c30034067$var$generateEnvMapTypeDefine(parameters) {\n let envMapTypeDefine = \"ENVMAP_TYPE_CUBE\";\n if (parameters.envMap) switch(parameters.envMapMode){\n case $d5b33d7c30034067$export$8759762a6477f2c4:\n case $d5b33d7c30034067$export$dc59f8aed047f61d:\n envMapTypeDefine = \"ENVMAP_TYPE_CUBE\";\n break;\n case $d5b33d7c30034067$export$dbf3e70ff37af79:\n envMapTypeDefine = \"ENVMAP_TYPE_CUBE_UV\";\n break;\n }\n return envMapTypeDefine;\n}\nfunction $d5b33d7c30034067$var$generateEnvMapModeDefine(parameters) {\n let envMapModeDefine = \"ENVMAP_MODE_REFLECTION\";\n if (parameters.envMap) switch(parameters.envMapMode){\n case $d5b33d7c30034067$export$dc59f8aed047f61d:\n envMapModeDefine = \"ENVMAP_MODE_REFRACTION\";\n break;\n }\n return envMapModeDefine;\n}\nfunction $d5b33d7c30034067$var$generateEnvMapBlendingDefine(parameters) {\n let envMapBlendingDefine = \"ENVMAP_BLENDING_NONE\";\n if (parameters.envMap) switch(parameters.combine){\n case $d5b33d7c30034067$export$e50ac29801f1774d:\n envMapBlendingDefine = \"ENVMAP_BLENDING_MULTIPLY\";\n break;\n case $d5b33d7c30034067$export$9f9d94f963c85479:\n envMapBlendingDefine = \"ENVMAP_BLENDING_MIX\";\n break;\n case $d5b33d7c30034067$export$e641dc52bc3494aa:\n envMapBlendingDefine = \"ENVMAP_BLENDING_ADD\";\n break;\n }\n return envMapBlendingDefine;\n}\nfunction $d5b33d7c30034067$var$generateCubeUVSize(parameters) {\n const imageHeight = parameters.envMapCubeUVHeight;\n if (imageHeight === null) return null;\n const maxMip = Math.log2(imageHeight) - 2;\n const texelHeight = 1.0 / imageHeight;\n const texelWidth = 1.0 / (3 * Math.max(Math.pow(2, maxMip), 112));\n return {\n texelWidth: texelWidth,\n texelHeight: texelHeight,\n maxMip: maxMip\n };\n}\nfunction $d5b33d7c30034067$var$WebGLProgram(renderer, cacheKey, parameters, bindingStates) {\n // TODO Send this event to Three.js DevTools\n // console.log( 'WebGLProgram', cacheKey );\n const gl = renderer.getContext();\n const defines = parameters.defines;\n let vertexShader = parameters.vertexShader;\n let fragmentShader = parameters.fragmentShader;\n const shadowMapTypeDefine = $d5b33d7c30034067$var$generateShadowMapTypeDefine(parameters);\n const envMapTypeDefine = $d5b33d7c30034067$var$generateEnvMapTypeDefine(parameters);\n const envMapModeDefine = $d5b33d7c30034067$var$generateEnvMapModeDefine(parameters);\n const envMapBlendingDefine = $d5b33d7c30034067$var$generateEnvMapBlendingDefine(parameters);\n const envMapCubeUVSize = $d5b33d7c30034067$var$generateCubeUVSize(parameters);\n const customExtensions = parameters.isWebGL2 ? \"\" : $d5b33d7c30034067$var$generateExtensions(parameters);\n const customDefines = $d5b33d7c30034067$var$generateDefines(defines);\n const program = gl.createProgram();\n let prefixVertex, prefixFragment;\n let versionString = parameters.glslVersion ? \"#version \" + parameters.glslVersion + \"\\n\" : \"\";\n if (parameters.isRawShaderMaterial) {\n prefixVertex = [\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines\n ].filter($d5b33d7c30034067$var$filterEmptyLine).join(\"\\n\");\n if (prefixVertex.length > 0) prefixVertex += \"\\n\";\n prefixFragment = [\n customExtensions,\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines\n ].filter($d5b33d7c30034067$var$filterEmptyLine).join(\"\\n\");\n if (prefixFragment.length > 0) prefixFragment += \"\\n\";\n } else {\n prefixVertex = [\n $d5b33d7c30034067$var$generatePrecision(parameters),\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines,\n parameters.instancing ? \"#define USE_INSTANCING\" : \"\",\n parameters.instancingColor ? \"#define USE_INSTANCING_COLOR\" : \"\",\n parameters.useFog && parameters.fog ? \"#define USE_FOG\" : \"\",\n parameters.useFog && parameters.fogExp2 ? \"#define FOG_EXP2\" : \"\",\n parameters.map ? \"#define USE_MAP\" : \"\",\n parameters.envMap ? \"#define USE_ENVMAP\" : \"\",\n parameters.envMap ? \"#define \" + envMapModeDefine : \"\",\n parameters.lightMap ? \"#define USE_LIGHTMAP\" : \"\",\n parameters.aoMap ? \"#define USE_AOMAP\" : \"\",\n parameters.bumpMap ? \"#define USE_BUMPMAP\" : \"\",\n parameters.normalMap ? \"#define USE_NORMALMAP\" : \"\",\n parameters.normalMapObjectSpace ? \"#define USE_NORMALMAP_OBJECTSPACE\" : \"\",\n parameters.normalMapTangentSpace ? \"#define USE_NORMALMAP_TANGENTSPACE\" : \"\",\n parameters.displacementMap ? \"#define USE_DISPLACEMENTMAP\" : \"\",\n parameters.emissiveMap ? \"#define USE_EMISSIVEMAP\" : \"\",\n parameters.anisotropyMap ? \"#define USE_ANISOTROPYMAP\" : \"\",\n parameters.clearcoatMap ? \"#define USE_CLEARCOATMAP\" : \"\",\n parameters.clearcoatRoughnessMap ? \"#define USE_CLEARCOAT_ROUGHNESSMAP\" : \"\",\n parameters.clearcoatNormalMap ? \"#define USE_CLEARCOAT_NORMALMAP\" : \"\",\n parameters.iridescenceMap ? \"#define USE_IRIDESCENCEMAP\" : \"\",\n parameters.iridescenceThicknessMap ? \"#define USE_IRIDESCENCE_THICKNESSMAP\" : \"\",\n parameters.specularMap ? \"#define USE_SPECULARMAP\" : \"\",\n parameters.specularColorMap ? \"#define USE_SPECULAR_COLORMAP\" : \"\",\n parameters.specularIntensityMap ? \"#define USE_SPECULAR_INTENSITYMAP\" : \"\",\n parameters.roughnessMap ? \"#define USE_ROUGHNESSMAP\" : \"\",\n parameters.metalnessMap ? \"#define USE_METALNESSMAP\" : \"\",\n parameters.alphaMap ? \"#define USE_ALPHAMAP\" : \"\",\n parameters.alphaHash ? \"#define USE_ALPHAHASH\" : \"\",\n parameters.transmission ? \"#define USE_TRANSMISSION\" : \"\",\n parameters.transmissionMap ? \"#define USE_TRANSMISSIONMAP\" : \"\",\n parameters.thicknessMap ? \"#define USE_THICKNESSMAP\" : \"\",\n parameters.sheenColorMap ? \"#define USE_SHEEN_COLORMAP\" : \"\",\n parameters.sheenRoughnessMap ? \"#define USE_SHEEN_ROUGHNESSMAP\" : \"\",\n //\n parameters.mapUv ? \"#define MAP_UV \" + parameters.mapUv : \"\",\n parameters.alphaMapUv ? \"#define ALPHAMAP_UV \" + parameters.alphaMapUv : \"\",\n parameters.lightMapUv ? \"#define LIGHTMAP_UV \" + parameters.lightMapUv : \"\",\n parameters.aoMapUv ? \"#define AOMAP_UV \" + parameters.aoMapUv : \"\",\n parameters.emissiveMapUv ? \"#define EMISSIVEMAP_UV \" + parameters.emissiveMapUv : \"\",\n parameters.bumpMapUv ? \"#define BUMPMAP_UV \" + parameters.bumpMapUv : \"\",\n parameters.normalMapUv ? \"#define NORMALMAP_UV \" + parameters.normalMapUv : \"\",\n parameters.displacementMapUv ? \"#define DISPLACEMENTMAP_UV \" + parameters.displacementMapUv : \"\",\n parameters.metalnessMapUv ? \"#define METALNESSMAP_UV \" + parameters.metalnessMapUv : \"\",\n parameters.roughnessMapUv ? \"#define ROUGHNESSMAP_UV \" + parameters.roughnessMapUv : \"\",\n parameters.anisotropyMapUv ? \"#define ANISOTROPYMAP_UV \" + parameters.anisotropyMapUv : \"\",\n parameters.clearcoatMapUv ? \"#define CLEARCOATMAP_UV \" + parameters.clearcoatMapUv : \"\",\n parameters.clearcoatNormalMapUv ? \"#define CLEARCOAT_NORMALMAP_UV \" + parameters.clearcoatNormalMapUv : \"\",\n parameters.clearcoatRoughnessMapUv ? \"#define CLEARCOAT_ROUGHNESSMAP_UV \" + parameters.clearcoatRoughnessMapUv : \"\",\n parameters.iridescenceMapUv ? \"#define IRIDESCENCEMAP_UV \" + parameters.iridescenceMapUv : \"\",\n parameters.iridescenceThicknessMapUv ? \"#define IRIDESCENCE_THICKNESSMAP_UV \" + parameters.iridescenceThicknessMapUv : \"\",\n parameters.sheenColorMapUv ? \"#define SHEEN_COLORMAP_UV \" + parameters.sheenColorMapUv : \"\",\n parameters.sheenRoughnessMapUv ? \"#define SHEEN_ROUGHNESSMAP_UV \" + parameters.sheenRoughnessMapUv : \"\",\n parameters.specularMapUv ? \"#define SPECULARMAP_UV \" + parameters.specularMapUv : \"\",\n parameters.specularColorMapUv ? \"#define SPECULAR_COLORMAP_UV \" + parameters.specularColorMapUv : \"\",\n parameters.specularIntensityMapUv ? \"#define SPECULAR_INTENSITYMAP_UV \" + parameters.specularIntensityMapUv : \"\",\n parameters.transmissionMapUv ? \"#define TRANSMISSIONMAP_UV \" + parameters.transmissionMapUv : \"\",\n parameters.thicknessMapUv ? \"#define THICKNESSMAP_UV \" + parameters.thicknessMapUv : \"\",\n //\n parameters.vertexTangents && parameters.flatShading === false ? \"#define USE_TANGENT\" : \"\",\n parameters.vertexColors ? \"#define USE_COLOR\" : \"\",\n parameters.vertexAlphas ? \"#define USE_COLOR_ALPHA\" : \"\",\n parameters.vertexUv1s ? \"#define USE_UV1\" : \"\",\n parameters.vertexUv2s ? \"#define USE_UV2\" : \"\",\n parameters.vertexUv3s ? \"#define USE_UV3\" : \"\",\n parameters.pointsUvs ? \"#define USE_POINTS_UV\" : \"\",\n parameters.flatShading ? \"#define FLAT_SHADED\" : \"\",\n parameters.skinning ? \"#define USE_SKINNING\" : \"\",\n parameters.morphTargets ? \"#define USE_MORPHTARGETS\" : \"\",\n parameters.morphNormals && parameters.flatShading === false ? \"#define USE_MORPHNORMALS\" : \"\",\n parameters.morphColors && parameters.isWebGL2 ? \"#define USE_MORPHCOLORS\" : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_TEXTURE\" : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_TEXTURE_STRIDE \" + parameters.morphTextureStride : \"\",\n parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? \"#define MORPHTARGETS_COUNT \" + parameters.morphTargetsCount : \"\",\n parameters.doubleSided ? \"#define DOUBLE_SIDED\" : \"\",\n parameters.flipSided ? \"#define FLIP_SIDED\" : \"\",\n parameters.shadowMapEnabled ? \"#define USE_SHADOWMAP\" : \"\",\n parameters.shadowMapEnabled ? \"#define \" + shadowMapTypeDefine : \"\",\n parameters.sizeAttenuation ? \"#define USE_SIZEATTENUATION\" : \"\",\n parameters.useLegacyLights ? \"#define LEGACY_LIGHTS\" : \"\",\n parameters.logarithmicDepthBuffer ? \"#define USE_LOGDEPTHBUF\" : \"\",\n parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? \"#define USE_LOGDEPTHBUF_EXT\" : \"\",\n \"uniform mat4 modelMatrix;\",\n \"uniform mat4 modelViewMatrix;\",\n \"uniform mat4 projectionMatrix;\",\n \"uniform mat4 viewMatrix;\",\n \"uniform mat3 normalMatrix;\",\n \"uniform vec3 cameraPosition;\",\n \"uniform bool isOrthographic;\",\n \"#ifdef USE_INSTANCING\",\n \"\tattribute mat4 instanceMatrix;\",\n \"#endif\",\n \"#ifdef USE_INSTANCING_COLOR\",\n \"\tattribute vec3 instanceColor;\",\n \"#endif\",\n \"attribute vec3 position;\",\n \"attribute vec3 normal;\",\n \"attribute vec2 uv;\",\n \"#ifdef USE_UV1\",\n \"\tattribute vec2 uv1;\",\n \"#endif\",\n \"#ifdef USE_UV2\",\n \"\tattribute vec2 uv2;\",\n \"#endif\",\n \"#ifdef USE_UV3\",\n \"\tattribute vec2 uv3;\",\n \"#endif\",\n \"#ifdef USE_TANGENT\",\n \"\tattribute vec4 tangent;\",\n \"#endif\",\n \"#if defined( USE_COLOR_ALPHA )\",\n \"\tattribute vec4 color;\",\n \"#elif defined( USE_COLOR )\",\n \"\tattribute vec3 color;\",\n \"#endif\",\n \"#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )\",\n \"\tattribute vec3 morphTarget0;\",\n \"\tattribute vec3 morphTarget1;\",\n \"\tattribute vec3 morphTarget2;\",\n \"\tattribute vec3 morphTarget3;\",\n \"\t#ifdef USE_MORPHNORMALS\",\n \"\t\tattribute vec3 morphNormal0;\",\n \"\t\tattribute vec3 morphNormal1;\",\n \"\t\tattribute vec3 morphNormal2;\",\n \"\t\tattribute vec3 morphNormal3;\",\n \"\t#else\",\n \"\t\tattribute vec3 morphTarget4;\",\n \"\t\tattribute vec3 morphTarget5;\",\n \"\t\tattribute vec3 morphTarget6;\",\n \"\t\tattribute vec3 morphTarget7;\",\n \"\t#endif\",\n \"#endif\",\n \"#ifdef USE_SKINNING\",\n \"\tattribute vec4 skinIndex;\",\n \"\tattribute vec4 skinWeight;\",\n \"#endif\",\n \"\\n\"\n ].filter($d5b33d7c30034067$var$filterEmptyLine).join(\"\\n\");\n prefixFragment = [\n customExtensions,\n $d5b33d7c30034067$var$generatePrecision(parameters),\n \"#define SHADER_TYPE \" + parameters.shaderType,\n \"#define SHADER_NAME \" + parameters.shaderName,\n customDefines,\n parameters.useFog && parameters.fog ? \"#define USE_FOG\" : \"\",\n parameters.useFog && parameters.fogExp2 ? \"#define FOG_EXP2\" : \"\",\n parameters.map ? \"#define USE_MAP\" : \"\",\n parameters.matcap ? \"#define USE_MATCAP\" : \"\",\n parameters.envMap ? \"#define USE_ENVMAP\" : \"\",\n parameters.envMap ? \"#define \" + envMapTypeDefine : \"\",\n parameters.envMap ? \"#define \" + envMapModeDefine : \"\",\n parameters.envMap ? \"#define \" + envMapBlendingDefine : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_TEXEL_WIDTH \" + envMapCubeUVSize.texelWidth : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_TEXEL_HEIGHT \" + envMapCubeUVSize.texelHeight : \"\",\n envMapCubeUVSize ? \"#define CUBEUV_MAX_MIP \" + envMapCubeUVSize.maxMip + \".0\" : \"\",\n parameters.lightMap ? \"#define USE_LIGHTMAP\" : \"\",\n parameters.aoMap ? \"#define USE_AOMAP\" : \"\",\n parameters.bumpMap ? \"#define USE_BUMPMAP\" : \"\",\n parameters.normalMap ? \"#define USE_NORMALMAP\" : \"\",\n parameters.normalMapObjectSpace ? \"#define USE_NORMALMAP_OBJECTSPACE\" : \"\",\n parameters.normalMapTangentSpace ? \"#define USE_NORMALMAP_TANGENTSPACE\" : \"\",\n parameters.emissiveMap ? \"#define USE_EMISSIVEMAP\" : \"\",\n parameters.anisotropy ? \"#define USE_ANISOTROPY\" : \"\",\n parameters.anisotropyMap ? \"#define USE_ANISOTROPYMAP\" : \"\",\n parameters.clearcoat ? \"#define USE_CLEARCOAT\" : \"\",\n parameters.clearcoatMap ? \"#define USE_CLEARCOATMAP\" : \"\",\n parameters.clearcoatRoughnessMap ? \"#define USE_CLEARCOAT_ROUGHNESSMAP\" : \"\",\n parameters.clearcoatNormalMap ? \"#define USE_CLEARCOAT_NORMALMAP\" : \"\",\n parameters.iridescence ? \"#define USE_IRIDESCENCE\" : \"\",\n parameters.iridescenceMap ? \"#define USE_IRIDESCENCEMAP\" : \"\",\n parameters.iridescenceThicknessMap ? \"#define USE_IRIDESCENCE_THICKNESSMAP\" : \"\",\n parameters.specularMap ? \"#define USE_SPECULARMAP\" : \"\",\n parameters.specularColorMap ? \"#define USE_SPECULAR_COLORMAP\" : \"\",\n parameters.specularIntensityMap ? \"#define USE_SPECULAR_INTENSITYMAP\" : \"\",\n parameters.roughnessMap ? \"#define USE_ROUGHNESSMAP\" : \"\",\n parameters.metalnessMap ? \"#define USE_METALNESSMAP\" : \"\",\n parameters.alphaMap ? \"#define USE_ALPHAMAP\" : \"\",\n parameters.alphaTest ? \"#define USE_ALPHATEST\" : \"\",\n parameters.alphaHash ? \"#define USE_ALPHAHASH\" : \"\",\n parameters.sheen ? \"#define USE_SHEEN\" : \"\",\n parameters.sheenColorMap ? \"#define USE_SHEEN_COLORMAP\" : \"\",\n parameters.sheenRoughnessMap ? \"#define USE_SHEEN_ROUGHNESSMAP\" : \"\",\n parameters.transmission ? \"#define USE_TRANSMISSION\" : \"\",\n parameters.transmissionMap ? \"#define USE_TRANSMISSIONMAP\" : \"\",\n parameters.thicknessMap ? \"#define USE_THICKNESSMAP\" : \"\",\n parameters.vertexTangents && parameters.flatShading === false ? \"#define USE_TANGENT\" : \"\",\n parameters.vertexColors || parameters.instancingColor ? \"#define USE_COLOR\" : \"\",\n parameters.vertexAlphas ? \"#define USE_COLOR_ALPHA\" : \"\",\n parameters.vertexUv1s ? \"#define USE_UV1\" : \"\",\n parameters.vertexUv2s ? \"#define USE_UV2\" : \"\",\n parameters.vertexUv3s ? \"#define USE_UV3\" : \"\",\n parameters.pointsUvs ? \"#define USE_POINTS_UV\" : \"\",\n parameters.gradientMap ? \"#define USE_GRADIENTMAP\" : \"\",\n parameters.flatShading ? \"#define FLAT_SHADED\" : \"\",\n parameters.doubleSided ? \"#define DOUBLE_SIDED\" : \"\",\n parameters.flipSided ? \"#define FLIP_SIDED\" : \"\",\n parameters.shadowMapEnabled ? \"#define USE_SHADOWMAP\" : \"\",\n parameters.shadowMapEnabled ? \"#define \" + shadowMapTypeDefine : \"\",\n parameters.premultipliedAlpha ? \"#define PREMULTIPLIED_ALPHA\" : \"\",\n parameters.useLegacyLights ? \"#define LEGACY_LIGHTS\" : \"\",\n parameters.logarithmicDepthBuffer ? \"#define USE_LOGDEPTHBUF\" : \"\",\n parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? \"#define USE_LOGDEPTHBUF_EXT\" : \"\",\n \"uniform mat4 viewMatrix;\",\n \"uniform vec3 cameraPosition;\",\n \"uniform bool isOrthographic;\",\n parameters.toneMapping !== $d5b33d7c30034067$export$9fcb6b4294603b2 ? \"#define TONE_MAPPING\" : \"\",\n parameters.toneMapping !== $d5b33d7c30034067$export$9fcb6b4294603b2 ? $d5b33d7c30034067$export$955f9f2e84c43c8b[\"tonemapping_pars_fragment\"] : \"\",\n parameters.toneMapping !== $d5b33d7c30034067$export$9fcb6b4294603b2 ? $d5b33d7c30034067$var$getToneMappingFunction(\"toneMapping\", parameters.toneMapping) : \"\",\n parameters.dithering ? \"#define DITHERING\" : \"\",\n parameters.opaque ? \"#define OPAQUE\" : \"\",\n $d5b33d7c30034067$export$955f9f2e84c43c8b[\"colorspace_pars_fragment\"],\n $d5b33d7c30034067$var$getTexelEncodingFunction(\"linearToOutputTexel\", parameters.outputColorSpace),\n parameters.useDepthPacking ? \"#define DEPTH_PACKING \" + parameters.depthPacking : \"\",\n \"\\n\"\n ].filter($d5b33d7c30034067$var$filterEmptyLine).join(\"\\n\");\n }\n vertexShader = $d5b33d7c30034067$var$resolveIncludes(vertexShader);\n vertexShader = $d5b33d7c30034067$var$replaceLightNums(vertexShader, parameters);\n vertexShader = $d5b33d7c30034067$var$replaceClippingPlaneNums(vertexShader, parameters);\n fragmentShader = $d5b33d7c30034067$var$resolveIncludes(fragmentShader);\n fragmentShader = $d5b33d7c30034067$var$replaceLightNums(fragmentShader, parameters);\n fragmentShader = $d5b33d7c30034067$var$replaceClippingPlaneNums(fragmentShader, parameters);\n vertexShader = $d5b33d7c30034067$var$unrollLoops(vertexShader);\n fragmentShader = $d5b33d7c30034067$var$unrollLoops(fragmentShader);\n if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) {\n // GLSL 3.0 conversion for built-in materials and ShaderMaterial\n versionString = \"#version 300 es\\n\";\n prefixVertex = [\n \"precision mediump sampler2DArray;\",\n \"#define attribute in\",\n \"#define varying out\",\n \"#define texture2D texture\"\n ].join(\"\\n\") + \"\\n\" + prefixVertex;\n prefixFragment = [\n \"#define varying in\",\n parameters.glslVersion === $d5b33d7c30034067$export$f63012db5506e7dd ? \"\" : \"layout(location = 0) out highp vec4 pc_fragColor;\",\n parameters.glslVersion === $d5b33d7c30034067$export$f63012db5506e7dd ? \"\" : \"#define gl_FragColor pc_fragColor\",\n \"#define gl_FragDepthEXT gl_FragDepth\",\n \"#define texture2D texture\",\n \"#define textureCube texture\",\n \"#define texture2DProj textureProj\",\n \"#define texture2DLodEXT textureLod\",\n \"#define texture2DProjLodEXT textureProjLod\",\n \"#define textureCubeLodEXT textureLod\",\n \"#define texture2DGradEXT textureGrad\",\n \"#define texture2DProjGradEXT textureProjGrad\",\n \"#define textureCubeGradEXT textureGrad\"\n ].join(\"\\n\") + \"\\n\" + prefixFragment;\n }\n const vertexGlsl = versionString + prefixVertex + vertexShader;\n const fragmentGlsl = versionString + prefixFragment + fragmentShader;\n // console.log( '*VERTEX*', vertexGlsl );\n // console.log( '*FRAGMENT*', fragmentGlsl );\n const glVertexShader = $d5b33d7c30034067$var$WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl);\n const glFragmentShader = $d5b33d7c30034067$var$WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl);\n gl.attachShader(program, glVertexShader);\n gl.attachShader(program, glFragmentShader);\n // Force a particular attribute to index 0.\n if (parameters.index0AttributeName !== undefined) gl.bindAttribLocation(program, 0, parameters.index0AttributeName);\n else if (parameters.morphTargets === true) // programs with morphTargets displace position out of attribute 0\n gl.bindAttribLocation(program, 0, \"position\");\n gl.linkProgram(program);\n // check for link errors\n if (renderer.debug.checkShaderErrors) {\n const programLog = gl.getProgramInfoLog(program).trim();\n const vertexLog = gl.getShaderInfoLog(glVertexShader).trim();\n const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim();\n let runnable = true;\n let haveDiagnostics = true;\n if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {\n runnable = false;\n if (typeof renderer.debug.onShaderError === \"function\") renderer.debug.onShaderError(gl, program, glVertexShader, glFragmentShader);\n else {\n // default error reporting\n const vertexErrors = $d5b33d7c30034067$var$getShaderErrors(gl, glVertexShader, \"vertex\");\n const fragmentErrors = $d5b33d7c30034067$var$getShaderErrors(gl, glFragmentShader, \"fragment\");\n console.error(\"THREE.WebGLProgram: Shader Error \" + gl.getError() + \" - \" + \"VALIDATE_STATUS \" + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + \"\\n\\n\" + \"Program Info Log: \" + programLog + \"\\n\" + vertexErrors + \"\\n\" + fragmentErrors);\n }\n } else if (programLog !== \"\") console.warn(\"THREE.WebGLProgram: Program Info Log:\", programLog);\n else if (vertexLog === \"\" || fragmentLog === \"\") haveDiagnostics = false;\n if (haveDiagnostics) this.diagnostics = {\n runnable: runnable,\n programLog: programLog,\n vertexShader: {\n log: vertexLog,\n prefix: prefixVertex\n },\n fragmentShader: {\n log: fragmentLog,\n prefix: prefixFragment\n }\n };\n }\n // Clean up\n // Crashes in iOS9 and iOS10. #18402\n // gl.detachShader( program, glVertexShader );\n // gl.detachShader( program, glFragmentShader );\n gl.deleteShader(glVertexShader);\n gl.deleteShader(glFragmentShader);\n // set up caching for uniform locations\n let cachedUniforms;\n this.getUniforms = function() {\n if (cachedUniforms === undefined) cachedUniforms = new $d5b33d7c30034067$var$WebGLUniforms(gl, program);\n return cachedUniforms;\n };\n // set up caching for attribute locations\n let cachedAttributes;\n this.getAttributes = function() {\n if (cachedAttributes === undefined) cachedAttributes = $d5b33d7c30034067$var$fetchAttributeLocations(gl, program);\n return cachedAttributes;\n };\n // free resource\n this.destroy = function() {\n bindingStates.releaseStatesOfProgram(this);\n gl.deleteProgram(program);\n this.program = undefined;\n };\n //\n this.type = parameters.shaderType;\n this.name = parameters.shaderName;\n this.id = $d5b33d7c30034067$var$programIdCount++;\n this.cacheKey = cacheKey;\n this.usedTimes = 1;\n this.program = program;\n this.vertexShader = glVertexShader;\n this.fragmentShader = glFragmentShader;\n return this;\n}\nlet $d5b33d7c30034067$var$_id = 0;\nclass $d5b33d7c30034067$var$WebGLShaderCache {\n constructor(){\n this.shaderCache = new Map();\n this.materialCache = new Map();\n }\n update(material) {\n const vertexShader = material.vertexShader;\n const fragmentShader = material.fragmentShader;\n const vertexShaderStage = this._getShaderStage(vertexShader);\n const fragmentShaderStage = this._getShaderStage(fragmentShader);\n const materialShaders = this._getShaderCacheForMaterial(material);\n if (materialShaders.has(vertexShaderStage) === false) {\n materialShaders.add(vertexShaderStage);\n vertexShaderStage.usedTimes++;\n }\n if (materialShaders.has(fragmentShaderStage) === false) {\n materialShaders.add(fragmentShaderStage);\n fragmentShaderStage.usedTimes++;\n }\n return this;\n }\n remove(material) {\n const materialShaders = this.materialCache.get(material);\n for (const shaderStage of materialShaders){\n shaderStage.usedTimes--;\n if (shaderStage.usedTimes === 0) this.shaderCache.delete(shaderStage.code);\n }\n this.materialCache.delete(material);\n return this;\n }\n getVertexShaderID(material) {\n return this._getShaderStage(material.vertexShader).id;\n }\n getFragmentShaderID(material) {\n return this._getShaderStage(material.fragmentShader).id;\n }\n dispose() {\n this.shaderCache.clear();\n this.materialCache.clear();\n }\n _getShaderCacheForMaterial(material) {\n const cache = this.materialCache;\n let set = cache.get(material);\n if (set === undefined) {\n set = new Set();\n cache.set(material, set);\n }\n return set;\n }\n _getShaderStage(code) {\n const cache = this.shaderCache;\n let stage = cache.get(code);\n if (stage === undefined) {\n stage = new $d5b33d7c30034067$var$WebGLShaderStage(code);\n cache.set(code, stage);\n }\n return stage;\n }\n}\nclass $d5b33d7c30034067$var$WebGLShaderStage {\n constructor(code){\n this.id = $d5b33d7c30034067$var$_id++;\n this.code = code;\n this.usedTimes = 0;\n }\n}\nfunction $d5b33d7c30034067$var$WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) {\n const _programLayers = new $d5b33d7c30034067$export$89312ce47c0ca777();\n const _customShaders = new $d5b33d7c30034067$var$WebGLShaderCache();\n const programs = [];\n const IS_WEBGL2 = capabilities.isWebGL2;\n const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n let precision = capabilities.precision;\n const shaderIDs = {\n MeshDepthMaterial: \"depth\",\n MeshDistanceMaterial: \"distanceRGBA\",\n MeshNormalMaterial: \"normal\",\n MeshBasicMaterial: \"basic\",\n MeshLambertMaterial: \"lambert\",\n MeshPhongMaterial: \"phong\",\n MeshToonMaterial: \"toon\",\n MeshStandardMaterial: \"physical\",\n MeshPhysicalMaterial: \"physical\",\n MeshMatcapMaterial: \"matcap\",\n LineBasicMaterial: \"basic\",\n LineDashedMaterial: \"dashed\",\n PointsMaterial: \"points\",\n ShadowMaterial: \"shadow\",\n SpriteMaterial: \"sprite\"\n };\n function getChannel(value) {\n if (value === 0) return \"uv\";\n return `uv${value}`;\n }\n function getParameters(material, lights, shadows, scene, object) {\n const fog = scene.fog;\n const geometry = object.geometry;\n const environment = material.isMeshStandardMaterial ? scene.environment : null;\n const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n const envMapCubeUVHeight = !!envMap && envMap.mapping === $d5b33d7c30034067$export$dbf3e70ff37af79 ? envMap.image.height : null;\n const shaderID = shaderIDs[material.type];\n // heuristics to create shader parameters according to lights in the scene\n // (not to blow over maxLights budget)\n if (material.precision !== null) {\n precision = capabilities.getMaxPrecision(material.precision);\n if (precision !== material.precision) console.warn(\"THREE.WebGLProgram.getParameters:\", material.precision, \"not supported, using\", precision, \"instead.\");\n }\n //\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n let morphTextureStride = 0;\n if (geometry.morphAttributes.position !== undefined) morphTextureStride = 1;\n if (geometry.morphAttributes.normal !== undefined) morphTextureStride = 2;\n if (geometry.morphAttributes.color !== undefined) morphTextureStride = 3;\n //\n let vertexShader, fragmentShader;\n let customVertexShaderID, customFragmentShaderID;\n if (shaderID) {\n const shader = $d5b33d7c30034067$export$bee4a7d47f8f5014[shaderID];\n vertexShader = shader.vertexShader;\n fragmentShader = shader.fragmentShader;\n } else {\n vertexShader = material.vertexShader;\n fragmentShader = material.fragmentShader;\n _customShaders.update(material);\n customVertexShaderID = _customShaders.getVertexShaderID(material);\n customFragmentShaderID = _customShaders.getFragmentShaderID(material);\n }\n const currentRenderTarget = renderer.getRenderTarget();\n const IS_INSTANCEDMESH = object.isInstancedMesh === true;\n const HAS_MAP = !!material.map;\n const HAS_MATCAP = !!material.matcap;\n const HAS_ENVMAP = !!envMap;\n const HAS_AOMAP = !!material.aoMap;\n const HAS_LIGHTMAP = !!material.lightMap;\n const HAS_BUMPMAP = !!material.bumpMap;\n const HAS_NORMALMAP = !!material.normalMap;\n const HAS_DISPLACEMENTMAP = !!material.displacementMap;\n const HAS_EMISSIVEMAP = !!material.emissiveMap;\n const HAS_METALNESSMAP = !!material.metalnessMap;\n const HAS_ROUGHNESSMAP = !!material.roughnessMap;\n const HAS_ANISOTROPY = material.anisotropy > 0;\n const HAS_CLEARCOAT = material.clearcoat > 0;\n const HAS_IRIDESCENCE = material.iridescence > 0;\n const HAS_SHEEN = material.sheen > 0;\n const HAS_TRANSMISSION = material.transmission > 0;\n const HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !!material.anisotropyMap;\n const HAS_CLEARCOATMAP = HAS_CLEARCOAT && !!material.clearcoatMap;\n const HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !!material.clearcoatNormalMap;\n const HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !!material.clearcoatRoughnessMap;\n const HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !!material.iridescenceMap;\n const HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !!material.iridescenceThicknessMap;\n const HAS_SHEEN_COLORMAP = HAS_SHEEN && !!material.sheenColorMap;\n const HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !!material.sheenRoughnessMap;\n const HAS_SPECULARMAP = !!material.specularMap;\n const HAS_SPECULAR_COLORMAP = !!material.specularColorMap;\n const HAS_SPECULAR_INTENSITYMAP = !!material.specularIntensityMap;\n const HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !!material.transmissionMap;\n const HAS_THICKNESSMAP = HAS_TRANSMISSION && !!material.thicknessMap;\n const HAS_GRADIENTMAP = !!material.gradientMap;\n const HAS_ALPHAMAP = !!material.alphaMap;\n const HAS_ALPHATEST = material.alphaTest > 0;\n const HAS_ALPHAHASH = !!material.alphaHash;\n const HAS_EXTENSIONS = !!material.extensions;\n const HAS_ATTRIBUTE_UV1 = !!geometry.attributes.uv1;\n const HAS_ATTRIBUTE_UV2 = !!geometry.attributes.uv2;\n const HAS_ATTRIBUTE_UV3 = !!geometry.attributes.uv3;\n let toneMapping = $d5b33d7c30034067$export$9fcb6b4294603b2;\n if (material.toneMapped) {\n if (currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true) toneMapping = renderer.toneMapping;\n }\n const parameters = {\n isWebGL2: IS_WEBGL2,\n shaderID: shaderID,\n shaderType: material.type,\n shaderName: material.name,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n defines: material.defines,\n customVertexShaderID: customVertexShaderID,\n customFragmentShaderID: customFragmentShaderID,\n isRawShaderMaterial: material.isRawShaderMaterial === true,\n glslVersion: material.glslVersion,\n precision: precision,\n instancing: IS_INSTANCEDMESH,\n instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : $d5b33d7c30034067$export$42429b3acfb233a4,\n map: HAS_MAP,\n matcap: HAS_MATCAP,\n envMap: HAS_ENVMAP,\n envMapMode: HAS_ENVMAP && envMap.mapping,\n envMapCubeUVHeight: envMapCubeUVHeight,\n aoMap: HAS_AOMAP,\n lightMap: HAS_LIGHTMAP,\n bumpMap: HAS_BUMPMAP,\n normalMap: HAS_NORMALMAP,\n displacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n emissiveMap: HAS_EMISSIVEMAP,\n normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === $d5b33d7c30034067$export$9990ad26f9db5b2c,\n normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === $d5b33d7c30034067$export$2852a58ebdac27b8,\n metalnessMap: HAS_METALNESSMAP,\n roughnessMap: HAS_ROUGHNESSMAP,\n anisotropy: HAS_ANISOTROPY,\n anisotropyMap: HAS_ANISOTROPYMAP,\n clearcoat: HAS_CLEARCOAT,\n clearcoatMap: HAS_CLEARCOATMAP,\n clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n iridescence: HAS_IRIDESCENCE,\n iridescenceMap: HAS_IRIDESCENCEMAP,\n iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n sheen: HAS_SHEEN,\n sheenColorMap: HAS_SHEEN_COLORMAP,\n sheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n specularMap: HAS_SPECULARMAP,\n specularColorMap: HAS_SPECULAR_COLORMAP,\n specularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n transmission: HAS_TRANSMISSION,\n transmissionMap: HAS_TRANSMISSIONMAP,\n thicknessMap: HAS_THICKNESSMAP,\n gradientMap: HAS_GRADIENTMAP,\n opaque: material.transparent === false && material.blending === $d5b33d7c30034067$export$5b29a26d96ee6af0,\n alphaMap: HAS_ALPHAMAP,\n alphaTest: HAS_ALPHATEST,\n alphaHash: HAS_ALPHAHASH,\n combine: material.combine,\n //\n mapUv: HAS_MAP && getChannel(material.map.channel),\n aoMapUv: HAS_AOMAP && getChannel(material.aoMap.channel),\n lightMapUv: HAS_LIGHTMAP && getChannel(material.lightMap.channel),\n bumpMapUv: HAS_BUMPMAP && getChannel(material.bumpMap.channel),\n normalMapUv: HAS_NORMALMAP && getChannel(material.normalMap.channel),\n displacementMapUv: HAS_DISPLACEMENTMAP && getChannel(material.displacementMap.channel),\n emissiveMapUv: HAS_EMISSIVEMAP && getChannel(material.emissiveMap.channel),\n metalnessMapUv: HAS_METALNESSMAP && getChannel(material.metalnessMap.channel),\n roughnessMapUv: HAS_ROUGHNESSMAP && getChannel(material.roughnessMap.channel),\n anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel(material.anisotropyMap.channel),\n clearcoatMapUv: HAS_CLEARCOATMAP && getChannel(material.clearcoatMap.channel),\n clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel(material.clearcoatNormalMap.channel),\n clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel(material.clearcoatRoughnessMap.channel),\n iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel(material.iridescenceMap.channel),\n iridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel(material.iridescenceThicknessMap.channel),\n sheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel(material.sheenColorMap.channel),\n sheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel(material.sheenRoughnessMap.channel),\n specularMapUv: HAS_SPECULARMAP && getChannel(material.specularMap.channel),\n specularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel(material.specularColorMap.channel),\n specularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel(material.specularIntensityMap.channel),\n transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel(material.transmissionMap.channel),\n thicknessMapUv: HAS_THICKNESSMAP && getChannel(material.thicknessMap.channel),\n alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),\n //\n vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),\n vertexColors: material.vertexColors,\n vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n vertexUv1s: HAS_ATTRIBUTE_UV1,\n vertexUv2s: HAS_ATTRIBUTE_UV2,\n vertexUv3s: HAS_ATTRIBUTE_UV3,\n pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),\n fog: !!fog,\n useFog: material.fog === true,\n fogExp2: fog && fog.isFogExp2,\n flatShading: material.flatShading === true,\n sizeAttenuation: material.sizeAttenuation === true,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n skinning: object.isSkinnedMesh === true,\n morphTargets: geometry.morphAttributes.position !== undefined,\n morphNormals: geometry.morphAttributes.normal !== undefined,\n morphColors: geometry.morphAttributes.color !== undefined,\n morphTargetsCount: morphTargetsCount,\n morphTextureStride: morphTextureStride,\n numDirLights: lights.directional.length,\n numPointLights: lights.point.length,\n numSpotLights: lights.spot.length,\n numSpotLightMaps: lights.spotLightMap.length,\n numRectAreaLights: lights.rectArea.length,\n numHemiLights: lights.hemi.length,\n numDirLightShadows: lights.directionalShadowMap.length,\n numPointLightShadows: lights.pointShadowMap.length,\n numSpotLightShadows: lights.spotShadowMap.length,\n numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n numClippingPlanes: clipping.numPlanes,\n numClipIntersection: clipping.numIntersection,\n dithering: material.dithering,\n shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n shadowMapType: renderer.shadowMap.type,\n toneMapping: toneMapping,\n useLegacyLights: renderer._useLegacyLights,\n premultipliedAlpha: material.premultipliedAlpha,\n doubleSided: material.side === $d5b33d7c30034067$export$3b296b6f144d5b03,\n flipSided: material.side === $d5b33d7c30034067$export$d9f0486e75b5ace,\n useDepthPacking: material.depthPacking >= 0,\n depthPacking: material.depthPacking || 0,\n index0AttributeName: material.index0AttributeName,\n extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n rendererExtensionFragDepth: IS_WEBGL2 || extensions.has(\"EXT_frag_depth\"),\n rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has(\"WEBGL_draw_buffers\"),\n rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has(\"EXT_shader_texture_lod\"),\n customProgramCacheKey: material.customProgramCacheKey()\n };\n return parameters;\n }\n function getProgramCacheKey(parameters) {\n const array = [];\n if (parameters.shaderID) array.push(parameters.shaderID);\n else {\n array.push(parameters.customVertexShaderID);\n array.push(parameters.customFragmentShaderID);\n }\n if (parameters.defines !== undefined) for(const name in parameters.defines){\n array.push(name);\n array.push(parameters.defines[name]);\n }\n if (parameters.isRawShaderMaterial === false) {\n getProgramCacheKeyParameters(array, parameters);\n getProgramCacheKeyBooleans(array, parameters);\n array.push(renderer.outputColorSpace);\n }\n array.push(parameters.customProgramCacheKey);\n return array.join();\n }\n function getProgramCacheKeyParameters(array, parameters) {\n array.push(parameters.precision);\n array.push(parameters.outputColorSpace);\n array.push(parameters.envMapMode);\n array.push(parameters.envMapCubeUVHeight);\n array.push(parameters.mapUv);\n array.push(parameters.alphaMapUv);\n array.push(parameters.lightMapUv);\n array.push(parameters.aoMapUv);\n array.push(parameters.bumpMapUv);\n array.push(parameters.normalMapUv);\n array.push(parameters.displacementMapUv);\n array.push(parameters.emissiveMapUv);\n array.push(parameters.metalnessMapUv);\n array.push(parameters.roughnessMapUv);\n array.push(parameters.anisotropyMapUv);\n array.push(parameters.clearcoatMapUv);\n array.push(parameters.clearcoatNormalMapUv);\n array.push(parameters.clearcoatRoughnessMapUv);\n array.push(parameters.iridescenceMapUv);\n array.push(parameters.iridescenceThicknessMapUv);\n array.push(parameters.sheenColorMapUv);\n array.push(parameters.sheenRoughnessMapUv);\n array.push(parameters.specularMapUv);\n array.push(parameters.specularColorMapUv);\n array.push(parameters.specularIntensityMapUv);\n array.push(parameters.transmissionMapUv);\n array.push(parameters.thicknessMapUv);\n array.push(parameters.combine);\n array.push(parameters.fogExp2);\n array.push(parameters.sizeAttenuation);\n array.push(parameters.morphTargetsCount);\n array.push(parameters.morphAttributeCount);\n array.push(parameters.numDirLights);\n array.push(parameters.numPointLights);\n array.push(parameters.numSpotLights);\n array.push(parameters.numSpotLightMaps);\n array.push(parameters.numHemiLights);\n array.push(parameters.numRectAreaLights);\n array.push(parameters.numDirLightShadows);\n array.push(parameters.numPointLightShadows);\n array.push(parameters.numSpotLightShadows);\n array.push(parameters.numSpotLightShadowsWithMaps);\n array.push(parameters.shadowMapType);\n array.push(parameters.toneMapping);\n array.push(parameters.numClippingPlanes);\n array.push(parameters.numClipIntersection);\n array.push(parameters.depthPacking);\n }\n function getProgramCacheKeyBooleans(array, parameters) {\n _programLayers.disableAll();\n if (parameters.isWebGL2) _programLayers.enable(0);\n if (parameters.supportsVertexTextures) _programLayers.enable(1);\n if (parameters.instancing) _programLayers.enable(2);\n if (parameters.instancingColor) _programLayers.enable(3);\n if (parameters.matcap) _programLayers.enable(4);\n if (parameters.envMap) _programLayers.enable(5);\n if (parameters.normalMapObjectSpace) _programLayers.enable(6);\n if (parameters.normalMapTangentSpace) _programLayers.enable(7);\n if (parameters.clearcoat) _programLayers.enable(8);\n if (parameters.iridescence) _programLayers.enable(9);\n if (parameters.alphaTest) _programLayers.enable(10);\n if (parameters.vertexColors) _programLayers.enable(11);\n if (parameters.vertexAlphas) _programLayers.enable(12);\n if (parameters.vertexUv1s) _programLayers.enable(13);\n if (parameters.vertexUv2s) _programLayers.enable(14);\n if (parameters.vertexUv3s) _programLayers.enable(15);\n if (parameters.vertexTangents) _programLayers.enable(16);\n if (parameters.anisotropy) _programLayers.enable(17);\n array.push(_programLayers.mask);\n _programLayers.disableAll();\n if (parameters.fog) _programLayers.enable(0);\n if (parameters.useFog) _programLayers.enable(1);\n if (parameters.flatShading) _programLayers.enable(2);\n if (parameters.logarithmicDepthBuffer) _programLayers.enable(3);\n if (parameters.skinning) _programLayers.enable(4);\n if (parameters.morphTargets) _programLayers.enable(5);\n if (parameters.morphNormals) _programLayers.enable(6);\n if (parameters.morphColors) _programLayers.enable(7);\n if (parameters.premultipliedAlpha) _programLayers.enable(8);\n if (parameters.shadowMapEnabled) _programLayers.enable(9);\n if (parameters.useLegacyLights) _programLayers.enable(10);\n if (parameters.doubleSided) _programLayers.enable(11);\n if (parameters.flipSided) _programLayers.enable(12);\n if (parameters.useDepthPacking) _programLayers.enable(13);\n if (parameters.dithering) _programLayers.enable(14);\n if (parameters.transmission) _programLayers.enable(15);\n if (parameters.sheen) _programLayers.enable(16);\n if (parameters.opaque) _programLayers.enable(17);\n if (parameters.pointsUvs) _programLayers.enable(18);\n array.push(_programLayers.mask);\n }\n function getUniforms(material) {\n const shaderID = shaderIDs[material.type];\n let uniforms;\n if (shaderID) {\n const shader = $d5b33d7c30034067$export$bee4a7d47f8f5014[shaderID];\n uniforms = $d5b33d7c30034067$export$d8ecdf8615bfea69.clone(shader.uniforms);\n } else uniforms = material.uniforms;\n return uniforms;\n }\n function acquireProgram(parameters, cacheKey) {\n let program;\n // Check if code has been already compiled\n for(let p = 0, pl = programs.length; p < pl; p++){\n const preexistingProgram = programs[p];\n if (preexistingProgram.cacheKey === cacheKey) {\n program = preexistingProgram;\n ++program.usedTimes;\n break;\n }\n }\n if (program === undefined) {\n program = new $d5b33d7c30034067$var$WebGLProgram(renderer, cacheKey, parameters, bindingStates);\n programs.push(program);\n }\n return program;\n }\n function releaseProgram(program) {\n if (--program.usedTimes === 0) {\n // Remove from unordered set\n const i = programs.indexOf(program);\n programs[i] = programs[programs.length - 1];\n programs.pop();\n // Free WebGL resources\n program.destroy();\n }\n }\n function releaseShaderCache(material) {\n _customShaders.remove(material);\n }\n function dispose() {\n _customShaders.dispose();\n }\n return {\n getParameters: getParameters,\n getProgramCacheKey: getProgramCacheKey,\n getUniforms: getUniforms,\n acquireProgram: acquireProgram,\n releaseProgram: releaseProgram,\n releaseShaderCache: releaseShaderCache,\n // Exposed for resource monitoring & error feedback via renderer.info:\n programs: programs,\n dispose: dispose\n };\n}\nfunction $d5b33d7c30034067$var$WebGLProperties() {\n let properties = new WeakMap();\n function get(object) {\n let map = properties.get(object);\n if (map === undefined) {\n map = {};\n properties.set(object, map);\n }\n return map;\n }\n function remove(object) {\n properties.delete(object);\n }\n function update(object, key, value) {\n properties.get(object)[key] = value;\n }\n function dispose() {\n properties = new WeakMap();\n }\n return {\n get: get,\n remove: remove,\n update: update,\n dispose: dispose\n };\n}\nfunction $d5b33d7c30034067$var$painterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) return a.groupOrder - b.groupOrder;\n else if (a.renderOrder !== b.renderOrder) return a.renderOrder - b.renderOrder;\n else if (a.material.id !== b.material.id) return a.material.id - b.material.id;\n else if (a.z !== b.z) return a.z - b.z;\n else return a.id - b.id;\n}\nfunction $d5b33d7c30034067$var$reversePainterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) return a.groupOrder - b.groupOrder;\n else if (a.renderOrder !== b.renderOrder) return a.renderOrder - b.renderOrder;\n else if (a.z !== b.z) return b.z - a.z;\n else return a.id - b.id;\n}\nfunction $d5b33d7c30034067$var$WebGLRenderList() {\n const renderItems = [];\n let renderItemsIndex = 0;\n const opaque = [];\n const transmissive = [];\n const transparent = [];\n function init() {\n renderItemsIndex = 0;\n opaque.length = 0;\n transmissive.length = 0;\n transparent.length = 0;\n }\n function getNextRenderItem(object, geometry, material, groupOrder, z, group) {\n let renderItem = renderItems[renderItemsIndex];\n if (renderItem === undefined) {\n renderItem = {\n id: object.id,\n object: object,\n geometry: geometry,\n material: material,\n groupOrder: groupOrder,\n renderOrder: object.renderOrder,\n z: z,\n group: group\n };\n renderItems[renderItemsIndex] = renderItem;\n } else {\n renderItem.id = object.id;\n renderItem.object = object;\n renderItem.geometry = geometry;\n renderItem.material = material;\n renderItem.groupOrder = groupOrder;\n renderItem.renderOrder = object.renderOrder;\n renderItem.z = z;\n renderItem.group = group;\n }\n renderItemsIndex++;\n return renderItem;\n }\n function push(object, geometry, material, groupOrder, z, group) {\n const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) transmissive.push(renderItem);\n else if (material.transparent === true) transparent.push(renderItem);\n else opaque.push(renderItem);\n }\n function unshift(object, geometry, material, groupOrder, z, group) {\n const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) transmissive.unshift(renderItem);\n else if (material.transparent === true) transparent.unshift(renderItem);\n else opaque.unshift(renderItem);\n }\n function sort(customOpaqueSort, customTransparentSort) {\n if (opaque.length > 1) opaque.sort(customOpaqueSort || $d5b33d7c30034067$var$painterSortStable);\n if (transmissive.length > 1) transmissive.sort(customTransparentSort || $d5b33d7c30034067$var$reversePainterSortStable);\n if (transparent.length > 1) transparent.sort(customTransparentSort || $d5b33d7c30034067$var$reversePainterSortStable);\n }\n function finish() {\n // Clear references from inactive renderItems in the list\n for(let i = renderItemsIndex, il = renderItems.length; i < il; i++){\n const renderItem = renderItems[i];\n if (renderItem.id === null) break;\n renderItem.id = null;\n renderItem.object = null;\n renderItem.geometry = null;\n renderItem.material = null;\n renderItem.group = null;\n }\n }\n return {\n opaque: opaque,\n transmissive: transmissive,\n transparent: transparent,\n init: init,\n push: push,\n unshift: unshift,\n finish: finish,\n sort: sort\n };\n}\nfunction $d5b33d7c30034067$var$WebGLRenderLists() {\n let lists = new WeakMap();\n function get(scene, renderCallDepth) {\n const listArray = lists.get(scene);\n let list;\n if (listArray === undefined) {\n list = new $d5b33d7c30034067$var$WebGLRenderList();\n lists.set(scene, [\n list\n ]);\n } else if (renderCallDepth >= listArray.length) {\n list = new $d5b33d7c30034067$var$WebGLRenderList();\n listArray.push(list);\n } else list = listArray[renderCallDepth];\n return list;\n }\n function dispose() {\n lists = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction $d5b33d7c30034067$var$UniformsCache() {\n const lights = {};\n return {\n get: function(light) {\n if (lights[light.id] !== undefined) return lights[light.id];\n let uniforms;\n switch(light.type){\n case \"DirectionalLight\":\n uniforms = {\n direction: new $d5b33d7c30034067$export$64b5c384219d3699(),\n color: new $d5b33d7c30034067$export$892596cec99bc70e()\n };\n break;\n case \"SpotLight\":\n uniforms = {\n position: new $d5b33d7c30034067$export$64b5c384219d3699(),\n direction: new $d5b33d7c30034067$export$64b5c384219d3699(),\n color: new $d5b33d7c30034067$export$892596cec99bc70e(),\n distance: 0,\n coneCos: 0,\n penumbraCos: 0,\n decay: 0\n };\n break;\n case \"PointLight\":\n uniforms = {\n position: new $d5b33d7c30034067$export$64b5c384219d3699(),\n color: new $d5b33d7c30034067$export$892596cec99bc70e(),\n distance: 0,\n decay: 0\n };\n break;\n case \"HemisphereLight\":\n uniforms = {\n direction: new $d5b33d7c30034067$export$64b5c384219d3699(),\n skyColor: new $d5b33d7c30034067$export$892596cec99bc70e(),\n groundColor: new $d5b33d7c30034067$export$892596cec99bc70e()\n };\n break;\n case \"RectAreaLight\":\n uniforms = {\n color: new $d5b33d7c30034067$export$892596cec99bc70e(),\n position: new $d5b33d7c30034067$export$64b5c384219d3699(),\n halfWidth: new $d5b33d7c30034067$export$64b5c384219d3699(),\n halfHeight: new $d5b33d7c30034067$export$64b5c384219d3699()\n };\n break;\n }\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nfunction $d5b33d7c30034067$var$ShadowUniformsCache() {\n const lights = {};\n return {\n get: function(light) {\n if (lights[light.id] !== undefined) return lights[light.id];\n let uniforms;\n switch(light.type){\n case \"DirectionalLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $d5b33d7c30034067$export$c977b3e384af9ae1()\n };\n break;\n case \"SpotLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $d5b33d7c30034067$export$c977b3e384af9ae1()\n };\n break;\n case \"PointLight\":\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new $d5b33d7c30034067$export$c977b3e384af9ae1(),\n shadowCameraNear: 1,\n shadowCameraFar: 1000\n };\n break;\n }\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nlet $d5b33d7c30034067$var$nextVersion = 0;\nfunction $d5b33d7c30034067$var$shadowCastingAndTexturingLightsFirst(lightA, lightB) {\n return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0);\n}\nfunction $d5b33d7c30034067$var$WebGLLights(extensions, capabilities) {\n const cache = new $d5b33d7c30034067$var$UniformsCache();\n const shadowCache = $d5b33d7c30034067$var$ShadowUniformsCache();\n const state = {\n version: 0,\n hash: {\n directionalLength: -1,\n pointLength: -1,\n spotLength: -1,\n rectAreaLength: -1,\n hemiLength: -1,\n numDirectionalShadows: -1,\n numPointShadows: -1,\n numSpotShadows: -1,\n numSpotMaps: -1\n },\n ambient: [\n 0,\n 0,\n 0\n ],\n probe: [],\n directional: [],\n directionalShadow: [],\n directionalShadowMap: [],\n directionalShadowMatrix: [],\n spot: [],\n spotLightMap: [],\n spotShadow: [],\n spotShadowMap: [],\n spotLightMatrix: [],\n rectArea: [],\n rectAreaLTC1: null,\n rectAreaLTC2: null,\n point: [],\n pointShadow: [],\n pointShadowMap: [],\n pointShadowMatrix: [],\n hemi: [],\n numSpotLightShadowsWithMaps: 0\n };\n for(let i = 0; i < 9; i++)state.probe.push(new $d5b33d7c30034067$export$64b5c384219d3699());\n const vector3 = new $d5b33d7c30034067$export$64b5c384219d3699();\n const matrix4 = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n const matrix42 = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n function setup(lights, useLegacyLights) {\n let r = 0, g = 0, b = 0;\n for(let i = 0; i < 9; i++)state.probe[i].set(0, 0, 0);\n let directionalLength = 0;\n let pointLength = 0;\n let spotLength = 0;\n let rectAreaLength = 0;\n let hemiLength = 0;\n let numDirectionalShadows = 0;\n let numPointShadows = 0;\n let numSpotShadows = 0;\n let numSpotMaps = 0;\n let numSpotShadowsWithMaps = 0;\n // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n lights.sort($d5b33d7c30034067$var$shadowCastingAndTexturingLightsFirst);\n // artist-friendly light intensity scaling factor\n const scaleFactor = useLegacyLights === true ? Math.PI : 1;\n for(let i = 0, l = lights.length; i < l; i++){\n const light = lights[i];\n const color = light.color;\n const intensity = light.intensity;\n const distance = light.distance;\n const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null;\n if (light.isAmbientLight) {\n r += color.r * intensity * scaleFactor;\n g += color.g * intensity * scaleFactor;\n b += color.b * intensity * scaleFactor;\n } else if (light.isLightProbe) for(let j = 0; j < 9; j++)state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);\n else if (light.isDirectionalLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n if (light.castShadow) {\n const shadow = light.shadow;\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n state.directionalShadow[directionalLength] = shadowUniforms;\n state.directionalShadowMap[directionalLength] = shadowMap;\n state.directionalShadowMatrix[directionalLength] = light.shadow.matrix;\n numDirectionalShadows++;\n }\n state.directional[directionalLength] = uniforms;\n directionalLength++;\n } else if (light.isSpotLight) {\n const uniforms = cache.get(light);\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor);\n uniforms.distance = distance;\n uniforms.coneCos = Math.cos(light.angle);\n uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));\n uniforms.decay = light.decay;\n state.spot[spotLength] = uniforms;\n const shadow = light.shadow;\n if (light.map) {\n state.spotLightMap[numSpotMaps] = light.map;\n numSpotMaps++;\n // make sure the lightMatrix is up to date\n // TODO : do it if required only\n shadow.updateMatrices(light);\n if (light.castShadow) numSpotShadowsWithMaps++;\n }\n state.spotLightMatrix[spotLength] = shadow.matrix;\n if (light.castShadow) {\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n state.spotShadow[spotLength] = shadowUniforms;\n state.spotShadowMap[spotLength] = shadowMap;\n numSpotShadows++;\n }\n spotLength++;\n } else if (light.isRectAreaLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(color).multiplyScalar(intensity);\n uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);\n state.rectArea[rectAreaLength] = uniforms;\n rectAreaLength++;\n } else if (light.isPointLight) {\n const uniforms = cache.get(light);\n uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n uniforms.distance = light.distance;\n uniforms.decay = light.decay;\n if (light.castShadow) {\n const shadow = light.shadow;\n const shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n shadowUniforms.shadowCameraNear = shadow.camera.near;\n shadowUniforms.shadowCameraFar = shadow.camera.far;\n state.pointShadow[pointLength] = shadowUniforms;\n state.pointShadowMap[pointLength] = shadowMap;\n state.pointShadowMatrix[pointLength] = light.shadow.matrix;\n numPointShadows++;\n }\n state.point[pointLength] = uniforms;\n pointLength++;\n } else if (light.isHemisphereLight) {\n const uniforms = cache.get(light);\n uniforms.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor);\n uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor);\n state.hemi[hemiLength] = uniforms;\n hemiLength++;\n }\n }\n if (rectAreaLength > 0) {\n if (capabilities.isWebGL2) {\n // WebGL 2\n state.rectAreaLTC1 = $d5b33d7c30034067$export$6643083551874bf5.LTC_FLOAT_1;\n state.rectAreaLTC2 = $d5b33d7c30034067$export$6643083551874bf5.LTC_FLOAT_2;\n } else {\n // WebGL 1\n if (extensions.has(\"OES_texture_float_linear\") === true) {\n state.rectAreaLTC1 = $d5b33d7c30034067$export$6643083551874bf5.LTC_FLOAT_1;\n state.rectAreaLTC2 = $d5b33d7c30034067$export$6643083551874bf5.LTC_FLOAT_2;\n } else if (extensions.has(\"OES_texture_half_float_linear\") === true) {\n state.rectAreaLTC1 = $d5b33d7c30034067$export$6643083551874bf5.LTC_HALF_1;\n state.rectAreaLTC2 = $d5b33d7c30034067$export$6643083551874bf5.LTC_HALF_2;\n } else console.error(\"THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.\");\n }\n }\n state.ambient[0] = r;\n state.ambient[1] = g;\n state.ambient[2] = b;\n const hash = state.hash;\n if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps) {\n state.directional.length = directionalLength;\n state.spot.length = spotLength;\n state.rectArea.length = rectAreaLength;\n state.point.length = pointLength;\n state.hemi.length = hemiLength;\n state.directionalShadow.length = numDirectionalShadows;\n state.directionalShadowMap.length = numDirectionalShadows;\n state.pointShadow.length = numPointShadows;\n state.pointShadowMap.length = numPointShadows;\n state.spotShadow.length = numSpotShadows;\n state.spotShadowMap.length = numSpotShadows;\n state.directionalShadowMatrix.length = numDirectionalShadows;\n state.pointShadowMatrix.length = numPointShadows;\n state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n state.spotLightMap.length = numSpotMaps;\n state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n hash.directionalLength = directionalLength;\n hash.pointLength = pointLength;\n hash.spotLength = spotLength;\n hash.rectAreaLength = rectAreaLength;\n hash.hemiLength = hemiLength;\n hash.numDirectionalShadows = numDirectionalShadows;\n hash.numPointShadows = numPointShadows;\n hash.numSpotShadows = numSpotShadows;\n hash.numSpotMaps = numSpotMaps;\n state.version = $d5b33d7c30034067$var$nextVersion++;\n }\n }\n function setupView(lights, camera) {\n let directionalLength = 0;\n let pointLength = 0;\n let spotLength = 0;\n let rectAreaLength = 0;\n let hemiLength = 0;\n const viewMatrix = camera.matrixWorldInverse;\n for(let i = 0, l = lights.length; i < l; i++){\n const light = lights[i];\n if (light.isDirectionalLight) {\n const uniforms = state.directional[directionalLength];\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n uniforms.direction.sub(vector3);\n uniforms.direction.transformDirection(viewMatrix);\n directionalLength++;\n } else if (light.isSpotLight) {\n const uniforms = state.spot[spotLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n uniforms.direction.sub(vector3);\n uniforms.direction.transformDirection(viewMatrix);\n spotLength++;\n } else if (light.isRectAreaLight) {\n const uniforms = state.rectArea[rectAreaLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n // extract local rotation of light to derive width/height half vectors\n matrix42.identity();\n matrix4.copy(light.matrixWorld);\n matrix4.premultiply(viewMatrix);\n matrix42.extractRotation(matrix4);\n uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);\n uniforms.halfWidth.applyMatrix4(matrix42);\n uniforms.halfHeight.applyMatrix4(matrix42);\n rectAreaLength++;\n } else if (light.isPointLight) {\n const uniforms = state.point[pointLength];\n uniforms.position.setFromMatrixPosition(light.matrixWorld);\n uniforms.position.applyMatrix4(viewMatrix);\n pointLength++;\n } else if (light.isHemisphereLight) {\n const uniforms = state.hemi[hemiLength];\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n uniforms.direction.transformDirection(viewMatrix);\n hemiLength++;\n }\n }\n }\n return {\n setup: setup,\n setupView: setupView,\n state: state\n };\n}\nfunction $d5b33d7c30034067$var$WebGLRenderState(extensions, capabilities) {\n const lights = new $d5b33d7c30034067$var$WebGLLights(extensions, capabilities);\n const lightsArray = [];\n const shadowsArray = [];\n function init() {\n lightsArray.length = 0;\n shadowsArray.length = 0;\n }\n function pushLight(light) {\n lightsArray.push(light);\n }\n function pushShadow(shadowLight) {\n shadowsArray.push(shadowLight);\n }\n function setupLights(useLegacyLights) {\n lights.setup(lightsArray, useLegacyLights);\n }\n function setupLightsView(camera) {\n lights.setupView(lightsArray, camera);\n }\n const state = {\n lightsArray: lightsArray,\n shadowsArray: shadowsArray,\n lights: lights\n };\n return {\n init: init,\n state: state,\n setupLights: setupLights,\n setupLightsView: setupLightsView,\n pushLight: pushLight,\n pushShadow: pushShadow\n };\n}\nfunction $d5b33d7c30034067$var$WebGLRenderStates(extensions, capabilities) {\n let renderStates = new WeakMap();\n function get(scene, renderCallDepth = 0) {\n const renderStateArray = renderStates.get(scene);\n let renderState;\n if (renderStateArray === undefined) {\n renderState = new $d5b33d7c30034067$var$WebGLRenderState(extensions, capabilities);\n renderStates.set(scene, [\n renderState\n ]);\n } else if (renderCallDepth >= renderStateArray.length) {\n renderState = new $d5b33d7c30034067$var$WebGLRenderState(extensions, capabilities);\n renderStateArray.push(renderState);\n } else renderState = renderStateArray[renderCallDepth];\n return renderState;\n }\n function dispose() {\n renderStates = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nclass $d5b33d7c30034067$export$2698c22ec13825db extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshDepthMaterial = true;\n this.type = \"MeshDepthMaterial\";\n this.depthPacking = $d5b33d7c30034067$export$deeb383078690b50;\n this.map = null;\n this.alphaMap = null;\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.depthPacking = source.depthPacking;\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$33e187ed002f2a19 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshDistanceMaterial = true;\n this.type = \"MeshDistanceMaterial\";\n this.map = null;\n this.alphaMap = null;\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n return this;\n }\n}\nconst $d5b33d7c30034067$var$vertex = \"void main() {\\n\tgl_Position = vec4( position, 1.0 );\\n}\";\nconst $d5b33d7c30034067$var$fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\tconst float samples = float( VSM_SAMPLES );\\n\tfloat mean = 0.0;\\n\tfloat squared_mean = 0.0;\\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\t\tfloat uvOffset = uvStart + i * uvStride;\\n\t\t#ifdef HORIZONTAL_PASS\\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\t\t\tmean += distribution.x;\\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\t\t#else\\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\t\t\tmean += depth;\\n\t\t\tsquared_mean += depth * depth;\\n\t\t#endif\\n\t}\\n\tmean = mean / samples;\\n\tsquared_mean = squared_mean / samples;\\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\nfunction $d5b33d7c30034067$var$WebGLShadowMap(_renderer, _objects, _capabilities) {\n let _frustum = new $d5b33d7c30034067$export$35efe6f4c85463d2();\n const _shadowMapSize = new $d5b33d7c30034067$export$c977b3e384af9ae1(), _viewportSize = new $d5b33d7c30034067$export$c977b3e384af9ae1(), _viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3(), _depthMaterial = new $d5b33d7c30034067$export$2698c22ec13825db({\n depthPacking: $d5b33d7c30034067$export$8f910f4c4f73df11\n }), _distanceMaterial = new $d5b33d7c30034067$export$33e187ed002f2a19(), _materialCache = {}, _maxTextureSize = _capabilities.maxTextureSize;\n const shadowSide = {\n [$d5b33d7c30034067$export$2ede184fc2998901]: $d5b33d7c30034067$export$d9f0486e75b5ace,\n [$d5b33d7c30034067$export$d9f0486e75b5ace]: $d5b33d7c30034067$export$2ede184fc2998901,\n [$d5b33d7c30034067$export$3b296b6f144d5b03]: $d5b33d7c30034067$export$3b296b6f144d5b03\n };\n const shadowMaterialVertical = new $d5b33d7c30034067$export$83c7d75d550a8b0d({\n defines: {\n VSM_SAMPLES: 8\n },\n uniforms: {\n shadow_pass: {\n value: null\n },\n resolution: {\n value: new $d5b33d7c30034067$export$c977b3e384af9ae1()\n },\n radius: {\n value: 4.0\n }\n },\n vertexShader: $d5b33d7c30034067$var$vertex,\n fragmentShader: $d5b33d7c30034067$var$fragment\n });\n const shadowMaterialHorizontal = shadowMaterialVertical.clone();\n shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n const fullScreenTri = new $d5b33d7c30034067$export$b7be63a67df8959();\n fullScreenTri.setAttribute(\"position\", new $d5b33d7c30034067$export$8dea267bd6bde117(new Float32Array([\n -1,\n -1,\n 0.5,\n 3,\n -1,\n 0.5,\n -1,\n 3,\n 0.5\n ]), 3));\n const fullScreenMesh = new $d5b33d7c30034067$export$e176487c05830cc5(fullScreenTri, shadowMaterialVertical);\n const scope = this;\n this.enabled = false;\n this.autoUpdate = true;\n this.needsUpdate = false;\n this.type = $d5b33d7c30034067$export$5813f879eee7cd88;\n let _previousType = this.type;\n this.render = function(lights, scene, camera) {\n if (scope.enabled === false) return;\n if (scope.autoUpdate === false && scope.needsUpdate === false) return;\n if (lights.length === 0) return;\n const currentRenderTarget = _renderer.getRenderTarget();\n const activeCubeFace = _renderer.getActiveCubeFace();\n const activeMipmapLevel = _renderer.getActiveMipmapLevel();\n const _state = _renderer.state;\n // Set GL state for depth map.\n _state.setBlending($d5b33d7c30034067$export$63b8d6b580fc65ba);\n _state.buffers.color.setClear(1, 1, 1, 1);\n _state.buffers.depth.setTest(true);\n _state.setScissorTest(false);\n // check for shadow map type changes\n const toVSM = _previousType !== $d5b33d7c30034067$export$896ae1ade6c829c4 && this.type === $d5b33d7c30034067$export$896ae1ade6c829c4;\n const fromVSM = _previousType === $d5b33d7c30034067$export$896ae1ade6c829c4 && this.type !== $d5b33d7c30034067$export$896ae1ade6c829c4;\n // render depth map\n for(let i = 0, il = lights.length; i < il; i++){\n const light = lights[i];\n const shadow = light.shadow;\n if (shadow === undefined) {\n console.warn(\"THREE.WebGLShadowMap:\", light, \"has no shadow.\");\n continue;\n }\n if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue;\n _shadowMapSize.copy(shadow.mapSize);\n const shadowFrameExtents = shadow.getFrameExtents();\n _shadowMapSize.multiply(shadowFrameExtents);\n _viewportSize.copy(shadow.mapSize);\n if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) {\n if (_shadowMapSize.x > _maxTextureSize) {\n _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x);\n _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n shadow.mapSize.x = _viewportSize.x;\n }\n if (_shadowMapSize.y > _maxTextureSize) {\n _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y);\n _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n shadow.mapSize.y = _viewportSize.y;\n }\n }\n if (shadow.map === null || toVSM === true || fromVSM === true) {\n const pars = this.type !== $d5b33d7c30034067$export$896ae1ade6c829c4 ? {\n minFilter: $d5b33d7c30034067$export$727aa5ec3fe39bf0,\n magFilter: $d5b33d7c30034067$export$727aa5ec3fe39bf0\n } : {};\n if (shadow.map !== null) shadow.map.dispose();\n shadow.map = new $d5b33d7c30034067$export$3c052beb2e51e23f(_shadowMapSize.x, _shadowMapSize.y, pars);\n shadow.map.texture.name = light.name + \".shadowMap\";\n shadow.camera.updateProjectionMatrix();\n }\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n const viewportCount = shadow.getViewportCount();\n for(let vp = 0; vp < viewportCount; vp++){\n const viewport = shadow.getViewport(vp);\n _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w);\n _state.viewport(_viewport);\n shadow.updateMatrices(light, vp);\n _frustum = shadow.getFrustum();\n renderObject(scene, camera, shadow.camera, light, this.type);\n }\n // do blur pass for VSM\n if (shadow.isPointLightShadow !== true && this.type === $d5b33d7c30034067$export$896ae1ade6c829c4) VSMPass(shadow, camera);\n shadow.needsUpdate = false;\n }\n _previousType = this.type;\n scope.needsUpdate = false;\n _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\n };\n function VSMPass(shadow, camera) {\n const geometry = _objects.update(fullScreenMesh);\n if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) {\n shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialVertical.needsUpdate = true;\n shadowMaterialHorizontal.needsUpdate = true;\n }\n if (shadow.mapPass === null) shadow.mapPass = new $d5b33d7c30034067$export$3c052beb2e51e23f(_shadowMapSize.x, _shadowMapSize.y);\n // vertical pass\n shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialVertical.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.mapPass);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null);\n // horizontal pass\n shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);\n }\n function getDepthMaterial(object, material, light, type) {\n let result = null;\n const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;\n if (customMaterial !== undefined) result = customMaterial;\n else {\n result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;\n if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {\n // in this case we need a unique material instance reflecting the\n // appropriate state\n const keyA = result.uuid, keyB = material.uuid;\n let materialsForVariant = _materialCache[keyA];\n if (materialsForVariant === undefined) {\n materialsForVariant = {};\n _materialCache[keyA] = materialsForVariant;\n }\n let cachedMaterial = materialsForVariant[keyB];\n if (cachedMaterial === undefined) {\n cachedMaterial = result.clone();\n materialsForVariant[keyB] = cachedMaterial;\n }\n result = cachedMaterial;\n }\n }\n result.visible = material.visible;\n result.wireframe = material.wireframe;\n if (type === $d5b33d7c30034067$export$896ae1ade6c829c4) result.side = material.shadowSide !== null ? material.shadowSide : material.side;\n else result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];\n result.alphaMap = material.alphaMap;\n result.alphaTest = material.alphaTest;\n result.map = material.map;\n result.clipShadows = material.clipShadows;\n result.clippingPlanes = material.clippingPlanes;\n result.clipIntersection = material.clipIntersection;\n result.displacementMap = material.displacementMap;\n result.displacementScale = material.displacementScale;\n result.displacementBias = material.displacementBias;\n result.wireframeLinewidth = material.wireframeLinewidth;\n result.linewidth = material.linewidth;\n if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {\n const materialProperties = _renderer.properties.get(result);\n materialProperties.light = light;\n }\n return result;\n }\n function renderObject(object, camera, shadowCamera, light, type) {\n if (object.visible === false) return;\n const visible = object.layers.test(camera.layers);\n if (visible && (object.isMesh || object.isLine || object.isPoints)) {\n if ((object.castShadow || object.receiveShadow && type === $d5b33d7c30034067$export$896ae1ade6c829c4) && (!object.frustumCulled || _frustum.intersectsObject(object))) {\n object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);\n const geometry = _objects.update(object);\n const material = object.material;\n if (Array.isArray(material)) {\n const groups = geometry.groups;\n for(let k = 0, kl = groups.length; k < kl; k++){\n const group = groups[k];\n const groupMaterial = material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) {\n const depthMaterial = getDepthMaterial(object, groupMaterial, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group);\n }\n }\n } else if (material.visible) {\n const depthMaterial = getDepthMaterial(object, material, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)renderObject(children[i], camera, shadowCamera, light, type);\n }\n}\nfunction $d5b33d7c30034067$var$WebGLState(gl, extensions, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n function ColorBuffer() {\n let locked = false;\n const color = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n let currentColorMask = null;\n const currentColorClear = new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, 0, 0);\n return {\n setMask: function(colorMask) {\n if (currentColorMask !== colorMask && !locked) {\n gl.colorMask(colorMask, colorMask, colorMask, colorMask);\n currentColorMask = colorMask;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(r, g, b, a, premultipliedAlpha) {\n if (premultipliedAlpha === true) {\n r *= a;\n g *= a;\n b *= a;\n }\n color.set(r, g, b, a);\n if (currentColorClear.equals(color) === false) {\n gl.clearColor(r, g, b, a);\n currentColorClear.copy(color);\n }\n },\n reset: function() {\n locked = false;\n currentColorMask = null;\n currentColorClear.set(-1, 0, 0, 0); // set to invalid state\n }\n };\n }\n function DepthBuffer() {\n let locked = false;\n let currentDepthMask = null;\n let currentDepthFunc = null;\n let currentDepthClear = null;\n return {\n setTest: function(depthTest) {\n if (depthTest) enable(gl.DEPTH_TEST);\n else disable(gl.DEPTH_TEST);\n },\n setMask: function(depthMask) {\n if (currentDepthMask !== depthMask && !locked) {\n gl.depthMask(depthMask);\n currentDepthMask = depthMask;\n }\n },\n setFunc: function(depthFunc) {\n if (currentDepthFunc !== depthFunc) {\n switch(depthFunc){\n case $d5b33d7c30034067$export$69025ce147cee220:\n gl.depthFunc(gl.NEVER);\n break;\n case $d5b33d7c30034067$export$7182eb52ea3b3f04:\n gl.depthFunc(gl.ALWAYS);\n break;\n case $d5b33d7c30034067$export$eedccec66ab7ebe:\n gl.depthFunc(gl.LESS);\n break;\n case $d5b33d7c30034067$export$296f78a0b892f81a:\n gl.depthFunc(gl.LEQUAL);\n break;\n case $d5b33d7c30034067$export$a60d398fc7b7590e:\n gl.depthFunc(gl.EQUAL);\n break;\n case $d5b33d7c30034067$export$7d7234c1240a1fc4:\n gl.depthFunc(gl.GEQUAL);\n break;\n case $d5b33d7c30034067$export$c5e2c52991f30937:\n gl.depthFunc(gl.GREATER);\n break;\n case $d5b33d7c30034067$export$2f843afa843d8916:\n gl.depthFunc(gl.NOTEQUAL);\n break;\n default:\n gl.depthFunc(gl.LEQUAL);\n }\n currentDepthFunc = depthFunc;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(depth) {\n if (currentDepthClear !== depth) {\n gl.clearDepth(depth);\n currentDepthClear = depth;\n }\n },\n reset: function() {\n locked = false;\n currentDepthMask = null;\n currentDepthFunc = null;\n currentDepthClear = null;\n }\n };\n }\n function StencilBuffer() {\n let locked = false;\n let currentStencilMask = null;\n let currentStencilFunc = null;\n let currentStencilRef = null;\n let currentStencilFuncMask = null;\n let currentStencilFail = null;\n let currentStencilZFail = null;\n let currentStencilZPass = null;\n let currentStencilClear = null;\n return {\n setTest: function(stencilTest) {\n if (!locked) {\n if (stencilTest) enable(gl.STENCIL_TEST);\n else disable(gl.STENCIL_TEST);\n }\n },\n setMask: function(stencilMask) {\n if (currentStencilMask !== stencilMask && !locked) {\n gl.stencilMask(stencilMask);\n currentStencilMask = stencilMask;\n }\n },\n setFunc: function(stencilFunc, stencilRef, stencilMask) {\n if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) {\n gl.stencilFunc(stencilFunc, stencilRef, stencilMask);\n currentStencilFunc = stencilFunc;\n currentStencilRef = stencilRef;\n currentStencilFuncMask = stencilMask;\n }\n },\n setOp: function(stencilFail, stencilZFail, stencilZPass) {\n if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) {\n gl.stencilOp(stencilFail, stencilZFail, stencilZPass);\n currentStencilFail = stencilFail;\n currentStencilZFail = stencilZFail;\n currentStencilZPass = stencilZPass;\n }\n },\n setLocked: function(lock) {\n locked = lock;\n },\n setClear: function(stencil) {\n if (currentStencilClear !== stencil) {\n gl.clearStencil(stencil);\n currentStencilClear = stencil;\n }\n },\n reset: function() {\n locked = false;\n currentStencilMask = null;\n currentStencilFunc = null;\n currentStencilRef = null;\n currentStencilFuncMask = null;\n currentStencilFail = null;\n currentStencilZFail = null;\n currentStencilZPass = null;\n currentStencilClear = null;\n }\n };\n }\n //\n const colorBuffer = new ColorBuffer();\n const depthBuffer = new DepthBuffer();\n const stencilBuffer = new StencilBuffer();\n const uboBindings = new WeakMap();\n const uboProgramMap = new WeakMap();\n let enabledCapabilities = {};\n let currentBoundFramebuffers = {};\n let currentDrawbuffers = new WeakMap();\n let defaultDrawbuffers = [];\n let currentProgram = null;\n let currentBlendingEnabled = false;\n let currentBlending = null;\n let currentBlendEquation = null;\n let currentBlendSrc = null;\n let currentBlendDst = null;\n let currentBlendEquationAlpha = null;\n let currentBlendSrcAlpha = null;\n let currentBlendDstAlpha = null;\n let currentPremultipledAlpha = false;\n let currentFlipSided = null;\n let currentCullFace = null;\n let currentLineWidth = null;\n let currentPolygonOffsetFactor = null;\n let currentPolygonOffsetUnits = null;\n const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\n let lineWidthAvailable = false;\n let version = 0;\n const glVersion = gl.getParameter(gl.VERSION);\n if (glVersion.indexOf(\"WebGL\") !== -1) {\n version = parseFloat(/^WebGL (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 1.0;\n } else if (glVersion.indexOf(\"OpenGL ES\") !== -1) {\n version = parseFloat(/^OpenGL ES (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 2.0;\n }\n let currentTextureSlot = null;\n let currentBoundTextures = {};\n const scissorParam = gl.getParameter(gl.SCISSOR_BOX);\n const viewportParam = gl.getParameter(gl.VIEWPORT);\n const currentScissor = new $d5b33d7c30034067$export$fa7daccca11cdbe3().fromArray(scissorParam);\n const currentViewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3().fromArray(viewportParam);\n function createTexture(type, target, count, dimensions) {\n const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4.\n const texture = gl.createTexture();\n gl.bindTexture(type, texture);\n gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n for(let i = 0; i < count; i++)if (isWebGL2 && (type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY)) gl.texImage3D(target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n else gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n return texture;\n }\n const emptyTextures = {};\n emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1);\n emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6);\n if (isWebGL2) {\n emptyTextures[gl.TEXTURE_2D_ARRAY] = createTexture(gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1);\n emptyTextures[gl.TEXTURE_3D] = createTexture(gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1);\n }\n // init\n colorBuffer.setClear(0, 0, 0, 1);\n depthBuffer.setClear(1);\n stencilBuffer.setClear(0);\n enable(gl.DEPTH_TEST);\n depthBuffer.setFunc($d5b33d7c30034067$export$296f78a0b892f81a);\n setFlipSided(false);\n setCullFace($d5b33d7c30034067$export$b9a7b4fc5cb15f9b);\n enable(gl.CULL_FACE);\n setBlending($d5b33d7c30034067$export$63b8d6b580fc65ba);\n //\n function enable(id) {\n if (enabledCapabilities[id] !== true) {\n gl.enable(id);\n enabledCapabilities[id] = true;\n }\n }\n function disable(id) {\n if (enabledCapabilities[id] !== false) {\n gl.disable(id);\n enabledCapabilities[id] = false;\n }\n }\n function bindFramebuffer(target, framebuffer) {\n if (currentBoundFramebuffers[target] !== framebuffer) {\n gl.bindFramebuffer(target, framebuffer);\n currentBoundFramebuffers[target] = framebuffer;\n if (isWebGL2) {\n // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n if (target === gl.DRAW_FRAMEBUFFER) currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer;\n if (target === gl.FRAMEBUFFER) currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer;\n }\n return true;\n }\n return false;\n }\n function drawBuffers(renderTarget, framebuffer) {\n let drawBuffers = defaultDrawbuffers;\n let needsUpdate = false;\n if (renderTarget) {\n drawBuffers = currentDrawbuffers.get(framebuffer);\n if (drawBuffers === undefined) {\n drawBuffers = [];\n currentDrawbuffers.set(framebuffer, drawBuffers);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) {\n const textures = renderTarget.texture;\n if (drawBuffers.length !== textures.length || drawBuffers[0] !== gl.COLOR_ATTACHMENT0) {\n for(let i = 0, il = textures.length; i < il; i++)drawBuffers[i] = gl.COLOR_ATTACHMENT0 + i;\n drawBuffers.length = textures.length;\n needsUpdate = true;\n }\n } else if (drawBuffers[0] !== gl.COLOR_ATTACHMENT0) {\n drawBuffers[0] = gl.COLOR_ATTACHMENT0;\n needsUpdate = true;\n }\n } else if (drawBuffers[0] !== gl.BACK) {\n drawBuffers[0] = gl.BACK;\n needsUpdate = true;\n }\n if (needsUpdate) {\n if (capabilities.isWebGL2) gl.drawBuffers(drawBuffers);\n else extensions.get(\"WEBGL_draw_buffers\").drawBuffersWEBGL(drawBuffers);\n }\n }\n function useProgram(program) {\n if (currentProgram !== program) {\n gl.useProgram(program);\n currentProgram = program;\n return true;\n }\n return false;\n }\n const equationToGL = {\n [$d5b33d7c30034067$export$20183a0484ce21a0]: gl.FUNC_ADD,\n [$d5b33d7c30034067$export$73e0df5177988548]: gl.FUNC_SUBTRACT,\n [$d5b33d7c30034067$export$28e582859cbec660]: gl.FUNC_REVERSE_SUBTRACT\n };\n if (isWebGL2) {\n equationToGL[$d5b33d7c30034067$export$c8c1508da8d0600c] = gl.MIN;\n equationToGL[$d5b33d7c30034067$export$99948c02fb51055f] = gl.MAX;\n } else {\n const extension = extensions.get(\"EXT_blend_minmax\");\n if (extension !== null) {\n equationToGL[$d5b33d7c30034067$export$c8c1508da8d0600c] = extension.MIN_EXT;\n equationToGL[$d5b33d7c30034067$export$99948c02fb51055f] = extension.MAX_EXT;\n }\n }\n const factorToGL = {\n [$d5b33d7c30034067$export$2110f05edf778d3d]: gl.ZERO,\n [$d5b33d7c30034067$export$8805bad65e24940e]: gl.ONE,\n [$d5b33d7c30034067$export$7fbe15b28d28cf52]: gl.SRC_COLOR,\n [$d5b33d7c30034067$export$d5773124e86cf28c]: gl.SRC_ALPHA,\n [$d5b33d7c30034067$export$c05e2a1fc8609506]: gl.SRC_ALPHA_SATURATE,\n [$d5b33d7c30034067$export$ef5f2dd8ffac5574]: gl.DST_COLOR,\n [$d5b33d7c30034067$export$a78aed1ca2a87192]: gl.DST_ALPHA,\n [$d5b33d7c30034067$export$947829af9f2c17f6]: gl.ONE_MINUS_SRC_COLOR,\n [$d5b33d7c30034067$export$11d468cc7f19e971]: gl.ONE_MINUS_SRC_ALPHA,\n [$d5b33d7c30034067$export$56b85b2686ab16]: gl.ONE_MINUS_DST_COLOR,\n [$d5b33d7c30034067$export$5d0fe17fd8773bac]: gl.ONE_MINUS_DST_ALPHA\n };\n function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {\n if (blending === $d5b33d7c30034067$export$63b8d6b580fc65ba) {\n if (currentBlendingEnabled === true) {\n disable(gl.BLEND);\n currentBlendingEnabled = false;\n }\n return;\n }\n if (currentBlendingEnabled === false) {\n enable(gl.BLEND);\n currentBlendingEnabled = true;\n }\n if (blending !== $d5b33d7c30034067$export$eda4864c68df1fa2) {\n if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) {\n if (currentBlendEquation !== $d5b33d7c30034067$export$20183a0484ce21a0 || currentBlendEquationAlpha !== $d5b33d7c30034067$export$20183a0484ce21a0) {\n gl.blendEquation(gl.FUNC_ADD);\n currentBlendEquation = $d5b33d7c30034067$export$20183a0484ce21a0;\n currentBlendEquationAlpha = $d5b33d7c30034067$export$20183a0484ce21a0;\n }\n if (premultipliedAlpha) switch(blending){\n case $d5b33d7c30034067$export$5b29a26d96ee6af0:\n gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case $d5b33d7c30034067$export$777d8f9551c2216b:\n gl.blendFunc(gl.ONE, gl.ONE);\n break;\n case $d5b33d7c30034067$export$cdfa06f868e2e467:\n gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);\n break;\n case $d5b33d7c30034067$export$4138e1c684b46a20:\n gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA);\n break;\n default:\n console.error(\"THREE.WebGLState: Invalid blending: \", blending);\n break;\n }\n else switch(blending){\n case $d5b33d7c30034067$export$5b29a26d96ee6af0:\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case $d5b33d7c30034067$export$777d8f9551c2216b:\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE);\n break;\n case $d5b33d7c30034067$export$cdfa06f868e2e467:\n gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);\n break;\n case $d5b33d7c30034067$export$4138e1c684b46a20:\n gl.blendFunc(gl.ZERO, gl.SRC_COLOR);\n break;\n default:\n console.error(\"THREE.WebGLState: Invalid blending: \", blending);\n break;\n }\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentBlending = blending;\n currentPremultipledAlpha = premultipliedAlpha;\n }\n return;\n }\n // custom blending\n blendEquationAlpha = blendEquationAlpha || blendEquation;\n blendSrcAlpha = blendSrcAlpha || blendSrc;\n blendDstAlpha = blendDstAlpha || blendDst;\n if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) {\n gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]);\n currentBlendEquation = blendEquation;\n currentBlendEquationAlpha = blendEquationAlpha;\n }\n if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) {\n gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]);\n currentBlendSrc = blendSrc;\n currentBlendDst = blendDst;\n currentBlendSrcAlpha = blendSrcAlpha;\n currentBlendDstAlpha = blendDstAlpha;\n }\n currentBlending = blending;\n currentPremultipledAlpha = false;\n }\n function setMaterial(material, frontFaceCW) {\n material.side === $d5b33d7c30034067$export$3b296b6f144d5b03 ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE);\n let flipSided = material.side === $d5b33d7c30034067$export$d9f0486e75b5ace;\n if (frontFaceCW) flipSided = !flipSided;\n setFlipSided(flipSided);\n material.blending === $d5b33d7c30034067$export$5b29a26d96ee6af0 && material.transparent === false ? setBlending($d5b33d7c30034067$export$63b8d6b580fc65ba) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);\n depthBuffer.setFunc(material.depthFunc);\n depthBuffer.setTest(material.depthTest);\n depthBuffer.setMask(material.depthWrite);\n colorBuffer.setMask(material.colorWrite);\n const stencilWrite = material.stencilWrite;\n stencilBuffer.setTest(stencilWrite);\n if (stencilWrite) {\n stencilBuffer.setMask(material.stencilWriteMask);\n stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);\n stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);\n }\n setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);\n material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE);\n }\n //\n function setFlipSided(flipSided) {\n if (currentFlipSided !== flipSided) {\n if (flipSided) gl.frontFace(gl.CW);\n else gl.frontFace(gl.CCW);\n currentFlipSided = flipSided;\n }\n }\n function setCullFace(cullFace) {\n if (cullFace !== $d5b33d7c30034067$export$3237e1f2c1ea1f44) {\n enable(gl.CULL_FACE);\n if (cullFace !== currentCullFace) {\n if (cullFace === $d5b33d7c30034067$export$b9a7b4fc5cb15f9b) gl.cullFace(gl.BACK);\n else if (cullFace === $d5b33d7c30034067$export$b8058bcc7037d3f3) gl.cullFace(gl.FRONT);\n else gl.cullFace(gl.FRONT_AND_BACK);\n }\n } else disable(gl.CULL_FACE);\n currentCullFace = cullFace;\n }\n function setLineWidth(width) {\n if (width !== currentLineWidth) {\n if (lineWidthAvailable) gl.lineWidth(width);\n currentLineWidth = width;\n }\n }\n function setPolygonOffset(polygonOffset, factor, units) {\n if (polygonOffset) {\n enable(gl.POLYGON_OFFSET_FILL);\n if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) {\n gl.polygonOffset(factor, units);\n currentPolygonOffsetFactor = factor;\n currentPolygonOffsetUnits = units;\n }\n } else disable(gl.POLYGON_OFFSET_FILL);\n }\n function setScissorTest(scissorTest) {\n if (scissorTest) enable(gl.SCISSOR_TEST);\n else disable(gl.SCISSOR_TEST);\n }\n // texture\n function activeTexture(webglSlot) {\n if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n }\n function bindTexture(webglType, webglTexture, webglSlot) {\n if (webglSlot === undefined) {\n if (currentTextureSlot === null) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n else webglSlot = currentTextureSlot;\n }\n let boundTexture = currentBoundTextures[webglSlot];\n if (boundTexture === undefined) {\n boundTexture = {\n type: undefined,\n texture: undefined\n };\n currentBoundTextures[webglSlot] = boundTexture;\n }\n if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);\n boundTexture.type = webglType;\n boundTexture.texture = webglTexture;\n }\n }\n function unbindTexture() {\n const boundTexture = currentBoundTextures[currentTextureSlot];\n if (boundTexture !== undefined && boundTexture.type !== undefined) {\n gl.bindTexture(boundTexture.type, null);\n boundTexture.type = undefined;\n boundTexture.texture = undefined;\n }\n }\n function compressedTexImage2D() {\n try {\n gl.compressedTexImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexImage3D() {\n try {\n gl.compressedTexImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texSubImage2D() {\n try {\n gl.texSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texSubImage3D() {\n try {\n gl.texSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexSubImage2D() {\n try {\n gl.compressedTexSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function compressedTexSubImage3D() {\n try {\n gl.compressedTexSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texStorage2D() {\n try {\n gl.texStorage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texStorage3D() {\n try {\n gl.texStorage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texImage2D() {\n try {\n gl.texImage2D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n function texImage3D() {\n try {\n gl.texImage3D.apply(gl, arguments);\n } catch (error) {\n console.error(\"THREE.WebGLState:\", error);\n }\n }\n //\n function scissor(scissor) {\n if (currentScissor.equals(scissor) === false) {\n gl.scissor(scissor.x, scissor.y, scissor.z, scissor.w);\n currentScissor.copy(scissor);\n }\n }\n function viewport(viewport) {\n if (currentViewport.equals(viewport) === false) {\n gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);\n currentViewport.copy(viewport);\n }\n }\n function updateUBOMapping(uniformsGroup, program) {\n let mapping = uboProgramMap.get(program);\n if (mapping === undefined) {\n mapping = new WeakMap();\n uboProgramMap.set(program, mapping);\n }\n let blockIndex = mapping.get(uniformsGroup);\n if (blockIndex === undefined) {\n blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name);\n mapping.set(uniformsGroup, blockIndex);\n }\n }\n function uniformBlockBinding(uniformsGroup, program) {\n const mapping = uboProgramMap.get(program);\n const blockIndex = mapping.get(uniformsGroup);\n if (uboBindings.get(program) !== blockIndex) {\n // bind shader specific block index to global block point\n gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex);\n uboBindings.set(program, blockIndex);\n }\n }\n //\n function reset() {\n // reset state\n gl.disable(gl.BLEND);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.POLYGON_OFFSET_FILL);\n gl.disable(gl.SCISSOR_TEST);\n gl.disable(gl.STENCIL_TEST);\n gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.ONE, gl.ZERO);\n gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO);\n gl.colorMask(true, true, true, true);\n gl.clearColor(0, 0, 0, 0);\n gl.depthMask(true);\n gl.depthFunc(gl.LESS);\n gl.clearDepth(1);\n gl.stencilMask(0xffffffff);\n gl.stencilFunc(gl.ALWAYS, 0, 0xffffffff);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n gl.clearStencil(0);\n gl.cullFace(gl.BACK);\n gl.frontFace(gl.CCW);\n gl.polygonOffset(0, 0);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n if (isWebGL2 === true) {\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);\n }\n gl.useProgram(null);\n gl.lineWidth(1);\n gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);\n gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\n // reset internals\n enabledCapabilities = {};\n currentTextureSlot = null;\n currentBoundTextures = {};\n currentBoundFramebuffers = {};\n currentDrawbuffers = new WeakMap();\n defaultDrawbuffers = [];\n currentProgram = null;\n currentBlendingEnabled = false;\n currentBlending = null;\n currentBlendEquation = null;\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendEquationAlpha = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentPremultipledAlpha = false;\n currentFlipSided = null;\n currentCullFace = null;\n currentLineWidth = null;\n currentPolygonOffsetFactor = null;\n currentPolygonOffsetUnits = null;\n currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height);\n currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height);\n colorBuffer.reset();\n depthBuffer.reset();\n stencilBuffer.reset();\n }\n return {\n buffers: {\n color: colorBuffer,\n depth: depthBuffer,\n stencil: stencilBuffer\n },\n enable: enable,\n disable: disable,\n bindFramebuffer: bindFramebuffer,\n drawBuffers: drawBuffers,\n useProgram: useProgram,\n setBlending: setBlending,\n setMaterial: setMaterial,\n setFlipSided: setFlipSided,\n setCullFace: setCullFace,\n setLineWidth: setLineWidth,\n setPolygonOffset: setPolygonOffset,\n setScissorTest: setScissorTest,\n activeTexture: activeTexture,\n bindTexture: bindTexture,\n unbindTexture: unbindTexture,\n compressedTexImage2D: compressedTexImage2D,\n compressedTexImage3D: compressedTexImage3D,\n texImage2D: texImage2D,\n texImage3D: texImage3D,\n updateUBOMapping: updateUBOMapping,\n uniformBlockBinding: uniformBlockBinding,\n texStorage2D: texStorage2D,\n texStorage3D: texStorage3D,\n texSubImage2D: texSubImage2D,\n texSubImage3D: texSubImage3D,\n compressedTexSubImage2D: compressedTexSubImage2D,\n compressedTexSubImage3D: compressedTexSubImage3D,\n scissor: scissor,\n viewport: viewport,\n reset: reset\n };\n}\nfunction $d5b33d7c30034067$var$WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) {\n const isWebGL2 = capabilities.isWebGL2;\n const maxTextures = capabilities.maxTextures;\n const maxCubemapSize = capabilities.maxCubemapSize;\n const maxTextureSize = capabilities.maxTextureSize;\n const maxSamples = capabilities.maxSamples;\n const multisampledRTTExt = extensions.has(\"WEBGL_multisampled_render_to_texture\") ? extensions.get(\"WEBGL_multisampled_render_to_texture\") : null;\n const supportsInvalidateFramebuffer = typeof navigator === \"undefined\" ? false : /OculusBrowser/g.test(navigator.userAgent);\n const _videoTextures = new WeakMap();\n let _canvas;\n const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n // also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n let useOffscreenCanvas = false;\n try {\n useOffscreenCanvas = typeof OffscreenCanvas !== \"undefined\" && new OffscreenCanvas(1, 1).getContext(\"2d\") !== null;\n } catch (err) {\n // Ignore any errors\n }\n function createCanvas(width, height) {\n // Use OffscreenCanvas when available. Specially needed in web workers\n return useOffscreenCanvas ? // eslint-disable-next-line compat/compat\n new OffscreenCanvas(width, height) : $d5b33d7c30034067$var$createElementNS(\"canvas\");\n }\n function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) {\n let scale = 1;\n // handle case if texture exceeds max size\n if (image.width > maxSize || image.height > maxSize) scale = maxSize / Math.max(image.width, image.height);\n // only perform resize if necessary\n if (scale < 1 || needsPowerOfTwo === true) {\n // only perform resize for certain image types\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) {\n const floor = needsPowerOfTwo ? $d5b33d7c30034067$var$floorPowerOfTwo : Math.floor;\n const width = floor(scale * image.width);\n const height = floor(scale * image.height);\n if (_canvas === undefined) _canvas = createCanvas(width, height);\n // cube textures can't reuse the same canvas\n const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas;\n canvas.width = width;\n canvas.height = height;\n const context = canvas.getContext(\"2d\");\n context.drawImage(image, 0, 0, width, height);\n console.warn(\"THREE.WebGLRenderer: Texture has been resized from (\" + image.width + \"x\" + image.height + \") to (\" + width + \"x\" + height + \").\");\n return canvas;\n } else {\n if (\"data\" in image) console.warn(\"THREE.WebGLRenderer: Image in DataTexture is too big (\" + image.width + \"x\" + image.height + \").\");\n return image;\n }\n }\n return image;\n }\n function isPowerOfTwo$1(image) {\n return $d5b33d7c30034067$var$isPowerOfTwo(image.width) && $d5b33d7c30034067$var$isPowerOfTwo(image.height);\n }\n function textureNeedsPowerOfTwo(texture) {\n if (isWebGL2) return false;\n return texture.wrapS !== $d5b33d7c30034067$export$9d9334239a5a5e06 || texture.wrapT !== $d5b33d7c30034067$export$9d9334239a5a5e06 || texture.minFilter !== $d5b33d7c30034067$export$727aa5ec3fe39bf0 && texture.minFilter !== $d5b33d7c30034067$export$8a72f490b25c56c8;\n }\n function textureNeedsGenerateMipmaps(texture, supportsMips) {\n return texture.generateMipmaps && supportsMips && texture.minFilter !== $d5b33d7c30034067$export$727aa5ec3fe39bf0 && texture.minFilter !== $d5b33d7c30034067$export$8a72f490b25c56c8;\n }\n function generateMipmap(target) {\n _gl.generateMipmap(target);\n }\n function getInternalFormat(internalFormatName, glFormat, glType, colorSpace1, forceLinearTransfer = false) {\n if (isWebGL2 === false) return glFormat;\n if (internalFormatName !== null) {\n if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName];\n console.warn(\"THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '\" + internalFormatName + \"'\");\n }\n let internalFormat = glFormat;\n if (glFormat === _gl.RED) {\n if (glType === _gl.FLOAT) internalFormat = _gl.R32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;\n }\n if (glFormat === _gl.RED_INTEGER) {\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;\n if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.R16UI;\n if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.R32UI;\n if (glType === _gl.BYTE) internalFormat = _gl.R8I;\n if (glType === _gl.SHORT) internalFormat = _gl.R16I;\n if (glType === _gl.INT) internalFormat = _gl.R32I;\n }\n if (glFormat === _gl.RG) {\n if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;\n }\n if (glFormat === _gl.RGBA) {\n if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;\n if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;\n if (glType === _gl.UNSIGNED_BYTE) internalFormat = colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa && forceLinearTransfer === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;\n if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;\n }\n if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) extensions.get(\"EXT_color_buffer_float\");\n return internalFormat;\n }\n function getMipLevels(texture, image, supportsMips) {\n if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== $d5b33d7c30034067$export$727aa5ec3fe39bf0 && texture.minFilter !== $d5b33d7c30034067$export$8a72f490b25c56c8) return Math.log2(Math.max(image.width, image.height)) + 1;\n else if (texture.mipmaps !== undefined && texture.mipmaps.length > 0) // user-defined mipmaps\n return texture.mipmaps.length;\n else if (texture.isCompressedTexture && Array.isArray(texture.image)) return image.mipmaps.length;\n else // texture without mipmaps (only base level)\n return 1;\n }\n // Fallback filters for non-power-of-2 textures\n function filterFallback(f) {\n if (f === $d5b33d7c30034067$export$727aa5ec3fe39bf0 || f === $d5b33d7c30034067$export$d129e38cf6feaa8c || f === $d5b33d7c30034067$export$d2327c1afe5bfdf2) return _gl.NEAREST;\n return _gl.LINEAR;\n }\n //\n function onTextureDispose(event) {\n const texture = event.target;\n texture.removeEventListener(\"dispose\", onTextureDispose);\n deallocateTexture(texture);\n if (texture.isVideoTexture) _videoTextures.delete(texture);\n }\n function onRenderTargetDispose(event) {\n const renderTarget = event.target;\n renderTarget.removeEventListener(\"dispose\", onRenderTargetDispose);\n deallocateRenderTarget(renderTarget);\n }\n //\n function deallocateTexture(texture) {\n const textureProperties = properties.get(texture);\n if (textureProperties.__webglInit === undefined) return;\n // check if it's necessary to remove the WebGLTexture object\n const source = texture.source;\n const webglTextures = _sources.get(source);\n if (webglTextures) {\n const webglTexture = webglTextures[textureProperties.__cacheKey];\n webglTexture.usedTimes--;\n // the WebGLTexture object is not used anymore, remove it\n if (webglTexture.usedTimes === 0) deleteTexture(texture);\n // remove the weak map entry if no WebGLTexture uses the source anymore\n if (Object.keys(webglTextures).length === 0) _sources.delete(source);\n }\n properties.remove(texture);\n }\n function deleteTexture(texture) {\n const textureProperties = properties.get(texture);\n _gl.deleteTexture(textureProperties.__webglTexture);\n const source = texture.source;\n const webglTextures = _sources.get(source);\n delete webglTextures[textureProperties.__cacheKey];\n info.memory.textures--;\n }\n function deallocateRenderTarget(renderTarget) {\n const texture = renderTarget.texture;\n const renderTargetProperties = properties.get(renderTarget);\n const textureProperties = properties.get(texture);\n if (textureProperties.__webglTexture !== undefined) {\n _gl.deleteTexture(textureProperties.__webglTexture);\n info.memory.textures--;\n }\n if (renderTarget.depthTexture) renderTarget.depthTexture.dispose();\n if (renderTarget.isWebGLCubeRenderTarget) for(let i = 0; i < 6; i++){\n if (Array.isArray(renderTargetProperties.__webglFramebuffer[i])) for(let level = 0; level < renderTargetProperties.__webglFramebuffer[i].length; level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i][level]);\n else _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);\n }\n else {\n if (Array.isArray(renderTargetProperties.__webglFramebuffer)) for(let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[level]);\n else _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);\n if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);\n if (renderTargetProperties.__webglColorRenderbuffer) {\n for(let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i++)if (renderTargetProperties.__webglColorRenderbuffer[i]) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i]);\n }\n if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) for(let i = 0, il = texture.length; i < il; i++){\n const attachmentProperties = properties.get(texture[i]);\n if (attachmentProperties.__webglTexture) {\n _gl.deleteTexture(attachmentProperties.__webglTexture);\n info.memory.textures--;\n }\n properties.remove(texture[i]);\n }\n properties.remove(texture);\n properties.remove(renderTarget);\n }\n //\n let textureUnits = 0;\n function resetTextureUnits() {\n textureUnits = 0;\n }\n function allocateTextureUnit() {\n const textureUnit = textureUnits;\n if (textureUnit >= maxTextures) console.warn(\"THREE.WebGLTextures: Trying to use \" + textureUnit + \" texture units while this GPU supports only \" + maxTextures);\n textureUnits += 1;\n return textureUnit;\n }\n function getTextureCacheKey(texture) {\n const array = [];\n array.push(texture.wrapS);\n array.push(texture.wrapT);\n array.push(texture.wrapR || 0);\n array.push(texture.magFilter);\n array.push(texture.minFilter);\n array.push(texture.anisotropy);\n array.push(texture.internalFormat);\n array.push(texture.format);\n array.push(texture.type);\n array.push(texture.generateMipmaps);\n array.push(texture.premultiplyAlpha);\n array.push(texture.flipY);\n array.push(texture.unpackAlignment);\n array.push(texture.colorSpace);\n return array.join();\n }\n //\n function setTexture2D(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.isVideoTexture) updateVideoTexture(texture);\n if (texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version) {\n const image = texture.image;\n if (image === null) console.warn(\"THREE.WebGLRenderer: Texture marked for update but no image data found.\");\n else if (image.complete === false) console.warn(\"THREE.WebGLRenderer: Texture marked for update but image is incomplete\");\n else {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n }\n state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTexture2DArray(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTexture3D(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n function setTextureCube(texture, slot) {\n const textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadCubeTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n }\n const wrappingToGL = {\n [$d5b33d7c30034067$export$533346c8e8dac0f5]: _gl.REPEAT,\n [$d5b33d7c30034067$export$9d9334239a5a5e06]: _gl.CLAMP_TO_EDGE,\n [$d5b33d7c30034067$export$c7e7c00b14f51a4f]: _gl.MIRRORED_REPEAT\n };\n const filterToGL = {\n [$d5b33d7c30034067$export$727aa5ec3fe39bf0]: _gl.NEAREST,\n [$d5b33d7c30034067$export$d129e38cf6feaa8c]: _gl.NEAREST_MIPMAP_NEAREST,\n [$d5b33d7c30034067$export$d2327c1afe5bfdf2]: _gl.NEAREST_MIPMAP_LINEAR,\n [$d5b33d7c30034067$export$8a72f490b25c56c8]: _gl.LINEAR,\n [$d5b33d7c30034067$export$19a719f377145a13]: _gl.LINEAR_MIPMAP_NEAREST,\n [$d5b33d7c30034067$export$5d8599b6a933fb1b]: _gl.LINEAR_MIPMAP_LINEAR\n };\n const compareToGL = {\n [$d5b33d7c30034067$export$d9e2d19a747baaab]: _gl.NEVER,\n [$d5b33d7c30034067$export$187b73a3e352c145]: _gl.ALWAYS,\n [$d5b33d7c30034067$export$36bcf49c713b3eb7]: _gl.LESS,\n [$d5b33d7c30034067$export$64eea11eb407ddf1]: _gl.LEQUAL,\n [$d5b33d7c30034067$export$66f28d946fc6a0d5]: _gl.EQUAL,\n [$d5b33d7c30034067$export$1cdcb70d53d65f61]: _gl.GEQUAL,\n [$d5b33d7c30034067$export$155af022118f3a38]: _gl.GREATER,\n [$d5b33d7c30034067$export$67ab95dde6bed156]: _gl.NOTEQUAL\n };\n function setTextureParameters(textureType, texture, supportsMips) {\n if (supportsMips) {\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]);\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]);\n if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]);\n _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]);\n _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]);\n } else {\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);\n _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);\n if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE);\n if (texture.wrapS !== $d5b33d7c30034067$export$9d9334239a5a5e06 || texture.wrapT !== $d5b33d7c30034067$export$9d9334239a5a5e06) console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.\");\n _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter));\n _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter));\n if (texture.minFilter !== $d5b33d7c30034067$export$727aa5ec3fe39bf0 && texture.minFilter !== $d5b33d7c30034067$export$8a72f490b25c56c8) console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.\");\n }\n if (texture.compareFunction) {\n _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE);\n _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[texture.compareFunction]);\n }\n if (extensions.has(\"EXT_texture_filter_anisotropic\") === true) {\n const extension = extensions.get(\"EXT_texture_filter_anisotropic\");\n if (texture.magFilter === $d5b33d7c30034067$export$727aa5ec3fe39bf0) return;\n if (texture.minFilter !== $d5b33d7c30034067$export$d2327c1afe5bfdf2 && texture.minFilter !== $d5b33d7c30034067$export$5d8599b6a933fb1b) return;\n if (texture.type === $d5b33d7c30034067$export$f6d331659b644596 && extensions.has(\"OES_texture_float_linear\") === false) return; // verify extension for WebGL 1 and WebGL 2\n if (isWebGL2 === false && texture.type === $d5b33d7c30034067$export$2697304443f382bc && extensions.has(\"OES_texture_half_float_linear\") === false) return; // verify extension for WebGL 1 only\n if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) {\n _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy()));\n properties.get(texture).__currentAnisotropy = texture.anisotropy;\n }\n }\n }\n function initTexture(textureProperties, texture) {\n let forceUpload = false;\n if (textureProperties.__webglInit === undefined) {\n textureProperties.__webglInit = true;\n texture.addEventListener(\"dispose\", onTextureDispose);\n }\n // create Source <-> WebGLTextures mapping if necessary\n const source = texture.source;\n let webglTextures = _sources.get(source);\n if (webglTextures === undefined) {\n webglTextures = {};\n _sources.set(source, webglTextures);\n }\n // check if there is already a WebGLTexture object for the given texture parameters\n const textureCacheKey = getTextureCacheKey(texture);\n if (textureCacheKey !== textureProperties.__cacheKey) {\n // if not, create a new instance of WebGLTexture\n if (webglTextures[textureCacheKey] === undefined) {\n // create new entry\n webglTextures[textureCacheKey] = {\n texture: _gl.createTexture(),\n usedTimes: 0\n };\n info.memory.textures++;\n // when a new instance of WebGLTexture was created, a texture upload is required\n // even if the image contents are identical\n forceUpload = true;\n }\n webglTextures[textureCacheKey].usedTimes++;\n // every time the texture cache key changes, it's necessary to check if an instance of\n // WebGLTexture can be deleted in order to avoid a memory leak.\n const webglTexture = webglTextures[textureProperties.__cacheKey];\n if (webglTexture !== undefined) {\n webglTextures[textureProperties.__cacheKey].usedTimes--;\n if (webglTexture.usedTimes === 0) deleteTexture(texture);\n }\n // store references to cache key and WebGLTexture object\n textureProperties.__cacheKey = textureCacheKey;\n textureProperties.__webglTexture = webglTextures[textureCacheKey].texture;\n }\n return forceUpload;\n }\n function uploadTexture(textureProperties, texture, slot) {\n let textureType = _gl.TEXTURE_2D;\n if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;\n if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;\n const forceUpload = initTexture(textureProperties, texture);\n const source = texture.source;\n state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n const sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(_gl.TEXTURE0 + slot);\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);\n _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);\n const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false;\n let image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);\n image = verifyColorSpace(texture, image);\n const supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace);\n let glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n setTextureParameters(textureType, texture, supportsMips);\n let mipmap;\n const mipmaps = texture.mipmaps;\n const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n const levels = getMipLevels(texture, image, supportsMips);\n if (texture.isDepthTexture) {\n // populate depth texture with dummy data\n glInternalFormat = _gl.DEPTH_COMPONENT;\n if (isWebGL2) {\n if (texture.type === $d5b33d7c30034067$export$f6d331659b644596) glInternalFormat = _gl.DEPTH_COMPONENT32F;\n else if (texture.type === $d5b33d7c30034067$export$c3c7fc4518ebba96) glInternalFormat = _gl.DEPTH_COMPONENT24;\n else if (texture.type === $d5b33d7c30034067$export$6c8ea339bfab1301) glInternalFormat = _gl.DEPTH24_STENCIL8;\n else glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n } else if (texture.type === $d5b33d7c30034067$export$f6d331659b644596) console.error(\"WebGLRenderer: Floating point depth texture requires WebGL2.\");\n // validation checks for WebGL 1\n if (texture.format === $d5b33d7c30034067$export$c1b6b5136be58045 && glInternalFormat === _gl.DEPTH_COMPONENT) // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n {\n if (texture.type !== $d5b33d7c30034067$export$c63dc51868b06a9d && texture.type !== $d5b33d7c30034067$export$c3c7fc4518ebba96) {\n console.warn(\"THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.\");\n texture.type = $d5b33d7c30034067$export$c3c7fc4518ebba96;\n glType = utils.convert(texture.type);\n }\n }\n if (texture.format === $d5b33d7c30034067$export$1e113ac2d0905829 && glInternalFormat === _gl.DEPTH_COMPONENT) {\n // Depth stencil textures need the DEPTH_STENCIL internal format\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n glInternalFormat = _gl.DEPTH_STENCIL;\n // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n if (texture.type !== $d5b33d7c30034067$export$6c8ea339bfab1301) {\n console.warn(\"THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.\");\n texture.type = $d5b33d7c30034067$export$6c8ea339bfab1301;\n glType = utils.convert(texture.type);\n }\n }\n //\n if (allocateMemory) {\n if (useTexStorage) state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height);\n else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);\n }\n } else if (texture.isDataTexture) {\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n texture.generateMipmaps = false;\n } else if (useTexStorage) {\n if (allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data);\n } else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data);\n } else if (texture.isCompressedTexture) {\n if (texture.isCompressedArrayTexture) {\n if (useTexStorage && allocateMemory) state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (texture.format !== $d5b33d7c30034067$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);\n else state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\");\n } else if (useTexStorage) state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);\n else state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);\n }\n } else {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (texture.format !== $d5b33d7c30034067$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n else state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\");\n } else if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n } else if (texture.isDataArrayTexture) {\n if (useTexStorage) {\n if (allocateMemory) state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth);\n state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n } else if (texture.isData3DTexture) {\n if (useTexStorage) {\n if (allocateMemory) state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth);\n state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n } else if (texture.isFramebufferTexture) {\n if (allocateMemory) {\n if (useTexStorage) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n else {\n let width = image.width, height = image.height;\n for(let i = 0; i < levels; i++){\n state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null);\n width >>= 1;\n height >>= 1;\n }\n }\n }\n } else {\n // regular Texture (image, video, canvas)\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n for(let i = 0, il = mipmaps.length; i < il; i++){\n mipmap = mipmaps[i];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap);\n else state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap);\n }\n texture.generateMipmaps = false;\n } else if (useTexStorage) {\n if (allocateMemory) state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height);\n state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image);\n } else state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image);\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(textureType);\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n function uploadCubeTexture(textureProperties, texture, slot) {\n if (texture.image.length !== 6) return;\n const forceUpload = initTexture(textureProperties, texture);\n const source = texture.source;\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);\n const sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(_gl.TEXTURE0 + slot);\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);\n _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);\n const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;\n const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;\n const cubeImage = [];\n for(let i = 0; i < 6; i++){\n if (!isCompressed && !isDataTexture) cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize);\n else cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];\n cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);\n }\n const image = cubeImage[0], supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n let levels = getMipLevels(texture, image, supportsMips);\n setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);\n let mipmaps;\n if (isCompressed) {\n if (useTexStorage && allocateMemory) state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height);\n for(let i = 0; i < 6; i++){\n mipmaps = cubeImage[i].mipmaps;\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n if (texture.format !== $d5b33d7c30034067$export$3f8bb04b555a363c) {\n if (glFormat !== null) {\n if (useTexStorage) state.compressedTexSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n else state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n } else console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()\");\n } else if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n } else {\n mipmaps = texture.mipmaps;\n if (useTexStorage && allocateMemory) {\n // TODO: Uniformly handle mipmap definitions\n // Normal textures and compressed cube textures define base level + mips with their mipmap array\n // Uncompressed cube textures use their mipmap array only for mips (no base level)\n if (mipmaps.length > 0) levels++;\n state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height);\n }\n for(let i = 0; i < 6; i++)if (isDataTexture) {\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[i].width, cubeImage[i].height, glFormat, glType, cubeImage[i].data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data);\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n const mipmapImage = mipmap.image[i].image;\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data);\n }\n } else {\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[i]);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]);\n for(let j = 0; j < mipmaps.length; j++){\n const mipmap = mipmaps[j];\n if (useTexStorage) state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]);\n else state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]);\n }\n }\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) // We assume images for cube map have the same size.\n generateMipmap(_gl.TEXTURE_CUBE_MAP);\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n // Render targets\n // Setup storage for target texture and bind it to correct framebuffer\n function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const renderTargetProperties = properties.get(renderTarget);\n if (!renderTargetProperties.__hasExternalTextures) {\n const width = Math.max(1, renderTarget.width >> level);\n const height = Math.max(1, renderTarget.height >> level);\n if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) state.texImage3D(textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null);\n else state.texImage2D(textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget));\n else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, level);\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n // Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) {\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer);\n if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) {\n let glInternalFormat = _gl.DEPTH_COMPONENT16;\n if (isMultisample || useMultisampledRTT(renderTarget)) {\n const depthTexture = renderTarget.depthTexture;\n if (depthTexture && depthTexture.isDepthTexture) {\n if (depthTexture.type === $d5b33d7c30034067$export$f6d331659b644596) glInternalFormat = _gl.DEPTH_COMPONENT32F;\n else if (depthTexture.type === $d5b33d7c30034067$export$c3c7fc4518ebba96) glInternalFormat = _gl.DEPTH_COMPONENT24;\n }\n const samples = getRenderTargetSamples(renderTarget);\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n } else _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);\n } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) {\n const samples = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);\n else if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);\n } else {\n const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [\n renderTarget.texture\n ];\n for(let i = 0; i < textures.length; i++){\n const texture = textures[i];\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);\n const samples = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else if (useMultisampledRTT(renderTarget)) multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n else _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);\n }\n }\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);\n }\n // Setup resources for a Depth Texture for a FBO (needs an extension)\n function setupDepthTexture(framebuffer, renderTarget) {\n const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget;\n if (isCube) throw new Error(\"Depth Texture with cube render targets is not supported\");\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) throw new Error(\"renderTarget.depthTexture must be an instance of THREE.DepthTexture\");\n // upload an empty depth texture with framebuffer size\n if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) {\n renderTarget.depthTexture.image.width = renderTarget.width;\n renderTarget.depthTexture.image.height = renderTarget.height;\n renderTarget.depthTexture.needsUpdate = true;\n }\n setTexture2D(renderTarget.depthTexture, 0);\n const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture;\n const samples = getRenderTargetSamples(renderTarget);\n if (renderTarget.depthTexture.format === $d5b33d7c30034067$export$c1b6b5136be58045) {\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples);\n else _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);\n } else if (renderTarget.depthTexture.format === $d5b33d7c30034067$export$1e113ac2d0905829) {\n if (useMultisampledRTT(renderTarget)) multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples);\n else _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);\n } else throw new Error(\"Unknown depthTexture format\");\n }\n // Setup GL resources for a non-texture depth buffer\n function setupDepthRenderbuffer(renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n const isCube = renderTarget.isWebGLCubeRenderTarget === true;\n if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) {\n if (isCube) throw new Error(\"target.depthTexture not supported in Cube render targets\");\n setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget);\n } else if (isCube) {\n renderTargetProperties.__webglDepthbuffer = [];\n for(let i = 0; i < 6; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]);\n renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false);\n }\n } else {\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n // rebind framebuffer with external textures\n function rebindTextures(renderTarget, colorTexture, depthTexture) {\n const renderTargetProperties = properties.get(renderTarget);\n if (colorTexture !== undefined) setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0);\n if (depthTexture !== undefined) setupDepthRenderbuffer(renderTarget);\n }\n // Set up GL resources for the render target\n function setupRenderTarget(renderTarget) {\n const texture = renderTarget.texture;\n const renderTargetProperties = properties.get(renderTarget);\n const textureProperties = properties.get(texture);\n renderTarget.addEventListener(\"dispose\", onRenderTargetDispose);\n if (renderTarget.isWebGLMultipleRenderTargets !== true) {\n if (textureProperties.__webglTexture === undefined) textureProperties.__webglTexture = _gl.createTexture();\n textureProperties.__version = texture.version;\n info.memory.textures++;\n }\n const isCube = renderTarget.isWebGLCubeRenderTarget === true;\n const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n // Setup framebuffer\n if (isCube) {\n renderTargetProperties.__webglFramebuffer = [];\n for(let i = 0; i < 6; i++)if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) {\n renderTargetProperties.__webglFramebuffer[i] = [];\n for(let level = 0; level < texture.mipmaps.length; level++)renderTargetProperties.__webglFramebuffer[i][level] = _gl.createFramebuffer();\n } else renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer();\n } else {\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) {\n renderTargetProperties.__webglFramebuffer = [];\n for(let level = 0; level < texture.mipmaps.length; level++)renderTargetProperties.__webglFramebuffer[level] = _gl.createFramebuffer();\n } else renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n if (isMultipleRenderTargets) {\n if (capabilities.drawBuffers) {\n const textures = renderTarget.texture;\n for(let i = 0, il = textures.length; i < il; i++){\n const attachmentProperties = properties.get(textures[i]);\n if (attachmentProperties.__webglTexture === undefined) {\n attachmentProperties.__webglTexture = _gl.createTexture();\n info.memory.textures++;\n }\n }\n } else console.warn(\"THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.\");\n }\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n const textures = isMultipleRenderTargets ? texture : [\n texture\n ];\n renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n renderTargetProperties.__webglColorRenderbuffer = [];\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n for(let i = 0; i < textures.length; i++){\n const texture = textures[i];\n renderTargetProperties.__webglColorRenderbuffer[i] = _gl.createRenderbuffer();\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n const glFormat = utils.convert(texture.format, texture.colorSpace);\n const glType = utils.convert(texture.type);\n const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true);\n const samples = getRenderTargetSamples(renderTarget);\n _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n }\n _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);\n if (renderTarget.depthBuffer) {\n renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true);\n }\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n }\n }\n // Setup color buffer\n if (isCube) {\n state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);\n setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);\n for(let i = 0; i < 6; i++){\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) for(let level = 0; level < texture.mipmaps.length; level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i][level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level);\n else setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0);\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(_gl.TEXTURE_CUBE_MAP);\n state.unbindTexture();\n } else if (isMultipleRenderTargets) {\n const textures = renderTarget.texture;\n for(let i = 0, il = textures.length; i < il; i++){\n const attachment = textures[i];\n const attachmentProperties = properties.get(attachment);\n state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture);\n setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips);\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0);\n if (textureNeedsGenerateMipmaps(attachment, supportsMips)) generateMipmap(_gl.TEXTURE_2D);\n }\n state.unbindTexture();\n } else {\n let glTextureType = _gl.TEXTURE_2D;\n if (renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget) {\n if (isWebGL2) glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n else console.error(\"THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.\");\n }\n state.bindTexture(glTextureType, textureProperties.__webglTexture);\n setTextureParameters(glTextureType, texture, supportsMips);\n if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) for(let level = 0; level < texture.mipmaps.length; level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level);\n else setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0);\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) generateMipmap(glTextureType);\n state.unbindTexture();\n }\n // Setup depth and stencil buffers\n if (renderTarget.depthBuffer) setupDepthRenderbuffer(renderTarget);\n }\n function updateRenderTargetMipmap(renderTarget) {\n const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [\n renderTarget.texture\n ];\n for(let i = 0, il = textures.length; i < il; i++){\n const texture = textures[i];\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n const webglTexture = properties.get(texture).__webglTexture;\n state.bindTexture(target, webglTexture);\n generateMipmap(target);\n state.unbindTexture();\n }\n }\n }\n function updateMultisampleRenderTarget(renderTarget) {\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [\n renderTarget.texture\n ];\n const width = renderTarget.width;\n const height = renderTarget.height;\n let mask = _gl.COLOR_BUFFER_BIT;\n const invalidationArray = [];\n const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n const renderTargetProperties = properties.get(renderTarget);\n const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n // If MRT we need to remove FBO attachments\n if (isMultipleRenderTargets) for(let i = 0; i < textures.length; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null);\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0);\n }\n state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n for(let i = 0; i < textures.length; i++){\n invalidationArray.push(_gl.COLOR_ATTACHMENT0 + i);\n if (renderTarget.depthBuffer) invalidationArray.push(depthStyle);\n const ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== undefined ? renderTargetProperties.__ignoreDepthValues : false;\n if (ignoreDepthValues === false) {\n if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT;\n if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT;\n }\n if (isMultipleRenderTargets) _gl.framebufferRenderbuffer(_gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n if (ignoreDepthValues === true) {\n _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, [\n depthStyle\n ]);\n _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [\n depthStyle\n ]);\n }\n if (isMultipleRenderTargets) {\n const webglTexture = properties.get(textures[i]).__webglTexture;\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0);\n }\n _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST);\n if (supportsInvalidateFramebuffer) _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArray);\n }\n state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null);\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, null);\n // If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n if (isMultipleRenderTargets) for(let i = 0; i < textures.length; i++){\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);\n const webglTexture = properties.get(textures[i]).__webglTexture;\n state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0);\n }\n state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);\n }\n }\n function getRenderTargetSamples(renderTarget) {\n return Math.min(maxSamples, renderTarget.samples);\n }\n function useMultisampledRTT(renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n return isWebGL2 && renderTarget.samples > 0 && extensions.has(\"WEBGL_multisampled_render_to_texture\") === true && renderTargetProperties.__useRenderToTexture !== false;\n }\n function updateVideoTexture(texture) {\n const frame = info.render.frame;\n // Check the last frame we updated the VideoTexture\n if (_videoTextures.get(texture) !== frame) {\n _videoTextures.set(texture, frame);\n texture.update();\n }\n }\n function verifyColorSpace(texture, image) {\n const colorSpace1 = texture.colorSpace;\n const format = texture.format;\n const type = texture.type;\n if (texture.isCompressedTexture === true || texture.format === $d5b33d7c30034067$export$ca1dce8b5e1de74d) return image;\n if (colorSpace1 !== $d5b33d7c30034067$export$42429b3acfb233a4 && colorSpace1 !== $d5b33d7c30034067$export$bfcb490c2dd3db51) {\n // sRGB\n if (colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa) {\n if (isWebGL2 === false) {\n // in WebGL 1, try to use EXT_sRGB extension and unsized formats\n if (extensions.has(\"EXT_sRGB\") === true && format === $d5b33d7c30034067$export$3f8bb04b555a363c) {\n texture.format = $d5b33d7c30034067$export$ca1dce8b5e1de74d;\n // it's not possible to generate mips in WebGL 1 with this extension\n texture.minFilter = $d5b33d7c30034067$export$8a72f490b25c56c8;\n texture.generateMipmaps = false;\n } else // slow fallback (CPU decode)\n image = $d5b33d7c30034067$export$698882cf06df44aa.sRGBToLinear(image);\n } else // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n if (format !== $d5b33d7c30034067$export$3f8bb04b555a363c || type !== $d5b33d7c30034067$export$2e8ce08d3f6f5e10) console.warn(\"THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.\");\n } else console.error(\"THREE.WebGLTextures: Unsupported texture color space:\", colorSpace1);\n }\n return image;\n }\n //\n this.allocateTextureUnit = allocateTextureUnit;\n this.resetTextureUnits = resetTextureUnits;\n this.setTexture2D = setTexture2D;\n this.setTexture2DArray = setTexture2DArray;\n this.setTexture3D = setTexture3D;\n this.setTextureCube = setTextureCube;\n this.rebindTextures = rebindTextures;\n this.setupRenderTarget = setupRenderTarget;\n this.updateRenderTargetMipmap = updateRenderTargetMipmap;\n this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n this.setupDepthRenderbuffer = setupDepthRenderbuffer;\n this.setupFrameBufferTexture = setupFrameBufferTexture;\n this.useMultisampledRTT = useMultisampledRTT;\n}\nfunction $d5b33d7c30034067$export$ddaebcad857649a8(gl, extensions, capabilities) {\n const isWebGL2 = capabilities.isWebGL2;\n function convert(p, colorSpace1 = $d5b33d7c30034067$export$bfcb490c2dd3db51) {\n let extension;\n if (p === $d5b33d7c30034067$export$2e8ce08d3f6f5e10) return gl.UNSIGNED_BYTE;\n if (p === $d5b33d7c30034067$export$b3969b01faf587f2) return gl.UNSIGNED_SHORT_4_4_4_4;\n if (p === $d5b33d7c30034067$export$18886f8ae33e90de) return gl.UNSIGNED_SHORT_5_5_5_1;\n if (p === $d5b33d7c30034067$export$545fce0311a9796a) return gl.BYTE;\n if (p === $d5b33d7c30034067$export$88572337f312435f) return gl.SHORT;\n if (p === $d5b33d7c30034067$export$c63dc51868b06a9d) return gl.UNSIGNED_SHORT;\n if (p === $d5b33d7c30034067$export$5c612977753abe2) return gl.INT;\n if (p === $d5b33d7c30034067$export$c3c7fc4518ebba96) return gl.UNSIGNED_INT;\n if (p === $d5b33d7c30034067$export$f6d331659b644596) return gl.FLOAT;\n if (p === $d5b33d7c30034067$export$2697304443f382bc) {\n if (isWebGL2) return gl.HALF_FLOAT;\n extension = extensions.get(\"OES_texture_half_float\");\n if (extension !== null) return extension.HALF_FLOAT_OES;\n else return null;\n }\n if (p === $d5b33d7c30034067$export$988473390501ed4b) return gl.ALPHA;\n if (p === $d5b33d7c30034067$export$3f8bb04b555a363c) return gl.RGBA;\n if (p === $d5b33d7c30034067$export$cc09ccbf6d1ed449) return gl.LUMINANCE;\n if (p === $d5b33d7c30034067$export$9053a81c4a69c289) return gl.LUMINANCE_ALPHA;\n if (p === $d5b33d7c30034067$export$c1b6b5136be58045) return gl.DEPTH_COMPONENT;\n if (p === $d5b33d7c30034067$export$1e113ac2d0905829) return gl.DEPTH_STENCIL;\n // WebGL 1 sRGB fallback\n if (p === $d5b33d7c30034067$export$ca1dce8b5e1de74d) {\n extension = extensions.get(\"EXT_sRGB\");\n if (extension !== null) return extension.SRGB_ALPHA_EXT;\n else return null;\n }\n // WebGL2 formats.\n if (p === $d5b33d7c30034067$export$4e041a7967d15c4b) return gl.RED;\n if (p === $d5b33d7c30034067$export$aa92e870a709d190) return gl.RED_INTEGER;\n if (p === $d5b33d7c30034067$export$6cdf0b461c7ce8a0) return gl.RG;\n if (p === $d5b33d7c30034067$export$1ba1c45f9f77d4d7) return gl.RG_INTEGER;\n if (p === $d5b33d7c30034067$export$c200e7d26f592f21) return gl.RGBA_INTEGER;\n // S3TC\n if (p === $d5b33d7c30034067$export$21d1799c6d552fc0 || p === $d5b33d7c30034067$export$afa304c3e981b668 || p === $d5b33d7c30034067$export$d2a1a68024a3e56c || p === $d5b33d7c30034067$export$9a79c424327dacf9) {\n if (colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa) {\n extension = extensions.get(\"WEBGL_compressed_texture_s3tc_srgb\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$21d1799c6d552fc0) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n if (p === $d5b33d7c30034067$export$afa304c3e981b668) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n if (p === $d5b33d7c30034067$export$d2a1a68024a3e56c) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n if (p === $d5b33d7c30034067$export$9a79c424327dacf9) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n } else return null;\n } else {\n extension = extensions.get(\"WEBGL_compressed_texture_s3tc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$21d1799c6d552fc0) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n if (p === $d5b33d7c30034067$export$afa304c3e981b668) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n if (p === $d5b33d7c30034067$export$d2a1a68024a3e56c) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n if (p === $d5b33d7c30034067$export$9a79c424327dacf9) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n } else return null;\n }\n }\n // PVRTC\n if (p === $d5b33d7c30034067$export$19ada9bbb1af3573 || p === $d5b33d7c30034067$export$d0f0355bb3d948e4 || p === $d5b33d7c30034067$export$b82296714358084c || p === $d5b33d7c30034067$export$b71692456c47b6c3) {\n extension = extensions.get(\"WEBGL_compressed_texture_pvrtc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$19ada9bbb1af3573) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n if (p === $d5b33d7c30034067$export$d0f0355bb3d948e4) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n if (p === $d5b33d7c30034067$export$b82296714358084c) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n if (p === $d5b33d7c30034067$export$b71692456c47b6c3) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n } else return null;\n }\n // ETC1\n if (p === $d5b33d7c30034067$export$6ab91af2d757aee7) {\n extension = extensions.get(\"WEBGL_compressed_texture_etc1\");\n if (extension !== null) return extension.COMPRESSED_RGB_ETC1_WEBGL;\n else return null;\n }\n // ETC2\n if (p === $d5b33d7c30034067$export$7800993ef8106a6a || p === $d5b33d7c30034067$export$23ed8300a860e7d8) {\n extension = extensions.get(\"WEBGL_compressed_texture_etc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$7800993ef8106a6a) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n if (p === $d5b33d7c30034067$export$23ed8300a860e7d8) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n } else return null;\n }\n // ASTC\n if (p === $d5b33d7c30034067$export$dc5570b4a2b92d48 || p === $d5b33d7c30034067$export$68880cd325f8b2fb || p === $d5b33d7c30034067$export$7d2c0be323373d95 || p === $d5b33d7c30034067$export$22b52da301fc3a3e || p === $d5b33d7c30034067$export$c009e2cb4a66485e || p === $d5b33d7c30034067$export$118fff5afa255b63 || p === $d5b33d7c30034067$export$120713c829ae0667 || p === $d5b33d7c30034067$export$c79eeabbf53313e9 || p === $d5b33d7c30034067$export$443cf6567cdd6424 || p === $d5b33d7c30034067$export$6573984fc9840780 || p === $d5b33d7c30034067$export$e7aee563f30091de || p === $d5b33d7c30034067$export$2eb8634622ddeab7 || p === $d5b33d7c30034067$export$202b1ce7b5d25742 || p === $d5b33d7c30034067$export$18ab77abd087e467) {\n extension = extensions.get(\"WEBGL_compressed_texture_astc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$dc5570b4a2b92d48) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n if (p === $d5b33d7c30034067$export$68880cd325f8b2fb) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n if (p === $d5b33d7c30034067$export$7d2c0be323373d95) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n if (p === $d5b33d7c30034067$export$22b52da301fc3a3e) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n if (p === $d5b33d7c30034067$export$c009e2cb4a66485e) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n if (p === $d5b33d7c30034067$export$118fff5afa255b63) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n if (p === $d5b33d7c30034067$export$120713c829ae0667) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n if (p === $d5b33d7c30034067$export$c79eeabbf53313e9) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n if (p === $d5b33d7c30034067$export$443cf6567cdd6424) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n if (p === $d5b33d7c30034067$export$6573984fc9840780) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n if (p === $d5b33d7c30034067$export$e7aee563f30091de) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n if (p === $d5b33d7c30034067$export$2eb8634622ddeab7) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n if (p === $d5b33d7c30034067$export$202b1ce7b5d25742) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n if (p === $d5b33d7c30034067$export$18ab77abd087e467) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n } else return null;\n }\n // BPTC\n if (p === $d5b33d7c30034067$export$ce40b115e188bc81) {\n extension = extensions.get(\"EXT_texture_compression_bptc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$ce40b115e188bc81) return colorSpace1 === $d5b33d7c30034067$export$561f394b24edfcaa ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n } else return null;\n }\n // RGTC\n if (p === $d5b33d7c30034067$export$b1688df4c4c21670 || p === $d5b33d7c30034067$export$fc15e5d8261eed58 || p === $d5b33d7c30034067$export$d220f6ade8463a0f || p === $d5b33d7c30034067$export$768646d09dc1b6ef) {\n extension = extensions.get(\"EXT_texture_compression_rgtc\");\n if (extension !== null) {\n if (p === $d5b33d7c30034067$export$ce40b115e188bc81) return extension.COMPRESSED_RED_RGTC1_EXT;\n if (p === $d5b33d7c30034067$export$fc15e5d8261eed58) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n if (p === $d5b33d7c30034067$export$d220f6ade8463a0f) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n if (p === $d5b33d7c30034067$export$768646d09dc1b6ef) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n } else return null;\n }\n //\n if (p === $d5b33d7c30034067$export$6c8ea339bfab1301) {\n if (isWebGL2) return gl.UNSIGNED_INT_24_8;\n extension = extensions.get(\"WEBGL_depth_texture\");\n if (extension !== null) return extension.UNSIGNED_INT_24_8_WEBGL;\n else return null;\n }\n // if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n return gl[p] !== undefined ? gl[p] : null;\n }\n return {\n convert: convert\n };\n}\nclass $d5b33d7c30034067$export$56b937d9e5581166 extends $d5b33d7c30034067$export$74e4ae24825f68d7 {\n constructor(array = []){\n super();\n this.isArrayCamera = true;\n this.cameras = array;\n }\n}\nclass $d5b33d7c30034067$export$eb2fcfdbd7ba97d4 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isGroup = true;\n this.type = \"Group\";\n }\n}\nconst $d5b33d7c30034067$var$_moveEvent = {\n type: \"move\"\n};\nclass $d5b33d7c30034067$var$WebXRController {\n constructor(){\n this._targetRay = null;\n this._grip = null;\n this._hand = null;\n }\n getHandSpace() {\n if (this._hand === null) {\n this._hand = new $d5b33d7c30034067$export$eb2fcfdbd7ba97d4();\n this._hand.matrixAutoUpdate = false;\n this._hand.visible = false;\n this._hand.joints = {};\n this._hand.inputState = {\n pinching: false\n };\n }\n return this._hand;\n }\n getTargetRaySpace() {\n if (this._targetRay === null) {\n this._targetRay = new $d5b33d7c30034067$export$eb2fcfdbd7ba97d4();\n this._targetRay.matrixAutoUpdate = false;\n this._targetRay.visible = false;\n this._targetRay.hasLinearVelocity = false;\n this._targetRay.linearVelocity = new $d5b33d7c30034067$export$64b5c384219d3699();\n this._targetRay.hasAngularVelocity = false;\n this._targetRay.angularVelocity = new $d5b33d7c30034067$export$64b5c384219d3699();\n }\n return this._targetRay;\n }\n getGripSpace() {\n if (this._grip === null) {\n this._grip = new $d5b33d7c30034067$export$eb2fcfdbd7ba97d4();\n this._grip.matrixAutoUpdate = false;\n this._grip.visible = false;\n this._grip.hasLinearVelocity = false;\n this._grip.linearVelocity = new $d5b33d7c30034067$export$64b5c384219d3699();\n this._grip.hasAngularVelocity = false;\n this._grip.angularVelocity = new $d5b33d7c30034067$export$64b5c384219d3699();\n }\n return this._grip;\n }\n dispatchEvent(event) {\n if (this._targetRay !== null) this._targetRay.dispatchEvent(event);\n if (this._grip !== null) this._grip.dispatchEvent(event);\n if (this._hand !== null) this._hand.dispatchEvent(event);\n return this;\n }\n connect(inputSource) {\n if (inputSource && inputSource.hand) {\n const hand = this._hand;\n if (hand) for (const inputjoint of inputSource.hand.values())// Initialize hand with joints when connected\n this._getHandJoint(hand, inputjoint);\n }\n this.dispatchEvent({\n type: \"connected\",\n data: inputSource\n });\n return this;\n }\n disconnect(inputSource) {\n this.dispatchEvent({\n type: \"disconnected\",\n data: inputSource\n });\n if (this._targetRay !== null) this._targetRay.visible = false;\n if (this._grip !== null) this._grip.visible = false;\n if (this._hand !== null) this._hand.visible = false;\n return this;\n }\n update(inputSource, frame, referenceSpace) {\n let inputPose = null;\n let gripPose = null;\n let handPose = null;\n const targetRay = this._targetRay;\n const grip = this._grip;\n const hand = this._hand;\n if (inputSource && frame.session.visibilityState !== \"visible-blurred\") {\n if (hand && inputSource.hand) {\n handPose = true;\n for (const inputjoint of inputSource.hand.values()){\n // Update the joints groups with the XRJoint poses\n const jointPose = frame.getJointPose(inputjoint, referenceSpace);\n // The transform of this joint will be updated with the joint pose on each frame\n const joint = this._getHandJoint(hand, inputjoint);\n if (jointPose !== null) {\n joint.matrix.fromArray(jointPose.transform.matrix);\n joint.matrix.decompose(joint.position, joint.rotation, joint.scale);\n joint.matrixWorldNeedsUpdate = true;\n joint.jointRadius = jointPose.radius;\n }\n joint.visible = jointPose !== null;\n }\n // Custom events\n // Check pinchz\n const indexTip = hand.joints[\"index-finger-tip\"];\n const thumbTip = hand.joints[\"thumb-tip\"];\n const distance = indexTip.position.distanceTo(thumbTip.position);\n const distanceToPinch = 0.02;\n const threshold = 0.005;\n if (hand.inputState.pinching && distance > distanceToPinch + threshold) {\n hand.inputState.pinching = false;\n this.dispatchEvent({\n type: \"pinchend\",\n handedness: inputSource.handedness,\n target: this\n });\n } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) {\n hand.inputState.pinching = true;\n this.dispatchEvent({\n type: \"pinchstart\",\n handedness: inputSource.handedness,\n target: this\n });\n }\n } else if (grip !== null && inputSource.gripSpace) {\n gripPose = frame.getPose(inputSource.gripSpace, referenceSpace);\n if (gripPose !== null) {\n grip.matrix.fromArray(gripPose.transform.matrix);\n grip.matrix.decompose(grip.position, grip.rotation, grip.scale);\n grip.matrixWorldNeedsUpdate = true;\n if (gripPose.linearVelocity) {\n grip.hasLinearVelocity = true;\n grip.linearVelocity.copy(gripPose.linearVelocity);\n } else grip.hasLinearVelocity = false;\n if (gripPose.angularVelocity) {\n grip.hasAngularVelocity = true;\n grip.angularVelocity.copy(gripPose.angularVelocity);\n } else grip.hasAngularVelocity = false;\n }\n }\n if (targetRay !== null) {\n inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);\n // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n if (inputPose === null && gripPose !== null) inputPose = gripPose;\n if (inputPose !== null) {\n targetRay.matrix.fromArray(inputPose.transform.matrix);\n targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);\n targetRay.matrixWorldNeedsUpdate = true;\n if (inputPose.linearVelocity) {\n targetRay.hasLinearVelocity = true;\n targetRay.linearVelocity.copy(inputPose.linearVelocity);\n } else targetRay.hasLinearVelocity = false;\n if (inputPose.angularVelocity) {\n targetRay.hasAngularVelocity = true;\n targetRay.angularVelocity.copy(inputPose.angularVelocity);\n } else targetRay.hasAngularVelocity = false;\n this.dispatchEvent($d5b33d7c30034067$var$_moveEvent);\n }\n }\n }\n if (targetRay !== null) targetRay.visible = inputPose !== null;\n if (grip !== null) grip.visible = gripPose !== null;\n if (hand !== null) hand.visible = handPose !== null;\n return this;\n }\n // private method\n _getHandJoint(hand, inputjoint) {\n if (hand.joints[inputjoint.jointName] === undefined) {\n const joint = new $d5b33d7c30034067$export$eb2fcfdbd7ba97d4();\n joint.matrixAutoUpdate = false;\n joint.visible = false;\n hand.joints[inputjoint.jointName] = joint;\n hand.add(joint);\n }\n return hand.joints[inputjoint.jointName];\n }\n}\nclass $d5b33d7c30034067$export$fc830aa069cc8c2f extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format){\n format = format !== undefined ? format : $d5b33d7c30034067$export$c1b6b5136be58045;\n if (format !== $d5b33d7c30034067$export$c1b6b5136be58045 && format !== $d5b33d7c30034067$export$1e113ac2d0905829) throw new Error(\"DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat\");\n if (type === undefined && format === $d5b33d7c30034067$export$c1b6b5136be58045) type = $d5b33d7c30034067$export$c3c7fc4518ebba96;\n if (type === undefined && format === $d5b33d7c30034067$export$1e113ac2d0905829) type = $d5b33d7c30034067$export$6c8ea339bfab1301;\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isDepthTexture = true;\n this.image = {\n width: width,\n height: height\n };\n this.magFilter = magFilter !== undefined ? magFilter : $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.minFilter = minFilter !== undefined ? minFilter : $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.flipY = false;\n this.generateMipmaps = false;\n this.compareFunction = null;\n }\n copy(source) {\n super.copy(source);\n this.compareFunction = source.compareFunction;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.compareFunction !== null) data.compareFunction = this.compareFunction;\n return data;\n }\n}\nclass $d5b33d7c30034067$var$WebXRManager extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(renderer, gl){\n super();\n const scope = this;\n let session = null;\n let framebufferScaleFactor = 1.0;\n let referenceSpace = null;\n let referenceSpaceType = \"local-floor\";\n // Set default foveation to maximum.\n let foveation = 1.0;\n let customReferenceSpace = null;\n let pose = null;\n let glBinding = null;\n let glProjLayer = null;\n let glBaseLayer = null;\n let xrFrame = null;\n const attributes = gl.getContextAttributes();\n let initialRenderTarget = null;\n let newRenderTarget = null;\n const controllers = [];\n const controllerInputSources = [];\n //\n const cameraL = new $d5b33d7c30034067$export$74e4ae24825f68d7();\n cameraL.layers.enable(1);\n cameraL.viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n const cameraR = new $d5b33d7c30034067$export$74e4ae24825f68d7();\n cameraR.layers.enable(2);\n cameraR.viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n const cameras = [\n cameraL,\n cameraR\n ];\n const cameraXR = new $d5b33d7c30034067$export$56b937d9e5581166();\n cameraXR.layers.enable(1);\n cameraXR.layers.enable(2);\n let _currentDepthNear = null;\n let _currentDepthFar = null;\n //\n this.cameraAutoUpdate = true;\n this.enabled = false;\n this.isPresenting = false;\n this.getController = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $d5b33d7c30034067$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getTargetRaySpace();\n };\n this.getControllerGrip = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $d5b33d7c30034067$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getGripSpace();\n };\n this.getHand = function(index) {\n let controller = controllers[index];\n if (controller === undefined) {\n controller = new $d5b33d7c30034067$var$WebXRController();\n controllers[index] = controller;\n }\n return controller.getHandSpace();\n };\n //\n function onSessionEvent(event) {\n const controllerIndex = controllerInputSources.indexOf(event.inputSource);\n if (controllerIndex === -1) return;\n const controller = controllers[controllerIndex];\n if (controller !== undefined) {\n controller.update(event.inputSource, event.frame, customReferenceSpace || referenceSpace);\n controller.dispatchEvent({\n type: event.type,\n data: event.inputSource\n });\n }\n }\n function onSessionEnd() {\n session.removeEventListener(\"select\", onSessionEvent);\n session.removeEventListener(\"selectstart\", onSessionEvent);\n session.removeEventListener(\"selectend\", onSessionEvent);\n session.removeEventListener(\"squeeze\", onSessionEvent);\n session.removeEventListener(\"squeezestart\", onSessionEvent);\n session.removeEventListener(\"squeezeend\", onSessionEvent);\n session.removeEventListener(\"end\", onSessionEnd);\n session.removeEventListener(\"inputsourceschange\", onInputSourcesChange);\n for(let i = 0; i < controllers.length; i++){\n const inputSource = controllerInputSources[i];\n if (inputSource === null) continue;\n controllerInputSources[i] = null;\n controllers[i].disconnect(inputSource);\n }\n _currentDepthNear = null;\n _currentDepthFar = null;\n // restore framebuffer/rendering state\n renderer.setRenderTarget(initialRenderTarget);\n glBaseLayer = null;\n glProjLayer = null;\n glBinding = null;\n session = null;\n newRenderTarget = null;\n //\n animation.stop();\n scope.isPresenting = false;\n scope.dispatchEvent({\n type: \"sessionend\"\n });\n }\n this.setFramebufferScaleFactor = function(value) {\n framebufferScaleFactor = value;\n if (scope.isPresenting === true) console.warn(\"THREE.WebXRManager: Cannot change framebuffer scale while presenting.\");\n };\n this.setReferenceSpaceType = function(value) {\n referenceSpaceType = value;\n if (scope.isPresenting === true) console.warn(\"THREE.WebXRManager: Cannot change reference space type while presenting.\");\n };\n this.getReferenceSpace = function() {\n return customReferenceSpace || referenceSpace;\n };\n this.setReferenceSpace = function(space) {\n customReferenceSpace = space;\n };\n this.getBaseLayer = function() {\n return glProjLayer !== null ? glProjLayer : glBaseLayer;\n };\n this.getBinding = function() {\n return glBinding;\n };\n this.getFrame = function() {\n return xrFrame;\n };\n this.getSession = function() {\n return session;\n };\n this.setSession = async function(value) {\n session = value;\n if (session !== null) {\n initialRenderTarget = renderer.getRenderTarget();\n session.addEventListener(\"select\", onSessionEvent);\n session.addEventListener(\"selectstart\", onSessionEvent);\n session.addEventListener(\"selectend\", onSessionEvent);\n session.addEventListener(\"squeeze\", onSessionEvent);\n session.addEventListener(\"squeezestart\", onSessionEvent);\n session.addEventListener(\"squeezeend\", onSessionEvent);\n session.addEventListener(\"end\", onSessionEnd);\n session.addEventListener(\"inputsourceschange\", onInputSourcesChange);\n if (attributes.xrCompatible !== true) await gl.makeXRCompatible();\n if (session.renderState.layers === undefined || renderer.capabilities.isWebGL2 === false) {\n const layerInit = {\n antialias: session.renderState.layers === undefined ? attributes.antialias : true,\n alpha: true,\n depth: attributes.depth,\n stencil: attributes.stencil,\n framebufferScaleFactor: framebufferScaleFactor\n };\n glBaseLayer = new XRWebGLLayer(session, gl, layerInit);\n session.updateRenderState({\n baseLayer: glBaseLayer\n });\n newRenderTarget = new $d5b33d7c30034067$export$3c052beb2e51e23f(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, {\n format: $d5b33d7c30034067$export$3f8bb04b555a363c,\n type: $d5b33d7c30034067$export$2e8ce08d3f6f5e10,\n colorSpace: renderer.outputColorSpace,\n stencilBuffer: attributes.stencil\n });\n } else {\n let depthFormat = null;\n let depthType = null;\n let glDepthFormat = null;\n if (attributes.depth) {\n glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n depthFormat = attributes.stencil ? $d5b33d7c30034067$export$1e113ac2d0905829 : $d5b33d7c30034067$export$c1b6b5136be58045;\n depthType = attributes.stencil ? $d5b33d7c30034067$export$6c8ea339bfab1301 : $d5b33d7c30034067$export$c3c7fc4518ebba96;\n }\n const projectionlayerInit = {\n colorFormat: gl.RGBA8,\n depthFormat: glDepthFormat,\n scaleFactor: framebufferScaleFactor\n };\n glBinding = new XRWebGLBinding(session, gl);\n glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);\n session.updateRenderState({\n layers: [\n glProjLayer\n ]\n });\n newRenderTarget = new $d5b33d7c30034067$export$3c052beb2e51e23f(glProjLayer.textureWidth, glProjLayer.textureHeight, {\n format: $d5b33d7c30034067$export$3f8bb04b555a363c,\n type: $d5b33d7c30034067$export$2e8ce08d3f6f5e10,\n depthTexture: new $d5b33d7c30034067$export$fc830aa069cc8c2f(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat),\n stencilBuffer: attributes.stencil,\n colorSpace: renderer.outputColorSpace,\n samples: attributes.antialias ? 4 : 0\n });\n const renderTargetProperties = renderer.properties.get(newRenderTarget);\n renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n }\n newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n this.setFoveation(foveation);\n customReferenceSpace = null;\n referenceSpace = await session.requestReferenceSpace(referenceSpaceType);\n animation.setContext(session);\n animation.start();\n scope.isPresenting = true;\n scope.dispatchEvent({\n type: \"sessionstart\"\n });\n }\n };\n this.getEnvironmentBlendMode = function() {\n if (session !== null) return session.environmentBlendMode;\n };\n function onInputSourcesChange(event) {\n // Notify disconnected\n for(let i = 0; i < event.removed.length; i++){\n const inputSource = event.removed[i];\n const index = controllerInputSources.indexOf(inputSource);\n if (index >= 0) {\n controllerInputSources[index] = null;\n controllers[index].disconnect(inputSource);\n }\n }\n // Notify connected\n for(let i = 0; i < event.added.length; i++){\n const inputSource = event.added[i];\n let controllerIndex = controllerInputSources.indexOf(inputSource);\n if (controllerIndex === -1) {\n // Assign input source a controller that currently has no input source\n for(let i = 0; i < controllers.length; i++){\n if (i >= controllerInputSources.length) {\n controllerInputSources.push(inputSource);\n controllerIndex = i;\n break;\n } else if (controllerInputSources[i] === null) {\n controllerInputSources[i] = inputSource;\n controllerIndex = i;\n break;\n }\n }\n // If all controllers do currently receive input we ignore new ones\n if (controllerIndex === -1) break;\n }\n const controller = controllers[controllerIndex];\n if (controller) controller.connect(inputSource);\n }\n }\n //\n const cameraLPos = new $d5b33d7c30034067$export$64b5c384219d3699();\n const cameraRPos = new $d5b33d7c30034067$export$64b5c384219d3699();\n /**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */ function setProjectionFromUnion(camera, cameraL, cameraR) {\n cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);\n cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);\n const ipd = cameraLPos.distanceTo(cameraRPos);\n const projL = cameraL.projectionMatrix.elements;\n const projR = cameraR.projectionMatrix.elements;\n // VR systems will have identical far and near planes, and\n // most likely identical top and bottom frustum extents.\n // Use the left camera for these values.\n const near = projL[14] / (projL[10] - 1);\n const far = projL[14] / (projL[10] + 1);\n const topFov = (projL[9] + 1) / projL[5];\n const bottomFov = (projL[9] - 1) / projL[5];\n const leftFov = (projL[8] - 1) / projL[0];\n const rightFov = (projR[8] + 1) / projR[0];\n const left = near * leftFov;\n const right = near * rightFov;\n // Calculate the new camera's position offset from the\n // left camera. xOffset should be roughly half `ipd`.\n const zOffset = ipd / (-leftFov + rightFov);\n const xOffset = zOffset * -leftFov;\n // TODO: Better way to apply this offset?\n cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);\n camera.translateX(xOffset);\n camera.translateZ(zOffset);\n camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n // Find the union of the frustum values of the cameras and scale\n // the values so that the near plane's position does not change in world space,\n // although must now be relative to the new union camera.\n const near2 = near + zOffset;\n const far2 = far + zOffset;\n const left2 = left - xOffset;\n const right2 = right + (ipd - xOffset);\n const top2 = topFov * far / far2 * near2;\n const bottom2 = bottomFov * far / far2 * near2;\n camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n }\n function updateCamera(camera, parent) {\n if (parent === null) camera.matrixWorld.copy(camera.matrix);\n else camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix);\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n }\n this.updateCamera = function(camera) {\n if (session === null) return;\n cameraXR.near = cameraR.near = cameraL.near = camera.near;\n cameraXR.far = cameraR.far = cameraL.far = camera.far;\n if (_currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far) {\n // Note that the new renderState won't apply until the next frame. See #18320\n session.updateRenderState({\n depthNear: cameraXR.near,\n depthFar: cameraXR.far\n });\n _currentDepthNear = cameraXR.near;\n _currentDepthFar = cameraXR.far;\n }\n const parent = camera.parent;\n const cameras = cameraXR.cameras;\n updateCamera(cameraXR, parent);\n for(let i = 0; i < cameras.length; i++)updateCamera(cameras[i], parent);\n // update projection matrix for proper view frustum culling\n if (cameras.length === 2) setProjectionFromUnion(cameraXR, cameraL, cameraR);\n else // assume single camera setup (AR)\n cameraXR.projectionMatrix.copy(cameraL.projectionMatrix);\n // update user camera and its children\n updateUserCamera(camera, cameraXR, parent);\n };\n function updateUserCamera(camera, cameraXR, parent) {\n if (parent === null) camera.matrix.copy(cameraXR.matrixWorld);\n else {\n camera.matrix.copy(parent.matrixWorld);\n camera.matrix.invert();\n camera.matrix.multiply(cameraXR.matrixWorld);\n }\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.updateMatrixWorld(true);\n const children = camera.children;\n for(let i = 0, l = children.length; i < l; i++)children[i].updateMatrixWorld(true);\n camera.projectionMatrix.copy(cameraXR.projectionMatrix);\n camera.projectionMatrixInverse.copy(cameraXR.projectionMatrixInverse);\n if (camera.isPerspectiveCamera) {\n camera.fov = $d5b33d7c30034067$var$RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);\n camera.zoom = 1;\n }\n }\n this.getCamera = function() {\n return cameraXR;\n };\n this.getFoveation = function() {\n if (glProjLayer === null && glBaseLayer === null) return undefined;\n return foveation;\n };\n this.setFoveation = function(value) {\n // 0 = no foveation = full resolution\n // 1 = maximum foveation = the edges render at lower resolution\n foveation = value;\n if (glProjLayer !== null) glProjLayer.fixedFoveation = value;\n if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) glBaseLayer.fixedFoveation = value;\n };\n // Animation Loop\n let onAnimationFrameCallback = null;\n function onAnimationFrame(time, frame) {\n pose = frame.getViewerPose(customReferenceSpace || referenceSpace);\n xrFrame = frame;\n if (pose !== null) {\n const views = pose.views;\n if (glBaseLayer !== null) {\n renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer);\n renderer.setRenderTarget(newRenderTarget);\n }\n let cameraXRNeedsUpdate = false;\n // check if it's necessary to rebuild cameraXR's camera list\n if (views.length !== cameraXR.cameras.length) {\n cameraXR.cameras.length = 0;\n cameraXRNeedsUpdate = true;\n }\n for(let i = 0; i < views.length; i++){\n const view = views[i];\n let viewport = null;\n if (glBaseLayer !== null) viewport = glBaseLayer.getViewport(view);\n else {\n const glSubImage = glBinding.getViewSubImage(glProjLayer, view);\n viewport = glSubImage.viewport;\n // For side-by-side projection, we only produce a single texture for both eyes.\n if (i === 0) {\n renderer.setRenderTargetTextures(newRenderTarget, glSubImage.colorTexture, glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture);\n renderer.setRenderTarget(newRenderTarget);\n }\n }\n let camera = cameras[i];\n if (camera === undefined) {\n camera = new $d5b33d7c30034067$export$74e4ae24825f68d7();\n camera.layers.enable(i);\n camera.viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n cameras[i] = camera;\n }\n camera.matrix.fromArray(view.transform.matrix);\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.projectionMatrix.fromArray(view.projectionMatrix);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);\n if (i === 0) {\n cameraXR.matrix.copy(camera.matrix);\n cameraXR.matrix.decompose(cameraXR.position, cameraXR.quaternion, cameraXR.scale);\n }\n if (cameraXRNeedsUpdate === true) cameraXR.cameras.push(camera);\n }\n }\n //\n for(let i = 0; i < controllers.length; i++){\n const inputSource = controllerInputSources[i];\n const controller = controllers[i];\n if (inputSource !== null && controller !== undefined) controller.update(inputSource, frame, customReferenceSpace || referenceSpace);\n }\n if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);\n if (frame.detectedPlanes) scope.dispatchEvent({\n type: \"planesdetected\",\n data: frame\n });\n xrFrame = null;\n }\n const animation = new $d5b33d7c30034067$var$WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n this.setAnimationLoop = function(callback) {\n onAnimationFrameCallback = callback;\n };\n this.dispose = function() {};\n }\n}\nfunction $d5b33d7c30034067$var$WebGLMaterials(renderer, properties) {\n function refreshTransformUniform(map, uniform) {\n if (map.matrixAutoUpdate === true) map.updateMatrix();\n uniform.value.copy(map.matrix);\n }\n function refreshFogUniforms(uniforms, fog) {\n fog.color.getRGB(uniforms.fogColor.value, $d5b33d7c30034067$var$getUnlitUniformColorSpace(renderer));\n if (fog.isFog) {\n uniforms.fogNear.value = fog.near;\n uniforms.fogFar.value = fog.far;\n } else if (fog.isFogExp2) uniforms.fogDensity.value = fog.density;\n }\n function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {\n if (material.isMeshBasicMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshLambertMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshToonMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsToon(uniforms, material);\n } else if (material.isMeshPhongMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsPhong(uniforms, material);\n } else if (material.isMeshStandardMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsStandard(uniforms, material);\n if (material.isMeshPhysicalMaterial) refreshUniformsPhysical(uniforms, material, transmissionRenderTarget);\n } else if (material.isMeshMatcapMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsMatcap(uniforms, material);\n } else if (material.isMeshDepthMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isMeshDistanceMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsDistance(uniforms, material);\n } else if (material.isMeshNormalMaterial) refreshUniformsCommon(uniforms, material);\n else if (material.isLineBasicMaterial) {\n refreshUniformsLine(uniforms, material);\n if (material.isLineDashedMaterial) refreshUniformsDash(uniforms, material);\n } else if (material.isPointsMaterial) refreshUniformsPoints(uniforms, material, pixelRatio, height);\n else if (material.isSpriteMaterial) refreshUniformsSprites(uniforms, material);\n else if (material.isShadowMaterial) {\n uniforms.color.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n } else if (material.isShaderMaterial) material.uniformsNeedUpdate = false; // #15581\n }\n function refreshUniformsCommon(uniforms, material) {\n uniforms.opacity.value = material.opacity;\n if (material.color) uniforms.diffuse.value.copy(material.color);\n if (material.emissive) uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.bumpMap) {\n uniforms.bumpMap.value = material.bumpMap;\n refreshTransformUniform(material.bumpMap, uniforms.bumpMapTransform);\n uniforms.bumpScale.value = material.bumpScale;\n if (material.side === $d5b33d7c30034067$export$d9f0486e75b5ace) uniforms.bumpScale.value *= -1;\n }\n if (material.normalMap) {\n uniforms.normalMap.value = material.normalMap;\n refreshTransformUniform(material.normalMap, uniforms.normalMapTransform);\n uniforms.normalScale.value.copy(material.normalScale);\n if (material.side === $d5b33d7c30034067$export$d9f0486e75b5ace) uniforms.normalScale.value.negate();\n }\n if (material.displacementMap) {\n uniforms.displacementMap.value = material.displacementMap;\n refreshTransformUniform(material.displacementMap, uniforms.displacementMapTransform);\n uniforms.displacementScale.value = material.displacementScale;\n uniforms.displacementBias.value = material.displacementBias;\n }\n if (material.emissiveMap) {\n uniforms.emissiveMap.value = material.emissiveMap;\n refreshTransformUniform(material.emissiveMap, uniforms.emissiveMapTransform);\n }\n if (material.specularMap) {\n uniforms.specularMap.value = material.specularMap;\n refreshTransformUniform(material.specularMap, uniforms.specularMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n const envMap = properties.get(material).envMap;\n if (envMap) {\n uniforms.envMap.value = envMap;\n uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n uniforms.reflectivity.value = material.reflectivity;\n uniforms.ior.value = material.ior;\n uniforms.refractionRatio.value = material.refractionRatio;\n }\n if (material.lightMap) {\n uniforms.lightMap.value = material.lightMap;\n // artist-friendly light intensity scaling factor\n const scaleFactor = renderer._useLegacyLights === true ? Math.PI : 1;\n uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n refreshTransformUniform(material.lightMap, uniforms.lightMapTransform);\n }\n if (material.aoMap) {\n uniforms.aoMap.value = material.aoMap;\n uniforms.aoMapIntensity.value = material.aoMapIntensity;\n refreshTransformUniform(material.aoMap, uniforms.aoMapTransform);\n }\n }\n function refreshUniformsLine(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n }\n function refreshUniformsDash(uniforms, material) {\n uniforms.dashSize.value = material.dashSize;\n uniforms.totalSize.value = material.dashSize + material.gapSize;\n uniforms.scale.value = material.scale;\n }\n function refreshUniformsPoints(uniforms, material, pixelRatio, height) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.size.value = material.size * pixelRatio;\n uniforms.scale.value = height * 0.5;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.uvTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n }\n function refreshUniformsSprites(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.rotation.value = material.rotation;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.alphaTest > 0) uniforms.alphaTest.value = material.alphaTest;\n }\n function refreshUniformsPhong(uniforms, material) {\n uniforms.specular.value.copy(material.specular);\n uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 )\n }\n function refreshUniformsToon(uniforms, material) {\n if (material.gradientMap) uniforms.gradientMap.value = material.gradientMap;\n }\n function refreshUniformsStandard(uniforms, material) {\n uniforms.metalness.value = material.metalness;\n if (material.metalnessMap) {\n uniforms.metalnessMap.value = material.metalnessMap;\n refreshTransformUniform(material.metalnessMap, uniforms.metalnessMapTransform);\n }\n uniforms.roughness.value = material.roughness;\n if (material.roughnessMap) {\n uniforms.roughnessMap.value = material.roughnessMap;\n refreshTransformUniform(material.roughnessMap, uniforms.roughnessMapTransform);\n }\n const envMap = properties.get(material).envMap;\n if (envMap) //uniforms.envMap.value = material.envMap; // part of uniforms common\n uniforms.envMapIntensity.value = material.envMapIntensity;\n }\n function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) {\n uniforms.ior.value = material.ior; // also part of uniforms common\n if (material.sheen > 0) {\n uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen);\n uniforms.sheenRoughness.value = material.sheenRoughness;\n if (material.sheenColorMap) {\n uniforms.sheenColorMap.value = material.sheenColorMap;\n refreshTransformUniform(material.sheenColorMap, uniforms.sheenColorMapTransform);\n }\n if (material.sheenRoughnessMap) {\n uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n refreshTransformUniform(material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform);\n }\n }\n if (material.clearcoat > 0) {\n uniforms.clearcoat.value = material.clearcoat;\n uniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n if (material.clearcoatMap) {\n uniforms.clearcoatMap.value = material.clearcoatMap;\n refreshTransformUniform(material.clearcoatMap, uniforms.clearcoatMapTransform);\n }\n if (material.clearcoatRoughnessMap) {\n uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n refreshTransformUniform(material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform);\n }\n if (material.clearcoatNormalMap) {\n uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n refreshTransformUniform(material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform);\n uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);\n if (material.side === $d5b33d7c30034067$export$d9f0486e75b5ace) uniforms.clearcoatNormalScale.value.negate();\n }\n }\n if (material.iridescence > 0) {\n uniforms.iridescence.value = material.iridescence;\n uniforms.iridescenceIOR.value = material.iridescenceIOR;\n uniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[0];\n uniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[1];\n if (material.iridescenceMap) {\n uniforms.iridescenceMap.value = material.iridescenceMap;\n refreshTransformUniform(material.iridescenceMap, uniforms.iridescenceMapTransform);\n }\n if (material.iridescenceThicknessMap) {\n uniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n refreshTransformUniform(material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform);\n }\n }\n if (material.transmission > 0) {\n uniforms.transmission.value = material.transmission;\n uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height);\n if (material.transmissionMap) {\n uniforms.transmissionMap.value = material.transmissionMap;\n refreshTransformUniform(material.transmissionMap, uniforms.transmissionMapTransform);\n }\n uniforms.thickness.value = material.thickness;\n if (material.thicknessMap) {\n uniforms.thicknessMap.value = material.thicknessMap;\n refreshTransformUniform(material.thicknessMap, uniforms.thicknessMapTransform);\n }\n uniforms.attenuationDistance.value = material.attenuationDistance;\n uniforms.attenuationColor.value.copy(material.attenuationColor);\n }\n if (material.anisotropy > 0) {\n uniforms.anisotropyVector.value.set(material.anisotropy * Math.cos(material.anisotropyRotation), material.anisotropy * Math.sin(material.anisotropyRotation));\n if (material.anisotropyMap) {\n uniforms.anisotropyMap.value = material.anisotropyMap;\n refreshTransformUniform(material.anisotropyMap, uniforms.anisotropyMapTransform);\n }\n }\n uniforms.specularIntensity.value = material.specularIntensity;\n uniforms.specularColor.value.copy(material.specularColor);\n if (material.specularColorMap) {\n uniforms.specularColorMap.value = material.specularColorMap;\n refreshTransformUniform(material.specularColorMap, uniforms.specularColorMapTransform);\n }\n if (material.specularIntensityMap) {\n uniforms.specularIntensityMap.value = material.specularIntensityMap;\n refreshTransformUniform(material.specularIntensityMap, uniforms.specularIntensityMapTransform);\n }\n }\n function refreshUniformsMatcap(uniforms, material) {\n if (material.matcap) uniforms.matcap.value = material.matcap;\n }\n function refreshUniformsDistance(uniforms, material) {\n const light = properties.get(material).light;\n uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld);\n uniforms.nearDistance.value = light.shadow.camera.near;\n uniforms.farDistance.value = light.shadow.camera.far;\n }\n return {\n refreshFogUniforms: refreshFogUniforms,\n refreshMaterialUniforms: refreshMaterialUniforms\n };\n}\nfunction $d5b33d7c30034067$var$WebGLUniformsGroups(gl, info, capabilities, state) {\n let buffers = {};\n let updateList = {};\n let allocatedBindingPoints = [];\n const maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0; // binding points are global whereas block indices are per shader program\n function bind(uniformsGroup, program) {\n const webglProgram = program.program;\n state.uniformBlockBinding(uniformsGroup, webglProgram);\n }\n function update(uniformsGroup, program) {\n let buffer = buffers[uniformsGroup.id];\n if (buffer === undefined) {\n prepareUniformsGroup(uniformsGroup);\n buffer = createBuffer(uniformsGroup);\n buffers[uniformsGroup.id] = buffer;\n uniformsGroup.addEventListener(\"dispose\", onUniformsGroupsDispose);\n }\n // ensure to update the binding points/block indices mapping for this program\n const webglProgram = program.program;\n state.updateUBOMapping(uniformsGroup, webglProgram);\n // update UBO once per frame\n const frame = info.render.frame;\n if (updateList[uniformsGroup.id] !== frame) {\n updateBufferData(uniformsGroup);\n updateList[uniformsGroup.id] = frame;\n }\n }\n function createBuffer(uniformsGroup) {\n // the setup of an UBO is independent of a particular shader program but global\n const bindingPointIndex = allocateBindingPointIndex();\n uniformsGroup.__bindingPointIndex = bindingPointIndex;\n const buffer = gl.createBuffer();\n const size = uniformsGroup.__size;\n const usage = uniformsGroup.usage;\n gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);\n gl.bufferData(gl.UNIFORM_BUFFER, size, usage);\n gl.bindBuffer(gl.UNIFORM_BUFFER, null);\n gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer);\n return buffer;\n }\n function allocateBindingPointIndex() {\n for(let i = 0; i < maxBindingPoints; i++)if (allocatedBindingPoints.indexOf(i) === -1) {\n allocatedBindingPoints.push(i);\n return i;\n }\n console.error(\"THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.\");\n return 0;\n }\n function updateBufferData(uniformsGroup) {\n const buffer = buffers[uniformsGroup.id];\n const uniforms = uniformsGroup.uniforms;\n const cache = uniformsGroup.__cache;\n gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);\n for(let i = 0, il = uniforms.length; i < il; i++){\n const uniform = uniforms[i];\n // partly update the buffer if necessary\n if (hasUniformChanged(uniform, i, cache) === true) {\n const offset = uniform.__offset;\n const values = Array.isArray(uniform.value) ? uniform.value : [\n uniform.value\n ];\n let arrayOffset = 0;\n for(let i = 0; i < values.length; i++){\n const value = values[i];\n const info = getUniformSize(value);\n if (typeof value === \"number\") {\n uniform.__data[0] = value;\n gl.bufferSubData(gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data);\n } else if (value.isMatrix3) {\n // manually converting 3x3 to 3x4\n uniform.__data[0] = value.elements[0];\n uniform.__data[1] = value.elements[1];\n uniform.__data[2] = value.elements[2];\n uniform.__data[3] = value.elements[0];\n uniform.__data[4] = value.elements[3];\n uniform.__data[5] = value.elements[4];\n uniform.__data[6] = value.elements[5];\n uniform.__data[7] = value.elements[0];\n uniform.__data[8] = value.elements[6];\n uniform.__data[9] = value.elements[7];\n uniform.__data[10] = value.elements[8];\n uniform.__data[11] = value.elements[0];\n } else {\n value.toArray(uniform.__data, arrayOffset);\n arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n }\n }\n gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);\n }\n }\n gl.bindBuffer(gl.UNIFORM_BUFFER, null);\n }\n function hasUniformChanged(uniform, index, cache) {\n const value = uniform.value;\n if (cache[index] === undefined) {\n // cache entry does not exist so far\n if (typeof value === \"number\") cache[index] = value;\n else {\n const values = Array.isArray(value) ? value : [\n value\n ];\n const tempValues = [];\n for(let i = 0; i < values.length; i++)tempValues.push(values[i].clone());\n cache[index] = tempValues;\n }\n return true;\n } else {\n // compare current value with cached entry\n if (typeof value === \"number\") {\n if (cache[index] !== value) {\n cache[index] = value;\n return true;\n }\n } else {\n const cachedObjects = Array.isArray(cache[index]) ? cache[index] : [\n cache[index]\n ];\n const values = Array.isArray(value) ? value : [\n value\n ];\n for(let i = 0; i < cachedObjects.length; i++){\n const cachedObject = cachedObjects[i];\n if (cachedObject.equals(values[i]) === false) {\n cachedObject.copy(values[i]);\n return true;\n }\n }\n }\n }\n return false;\n }\n function prepareUniformsGroup(uniformsGroup) {\n // determine total buffer size according to the STD140 layout\n // Hint: STD140 is the only supported layout in WebGL 2\n const uniforms = uniformsGroup.uniforms;\n let offset = 0; // global buffer offset in bytes\n const chunkSize = 16; // size of a chunk in bytes\n let chunkOffset = 0; // offset within a single chunk in bytes\n for(let i = 0, l = uniforms.length; i < l; i++){\n const uniform = uniforms[i];\n const infos = {\n boundary: 0,\n storage: 0 // bytes\n };\n const values = Array.isArray(uniform.value) ? uniform.value : [\n uniform.value\n ];\n for(let j = 0, jl = values.length; j < jl; j++){\n const value = values[j];\n const info = getUniformSize(value);\n infos.boundary += info.boundary;\n infos.storage += info.storage;\n }\n // the following two properties will be used for partial buffer updates\n uniform.__data = new Float32Array(infos.storage / Float32Array.BYTES_PER_ELEMENT);\n uniform.__offset = offset;\n //\n if (i > 0) {\n chunkOffset = offset % chunkSize;\n const remainingSizeInChunk = chunkSize - chunkOffset;\n // check for chunk overflow\n if (chunkOffset !== 0 && remainingSizeInChunk - infos.boundary < 0) {\n // add padding and adjust offset\n offset += chunkSize - chunkOffset;\n uniform.__offset = offset;\n }\n }\n offset += infos.storage;\n }\n // ensure correct final padding\n chunkOffset = offset % chunkSize;\n if (chunkOffset > 0) offset += chunkSize - chunkOffset;\n //\n uniformsGroup.__size = offset;\n uniformsGroup.__cache = {};\n return this;\n }\n function getUniformSize(value) {\n const info = {\n boundary: 0,\n storage: 0 // bytes\n };\n // determine sizes according to STD140\n if (typeof value === \"number\") {\n // float/int\n info.boundary = 4;\n info.storage = 4;\n } else if (value.isVector2) {\n // vec2\n info.boundary = 8;\n info.storage = 8;\n } else if (value.isVector3 || value.isColor) {\n // vec3\n info.boundary = 16;\n info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n } else if (value.isVector4) {\n // vec4\n info.boundary = 16;\n info.storage = 16;\n } else if (value.isMatrix3) {\n // mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n info.boundary = 48;\n info.storage = 48;\n } else if (value.isMatrix4) {\n // mat4\n info.boundary = 64;\n info.storage = 64;\n } else if (value.isTexture) console.warn(\"THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.\");\n else console.warn(\"THREE.WebGLRenderer: Unsupported uniform value type.\", value);\n return info;\n }\n function onUniformsGroupsDispose(event) {\n const uniformsGroup = event.target;\n uniformsGroup.removeEventListener(\"dispose\", onUniformsGroupsDispose);\n const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);\n allocatedBindingPoints.splice(index, 1);\n gl.deleteBuffer(buffers[uniformsGroup.id]);\n delete buffers[uniformsGroup.id];\n delete updateList[uniformsGroup.id];\n }\n function dispose() {\n for(const id in buffers)gl.deleteBuffer(buffers[id]);\n allocatedBindingPoints = [];\n buffers = {};\n updateList = {};\n }\n return {\n bind: bind,\n update: update,\n dispose: dispose\n };\n}\nfunction $d5b33d7c30034067$var$createCanvasElement() {\n const canvas = $d5b33d7c30034067$var$createElementNS(\"canvas\");\n canvas.style.display = \"block\";\n return canvas;\n}\nclass $d5b33d7c30034067$export$f6cc00ef28d7cf97 {\n constructor(parameters = {}){\n const { canvas: canvas = $d5b33d7c30034067$var$createCanvasElement(), context: context = null, depth: depth = true, stencil: stencil = true, alpha: alpha = false, antialias: antialias = false, premultipliedAlpha: premultipliedAlpha = true, preserveDrawingBuffer: preserveDrawingBuffer = false, powerPreference: powerPreference = \"default\", failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat = false } = parameters;\n this.isWebGLRenderer = true;\n let _alpha;\n if (context !== null) _alpha = context.getContextAttributes().alpha;\n else _alpha = alpha;\n const uintClearColor = new Uint32Array(4);\n const intClearColor = new Int32Array(4);\n let currentRenderList = null;\n let currentRenderState = null;\n // render() can be called from within a callback triggered by another render.\n // We track this so that the nested render call gets its list and state isolated from the parent render call.\n const renderListStack = [];\n const renderStateStack = [];\n // public properties\n this.domElement = canvas;\n // Debug configuration container\n this.debug = {\n /**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */ checkShaderErrors: true,\n /**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */ onShaderError: null\n };\n // clearing\n this.autoClear = true;\n this.autoClearColor = true;\n this.autoClearDepth = true;\n this.autoClearStencil = true;\n // scene graph\n this.sortObjects = true;\n // user-defined clipping\n this.clippingPlanes = [];\n this.localClippingEnabled = false;\n // physically based shading\n this.outputColorSpace = $d5b33d7c30034067$export$561f394b24edfcaa;\n // physical lights\n this._useLegacyLights = false;\n // tone mapping\n this.toneMapping = $d5b33d7c30034067$export$9fcb6b4294603b2;\n this.toneMappingExposure = 1.0;\n // internal properties\n const _this = this;\n let _isContextLost = false;\n // internal state cache\n let _currentActiveCubeFace = 0;\n let _currentActiveMipmapLevel = 0;\n let _currentRenderTarget = null;\n let _currentMaterialId = -1;\n let _currentCamera = null;\n const _currentViewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n const _currentScissor = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n let _currentScissorTest = null;\n const _currentClearColor = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n let _currentClearAlpha = 0;\n //\n let _width = canvas.width;\n let _height = canvas.height;\n let _pixelRatio = 1;\n let _opaqueSort = null;\n let _transparentSort = null;\n const _viewport = new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, _width, _height);\n const _scissor = new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, _width, _height);\n let _scissorTest = false;\n // frustum\n const _frustum = new $d5b33d7c30034067$export$35efe6f4c85463d2();\n // clipping\n let _clippingEnabled = false;\n let _localClippingEnabled = false;\n // transmission\n let _transmissionRenderTarget = null;\n // camera matrices cache\n const _projScreenMatrix = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n const _vector2 = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const _vector3 = new $d5b33d7c30034067$export$64b5c384219d3699();\n const _emptyScene = {\n background: null,\n fog: null,\n environment: null,\n overrideMaterial: null,\n isScene: true\n };\n function getTargetPixelRatio() {\n return _currentRenderTarget === null ? _pixelRatio : 1;\n }\n // initialize\n let _gl = context;\n function getContext(contextNames, contextAttributes) {\n for(let i = 0; i < contextNames.length; i++){\n const contextName = contextNames[i];\n const context = canvas.getContext(contextName, contextAttributes);\n if (context !== null) return context;\n }\n return null;\n }\n try {\n const contextAttributes = {\n alpha: true,\n depth: depth,\n stencil: stencil,\n antialias: antialias,\n premultipliedAlpha: premultipliedAlpha,\n preserveDrawingBuffer: preserveDrawingBuffer,\n powerPreference: powerPreference,\n failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat\n };\n // OffscreenCanvas does not have setAttribute, see #22811\n if (\"setAttribute\" in canvas) canvas.setAttribute(\"data-engine\", `three.js r${$d5b33d7c30034067$export$3545e07a80636437}`);\n // event listeners must be registered before WebGL context is created, see #12753\n canvas.addEventListener(\"webglcontextlost\", onContextLost, false);\n canvas.addEventListener(\"webglcontextrestored\", onContextRestore, false);\n canvas.addEventListener(\"webglcontextcreationerror\", onContextCreationError, false);\n if (_gl === null) {\n const contextNames = [\n \"webgl2\",\n \"webgl\",\n \"experimental-webgl\"\n ];\n if (_this.isWebGL1Renderer === true) contextNames.shift();\n _gl = getContext(contextNames, contextAttributes);\n if (_gl === null) {\n if (getContext(contextNames)) throw new Error(\"Error creating WebGL context with your selected attributes.\");\n else throw new Error(\"Error creating WebGL context.\");\n }\n }\n if (typeof WebGLRenderingContext !== \"undefined\" && _gl instanceof WebGLRenderingContext) console.warn(\"THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.\");\n // Some experimental-webgl implementations do not have getShaderPrecisionFormat\n if (_gl.getShaderPrecisionFormat === undefined) _gl.getShaderPrecisionFormat = function() {\n return {\n \"rangeMin\": 1,\n \"rangeMax\": 1,\n \"precision\": 1\n };\n };\n } catch (error) {\n console.error(\"THREE.WebGLRenderer: \" + error.message);\n throw error;\n }\n let extensions, capabilities, state, info;\n let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n let programCache, materials, renderLists, renderStates, clipping, shadowMap;\n let background, morphtargets, bufferRenderer, indexedBufferRenderer;\n let utils, bindingStates, uniformsGroups;\n function initGLContext() {\n extensions = new $d5b33d7c30034067$var$WebGLExtensions(_gl);\n capabilities = new $d5b33d7c30034067$var$WebGLCapabilities(_gl, extensions, parameters);\n extensions.init(capabilities);\n utils = new $d5b33d7c30034067$export$ddaebcad857649a8(_gl, extensions, capabilities);\n state = new $d5b33d7c30034067$var$WebGLState(_gl, extensions, capabilities);\n info = new $d5b33d7c30034067$var$WebGLInfo(_gl);\n properties = new $d5b33d7c30034067$var$WebGLProperties();\n textures = new $d5b33d7c30034067$var$WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);\n cubemaps = new $d5b33d7c30034067$var$WebGLCubeMaps(_this);\n cubeuvmaps = new $d5b33d7c30034067$var$WebGLCubeUVMaps(_this);\n attributes = new $d5b33d7c30034067$var$WebGLAttributes(_gl, capabilities);\n bindingStates = new $d5b33d7c30034067$var$WebGLBindingStates(_gl, extensions, attributes, capabilities);\n geometries = new $d5b33d7c30034067$var$WebGLGeometries(_gl, attributes, info, bindingStates);\n objects = new $d5b33d7c30034067$var$WebGLObjects(_gl, geometries, attributes, info);\n morphtargets = new $d5b33d7c30034067$var$WebGLMorphtargets(_gl, capabilities, textures);\n clipping = new $d5b33d7c30034067$var$WebGLClipping(properties);\n programCache = new $d5b33d7c30034067$var$WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);\n materials = new $d5b33d7c30034067$var$WebGLMaterials(_this, properties);\n renderLists = new $d5b33d7c30034067$var$WebGLRenderLists();\n renderStates = new $d5b33d7c30034067$var$WebGLRenderStates(extensions, capabilities);\n background = new $d5b33d7c30034067$var$WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha);\n shadowMap = new $d5b33d7c30034067$var$WebGLShadowMap(_this, objects, capabilities);\n uniformsGroups = new $d5b33d7c30034067$var$WebGLUniformsGroups(_gl, info, capabilities, state);\n bufferRenderer = new $d5b33d7c30034067$var$WebGLBufferRenderer(_gl, extensions, info, capabilities);\n indexedBufferRenderer = new $d5b33d7c30034067$var$WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);\n info.programs = programCache.programs;\n _this.capabilities = capabilities;\n _this.extensions = extensions;\n _this.properties = properties;\n _this.renderLists = renderLists;\n _this.shadowMap = shadowMap;\n _this.state = state;\n _this.info = info;\n }\n initGLContext();\n // xr\n const xr = new $d5b33d7c30034067$var$WebXRManager(_this, _gl);\n this.xr = xr;\n // API\n this.getContext = function() {\n return _gl;\n };\n this.getContextAttributes = function() {\n return _gl.getContextAttributes();\n };\n this.forceContextLoss = function() {\n const extension = extensions.get(\"WEBGL_lose_context\");\n if (extension) extension.loseContext();\n };\n this.forceContextRestore = function() {\n const extension = extensions.get(\"WEBGL_lose_context\");\n if (extension) extension.restoreContext();\n };\n this.getPixelRatio = function() {\n return _pixelRatio;\n };\n this.setPixelRatio = function(value) {\n if (value === undefined) return;\n _pixelRatio = value;\n this.setSize(_width, _height, false);\n };\n this.getSize = function(target) {\n return target.set(_width, _height);\n };\n this.setSize = function(width, height, updateStyle = true) {\n if (xr.isPresenting) {\n console.warn(\"THREE.WebGLRenderer: Can't change size while VR device is presenting.\");\n return;\n }\n _width = width;\n _height = height;\n canvas.width = Math.floor(width * _pixelRatio);\n canvas.height = Math.floor(height * _pixelRatio);\n if (updateStyle === true) {\n canvas.style.width = width + \"px\";\n canvas.style.height = height + \"px\";\n }\n this.setViewport(0, 0, width, height);\n };\n this.getDrawingBufferSize = function(target) {\n return target.set(_width * _pixelRatio, _height * _pixelRatio).floor();\n };\n this.setDrawingBufferSize = function(width, height, pixelRatio) {\n _width = width;\n _height = height;\n _pixelRatio = pixelRatio;\n canvas.width = Math.floor(width * pixelRatio);\n canvas.height = Math.floor(height * pixelRatio);\n this.setViewport(0, 0, width, height);\n };\n this.getCurrentViewport = function(target) {\n return target.copy(_currentViewport);\n };\n this.getViewport = function(target) {\n return target.copy(_viewport);\n };\n this.setViewport = function(x, y, width, height) {\n if (x.isVector4) _viewport.set(x.x, x.y, x.z, x.w);\n else _viewport.set(x, y, width, height);\n state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissor = function(target) {\n return target.copy(_scissor);\n };\n this.setScissor = function(x, y, width, height) {\n if (x.isVector4) _scissor.set(x.x, x.y, x.z, x.w);\n else _scissor.set(x, y, width, height);\n state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissorTest = function() {\n return _scissorTest;\n };\n this.setScissorTest = function(boolean) {\n state.setScissorTest(_scissorTest = boolean);\n };\n this.setOpaqueSort = function(method) {\n _opaqueSort = method;\n };\n this.setTransparentSort = function(method) {\n _transparentSort = method;\n };\n // Clearing\n this.getClearColor = function(target) {\n return target.copy(background.getClearColor());\n };\n this.setClearColor = function() {\n background.setClearColor.apply(background, arguments);\n };\n this.getClearAlpha = function() {\n return background.getClearAlpha();\n };\n this.setClearAlpha = function() {\n background.setClearAlpha.apply(background, arguments);\n };\n this.clear = function(color = true, depth = true, stencil = true) {\n let bits = 0;\n if (color) {\n // check if we're trying to clear an integer target\n let isIntegerFormat = false;\n if (_currentRenderTarget !== null) {\n const targetFormat = _currentRenderTarget.texture.format;\n isIntegerFormat = targetFormat === $d5b33d7c30034067$export$c200e7d26f592f21 || targetFormat === $d5b33d7c30034067$export$1ba1c45f9f77d4d7 || targetFormat === $d5b33d7c30034067$export$aa92e870a709d190;\n }\n // use the appropriate clear functions to clear the target if it's a signed\n // or unsigned integer target\n if (isIntegerFormat) {\n const targetType = _currentRenderTarget.texture.type;\n const isUnsignedType = targetType === $d5b33d7c30034067$export$2e8ce08d3f6f5e10 || targetType === $d5b33d7c30034067$export$c3c7fc4518ebba96 || targetType === $d5b33d7c30034067$export$c63dc51868b06a9d || targetType === $d5b33d7c30034067$export$6c8ea339bfab1301 || targetType === $d5b33d7c30034067$export$b3969b01faf587f2 || targetType === $d5b33d7c30034067$export$18886f8ae33e90de;\n const clearColor = background.getClearColor();\n const a = background.getClearAlpha();\n const r = clearColor.r;\n const g = clearColor.g;\n const b = clearColor.b;\n if (isUnsignedType) {\n uintClearColor[0] = r;\n uintClearColor[1] = g;\n uintClearColor[2] = b;\n uintClearColor[3] = a;\n _gl.clearBufferuiv(_gl.COLOR, 0, uintClearColor);\n } else {\n intClearColor[0] = r;\n intClearColor[1] = g;\n intClearColor[2] = b;\n intClearColor[3] = a;\n _gl.clearBufferiv(_gl.COLOR, 0, intClearColor);\n }\n } else bits |= _gl.COLOR_BUFFER_BIT;\n }\n if (depth) bits |= _gl.DEPTH_BUFFER_BIT;\n if (stencil) bits |= _gl.STENCIL_BUFFER_BIT;\n _gl.clear(bits);\n };\n this.clearColor = function() {\n this.clear(true, false, false);\n };\n this.clearDepth = function() {\n this.clear(false, true, false);\n };\n this.clearStencil = function() {\n this.clear(false, false, true);\n };\n //\n this.dispose = function() {\n canvas.removeEventListener(\"webglcontextlost\", onContextLost, false);\n canvas.removeEventListener(\"webglcontextrestored\", onContextRestore, false);\n canvas.removeEventListener(\"webglcontextcreationerror\", onContextCreationError, false);\n renderLists.dispose();\n renderStates.dispose();\n properties.dispose();\n cubemaps.dispose();\n cubeuvmaps.dispose();\n objects.dispose();\n bindingStates.dispose();\n uniformsGroups.dispose();\n programCache.dispose();\n xr.dispose();\n xr.removeEventListener(\"sessionstart\", onXRSessionStart);\n xr.removeEventListener(\"sessionend\", onXRSessionEnd);\n if (_transmissionRenderTarget) {\n _transmissionRenderTarget.dispose();\n _transmissionRenderTarget = null;\n }\n animation.stop();\n };\n // Events\n function onContextLost(event) {\n event.preventDefault();\n console.log(\"THREE.WebGLRenderer: Context Lost.\");\n _isContextLost = true;\n }\n function onContextRestore() {\n console.log(\"THREE.WebGLRenderer: Context Restored.\");\n _isContextLost = false;\n const infoAutoReset = info.autoReset;\n const shadowMapEnabled = shadowMap.enabled;\n const shadowMapAutoUpdate = shadowMap.autoUpdate;\n const shadowMapNeedsUpdate = shadowMap.needsUpdate;\n const shadowMapType = shadowMap.type;\n initGLContext();\n info.autoReset = infoAutoReset;\n shadowMap.enabled = shadowMapEnabled;\n shadowMap.autoUpdate = shadowMapAutoUpdate;\n shadowMap.needsUpdate = shadowMapNeedsUpdate;\n shadowMap.type = shadowMapType;\n }\n function onContextCreationError(event) {\n console.error(\"THREE.WebGLRenderer: A WebGL context could not be created. Reason: \", event.statusMessage);\n }\n function onMaterialDispose(event) {\n const material = event.target;\n material.removeEventListener(\"dispose\", onMaterialDispose);\n deallocateMaterial(material);\n }\n // Buffer deallocation\n function deallocateMaterial(material) {\n releaseMaterialProgramReferences(material);\n properties.remove(material);\n }\n function releaseMaterialProgramReferences(material) {\n const programs = properties.get(material).programs;\n if (programs !== undefined) {\n programs.forEach(function(program) {\n programCache.releaseProgram(program);\n });\n if (material.isShaderMaterial) programCache.releaseShaderCache(material);\n }\n }\n // Buffer rendering\n this.renderBufferDirect = function(camera, scene, geometry, material, object, group) {\n if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;\n const program = setProgram(camera, scene, geometry, material, object);\n state.setMaterial(material, frontFaceCW);\n //\n let index = geometry.index;\n let rangeFactor = 1;\n if (material.wireframe === true) {\n index = geometries.getWireframeAttribute(geometry);\n if (index === undefined) return;\n rangeFactor = 2;\n }\n //\n const drawRange = geometry.drawRange;\n const position = geometry.attributes.position;\n let drawStart = drawRange.start * rangeFactor;\n let drawEnd = (drawRange.start + drawRange.count) * rangeFactor;\n if (group !== null) {\n drawStart = Math.max(drawStart, group.start * rangeFactor);\n drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor);\n }\n if (index !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, index.count);\n } else if (position !== undefined && position !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, position.count);\n }\n const drawCount = drawEnd - drawStart;\n if (drawCount < 0 || drawCount === Infinity) return;\n //\n bindingStates.setup(object, material, program, geometry, index);\n let attribute;\n let renderer = bufferRenderer;\n if (index !== null) {\n attribute = attributes.get(index);\n renderer = indexedBufferRenderer;\n renderer.setIndex(attribute);\n }\n //\n if (object.isMesh) {\n if (material.wireframe === true) {\n state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());\n renderer.setMode(_gl.LINES);\n } else renderer.setMode(_gl.TRIANGLES);\n } else if (object.isLine) {\n let lineWidth = material.linewidth;\n if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material\n state.setLineWidth(lineWidth * getTargetPixelRatio());\n if (object.isLineSegments) renderer.setMode(_gl.LINES);\n else if (object.isLineLoop) renderer.setMode(_gl.LINE_LOOP);\n else renderer.setMode(_gl.LINE_STRIP);\n } else if (object.isPoints) renderer.setMode(_gl.POINTS);\n else if (object.isSprite) renderer.setMode(_gl.TRIANGLES);\n if (object.isInstancedMesh) renderer.renderInstances(drawStart, drawCount, object.count);\n else if (geometry.isInstancedBufferGeometry) {\n const maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount);\n renderer.renderInstances(drawStart, drawCount, instanceCount);\n } else renderer.render(drawStart, drawCount);\n };\n // Compile\n this.compile = function(scene, camera) {\n function prepare(material, scene, object) {\n if (material.transparent === true && material.side === $d5b33d7c30034067$export$3b296b6f144d5b03 && material.forceSinglePass === false) {\n material.side = $d5b33d7c30034067$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = $d5b33d7c30034067$export$2ede184fc2998901;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = $d5b33d7c30034067$export$3b296b6f144d5b03;\n } else getProgram(material, scene, object);\n }\n currentRenderState = renderStates.get(scene);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n scene.traverseVisible(function(object) {\n if (object.isLight && object.layers.test(camera.layers)) {\n currentRenderState.pushLight(object);\n if (object.castShadow) currentRenderState.pushShadow(object);\n }\n });\n currentRenderState.setupLights(_this._useLegacyLights);\n scene.traverse(function(object) {\n const material = object.material;\n if (material) {\n if (Array.isArray(material)) for(let i = 0; i < material.length; i++){\n const material2 = material[i];\n prepare(material2, scene, object);\n }\n else prepare(material, scene, object);\n }\n });\n renderStateStack.pop();\n currentRenderState = null;\n };\n // Animation Loop\n let onAnimationFrameCallback = null;\n function onAnimationFrame(time) {\n if (onAnimationFrameCallback) onAnimationFrameCallback(time);\n }\n function onXRSessionStart() {\n animation.stop();\n }\n function onXRSessionEnd() {\n animation.start();\n }\n const animation = new $d5b33d7c30034067$var$WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n if (typeof self !== \"undefined\") animation.setContext(self);\n this.setAnimationLoop = function(callback) {\n onAnimationFrameCallback = callback;\n xr.setAnimationLoop(callback);\n callback === null ? animation.stop() : animation.start();\n };\n xr.addEventListener(\"sessionstart\", onXRSessionStart);\n xr.addEventListener(\"sessionend\", onXRSessionEnd);\n // Rendering\n this.render = function(scene, camera) {\n if (camera !== undefined && camera.isCamera !== true) {\n console.error(\"THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.\");\n return;\n }\n if (_isContextLost === true) return;\n // update scene graph\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();\n // update camera matrices and frustum\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();\n if (xr.enabled === true && xr.isPresenting === true) {\n if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);\n camera = xr.getCamera(); // use XR camera for rendering\n }\n //\n if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);\n currentRenderState = renderStates.get(scene, renderStateStack.length);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n _frustum.setFromProjectionMatrix(_projScreenMatrix);\n _localClippingEnabled = this.localClippingEnabled;\n _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled);\n currentRenderList = renderLists.get(scene, renderListStack.length);\n currentRenderList.init();\n renderListStack.push(currentRenderList);\n projectObject(scene, camera, 0, _this.sortObjects);\n currentRenderList.finish();\n if (_this.sortObjects === true) currentRenderList.sort(_opaqueSort, _transparentSort);\n //\n this.info.render.frame++;\n if (_clippingEnabled === true) clipping.beginShadows();\n const shadowsArray = currentRenderState.state.shadowsArray;\n shadowMap.render(shadowsArray, scene, camera);\n if (_clippingEnabled === true) clipping.endShadows();\n //\n if (this.info.autoReset === true) this.info.reset();\n //\n background.render(currentRenderList, scene);\n // render scene\n currentRenderState.setupLights(_this._useLegacyLights);\n if (camera.isArrayCamera) {\n const cameras = camera.cameras;\n for(let i = 0, l = cameras.length; i < l; i++){\n const camera2 = cameras[i];\n renderScene(currentRenderList, scene, camera2, camera2.viewport);\n }\n } else renderScene(currentRenderList, scene, camera);\n //\n if (_currentRenderTarget !== null) {\n // resolve multisample renderbuffers to a single-sample texture if necessary\n textures.updateMultisampleRenderTarget(_currentRenderTarget);\n // Generate mipmap if we're using any kind of mipmap filtering\n textures.updateRenderTargetMipmap(_currentRenderTarget);\n }\n //\n if (scene.isScene === true) scene.onAfterRender(_this, scene, camera);\n // _gl.finish();\n bindingStates.resetDefaultState();\n _currentMaterialId = -1;\n _currentCamera = null;\n renderStateStack.pop();\n if (renderStateStack.length > 0) currentRenderState = renderStateStack[renderStateStack.length - 1];\n else currentRenderState = null;\n renderListStack.pop();\n if (renderListStack.length > 0) currentRenderList = renderListStack[renderListStack.length - 1];\n else currentRenderList = null;\n };\n function projectObject(object, camera, groupOrder, sortObjects) {\n if (object.visible === false) return;\n const visible = object.layers.test(camera.layers);\n if (visible) {\n if (object.isGroup) groupOrder = object.renderOrder;\n else if (object.isLOD) {\n if (object.autoUpdate === true) object.update(camera);\n } else if (object.isLight) {\n currentRenderState.pushLight(object);\n if (object.castShadow) currentRenderState.pushShadow(object);\n } else if (object.isSprite) {\n if (!object.frustumCulled || _frustum.intersectsSprite(object)) {\n if (sortObjects) _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n const geometry = objects.update(object);\n const material = object.material;\n if (material.visible) currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);\n }\n } else if (object.isMesh || object.isLine || object.isPoints) {\n if (!object.frustumCulled || _frustum.intersectsObject(object)) {\n const geometry = objects.update(object);\n const material = object.material;\n if (sortObjects) {\n if (object.boundingSphere !== undefined) {\n if (object.boundingSphere === null) object.computeBoundingSphere();\n _vector3.copy(object.boundingSphere.center);\n } else {\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _vector3.copy(geometry.boundingSphere.center);\n }\n _vector3.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n }\n if (Array.isArray(material)) {\n const groups = geometry.groups;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n const groupMaterial = material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group);\n }\n } else if (material.visible) currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);\n }\n }\n }\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)projectObject(children[i], camera, groupOrder, sortObjects);\n }\n function renderScene(currentRenderList, scene, camera, viewport) {\n const opaqueObjects = currentRenderList.opaque;\n const transmissiveObjects = currentRenderList.transmissive;\n const transparentObjects = currentRenderList.transparent;\n currentRenderState.setupLightsView(camera);\n if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, camera);\n if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera);\n if (viewport) state.viewport(_currentViewport.copy(viewport));\n if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);\n if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera);\n if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera);\n // Ensure depth buffer writing is enabled so it can be cleared on next render\n state.buffers.depth.setTest(true);\n state.buffers.depth.setMask(true);\n state.buffers.color.setMask(true);\n state.setPolygonOffset(false);\n }\n function renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera) {\n const isWebGL2 = capabilities.isWebGL2;\n if (_transmissionRenderTarget === null) _transmissionRenderTarget = new $d5b33d7c30034067$export$3c052beb2e51e23f(1, 1, {\n generateMipmaps: true,\n type: extensions.has(\"EXT_color_buffer_half_float\") ? $d5b33d7c30034067$export$2697304443f382bc : $d5b33d7c30034067$export$2e8ce08d3f6f5e10,\n minFilter: $d5b33d7c30034067$export$5d8599b6a933fb1b,\n samples: isWebGL2 ? 4 : 0\n });\n _this.getDrawingBufferSize(_vector2);\n if (isWebGL2) _transmissionRenderTarget.setSize(_vector2.x, _vector2.y);\n else _transmissionRenderTarget.setSize($d5b33d7c30034067$var$floorPowerOfTwo(_vector2.x), $d5b33d7c30034067$var$floorPowerOfTwo(_vector2.y));\n //\n const currentRenderTarget = _this.getRenderTarget();\n _this.setRenderTarget(_transmissionRenderTarget);\n _this.getClearColor(_currentClearColor);\n _currentClearAlpha = _this.getClearAlpha();\n if (_currentClearAlpha < 1) _this.setClearColor(0xffffff, 0.5);\n _this.clear();\n // Turn off the features which can affect the frag color for opaque objects pass.\n // Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n const currentToneMapping = _this.toneMapping;\n _this.toneMapping = $d5b33d7c30034067$export$9fcb6b4294603b2;\n renderObjects(opaqueObjects, scene, camera);\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n let renderTargetNeedsUpdate = false;\n for(let i = 0, l = transmissiveObjects.length; i < l; i++){\n const renderItem = transmissiveObjects[i];\n const object = renderItem.object;\n const geometry = renderItem.geometry;\n const material = renderItem.material;\n const group = renderItem.group;\n if (material.side === $d5b33d7c30034067$export$3b296b6f144d5b03 && object.layers.test(camera.layers)) {\n const currentSide = material.side;\n material.side = $d5b33d7c30034067$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n renderObject(object, scene, camera, geometry, material, group);\n material.side = currentSide;\n material.needsUpdate = true;\n renderTargetNeedsUpdate = true;\n }\n }\n if (renderTargetNeedsUpdate === true) {\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n }\n _this.setRenderTarget(currentRenderTarget);\n _this.setClearColor(_currentClearColor, _currentClearAlpha);\n _this.toneMapping = currentToneMapping;\n }\n function renderObjects(renderList, scene, camera) {\n const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n for(let i = 0, l = renderList.length; i < l; i++){\n const renderItem = renderList[i];\n const object = renderItem.object;\n const geometry = renderItem.geometry;\n const material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n const group = renderItem.group;\n if (object.layers.test(camera.layers)) renderObject(object, scene, camera, geometry, material, group);\n }\n }\n function renderObject(object, scene, camera, geometry, material, group) {\n object.onBeforeRender(_this, scene, camera, geometry, material, group);\n object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);\n object.normalMatrix.getNormalMatrix(object.modelViewMatrix);\n material.onBeforeRender(_this, scene, camera, geometry, object, group);\n if (material.transparent === true && material.side === $d5b33d7c30034067$export$3b296b6f144d5b03 && material.forceSinglePass === false) {\n material.side = $d5b33d7c30034067$export$d9f0486e75b5ace;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = $d5b33d7c30034067$export$2ede184fc2998901;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = $d5b33d7c30034067$export$3b296b6f144d5b03;\n } else _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n object.onAfterRender(_this, scene, camera, geometry, material, group);\n }\n function getProgram(material, scene, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n const materialProperties = properties.get(material);\n const lights = currentRenderState.state.lights;\n const shadowsArray = currentRenderState.state.shadowsArray;\n const lightsStateVersion = lights.state.version;\n const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object);\n const programCacheKey = programCache.getProgramCacheKey(parameters);\n let programs = materialProperties.programs;\n // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n materialProperties.fog = scene.fog;\n materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment);\n if (programs === undefined) {\n // new material\n material.addEventListener(\"dispose\", onMaterialDispose);\n programs = new Map();\n materialProperties.programs = programs;\n }\n let program = programs.get(programCacheKey);\n if (program !== undefined) // early out if program and light state is identical\n {\n if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) {\n updateCommonMaterialProperties(material, parameters);\n return program;\n }\n } else {\n parameters.uniforms = programCache.getUniforms(material);\n material.onBuild(object, parameters, _this);\n material.onBeforeCompile(parameters, _this);\n program = programCache.acquireProgram(parameters, programCacheKey);\n programs.set(programCacheKey, program);\n materialProperties.uniforms = parameters.uniforms;\n }\n const uniforms = materialProperties.uniforms;\n if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) uniforms.clippingPlanes = clipping.uniform;\n updateCommonMaterialProperties(material, parameters);\n // store the light setup it was created for\n materialProperties.needsLights = materialNeedsLights(material);\n materialProperties.lightsStateVersion = lightsStateVersion;\n if (materialProperties.needsLights) {\n // wire up the material to this renderer's lighting state\n uniforms.ambientLightColor.value = lights.state.ambient;\n uniforms.lightProbe.value = lights.state.probe;\n uniforms.directionalLights.value = lights.state.directional;\n uniforms.directionalLightShadows.value = lights.state.directionalShadow;\n uniforms.spotLights.value = lights.state.spot;\n uniforms.spotLightShadows.value = lights.state.spotShadow;\n uniforms.rectAreaLights.value = lights.state.rectArea;\n uniforms.ltc_1.value = lights.state.rectAreaLTC1;\n uniforms.ltc_2.value = lights.state.rectAreaLTC2;\n uniforms.pointLights.value = lights.state.point;\n uniforms.pointLightShadows.value = lights.state.pointShadow;\n uniforms.hemisphereLights.value = lights.state.hemi;\n uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n uniforms.spotShadowMap.value = lights.state.spotShadowMap;\n uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n uniforms.spotLightMap.value = lights.state.spotLightMap;\n uniforms.pointShadowMap.value = lights.state.pointShadowMap;\n uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n // TODO (abelnation): add area lights shadow info to uniforms\n }\n const progUniforms = program.getUniforms();\n const uniformsList = $d5b33d7c30034067$var$WebGLUniforms.seqWithValue(progUniforms.seq, uniforms);\n materialProperties.currentProgram = program;\n materialProperties.uniformsList = uniformsList;\n return program;\n }\n function updateCommonMaterialProperties(material, parameters) {\n const materialProperties = properties.get(material);\n materialProperties.outputColorSpace = parameters.outputColorSpace;\n materialProperties.instancing = parameters.instancing;\n materialProperties.instancingColor = parameters.instancingColor;\n materialProperties.skinning = parameters.skinning;\n materialProperties.morphTargets = parameters.morphTargets;\n materialProperties.morphNormals = parameters.morphNormals;\n materialProperties.morphColors = parameters.morphColors;\n materialProperties.morphTargetsCount = parameters.morphTargetsCount;\n materialProperties.numClippingPlanes = parameters.numClippingPlanes;\n materialProperties.numIntersection = parameters.numClipIntersection;\n materialProperties.vertexAlphas = parameters.vertexAlphas;\n materialProperties.vertexTangents = parameters.vertexTangents;\n materialProperties.toneMapping = parameters.toneMapping;\n }\n function setProgram(camera, scene, geometry, material, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n textures.resetTextureUnits();\n const fog = scene.fog;\n const environment = material.isMeshStandardMaterial ? scene.environment : null;\n const colorSpace1 = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : $d5b33d7c30034067$export$42429b3acfb233a4;\n const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n const vertexTangents = !!geometry.attributes.tangent && (!!material.normalMap || material.anisotropy > 0);\n const morphTargets = !!geometry.morphAttributes.position;\n const morphNormals = !!geometry.morphAttributes.normal;\n const morphColors = !!geometry.morphAttributes.color;\n let toneMapping = $d5b33d7c30034067$export$9fcb6b4294603b2;\n if (material.toneMapped) {\n if (_currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true) toneMapping = _this.toneMapping;\n }\n const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n const materialProperties = properties.get(material);\n const lights = currentRenderState.state.lights;\n if (_clippingEnabled === true) {\n if (_localClippingEnabled === true || camera !== _currentCamera) {\n const useCache = camera === _currentCamera && material.id === _currentMaterialId;\n // we might want to call this function with some ClippingGroup\n // object instead of the material, once it becomes feasible\n // (#8465, #8379)\n clipping.setState(material, camera, useCache);\n }\n }\n //\n let needsProgramChange = false;\n if (material.version === materialProperties.__version) {\n if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) needsProgramChange = true;\n else if (materialProperties.outputColorSpace !== colorSpace1) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancing === false) needsProgramChange = true;\n else if (!object.isInstancedMesh && materialProperties.instancing === true) needsProgramChange = true;\n else if (object.isSkinnedMesh && materialProperties.skinning === false) needsProgramChange = true;\n else if (!object.isSkinnedMesh && materialProperties.skinning === true) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null) needsProgramChange = true;\n else if (object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null) needsProgramChange = true;\n else if (materialProperties.envMap !== envMap) needsProgramChange = true;\n else if (material.fog === true && materialProperties.fog !== fog) needsProgramChange = true;\n else if (materialProperties.numClippingPlanes !== undefined && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) needsProgramChange = true;\n else if (materialProperties.vertexAlphas !== vertexAlphas) needsProgramChange = true;\n else if (materialProperties.vertexTangents !== vertexTangents) needsProgramChange = true;\n else if (materialProperties.morphTargets !== morphTargets) needsProgramChange = true;\n else if (materialProperties.morphNormals !== morphNormals) needsProgramChange = true;\n else if (materialProperties.morphColors !== morphColors) needsProgramChange = true;\n else if (materialProperties.toneMapping !== toneMapping) needsProgramChange = true;\n else if (capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount) needsProgramChange = true;\n } else {\n needsProgramChange = true;\n materialProperties.__version = material.version;\n }\n //\n let program = materialProperties.currentProgram;\n if (needsProgramChange === true) program = getProgram(material, scene, object);\n let refreshProgram = false;\n let refreshMaterial = false;\n let refreshLights = false;\n const p_uniforms = program.getUniforms(), m_uniforms = materialProperties.uniforms;\n if (state.useProgram(program.program)) {\n refreshProgram = true;\n refreshMaterial = true;\n refreshLights = true;\n }\n if (material.id !== _currentMaterialId) {\n _currentMaterialId = material.id;\n refreshMaterial = true;\n }\n if (refreshProgram || _currentCamera !== camera) {\n p_uniforms.setValue(_gl, \"projectionMatrix\", camera.projectionMatrix);\n if (capabilities.logarithmicDepthBuffer) p_uniforms.setValue(_gl, \"logDepthBufFC\", 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));\n if (_currentCamera !== camera) {\n _currentCamera = camera;\n // lighting uniforms depend on the camera so enforce an update\n // now, in case this material supports lights - or later, when\n // the next material that does gets activated:\n refreshMaterial = true; // set to true on material change\n refreshLights = true; // remains set until update done\n }\n // load material specific uniforms\n // (shader material also gets them for the sake of genericity)\n if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) {\n const uCamPos = p_uniforms.map.cameraPosition;\n if (uCamPos !== undefined) uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));\n }\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) p_uniforms.setValue(_gl, \"isOrthographic\", camera.isOrthographicCamera === true);\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) p_uniforms.setValue(_gl, \"viewMatrix\", camera.matrixWorldInverse);\n }\n // skinning and morph target uniforms must be set even if material didn't change\n // auto-setting of texture unit for bone and morph texture must go before other textures\n // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n if (object.isSkinnedMesh) {\n p_uniforms.setOptional(_gl, object, \"bindMatrix\");\n p_uniforms.setOptional(_gl, object, \"bindMatrixInverse\");\n const skeleton = object.skeleton;\n if (skeleton) {\n if (capabilities.floatVertexTextures) {\n if (skeleton.boneTexture === null) skeleton.computeBoneTexture();\n p_uniforms.setValue(_gl, \"boneTexture\", skeleton.boneTexture, textures);\n p_uniforms.setValue(_gl, \"boneTextureSize\", skeleton.boneTextureSize);\n } else console.warn(\"THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.\");\n }\n }\n const morphAttributes = geometry.morphAttributes;\n if (morphAttributes.position !== undefined || morphAttributes.normal !== undefined || morphAttributes.color !== undefined && capabilities.isWebGL2 === true) morphtargets.update(object, geometry, program);\n if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {\n materialProperties.receiveShadow = object.receiveShadow;\n p_uniforms.setValue(_gl, \"receiveShadow\", object.receiveShadow);\n }\n // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n if (material.isMeshGouraudMaterial && material.envMap !== null) {\n m_uniforms.envMap.value = envMap;\n m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n }\n if (refreshMaterial) {\n p_uniforms.setValue(_gl, \"toneMappingExposure\", _this.toneMappingExposure);\n if (materialProperties.needsLights) // the current material requires lighting info\n // note: all lighting uniforms are always set correctly\n // they simply reference the renderer's state for their\n // values\n //\n // use the current material's .needsUpdate flags to set\n // the GL state when required\n markUniformsLightsNeedsUpdate(m_uniforms, refreshLights);\n // refresh uniforms common to several materials\n if (fog && material.fog === true) materials.refreshFogUniforms(m_uniforms, fog);\n materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget);\n $d5b33d7c30034067$var$WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n }\n if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {\n $d5b33d7c30034067$var$WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n material.uniformsNeedUpdate = false;\n }\n if (material.isSpriteMaterial) p_uniforms.setValue(_gl, \"center\", object.center);\n // common matrices\n p_uniforms.setValue(_gl, \"modelViewMatrix\", object.modelViewMatrix);\n p_uniforms.setValue(_gl, \"normalMatrix\", object.normalMatrix);\n p_uniforms.setValue(_gl, \"modelMatrix\", object.matrixWorld);\n // UBOs\n if (material.isShaderMaterial || material.isRawShaderMaterial) {\n const groups = material.uniformsGroups;\n for(let i = 0, l = groups.length; i < l; i++)if (capabilities.isWebGL2) {\n const group = groups[i];\n uniformsGroups.update(group, program);\n uniformsGroups.bind(group, program);\n } else console.warn(\"THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.\");\n }\n return program;\n }\n // If uniforms are marked as clean, they don't need to be loaded to the GPU.\n function markUniformsLightsNeedsUpdate(uniforms, value) {\n uniforms.ambientLightColor.needsUpdate = value;\n uniforms.lightProbe.needsUpdate = value;\n uniforms.directionalLights.needsUpdate = value;\n uniforms.directionalLightShadows.needsUpdate = value;\n uniforms.pointLights.needsUpdate = value;\n uniforms.pointLightShadows.needsUpdate = value;\n uniforms.spotLights.needsUpdate = value;\n uniforms.spotLightShadows.needsUpdate = value;\n uniforms.rectAreaLights.needsUpdate = value;\n uniforms.hemisphereLights.needsUpdate = value;\n }\n function materialNeedsLights(material) {\n return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true;\n }\n this.getActiveCubeFace = function() {\n return _currentActiveCubeFace;\n };\n this.getActiveMipmapLevel = function() {\n return _currentActiveMipmapLevel;\n };\n this.getRenderTarget = function() {\n return _currentRenderTarget;\n };\n this.setRenderTargetTextures = function(renderTarget, colorTexture, depthTexture) {\n properties.get(renderTarget.texture).__webglTexture = colorTexture;\n properties.get(renderTarget.depthTexture).__webglTexture = depthTexture;\n const renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__hasExternalTextures = true;\n if (renderTargetProperties.__hasExternalTextures) {\n renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n if (!renderTargetProperties.__autoAllocateDepthBuffer) // The multisample_render_to_texture extension doesn't work properly if there\n // are midframe flushes and an external depth buffer. Disable use of the extension.\n {\n if (extensions.has(\"WEBGL_multisampled_render_to_texture\") === true) {\n console.warn(\"THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided\");\n renderTargetProperties.__useRenderToTexture = false;\n }\n }\n }\n };\n this.setRenderTargetFramebuffer = function(renderTarget, defaultFramebuffer) {\n const renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n };\n this.setRenderTarget = function(renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) {\n _currentRenderTarget = renderTarget;\n _currentActiveCubeFace = activeCubeFace;\n _currentActiveMipmapLevel = activeMipmapLevel;\n let useDefaultFramebuffer = true;\n let framebuffer = null;\n let isCube = false;\n let isRenderTarget3D = false;\n if (renderTarget) {\n const renderTargetProperties = properties.get(renderTarget);\n if (renderTargetProperties.__useDefaultFramebuffer !== undefined) {\n // We need to make sure to rebind the framebuffer.\n state.bindFramebuffer(_gl.FRAMEBUFFER, null);\n useDefaultFramebuffer = false;\n } else if (renderTargetProperties.__webglFramebuffer === undefined) textures.setupRenderTarget(renderTarget);\n else if (renderTargetProperties.__hasExternalTextures) // Color and depth texture must be rebound in order for the swapchain to update.\n textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture);\n const texture = renderTarget.texture;\n if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) isRenderTarget3D = true;\n const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget) {\n if (Array.isArray(__webglFramebuffer[activeCubeFace])) framebuffer = __webglFramebuffer[activeCubeFace][activeMipmapLevel];\n else framebuffer = __webglFramebuffer[activeCubeFace];\n isCube = true;\n } else if (capabilities.isWebGL2 && renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer;\n else if (Array.isArray(__webglFramebuffer)) framebuffer = __webglFramebuffer[activeMipmapLevel];\n else framebuffer = __webglFramebuffer;\n _currentViewport.copy(renderTarget.viewport);\n _currentScissor.copy(renderTarget.scissor);\n _currentScissorTest = renderTarget.scissorTest;\n } else {\n _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();\n _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();\n _currentScissorTest = _scissorTest;\n }\n const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) state.drawBuffers(renderTarget, framebuffer);\n state.viewport(_currentViewport);\n state.scissor(_currentScissor);\n state.setScissorTest(_currentScissorTest);\n if (isCube) {\n const textureProperties = properties.get(renderTarget.texture);\n _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel);\n } else if (isRenderTarget3D) {\n const textureProperties = properties.get(renderTarget.texture);\n const layer = activeCubeFace || 0;\n _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer);\n }\n _currentMaterialId = -1; // reset current material to ensure correct uniform bindings\n };\n this.readRenderTargetPixels = function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) {\n if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\");\n return;\n }\n let framebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) framebuffer = framebuffer[activeCubeFaceIndex];\n if (framebuffer) {\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n try {\n const texture = renderTarget.texture;\n const textureFormat = texture.format;\n const textureType = texture.type;\n if (textureFormat !== $d5b33d7c30034067$export$3f8bb04b555a363c && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.\");\n return;\n }\n const halfFloatSupportedByExt = textureType === $d5b33d7c30034067$export$2697304443f382bc && (extensions.has(\"EXT_color_buffer_half_float\") || capabilities.isWebGL2 && extensions.has(\"EXT_color_buffer_float\"));\n if (textureType !== $d5b33d7c30034067$export$2e8ce08d3f6f5e10 && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)\n !(textureType === $d5b33d7c30034067$export$f6d331659b644596 && (capabilities.isWebGL2 || extensions.has(\"OES_texture_float\") || extensions.has(\"WEBGL_color_buffer_float\"))) && // Chrome Mac >= 52 and Firefox\n !halfFloatSupportedByExt) {\n console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.\");\n return;\n }\n // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer);\n } finally{\n // restore framebuffer of current render target if necessary\n const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;\n state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);\n }\n }\n };\n this.copyFramebufferToTexture = function(position, texture, level = 0) {\n const levelScale = Math.pow(2, -level);\n const width = Math.floor(texture.image.width * levelScale);\n const height = Math.floor(texture.image.height * levelScale);\n textures.setTexture2D(texture, 0);\n _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height);\n state.unbindTexture();\n };\n this.copyTextureToTexture = function(position, srcTexture, dstTexture, level = 0) {\n const width = srcTexture.image.width;\n const height = srcTexture.image.height;\n const glFormat = utils.convert(dstTexture.format);\n const glType = utils.convert(dstTexture.type);\n textures.setTexture2D(dstTexture, 0);\n // As another texture upload may have changed pixelStorei\n // parameters, make sure they are correct for the dstTexture\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);\n if (srcTexture.isDataTexture) _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data);\n else if (srcTexture.isCompressedTexture) _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data);\n else _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image);\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D);\n state.unbindTexture();\n };\n this.copyTextureToTexture3D = function(sourceBox, position, srcTexture, dstTexture, level = 0) {\n if (_this.isWebGL1Renderer) {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.\");\n return;\n }\n const width = sourceBox.max.x - sourceBox.min.x + 1;\n const height = sourceBox.max.y - sourceBox.min.y + 1;\n const depth = sourceBox.max.z - sourceBox.min.z + 1;\n const glFormat = utils.convert(dstTexture.format);\n const glType = utils.convert(dstTexture.type);\n let glTarget;\n if (dstTexture.isData3DTexture) {\n textures.setTexture3D(dstTexture, 0);\n glTarget = _gl.TEXTURE_3D;\n } else if (dstTexture.isDataArrayTexture) {\n textures.setTexture2DArray(dstTexture, 0);\n glTarget = _gl.TEXTURE_2D_ARRAY;\n } else {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.\");\n return;\n }\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);\n const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);\n const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);\n const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);\n const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);\n const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);\n const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image;\n _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);\n _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);\n _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x);\n _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y);\n _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z);\n if (srcTexture.isDataTexture || srcTexture.isData3DTexture) _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);\n else if (srcTexture.isCompressedArrayTexture) {\n console.warn(\"THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.\");\n _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);\n } else _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image);\n _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen);\n _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight);\n _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels);\n _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows);\n _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages);\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget);\n state.unbindTexture();\n };\n this.initTexture = function(texture) {\n if (texture.isCubeTexture) textures.setTextureCube(texture, 0);\n else if (texture.isData3DTexture) textures.setTexture3D(texture, 0);\n else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textures.setTexture2DArray(texture, 0);\n else textures.setTexture2D(texture, 0);\n state.unbindTexture();\n };\n this.resetState = function() {\n _currentActiveCubeFace = 0;\n _currentActiveMipmapLevel = 0;\n _currentRenderTarget = null;\n state.reset();\n bindingStates.reset();\n };\n if (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\", {\n detail: this\n }));\n }\n get coordinateSystem() {\n return $d5b33d7c30034067$export$5a0e9190d10875d3;\n }\n get physicallyCorrectLights() {\n console.warn(\"THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.\");\n return !this.useLegacyLights;\n }\n set physicallyCorrectLights(value) {\n console.warn(\"THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.\");\n this.useLegacyLights = !value;\n }\n get outputEncoding() {\n console.warn(\"THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.\");\n return this.outputColorSpace === $d5b33d7c30034067$export$561f394b24edfcaa ? $d5b33d7c30034067$export$f32388edbb32674 : $d5b33d7c30034067$export$7207336e4151a112;\n }\n set outputEncoding(encoding) {\n console.warn(\"THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.\");\n this.outputColorSpace = encoding === $d5b33d7c30034067$export$f32388edbb32674 ? $d5b33d7c30034067$export$561f394b24edfcaa : $d5b33d7c30034067$export$42429b3acfb233a4;\n }\n get useLegacyLights() {\n console.warn(\"THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.\");\n return this._useLegacyLights;\n }\n set useLegacyLights(value) {\n console.warn(\"THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.\");\n this._useLegacyLights = value;\n }\n}\nclass $d5b33d7c30034067$export$a2f65229194348f9 extends $d5b33d7c30034067$export$f6cc00ef28d7cf97 {\n}\n$d5b33d7c30034067$export$a2f65229194348f9.prototype.isWebGL1Renderer = true;\nclass $d5b33d7c30034067$export$6f1519f023b8d0f6 {\n constructor(color, density = 0.00025){\n this.isFogExp2 = true;\n this.name = \"\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(color);\n this.density = density;\n }\n clone() {\n return new $d5b33d7c30034067$export$6f1519f023b8d0f6(this.color, this.density);\n }\n toJSON() {\n return {\n type: \"FogExp2\",\n color: this.color.getHex(),\n density: this.density\n };\n }\n}\nclass $d5b33d7c30034067$export$3c890837b09508d4 {\n constructor(color, near = 1, far = 1000){\n this.isFog = true;\n this.name = \"\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(color);\n this.near = near;\n this.far = far;\n }\n clone() {\n return new $d5b33d7c30034067$export$3c890837b09508d4(this.color, this.near, this.far);\n }\n toJSON() {\n return {\n type: \"Fog\",\n color: this.color.getHex(),\n near: this.near,\n far: this.far\n };\n }\n}\nclass $d5b33d7c30034067$export$38af1803e3442a7f extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isScene = true;\n this.type = \"Scene\";\n this.background = null;\n this.environment = null;\n this.fog = null;\n this.backgroundBlurriness = 0;\n this.backgroundIntensity = 1;\n this.overrideMaterial = null;\n if (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\", {\n detail: this\n }));\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.background !== null) this.background = source.background.clone();\n if (source.environment !== null) this.environment = source.environment.clone();\n if (source.fog !== null) this.fog = source.fog.clone();\n this.backgroundBlurriness = source.backgroundBlurriness;\n this.backgroundIntensity = source.backgroundIntensity;\n if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.fog !== null) data.object.fog = this.fog.toJSON();\n if (this.backgroundBlurriness > 0) data.object.backgroundBlurriness = this.backgroundBlurriness;\n if (this.backgroundIntensity !== 1) data.object.backgroundIntensity = this.backgroundIntensity;\n return data;\n }\n}\nclass $d5b33d7c30034067$export$3d5cd879f108f53f {\n constructor(array, stride){\n this.isInterleavedBuffer = true;\n this.array = array;\n this.stride = stride;\n this.count = array !== undefined ? array.length / stride : 0;\n this.usage = $d5b33d7c30034067$export$763e8360f4d7f77d;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.version = 0;\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n }\n onUploadCallback() {}\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n copy(source) {\n this.array = new source.array.constructor(source.array);\n this.count = source.count;\n this.stride = source.stride;\n this.usage = source.usage;\n return this;\n }\n copyAt(index1, attribute, index2) {\n index1 *= this.stride;\n index2 *= attribute.stride;\n for(let i = 0, l = this.stride; i < l; i++)this.array[index1 + i] = attribute.array[index2 + i];\n return this;\n }\n set(value, offset = 0) {\n this.array.set(value, offset);\n return this;\n }\n clone(data) {\n if (data.arrayBuffers === undefined) data.arrayBuffers = {};\n if (this.array.buffer._uuid === undefined) this.array.buffer._uuid = $d5b33d7c30034067$var$generateUUID();\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;\n const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);\n const ib = new this.constructor(array, this.stride);\n ib.setUsage(this.usage);\n return ib;\n }\n onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n toJSON(data) {\n if (data.arrayBuffers === undefined) data.arrayBuffers = {};\n // generate UUID for array buffer if necessary\n if (this.array.buffer._uuid === undefined) this.array.buffer._uuid = $d5b33d7c30034067$var$generateUUID();\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));\n //\n return {\n uuid: this.uuid,\n buffer: this.array.buffer._uuid,\n type: this.array.constructor.name,\n stride: this.stride\n };\n }\n}\nconst $d5b33d7c30034067$var$_vector$5 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$920b6d07334599c7 {\n constructor(interleavedBuffer, itemSize, offset, normalized = false){\n this.isInterleavedBufferAttribute = true;\n this.name = \"\";\n this.data = interleavedBuffer;\n this.itemSize = itemSize;\n this.offset = offset;\n this.normalized = normalized;\n }\n get count() {\n return this.data.count;\n }\n get array() {\n return this.data.array;\n }\n set needsUpdate(value) {\n this.data.needsUpdate = value;\n }\n applyMatrix4(m) {\n for(let i = 0, l = this.data.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$5.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$5.applyMatrix4(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$5.x, $d5b33d7c30034067$var$_vector$5.y, $d5b33d7c30034067$var$_vector$5.z);\n }\n return this;\n }\n applyNormalMatrix(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$5.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$5.applyNormalMatrix(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$5.x, $d5b33d7c30034067$var$_vector$5.y, $d5b33d7c30034067$var$_vector$5.z);\n }\n return this;\n }\n transformDirection(m) {\n for(let i = 0, l = this.count; i < l; i++){\n $d5b33d7c30034067$var$_vector$5.fromBufferAttribute(this, i);\n $d5b33d7c30034067$var$_vector$5.transformDirection(m);\n this.setXYZ(i, $d5b33d7c30034067$var$_vector$5.x, $d5b33d7c30034067$var$_vector$5.y, $d5b33d7c30034067$var$_vector$5.z);\n }\n return this;\n }\n setX(index, x) {\n if (this.normalized) x = $d5b33d7c30034067$var$normalize(x, this.array);\n this.data.array[index * this.data.stride + this.offset] = x;\n return this;\n }\n setY(index, y) {\n if (this.normalized) y = $d5b33d7c30034067$var$normalize(y, this.array);\n this.data.array[index * this.data.stride + this.offset + 1] = y;\n return this;\n }\n setZ(index, z) {\n if (this.normalized) z = $d5b33d7c30034067$var$normalize(z, this.array);\n this.data.array[index * this.data.stride + this.offset + 2] = z;\n return this;\n }\n setW(index, w) {\n if (this.normalized) w = $d5b33d7c30034067$var$normalize(w, this.array);\n this.data.array[index * this.data.stride + this.offset + 3] = w;\n return this;\n }\n getX(index) {\n let x = this.data.array[index * this.data.stride + this.offset];\n if (this.normalized) x = $d5b33d7c30034067$var$denormalize(x, this.array);\n return x;\n }\n getY(index) {\n let y = this.data.array[index * this.data.stride + this.offset + 1];\n if (this.normalized) y = $d5b33d7c30034067$var$denormalize(y, this.array);\n return y;\n }\n getZ(index) {\n let z = this.data.array[index * this.data.stride + this.offset + 2];\n if (this.normalized) z = $d5b33d7c30034067$var$denormalize(z, this.array);\n return z;\n }\n getW(index) {\n let w = this.data.array[index * this.data.stride + this.offset + 3];\n if (this.normalized) w = $d5b33d7c30034067$var$denormalize(w, this.array);\n return w;\n }\n setXY(index, x, y) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n return this;\n }\n setXYZ(index, x, y, z) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n return this;\n }\n setXYZW(index, x, y, z, w) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = $d5b33d7c30034067$var$normalize(x, this.array);\n y = $d5b33d7c30034067$var$normalize(y, this.array);\n z = $d5b33d7c30034067$var$normalize(z, this.array);\n w = $d5b33d7c30034067$var$normalize(w, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n this.data.array[index + 3] = w;\n return this;\n }\n clone(data) {\n if (data === undefined) {\n console.log(\"THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.\");\n const array = [];\n for(let i = 0; i < this.count; i++){\n const index = i * this.data.stride + this.offset;\n for(let j = 0; j < this.itemSize; j++)array.push(this.data.array[index + j]);\n }\n return new $d5b33d7c30034067$export$8dea267bd6bde117(new this.array.constructor(array), this.itemSize, this.normalized);\n } else {\n if (data.interleavedBuffers === undefined) data.interleavedBuffers = {};\n if (data.interleavedBuffers[this.data.uuid] === undefined) data.interleavedBuffers[this.data.uuid] = this.data.clone(data);\n return new $d5b33d7c30034067$export$920b6d07334599c7(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);\n }\n }\n toJSON(data) {\n if (data === undefined) {\n console.log(\"THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.\");\n const array = [];\n for(let i = 0; i < this.count; i++){\n const index = i * this.data.stride + this.offset;\n for(let j = 0; j < this.itemSize; j++)array.push(this.data.array[index + j]);\n }\n // de-interleave data and save it as an ordinary buffer attribute for now\n return {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: array,\n normalized: this.normalized\n };\n } else {\n // save as true interleaved attribute\n if (data.interleavedBuffers === undefined) data.interleavedBuffers = {};\n if (data.interleavedBuffers[this.data.uuid] === undefined) data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);\n return {\n isInterleavedBufferAttribute: true,\n itemSize: this.itemSize,\n data: this.data.uuid,\n offset: this.offset,\n normalized: this.normalized\n };\n }\n }\n}\nclass $d5b33d7c30034067$export$5ec7dd1c6994bf8e extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isSpriteMaterial = true;\n this.type = \"SpriteMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.alphaMap = null;\n this.rotation = 0;\n this.sizeAttenuation = true;\n this.transparent = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.rotation = source.rotation;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n}\nlet $d5b33d7c30034067$var$_geometry;\nconst $d5b33d7c30034067$var$_intersectPoint = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_worldScale = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_mvPosition = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_alignedPosition = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_rotatedPosition = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_viewWorldMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_vA = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vB = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_vC = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_uvA = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_uvB = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nconst $d5b33d7c30034067$var$_uvC = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nclass $d5b33d7c30034067$export$3075603db8e6204c extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(material){\n super();\n this.isSprite = true;\n this.type = \"Sprite\";\n if ($d5b33d7c30034067$var$_geometry === undefined) {\n $d5b33d7c30034067$var$_geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n const float32Array = new Float32Array([\n -0.5,\n -0.5,\n 0,\n 0,\n 0,\n 0.5,\n -0.5,\n 0,\n 1,\n 0,\n 0.5,\n 0.5,\n 0,\n 1,\n 1,\n -0.5,\n 0.5,\n 0,\n 0,\n 1\n ]);\n const interleavedBuffer = new $d5b33d7c30034067$export$3d5cd879f108f53f(float32Array, 5);\n $d5b33d7c30034067$var$_geometry.setIndex([\n 0,\n 1,\n 2,\n 0,\n 2,\n 3\n ]);\n $d5b33d7c30034067$var$_geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$920b6d07334599c7(interleavedBuffer, 3, 0, false));\n $d5b33d7c30034067$var$_geometry.setAttribute(\"uv\", new $d5b33d7c30034067$export$920b6d07334599c7(interleavedBuffer, 2, 3, false));\n }\n this.geometry = $d5b33d7c30034067$var$_geometry;\n this.material = material !== undefined ? material : new $d5b33d7c30034067$export$5ec7dd1c6994bf8e();\n this.center = new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, 0.5);\n }\n raycast(raycaster, intersects) {\n if (raycaster.camera === null) console.error('THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.');\n $d5b33d7c30034067$var$_worldScale.setFromMatrixScale(this.matrixWorld);\n $d5b33d7c30034067$var$_viewWorldMatrix.copy(raycaster.camera.matrixWorld);\n this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld);\n $d5b33d7c30034067$var$_mvPosition.setFromMatrixPosition(this.modelViewMatrix);\n if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) $d5b33d7c30034067$var$_worldScale.multiplyScalar(-$d5b33d7c30034067$var$_mvPosition.z);\n const rotation = this.material.rotation;\n let sin, cos;\n if (rotation !== 0) {\n cos = Math.cos(rotation);\n sin = Math.sin(rotation);\n }\n const center = this.center;\n $d5b33d7c30034067$var$transformVertex($d5b33d7c30034067$var$_vA.set(-0.5, -0.5, 0), $d5b33d7c30034067$var$_mvPosition, center, $d5b33d7c30034067$var$_worldScale, sin, cos);\n $d5b33d7c30034067$var$transformVertex($d5b33d7c30034067$var$_vB.set(0.5, -0.5, 0), $d5b33d7c30034067$var$_mvPosition, center, $d5b33d7c30034067$var$_worldScale, sin, cos);\n $d5b33d7c30034067$var$transformVertex($d5b33d7c30034067$var$_vC.set(0.5, 0.5, 0), $d5b33d7c30034067$var$_mvPosition, center, $d5b33d7c30034067$var$_worldScale, sin, cos);\n $d5b33d7c30034067$var$_uvA.set(0, 0);\n $d5b33d7c30034067$var$_uvB.set(1, 0);\n $d5b33d7c30034067$var$_uvC.set(1, 1);\n // check first triangle\n let intersect = raycaster.ray.intersectTriangle($d5b33d7c30034067$var$_vA, $d5b33d7c30034067$var$_vB, $d5b33d7c30034067$var$_vC, false, $d5b33d7c30034067$var$_intersectPoint);\n if (intersect === null) {\n // check second triangle\n $d5b33d7c30034067$var$transformVertex($d5b33d7c30034067$var$_vB.set(-0.5, 0.5, 0), $d5b33d7c30034067$var$_mvPosition, center, $d5b33d7c30034067$var$_worldScale, sin, cos);\n $d5b33d7c30034067$var$_uvB.set(0, 1);\n intersect = raycaster.ray.intersectTriangle($d5b33d7c30034067$var$_vA, $d5b33d7c30034067$var$_vC, $d5b33d7c30034067$var$_vB, false, $d5b33d7c30034067$var$_intersectPoint);\n if (intersect === null) return;\n }\n const distance = raycaster.ray.origin.distanceTo($d5b33d7c30034067$var$_intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n point: $d5b33d7c30034067$var$_intersectPoint.clone(),\n uv: $d5b33d7c30034067$export$5a465592bfe74b48.getInterpolation($d5b33d7c30034067$var$_intersectPoint, $d5b33d7c30034067$var$_vA, $d5b33d7c30034067$var$_vB, $d5b33d7c30034067$var$_vC, $d5b33d7c30034067$var$_uvA, $d5b33d7c30034067$var$_uvB, $d5b33d7c30034067$var$_uvC, new $d5b33d7c30034067$export$c977b3e384af9ae1()),\n face: null,\n object: this\n });\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n if (source.center !== undefined) this.center.copy(source.center);\n this.material = source.material;\n return this;\n }\n}\nfunction $d5b33d7c30034067$var$transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {\n // compute position in camera space\n $d5b33d7c30034067$var$_alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale);\n // to check if rotation is not zero\n if (sin !== undefined) {\n $d5b33d7c30034067$var$_rotatedPosition.x = cos * $d5b33d7c30034067$var$_alignedPosition.x - sin * $d5b33d7c30034067$var$_alignedPosition.y;\n $d5b33d7c30034067$var$_rotatedPosition.y = sin * $d5b33d7c30034067$var$_alignedPosition.x + cos * $d5b33d7c30034067$var$_alignedPosition.y;\n } else $d5b33d7c30034067$var$_rotatedPosition.copy($d5b33d7c30034067$var$_alignedPosition);\n vertexPosition.copy(mvPosition);\n vertexPosition.x += $d5b33d7c30034067$var$_rotatedPosition.x;\n vertexPosition.y += $d5b33d7c30034067$var$_rotatedPosition.y;\n // transform to world space\n vertexPosition.applyMatrix4($d5b33d7c30034067$var$_viewWorldMatrix);\n}\nconst $d5b33d7c30034067$var$_v1$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v2$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$112e7237be0c5f30 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this._currentLevel = 0;\n this.type = \"LOD\";\n Object.defineProperties(this, {\n levels: {\n enumerable: true,\n value: []\n },\n isLOD: {\n value: true\n }\n });\n this.autoUpdate = true;\n }\n copy(source) {\n super.copy(source, false);\n const levels = source.levels;\n for(let i = 0, l = levels.length; i < l; i++){\n const level = levels[i];\n this.addLevel(level.object.clone(), level.distance, level.hysteresis);\n }\n this.autoUpdate = source.autoUpdate;\n return this;\n }\n addLevel(object, distance = 0, hysteresis = 0) {\n distance = Math.abs(distance);\n const levels = this.levels;\n let l;\n for(l = 0; l < levels.length; l++){\n if (distance < levels[l].distance) break;\n }\n levels.splice(l, 0, {\n distance: distance,\n hysteresis: hysteresis,\n object: object\n });\n this.add(object);\n return this;\n }\n getCurrentLevel() {\n return this._currentLevel;\n }\n getObjectForDistance(distance) {\n const levels = this.levels;\n if (levels.length > 0) {\n let i, l;\n for(i = 1, l = levels.length; i < l; i++){\n let levelDistance = levels[i].distance;\n if (levels[i].object.visible) levelDistance -= levelDistance * levels[i].hysteresis;\n if (distance < levelDistance) break;\n }\n return levels[i - 1].object;\n }\n return null;\n }\n raycast(raycaster, intersects) {\n const levels = this.levels;\n if (levels.length > 0) {\n $d5b33d7c30034067$var$_v1$2.setFromMatrixPosition(this.matrixWorld);\n const distance = raycaster.ray.origin.distanceTo($d5b33d7c30034067$var$_v1$2);\n this.getObjectForDistance(distance).raycast(raycaster, intersects);\n }\n }\n update(camera) {\n const levels = this.levels;\n if (levels.length > 1) {\n $d5b33d7c30034067$var$_v1$2.setFromMatrixPosition(camera.matrixWorld);\n $d5b33d7c30034067$var$_v2$1.setFromMatrixPosition(this.matrixWorld);\n const distance = $d5b33d7c30034067$var$_v1$2.distanceTo($d5b33d7c30034067$var$_v2$1) / camera.zoom;\n levels[0].object.visible = true;\n let i, l;\n for(i = 1, l = levels.length; i < l; i++){\n let levelDistance = levels[i].distance;\n if (levels[i].object.visible) levelDistance -= levelDistance * levels[i].hysteresis;\n if (distance >= levelDistance) {\n levels[i - 1].object.visible = false;\n levels[i].object.visible = true;\n } else break;\n }\n this._currentLevel = i - 1;\n for(; i < l; i++)levels[i].object.visible = false;\n }\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n if (this.autoUpdate === false) data.object.autoUpdate = false;\n data.object.levels = [];\n const levels = this.levels;\n for(let i = 0, l = levels.length; i < l; i++){\n const level = levels[i];\n data.object.levels.push({\n object: level.object.uuid,\n distance: level.distance,\n hysteresis: level.hysteresis\n });\n }\n return data;\n }\n}\nconst $d5b33d7c30034067$var$_basePosition = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_skinIndex = /*@__PURE__*/ new $d5b33d7c30034067$export$fa7daccca11cdbe3();\nconst $d5b33d7c30034067$var$_skinWeight = /*@__PURE__*/ new $d5b33d7c30034067$export$fa7daccca11cdbe3();\nconst $d5b33d7c30034067$var$_vector3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_matrix4 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_vertex = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_sphere$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nconst $d5b33d7c30034067$var$_inverseMatrix$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_ray$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$a186db52eed6d40e();\nclass $d5b33d7c30034067$export$b303577035157ecf extends $d5b33d7c30034067$export$e176487c05830cc5 {\n constructor(geometry, material){\n super(geometry, material);\n this.isSkinnedMesh = true;\n this.type = \"SkinnedMesh\";\n this.bindMode = \"attached\";\n this.bindMatrix = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.bindMatrixInverse = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.boundingBox = null;\n this.boundingSphere = null;\n }\n computeBoundingBox() {\n const geometry = this.geometry;\n if (this.boundingBox === null) this.boundingBox = new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\n this.boundingBox.makeEmpty();\n const positionAttribute = geometry.getAttribute(\"position\");\n for(let i = 0; i < positionAttribute.count; i++){\n $d5b33d7c30034067$var$_vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, $d5b33d7c30034067$var$_vertex);\n this.boundingBox.expandByPoint($d5b33d7c30034067$var$_vertex);\n }\n }\n computeBoundingSphere() {\n const geometry = this.geometry;\n if (this.boundingSphere === null) this.boundingSphere = new $d5b33d7c30034067$export$805e8b72413ccaba();\n this.boundingSphere.makeEmpty();\n const positionAttribute = geometry.getAttribute(\"position\");\n for(let i = 0; i < positionAttribute.count; i++){\n $d5b33d7c30034067$var$_vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, $d5b33d7c30034067$var$_vertex);\n this.boundingSphere.expandByPoint($d5b33d7c30034067$var$_vertex);\n }\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.bindMode = source.bindMode;\n this.bindMatrix.copy(source.bindMatrix);\n this.bindMatrixInverse.copy(source.bindMatrixInverse);\n this.skeleton = source.skeleton;\n if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();\n if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();\n return this;\n }\n raycast(raycaster, intersects) {\n const material = this.material;\n const matrixWorld = this.matrixWorld;\n if (material === undefined) return;\n // test with bounding sphere in world space\n if (this.boundingSphere === null) this.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$3.copy(this.boundingSphere);\n $d5b33d7c30034067$var$_sphere$3.applyMatrix4(matrixWorld);\n if (raycaster.ray.intersectsSphere($d5b33d7c30034067$var$_sphere$3) === false) return;\n // convert ray to local space of skinned mesh\n $d5b33d7c30034067$var$_inverseMatrix$2.copy(matrixWorld).invert();\n $d5b33d7c30034067$var$_ray$2.copy(raycaster.ray).applyMatrix4($d5b33d7c30034067$var$_inverseMatrix$2);\n // test with bounding box in local space\n if (this.boundingBox !== null) {\n if ($d5b33d7c30034067$var$_ray$2.intersectsBox(this.boundingBox) === false) return;\n }\n // test for intersections with geometry\n this._computeIntersections(raycaster, intersects, $d5b33d7c30034067$var$_ray$2);\n }\n getVertexPosition(index, target) {\n super.getVertexPosition(index, target);\n this.applyBoneTransform(index, target);\n return target;\n }\n bind(skeleton, bindMatrix) {\n this.skeleton = skeleton;\n if (bindMatrix === undefined) {\n this.updateMatrixWorld(true);\n this.skeleton.calculateInverses();\n bindMatrix = this.matrixWorld;\n }\n this.bindMatrix.copy(bindMatrix);\n this.bindMatrixInverse.copy(bindMatrix).invert();\n }\n pose() {\n this.skeleton.pose();\n }\n normalizeSkinWeights() {\n const vector = new $d5b33d7c30034067$export$fa7daccca11cdbe3();\n const skinWeight = this.geometry.attributes.skinWeight;\n for(let i = 0, l = skinWeight.count; i < l; i++){\n vector.fromBufferAttribute(skinWeight, i);\n const scale = 1.0 / vector.manhattanLength();\n if (scale !== Infinity) vector.multiplyScalar(scale);\n else vector.set(1, 0, 0, 0); // do something reasonable\n skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w);\n }\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.bindMode === \"attached\") this.bindMatrixInverse.copy(this.matrixWorld).invert();\n else if (this.bindMode === \"detached\") this.bindMatrixInverse.copy(this.bindMatrix).invert();\n else console.warn(\"THREE.SkinnedMesh: Unrecognized bindMode: \" + this.bindMode);\n }\n applyBoneTransform(index, vector) {\n const skeleton = this.skeleton;\n const geometry = this.geometry;\n $d5b33d7c30034067$var$_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);\n $d5b33d7c30034067$var$_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);\n $d5b33d7c30034067$var$_basePosition.copy(vector).applyMatrix4(this.bindMatrix);\n vector.set(0, 0, 0);\n for(let i = 0; i < 4; i++){\n const weight = $d5b33d7c30034067$var$_skinWeight.getComponent(i);\n if (weight !== 0) {\n const boneIndex = $d5b33d7c30034067$var$_skinIndex.getComponent(i);\n $d5b33d7c30034067$var$_matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);\n vector.addScaledVector($d5b33d7c30034067$var$_vector3.copy($d5b33d7c30034067$var$_basePosition).applyMatrix4($d5b33d7c30034067$var$_matrix4), weight);\n }\n }\n return vector.applyMatrix4(this.bindMatrixInverse);\n }\n boneTransform(index, vector) {\n console.warn(\"THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.\");\n return this.applyBoneTransform(index, vector);\n }\n}\nclass $d5b33d7c30034067$export$b127726e56765aa4 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.isBone = true;\n this.type = \"Bone\";\n }\n}\nclass $d5b33d7c30034067$export$b691f601014eabe1 extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0, minFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0, anisotropy, colorSpace1){\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isDataTexture = true;\n this.image = {\n data: data,\n width: width,\n height: height\n };\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nconst $d5b33d7c30034067$var$_offsetMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_identityMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nclass $d5b33d7c30034067$export$8f31e4c4a37b8e9c {\n constructor(bones = [], boneInverses = []){\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.bones = bones.slice(0);\n this.boneInverses = boneInverses;\n this.boneMatrices = null;\n this.boneTexture = null;\n this.boneTextureSize = 0;\n this.init();\n }\n init() {\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n this.boneMatrices = new Float32Array(bones.length * 16);\n // calculate inverse bone matrices if necessary\n if (boneInverses.length === 0) this.calculateInverses();\n else // handle special case\n if (bones.length !== boneInverses.length) {\n console.warn(\"THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.\");\n this.boneInverses = [];\n for(let i = 0, il = this.bones.length; i < il; i++)this.boneInverses.push(new $d5b33d7c30034067$export$2ae72fc923e5eb5());\n }\n }\n calculateInverses() {\n this.boneInverses.length = 0;\n for(let i = 0, il = this.bones.length; i < il; i++){\n const inverse = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n if (this.bones[i]) inverse.copy(this.bones[i].matrixWorld).invert();\n this.boneInverses.push(inverse);\n }\n }\n pose() {\n // recover the bind-time world matrices\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone) bone.matrixWorld.copy(this.boneInverses[i]).invert();\n }\n // compute the local matrices, positions, rotations and scales\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone) {\n if (bone.parent && bone.parent.isBone) {\n bone.matrix.copy(bone.parent.matrixWorld).invert();\n bone.matrix.multiply(bone.matrixWorld);\n } else bone.matrix.copy(bone.matrixWorld);\n bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);\n }\n }\n }\n update() {\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n const boneMatrices = this.boneMatrices;\n const boneTexture = this.boneTexture;\n // flatten bone matrices to array\n for(let i = 0, il = bones.length; i < il; i++){\n // compute the offset between the current and the original transform\n const matrix = bones[i] ? bones[i].matrixWorld : $d5b33d7c30034067$var$_identityMatrix;\n $d5b33d7c30034067$var$_offsetMatrix.multiplyMatrices(matrix, boneInverses[i]);\n $d5b33d7c30034067$var$_offsetMatrix.toArray(boneMatrices, i * 16);\n }\n if (boneTexture !== null) boneTexture.needsUpdate = true;\n }\n clone() {\n return new $d5b33d7c30034067$export$8f31e4c4a37b8e9c(this.bones, this.boneInverses);\n }\n computeBoneTexture() {\n // layout (1 matrix = 4 pixels)\n // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix\n size = $d5b33d7c30034067$var$ceilPowerOfTwo(size);\n size = Math.max(size, 4);\n const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel\n boneMatrices.set(this.boneMatrices); // copy current values\n const boneTexture = new $d5b33d7c30034067$export$b691f601014eabe1(boneMatrices, size, size, $d5b33d7c30034067$export$3f8bb04b555a363c, $d5b33d7c30034067$export$f6d331659b644596);\n boneTexture.needsUpdate = true;\n this.boneMatrices = boneMatrices;\n this.boneTexture = boneTexture;\n this.boneTextureSize = size;\n return this;\n }\n getBoneByName(name) {\n for(let i = 0, il = this.bones.length; i < il; i++){\n const bone = this.bones[i];\n if (bone.name === name) return bone;\n }\n return undefined;\n }\n dispose() {\n if (this.boneTexture !== null) {\n this.boneTexture.dispose();\n this.boneTexture = null;\n }\n }\n fromJSON(json, bones) {\n this.uuid = json.uuid;\n for(let i = 0, l = json.bones.length; i < l; i++){\n const uuid = json.bones[i];\n let bone = bones[uuid];\n if (bone === undefined) {\n console.warn(\"THREE.Skeleton: No bone found with UUID:\", uuid);\n bone = new $d5b33d7c30034067$export$b127726e56765aa4();\n }\n this.bones.push(bone);\n this.boneInverses.push(new $d5b33d7c30034067$export$2ae72fc923e5eb5().fromArray(json.boneInverses[i]));\n }\n this.init();\n return this;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"Skeleton\",\n generator: \"Skeleton.toJSON\"\n },\n bones: [],\n boneInverses: []\n };\n data.uuid = this.uuid;\n const bones = this.bones;\n const boneInverses = this.boneInverses;\n for(let i = 0, l = bones.length; i < l; i++){\n const bone = bones[i];\n data.bones.push(bone.uuid);\n const boneInverse = boneInverses[i];\n data.boneInverses.push(boneInverse.toArray());\n }\n return data;\n }\n}\nclass $d5b33d7c30034067$export$32ea87a8b54d744a extends $d5b33d7c30034067$export$8dea267bd6bde117 {\n constructor(array, itemSize, normalized, meshPerAttribute = 1){\n super(array, itemSize, normalized);\n this.isInstancedBufferAttribute = true;\n this.meshPerAttribute = meshPerAttribute;\n }\n copy(source) {\n super.copy(source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.meshPerAttribute = this.meshPerAttribute;\n data.isInstancedBufferAttribute = true;\n return data;\n }\n}\nconst $d5b33d7c30034067$var$_instanceLocalMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_instanceWorldMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_instanceIntersects = [];\nconst $d5b33d7c30034067$var$_box3 = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\nconst $d5b33d7c30034067$var$_identity = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_mesh = /*@__PURE__*/ new $d5b33d7c30034067$export$e176487c05830cc5();\nconst $d5b33d7c30034067$var$_sphere$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nclass $d5b33d7c30034067$export$f3c979c331175ad7 extends $d5b33d7c30034067$export$e176487c05830cc5 {\n constructor(geometry, material, count){\n super(geometry, material);\n this.isInstancedMesh = true;\n this.instanceMatrix = new $d5b33d7c30034067$export$32ea87a8b54d744a(new Float32Array(count * 16), 16);\n this.instanceColor = null;\n this.count = count;\n this.boundingBox = null;\n this.boundingSphere = null;\n for(let i = 0; i < count; i++)this.setMatrixAt(i, $d5b33d7c30034067$var$_identity);\n }\n computeBoundingBox() {\n const geometry = this.geometry;\n const count = this.count;\n if (this.boundingBox === null) this.boundingBox = new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\n if (geometry.boundingBox === null) geometry.computeBoundingBox();\n this.boundingBox.makeEmpty();\n for(let i = 0; i < count; i++){\n this.getMatrixAt(i, $d5b33d7c30034067$var$_instanceLocalMatrix);\n $d5b33d7c30034067$var$_box3.copy(geometry.boundingBox).applyMatrix4($d5b33d7c30034067$var$_instanceLocalMatrix);\n this.boundingBox.union($d5b33d7c30034067$var$_box3);\n }\n }\n computeBoundingSphere() {\n const geometry = this.geometry;\n const count = this.count;\n if (this.boundingSphere === null) this.boundingSphere = new $d5b33d7c30034067$export$805e8b72413ccaba();\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n this.boundingSphere.makeEmpty();\n for(let i = 0; i < count; i++){\n this.getMatrixAt(i, $d5b33d7c30034067$var$_instanceLocalMatrix);\n $d5b33d7c30034067$var$_sphere$2.copy(geometry.boundingSphere).applyMatrix4($d5b33d7c30034067$var$_instanceLocalMatrix);\n this.boundingSphere.union($d5b33d7c30034067$var$_sphere$2);\n }\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.instanceMatrix.copy(source.instanceMatrix);\n if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();\n this.count = source.count;\n if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();\n if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();\n return this;\n }\n getColorAt(index, color) {\n color.fromArray(this.instanceColor.array, index * 3);\n }\n getMatrixAt(index, matrix) {\n matrix.fromArray(this.instanceMatrix.array, index * 16);\n }\n raycast(raycaster, intersects) {\n const matrixWorld = this.matrixWorld;\n const raycastTimes = this.count;\n $d5b33d7c30034067$var$_mesh.geometry = this.geometry;\n $d5b33d7c30034067$var$_mesh.material = this.material;\n if ($d5b33d7c30034067$var$_mesh.material === undefined) return;\n // test with bounding sphere first\n if (this.boundingSphere === null) this.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$2.copy(this.boundingSphere);\n $d5b33d7c30034067$var$_sphere$2.applyMatrix4(matrixWorld);\n if (raycaster.ray.intersectsSphere($d5b33d7c30034067$var$_sphere$2) === false) return;\n // now test each instance\n for(let instanceId = 0; instanceId < raycastTimes; instanceId++){\n // calculate the world matrix for each instance\n this.getMatrixAt(instanceId, $d5b33d7c30034067$var$_instanceLocalMatrix);\n $d5b33d7c30034067$var$_instanceWorldMatrix.multiplyMatrices(matrixWorld, $d5b33d7c30034067$var$_instanceLocalMatrix);\n // the mesh represents this single instance\n $d5b33d7c30034067$var$_mesh.matrixWorld = $d5b33d7c30034067$var$_instanceWorldMatrix;\n $d5b33d7c30034067$var$_mesh.raycast(raycaster, $d5b33d7c30034067$var$_instanceIntersects);\n // process the result of raycast\n for(let i = 0, l = $d5b33d7c30034067$var$_instanceIntersects.length; i < l; i++){\n const intersect = $d5b33d7c30034067$var$_instanceIntersects[i];\n intersect.instanceId = instanceId;\n intersect.object = this;\n intersects.push(intersect);\n }\n $d5b33d7c30034067$var$_instanceIntersects.length = 0;\n }\n }\n setColorAt(index, color) {\n if (this.instanceColor === null) this.instanceColor = new $d5b33d7c30034067$export$32ea87a8b54d744a(new Float32Array(this.instanceMatrix.count * 3), 3);\n color.toArray(this.instanceColor.array, index * 3);\n }\n setMatrixAt(index, matrix) {\n matrix.toArray(this.instanceMatrix.array, index * 16);\n }\n updateMorphTargets() {}\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n }\n}\nclass $d5b33d7c30034067$export$fbaaa33907730a0c extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isLineBasicMaterial = true;\n this.type = \"LineBasicMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.linewidth = 1;\n this.linecap = \"round\";\n this.linejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.linewidth = source.linewidth;\n this.linecap = source.linecap;\n this.linejoin = source.linejoin;\n this.fog = source.fog;\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_start$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_end$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_inverseMatrix$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_ray$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$a186db52eed6d40e();\nconst $d5b33d7c30034067$var$_sphere$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nclass $d5b33d7c30034067$export$17d680238e50603e extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(geometry = new $d5b33d7c30034067$export$b7be63a67df8959(), material = new $d5b33d7c30034067$export$fbaaa33907730a0c()){\n super();\n this.isLine = true;\n this.type = \"Line\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n computeLineDistances() {\n const geometry = this.geometry;\n // we assume non-indexed geometry\n if (geometry.index === null) {\n const positionAttribute = geometry.attributes.position;\n const lineDistances = [\n 0\n ];\n for(let i = 1, l = positionAttribute.count; i < l; i++){\n $d5b33d7c30034067$var$_start$1.fromBufferAttribute(positionAttribute, i - 1);\n $d5b33d7c30034067$var$_end$1.fromBufferAttribute(positionAttribute, i);\n lineDistances[i] = lineDistances[i - 1];\n lineDistances[i] += $d5b33d7c30034067$var$_start$1.distanceTo($d5b33d7c30034067$var$_end$1);\n }\n geometry.setAttribute(\"lineDistance\", new $d5b33d7c30034067$export$cbe7a62641830ebd(lineDistances, 1));\n } else console.warn(\"THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const matrixWorld = this.matrixWorld;\n const threshold = raycaster.params.Line.threshold;\n const drawRange = geometry.drawRange;\n // Checking boundingSphere distance to ray\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere$1.copy(geometry.boundingSphere);\n $d5b33d7c30034067$var$_sphere$1.applyMatrix4(matrixWorld);\n $d5b33d7c30034067$var$_sphere$1.radius += threshold;\n if (raycaster.ray.intersectsSphere($d5b33d7c30034067$var$_sphere$1) === false) return;\n //\n $d5b33d7c30034067$var$_inverseMatrix$1.copy(matrixWorld).invert();\n $d5b33d7c30034067$var$_ray$1.copy(raycaster.ray).applyMatrix4($d5b33d7c30034067$var$_inverseMatrix$1);\n const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n const localThresholdSq = localThreshold * localThreshold;\n const vStart = new $d5b33d7c30034067$export$64b5c384219d3699();\n const vEnd = new $d5b33d7c30034067$export$64b5c384219d3699();\n const interSegment = new $d5b33d7c30034067$export$64b5c384219d3699();\n const interRay = new $d5b33d7c30034067$export$64b5c384219d3699();\n const step = this.isLineSegments ? 2 : 1;\n const index = geometry.index;\n const attributes = geometry.attributes;\n const positionAttribute = attributes.position;\n if (index !== null) {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, l = end - 1; i < l; i += step){\n const a = index.getX(i);\n const b = index.getX(i + 1);\n vStart.fromBufferAttribute(positionAttribute, a);\n vEnd.fromBufferAttribute(positionAttribute, b);\n const distSq = $d5b33d7c30034067$var$_ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n const distance = raycaster.ray.origin.distanceTo(interRay);\n if (distance < raycaster.near || distance > raycaster.far) continue;\n intersects.push({\n distance: distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: i,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n } else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for(let i = start, l = end - 1; i < l; i += step){\n vStart.fromBufferAttribute(positionAttribute, i);\n vEnd.fromBufferAttribute(positionAttribute, i + 1);\n const distSq = $d5b33d7c30034067$var$_ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n const distance = raycaster.ray.origin.distanceTo(interRay);\n if (distance < raycaster.near || distance > raycaster.far) continue;\n intersects.push({\n distance: distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: i,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n }\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n}\nconst $d5b33d7c30034067$var$_start = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_end = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$ff1ed10fedfdd604 extends $d5b33d7c30034067$export$17d680238e50603e {\n constructor(geometry, material){\n super(geometry, material);\n this.isLineSegments = true;\n this.type = \"LineSegments\";\n }\n computeLineDistances() {\n const geometry = this.geometry;\n // we assume non-indexed geometry\n if (geometry.index === null) {\n const positionAttribute = geometry.attributes.position;\n const lineDistances = [];\n for(let i = 0, l = positionAttribute.count; i < l; i += 2){\n $d5b33d7c30034067$var$_start.fromBufferAttribute(positionAttribute, i);\n $d5b33d7c30034067$var$_end.fromBufferAttribute(positionAttribute, i + 1);\n lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1];\n lineDistances[i + 1] = lineDistances[i] + $d5b33d7c30034067$var$_start.distanceTo($d5b33d7c30034067$var$_end);\n }\n geometry.setAttribute(\"lineDistance\", new $d5b33d7c30034067$export$cbe7a62641830ebd(lineDistances, 1));\n } else console.warn(\"THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n}\nclass $d5b33d7c30034067$export$f85a24d745e4f17d extends $d5b33d7c30034067$export$17d680238e50603e {\n constructor(geometry, material){\n super(geometry, material);\n this.isLineLoop = true;\n this.type = \"LineLoop\";\n }\n}\nclass $d5b33d7c30034067$export$a178c45366ce5d6b extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isPointsMaterial = true;\n this.type = \"PointsMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.alphaMap = null;\n this.size = 1;\n this.sizeAttenuation = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.size = source.size;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_inverseMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_ray = /*@__PURE__*/ new $d5b33d7c30034067$export$a186db52eed6d40e();\nconst $d5b33d7c30034067$var$_sphere = /*@__PURE__*/ new $d5b33d7c30034067$export$805e8b72413ccaba();\nconst $d5b33d7c30034067$var$_position$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$1c787534cb11aa3e extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(geometry = new $d5b33d7c30034067$export$b7be63a67df8959(), material = new $d5b33d7c30034067$export$a178c45366ce5d6b()){\n super();\n this.isPoints = true;\n this.type = \"Points\";\n this.geometry = geometry;\n this.material = material;\n this.updateMorphTargets();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n raycast(raycaster, intersects) {\n const geometry = this.geometry;\n const matrixWorld = this.matrixWorld;\n const threshold = raycaster.params.Points.threshold;\n const drawRange = geometry.drawRange;\n // Checking boundingSphere distance to ray\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n $d5b33d7c30034067$var$_sphere.copy(geometry.boundingSphere);\n $d5b33d7c30034067$var$_sphere.applyMatrix4(matrixWorld);\n $d5b33d7c30034067$var$_sphere.radius += threshold;\n if (raycaster.ray.intersectsSphere($d5b33d7c30034067$var$_sphere) === false) return;\n //\n $d5b33d7c30034067$var$_inverseMatrix.copy(matrixWorld).invert();\n $d5b33d7c30034067$var$_ray.copy(raycaster.ray).applyMatrix4($d5b33d7c30034067$var$_inverseMatrix);\n const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n const localThresholdSq = localThreshold * localThreshold;\n const index = geometry.index;\n const attributes = geometry.attributes;\n const positionAttribute = attributes.position;\n if (index !== null) {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(index.count, drawRange.start + drawRange.count);\n for(let i = start, il = end; i < il; i++){\n const a = index.getX(i);\n $d5b33d7c30034067$var$_position$2.fromBufferAttribute(positionAttribute, a);\n $d5b33d7c30034067$var$testPoint($d5b33d7c30034067$var$_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n } else {\n const start = Math.max(0, drawRange.start);\n const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for(let i = start, l = end; i < l; i++){\n $d5b33d7c30034067$var$_position$2.fromBufferAttribute(positionAttribute, i);\n $d5b33d7c30034067$var$testPoint($d5b33d7c30034067$var$_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n }\n }\n updateMorphTargets() {\n const geometry = this.geometry;\n const morphAttributes = geometry.morphAttributes;\n const keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n const morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for(let m = 0, ml = morphAttribute.length; m < ml; m++){\n const name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n}\nfunction $d5b33d7c30034067$var$testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) {\n const rayPointDistanceSq = $d5b33d7c30034067$var$_ray.distanceSqToPoint(point);\n if (rayPointDistanceSq < localThresholdSq) {\n const intersectPoint = new $d5b33d7c30034067$export$64b5c384219d3699();\n $d5b33d7c30034067$var$_ray.closestPointToPoint(point, intersectPoint);\n intersectPoint.applyMatrix4(matrixWorld);\n const distance = raycaster.ray.origin.distanceTo(intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n distanceToRay: Math.sqrt(rayPointDistanceSq),\n point: intersectPoint,\n index: index,\n face: null,\n object: object\n });\n }\n}\nclass $d5b33d7c30034067$export$6e09d1edf8d5a25c extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy){\n super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isVideoTexture = true;\n this.minFilter = minFilter !== undefined ? minFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n this.magFilter = magFilter !== undefined ? magFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n this.generateMipmaps = false;\n const scope = this;\n function updateVideo() {\n scope.needsUpdate = true;\n video.requestVideoFrameCallback(updateVideo);\n }\n if (\"requestVideoFrameCallback\" in video) video.requestVideoFrameCallback(updateVideo);\n }\n clone() {\n return new this.constructor(this.image).copy(this);\n }\n update() {\n const video = this.image;\n const hasVideoFrameCallback = \"requestVideoFrameCallback\" in video;\n if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) this.needsUpdate = true;\n }\n}\nclass $d5b33d7c30034067$export$9270d786f73ce6fe extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(width, height){\n super({\n width: width,\n height: height\n });\n this.isFramebufferTexture = true;\n this.magFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.minFilter = $d5b33d7c30034067$export$727aa5ec3fe39bf0;\n this.generateMipmaps = false;\n this.needsUpdate = true;\n }\n}\nclass $d5b33d7c30034067$export$3466bac9141a5cc4 extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace1){\n super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace1);\n this.isCompressedTexture = true;\n this.image = {\n width: width,\n height: height\n };\n this.mipmaps = mipmaps;\n // no flipping for cube textures\n // (also flipping doesn't work for compressed textures )\n this.flipY = false;\n // can't generate mipmaps for compressed textures\n // mips must be embedded in DDS files\n this.generateMipmaps = false;\n }\n}\nclass $d5b33d7c30034067$export$5fe6b8e34b274fcb extends $d5b33d7c30034067$export$3466bac9141a5cc4 {\n constructor(mipmaps, width, height, depth, format, type){\n super(mipmaps, width, height, format, type);\n this.isCompressedArrayTexture = true;\n this.image.depth = depth;\n this.wrapR = $d5b33d7c30034067$export$9d9334239a5a5e06;\n }\n}\nclass $d5b33d7c30034067$export$d80173634de65bff extends $d5b33d7c30034067$export$3466bac9141a5cc4 {\n constructor(images, format, type){\n super(undefined, images[0].width, images[0].height, format, type, $d5b33d7c30034067$export$8759762a6477f2c4);\n this.isCompressedCubeTexture = true;\n this.isCubeTexture = true;\n this.image = images;\n }\n}\nclass $d5b33d7c30034067$export$f7189e49152d1c13 extends $d5b33d7c30034067$export$5431306cf43de24a {\n constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy){\n super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n this.isCanvasTexture = true;\n this.needsUpdate = true;\n }\n}\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/ class $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(){\n this.type = \"Curve\";\n this.arcLengthDivisions = 200;\n }\n // Virtual base class method to overwrite and implement in subclasses\n //\t- t [0 .. 1]\n getPoint() {\n console.warn(\"THREE.Curve: .getPoint() not implemented.\");\n return null;\n }\n // Get point at relative position in curve according to arc length\n // - u [0 .. 1]\n getPointAt(u, optionalTarget) {\n const t = this.getUtoTmapping(u);\n return this.getPoint(t, optionalTarget);\n }\n // Get sequence of points using getPoint( t )\n getPoints(divisions = 5) {\n const points = [];\n for(let d = 0; d <= divisions; d++)points.push(this.getPoint(d / divisions));\n return points;\n }\n // Get sequence of points using getPointAt( u )\n getSpacedPoints(divisions = 5) {\n const points = [];\n for(let d = 0; d <= divisions; d++)points.push(this.getPointAt(d / divisions));\n return points;\n }\n // Get total curve arc length\n getLength() {\n const lengths = this.getLengths();\n return lengths[lengths.length - 1];\n }\n // Get list of cumulative segment lengths\n getLengths(divisions = this.arcLengthDivisions) {\n if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) return this.cacheArcLengths;\n this.needsUpdate = false;\n const cache = [];\n let current, last = this.getPoint(0);\n let sum = 0;\n cache.push(0);\n for(let p = 1; p <= divisions; p++){\n current = this.getPoint(p / divisions);\n sum += current.distanceTo(last);\n cache.push(sum);\n last = current;\n }\n this.cacheArcLengths = cache;\n return cache; // { sums: cache, sum: sum }; Sum is in the last element.\n }\n updateArcLengths() {\n this.needsUpdate = true;\n this.getLengths();\n }\n // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n getUtoTmapping(u, distance) {\n const arcLengths = this.getLengths();\n let i = 0;\n const il = arcLengths.length;\n let targetArcLength; // The targeted u distance value to get\n if (distance) targetArcLength = distance;\n else targetArcLength = u * arcLengths[il - 1];\n // binary search for the index with largest value smaller than target u distance\n let low = 0, high = il - 1, comparison;\n while(low <= high){\n i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n comparison = arcLengths[i] - targetArcLength;\n if (comparison < 0) low = i + 1;\n else if (comparison > 0) high = i - 1;\n else {\n high = i;\n break;\n // DONE\n }\n }\n i = high;\n if (arcLengths[i] === targetArcLength) return i / (il - 1);\n // we could get finer grain at lengths, or use simple interpolation between two points\n const lengthBefore = arcLengths[i];\n const lengthAfter = arcLengths[i + 1];\n const segmentLength = lengthAfter - lengthBefore;\n // determine where we are between the 'before' and 'after' points\n const segmentFraction = (targetArcLength - lengthBefore) / segmentLength;\n // add that fractional amount to t\n const t = (i + segmentFraction) / (il - 1);\n return t;\n }\n // Returns a unit vector tangent at t\n // In case any sub curve does not implement its tangent derivation,\n // 2 points a small delta apart will be used to find its gradient\n // which seems to give a reasonable approximation\n getTangent(t, optionalTarget) {\n const delta = 0.0001;\n let t1 = t - delta;\n let t2 = t + delta;\n // Capping in case of danger\n if (t1 < 0) t1 = 0;\n if (t2 > 1) t2 = 1;\n const pt1 = this.getPoint(t1);\n const pt2 = this.getPoint(t2);\n const tangent = optionalTarget || (pt1.isVector2 ? new $d5b33d7c30034067$export$c977b3e384af9ae1() : new $d5b33d7c30034067$export$64b5c384219d3699());\n tangent.copy(pt2).sub(pt1).normalize();\n return tangent;\n }\n getTangentAt(u, optionalTarget) {\n const t = this.getUtoTmapping(u);\n return this.getTangent(t, optionalTarget);\n }\n computeFrenetFrames(segments, closed) {\n // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const tangents = [];\n const normals = [];\n const binormals = [];\n const vec = new $d5b33d7c30034067$export$64b5c384219d3699();\n const mat = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n // compute the tangent vectors for each segment on the curve\n for(let i = 0; i <= segments; i++){\n const u = i / segments;\n tangents[i] = this.getTangentAt(u, new $d5b33d7c30034067$export$64b5c384219d3699());\n }\n // select an initial normal vector perpendicular to the first tangent vector,\n // and in the direction of the minimum tangent xyz component\n normals[0] = new $d5b33d7c30034067$export$64b5c384219d3699();\n binormals[0] = new $d5b33d7c30034067$export$64b5c384219d3699();\n let min = Number.MAX_VALUE;\n const tx = Math.abs(tangents[0].x);\n const ty = Math.abs(tangents[0].y);\n const tz = Math.abs(tangents[0].z);\n if (tx <= min) {\n min = tx;\n normal.set(1, 0, 0);\n }\n if (ty <= min) {\n min = ty;\n normal.set(0, 1, 0);\n }\n if (tz <= min) normal.set(0, 0, 1);\n vec.crossVectors(tangents[0], normal).normalize();\n normals[0].crossVectors(tangents[0], vec);\n binormals[0].crossVectors(tangents[0], normals[0]);\n // compute the slowly-varying normal and binormal vectors for each segment on the curve\n for(let i = 1; i <= segments; i++){\n normals[i] = normals[i - 1].clone();\n binormals[i] = binormals[i - 1].clone();\n vec.crossVectors(tangents[i - 1], tangents[i]);\n if (vec.length() > Number.EPSILON) {\n vec.normalize();\n const theta = Math.acos($d5b33d7c30034067$var$clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors\n normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta));\n }\n binormals[i].crossVectors(tangents[i], normals[i]);\n }\n // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n if (closed === true) {\n let theta = Math.acos($d5b33d7c30034067$var$clamp(normals[0].dot(normals[segments]), -1, 1));\n theta /= segments;\n if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) theta = -theta;\n for(let i = 1; i <= segments; i++){\n // twist a little...\n normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i));\n binormals[i].crossVectors(tangents[i], normals[i]);\n }\n }\n return {\n tangents: tangents,\n normals: normals,\n binormals: binormals\n };\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(source) {\n this.arcLengthDivisions = source.arcLengthDivisions;\n return this;\n }\n toJSON() {\n const data = {\n metadata: {\n version: 4.6,\n type: \"Curve\",\n generator: \"Curve.toJSON\"\n }\n };\n data.arcLengthDivisions = this.arcLengthDivisions;\n data.type = this.type;\n return data;\n }\n fromJSON(json) {\n this.arcLengthDivisions = json.arcLengthDivisions;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$3f87a931616cde04 extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0){\n super();\n this.isEllipseCurve = true;\n this.type = \"EllipseCurve\";\n this.aX = aX;\n this.aY = aY;\n this.xRadius = xRadius;\n this.yRadius = yRadius;\n this.aStartAngle = aStartAngle;\n this.aEndAngle = aEndAngle;\n this.aClockwise = aClockwise;\n this.aRotation = aRotation;\n }\n getPoint(t, optionalTarget) {\n const point = optionalTarget || new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const twoPi = Math.PI * 2;\n let deltaAngle = this.aEndAngle - this.aStartAngle;\n const samePoints = Math.abs(deltaAngle) < Number.EPSILON;\n // ensures that deltaAngle is 0 .. 2 PI\n while(deltaAngle < 0)deltaAngle += twoPi;\n while(deltaAngle > twoPi)deltaAngle -= twoPi;\n if (deltaAngle < Number.EPSILON) {\n if (samePoints) deltaAngle = 0;\n else deltaAngle = twoPi;\n }\n if (this.aClockwise === true && !samePoints) {\n if (deltaAngle === twoPi) deltaAngle = -twoPi;\n else deltaAngle = deltaAngle - twoPi;\n }\n const angle = this.aStartAngle + t * deltaAngle;\n let x = this.aX + this.xRadius * Math.cos(angle);\n let y = this.aY + this.yRadius * Math.sin(angle);\n if (this.aRotation !== 0) {\n const cos = Math.cos(this.aRotation);\n const sin = Math.sin(this.aRotation);\n const tx = x - this.aX;\n const ty = y - this.aY;\n // Rotate the point about the center of the ellipse.\n x = tx * cos - ty * sin + this.aX;\n y = tx * sin + ty * cos + this.aY;\n }\n return point.set(x, y);\n }\n copy(source) {\n super.copy(source);\n this.aX = source.aX;\n this.aY = source.aY;\n this.xRadius = source.xRadius;\n this.yRadius = source.yRadius;\n this.aStartAngle = source.aStartAngle;\n this.aEndAngle = source.aEndAngle;\n this.aClockwise = source.aClockwise;\n this.aRotation = source.aRotation;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.aX = this.aX;\n data.aY = this.aY;\n data.xRadius = this.xRadius;\n data.yRadius = this.yRadius;\n data.aStartAngle = this.aStartAngle;\n data.aEndAngle = this.aEndAngle;\n data.aClockwise = this.aClockwise;\n data.aRotation = this.aRotation;\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.aX = json.aX;\n this.aY = json.aY;\n this.xRadius = json.xRadius;\n this.yRadius = json.yRadius;\n this.aStartAngle = json.aStartAngle;\n this.aEndAngle = json.aEndAngle;\n this.aClockwise = json.aClockwise;\n this.aRotation = json.aRotation;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$b1eedc9aab6300e8 extends $d5b33d7c30034067$export$3f87a931616cde04 {\n constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise){\n super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n this.isArcCurve = true;\n this.type = \"ArcCurve\";\n }\n}\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */ /*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/ function $d5b33d7c30034067$var$CubicPoly() {\n let c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n /*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */ function init(x0, x1, t0, t1) {\n c0 = x0;\n c1 = t0;\n c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;\n c3 = 2 * x0 - 2 * x1 + t0 + t1;\n }\n return {\n initCatmullRom: function(x0, x1, x2, x3, tension) {\n init(x1, x2, tension * (x2 - x0), tension * (x3 - x1));\n },\n initNonuniformCatmullRom: function(x0, x1, x2, x3, dt0, dt1, dt2) {\n // compute tangents when parameterized in [t1,t2]\n let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;\n let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2;\n // rescale tangents for parametrization in [0,1]\n t1 *= dt1;\n t2 *= dt1;\n init(x1, x2, t1, t2);\n },\n calc: function(t) {\n const t2 = t * t;\n const t3 = t2 * t;\n return c0 + c1 * t + c2 * t2 + c3 * t3;\n }\n };\n}\n//\nconst $d5b33d7c30034067$var$tmp = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$px = /*@__PURE__*/ new $d5b33d7c30034067$var$CubicPoly();\nconst $d5b33d7c30034067$var$py = /*@__PURE__*/ new $d5b33d7c30034067$var$CubicPoly();\nconst $d5b33d7c30034067$var$pz = /*@__PURE__*/ new $d5b33d7c30034067$var$CubicPoly();\nclass $d5b33d7c30034067$export$b9146b27c24b744c extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(points = [], closed = false, curveType = \"centripetal\", tension = 0.5){\n super();\n this.isCatmullRomCurve3 = true;\n this.type = \"CatmullRomCurve3\";\n this.points = points;\n this.closed = closed;\n this.curveType = curveType;\n this.tension = tension;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const points = this.points;\n const l = points.length;\n const p = (l - (this.closed ? 0 : 1)) * t;\n let intPoint = Math.floor(p);\n let weight = p - intPoint;\n if (this.closed) intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l;\n else if (weight === 0 && intPoint === l - 1) {\n intPoint = l - 2;\n weight = 1;\n }\n let p0, p3; // 4 points (p1 & p2 defined below)\n if (this.closed || intPoint > 0) p0 = points[(intPoint - 1) % l];\n else {\n // extrapolate first point\n $d5b33d7c30034067$var$tmp.subVectors(points[0], points[1]).add(points[0]);\n p0 = $d5b33d7c30034067$var$tmp;\n }\n const p1 = points[intPoint % l];\n const p2 = points[(intPoint + 1) % l];\n if (this.closed || intPoint + 2 < l) p3 = points[(intPoint + 2) % l];\n else {\n // extrapolate last point\n $d5b33d7c30034067$var$tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]);\n p3 = $d5b33d7c30034067$var$tmp;\n }\n if (this.curveType === \"centripetal\" || this.curveType === \"chordal\") {\n // init Centripetal / Chordal Catmull-Rom\n const pow = this.curveType === \"chordal\" ? 0.5 : 0.25;\n let dt0 = Math.pow(p0.distanceToSquared(p1), pow);\n let dt1 = Math.pow(p1.distanceToSquared(p2), pow);\n let dt2 = Math.pow(p2.distanceToSquared(p3), pow);\n // safety check for repeated points\n if (dt1 < 1e-4) dt1 = 1.0;\n if (dt0 < 1e-4) dt0 = dt1;\n if (dt2 < 1e-4) dt2 = dt1;\n $d5b33d7c30034067$var$px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2);\n $d5b33d7c30034067$var$py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2);\n $d5b33d7c30034067$var$pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2);\n } else if (this.curveType === \"catmullrom\") {\n $d5b33d7c30034067$var$px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension);\n $d5b33d7c30034067$var$py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension);\n $d5b33d7c30034067$var$pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension);\n }\n point.set($d5b33d7c30034067$var$px.calc(weight), $d5b33d7c30034067$var$py.calc(weight), $d5b33d7c30034067$var$pz.calc(weight));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.points = [];\n for(let i = 0, l = source.points.length; i < l; i++){\n const point = source.points[i];\n this.points.push(point.clone());\n }\n this.closed = source.closed;\n this.curveType = source.curveType;\n this.tension = source.tension;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.points = [];\n for(let i = 0, l = this.points.length; i < l; i++){\n const point = this.points[i];\n data.points.push(point.toArray());\n }\n data.closed = this.closed;\n data.curveType = this.curveType;\n data.tension = this.tension;\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.points = [];\n for(let i = 0, l = json.points.length; i < l; i++){\n const point = json.points[i];\n this.points.push(new $d5b33d7c30034067$export$64b5c384219d3699().fromArray(point));\n }\n this.closed = json.closed;\n this.curveType = json.curveType;\n this.tension = json.tension;\n return this;\n }\n}\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */ function $d5b33d7c30034067$var$CatmullRom(t, p0, p1, p2, p3) {\n const v0 = (p2 - p0) * 0.5;\n const v1 = (p3 - p1) * 0.5;\n const t2 = t * t;\n const t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n}\n//\nfunction $d5b33d7c30034067$var$QuadraticBezierP0(t, p) {\n const k = 1 - t;\n return k * k * p;\n}\nfunction $d5b33d7c30034067$var$QuadraticBezierP1(t, p) {\n return 2 * (1 - t) * t * p;\n}\nfunction $d5b33d7c30034067$var$QuadraticBezierP2(t, p) {\n return t * t * p;\n}\nfunction $d5b33d7c30034067$var$QuadraticBezier(t, p0, p1, p2) {\n return $d5b33d7c30034067$var$QuadraticBezierP0(t, p0) + $d5b33d7c30034067$var$QuadraticBezierP1(t, p1) + $d5b33d7c30034067$var$QuadraticBezierP2(t, p2);\n}\n//\nfunction $d5b33d7c30034067$var$CubicBezierP0(t, p) {\n const k = 1 - t;\n return k * k * k * p;\n}\nfunction $d5b33d7c30034067$var$CubicBezierP1(t, p) {\n const k = 1 - t;\n return 3 * k * k * t * p;\n}\nfunction $d5b33d7c30034067$var$CubicBezierP2(t, p) {\n return 3 * (1 - t) * t * t * p;\n}\nfunction $d5b33d7c30034067$var$CubicBezierP3(t, p) {\n return t * t * t * p;\n}\nfunction $d5b33d7c30034067$var$CubicBezier(t, p0, p1, p2, p3) {\n return $d5b33d7c30034067$var$CubicBezierP0(t, p0) + $d5b33d7c30034067$var$CubicBezierP1(t, p1) + $d5b33d7c30034067$var$CubicBezierP2(t, p2) + $d5b33d7c30034067$var$CubicBezierP3(t, p3);\n}\nclass $d5b33d7c30034067$export$e36650d36468bb39 extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v1 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v2 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v3 = new $d5b33d7c30034067$export$c977b3e384af9ae1()){\n super();\n this.isCubicBezierCurve = true;\n this.type = \"CubicBezierCurve\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n this.v3 = v3;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n point.set($d5b33d7c30034067$var$CubicBezier(t, v0.x, v1.x, v2.x, v3.x), $d5b33d7c30034067$var$CubicBezier(t, v0.y, v1.y, v2.y, v3.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$13d5f1c9525f246c extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $d5b33d7c30034067$export$64b5c384219d3699(), v1 = new $d5b33d7c30034067$export$64b5c384219d3699(), v2 = new $d5b33d7c30034067$export$64b5c384219d3699(), v3 = new $d5b33d7c30034067$export$64b5c384219d3699()){\n super();\n this.isCubicBezierCurve3 = true;\n this.type = \"CubicBezierCurve3\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n this.v3 = v3;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n point.set($d5b33d7c30034067$var$CubicBezier(t, v0.x, v1.x, v2.x, v3.x), $d5b33d7c30034067$var$CubicBezier(t, v0.y, v1.y, v2.y, v3.y), $d5b33d7c30034067$var$CubicBezier(t, v0.z, v1.z, v2.z, v3.z));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$ab2e07e76531a47e extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v1 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v2 = new $d5b33d7c30034067$export$c977b3e384af9ae1()){\n super();\n this.isLineCurve = true;\n this.type = \"LineCurve\";\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n if (t === 1) point.copy(this.v2);\n else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n // Line curve is linear, so we can overwrite default getPointAt\n getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n getTangent(t, optionalTarget = new $d5b33d7c30034067$export$c977b3e384af9ae1()) {\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n copy(source) {\n super.copy(source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$1fdfd9d9cf487600 extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v1 = new $d5b33d7c30034067$export$64b5c384219d3699(), v2 = new $d5b33d7c30034067$export$64b5c384219d3699()){\n super();\n this.isLineCurve3 = true;\n this.type = \"LineCurve3\";\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$64b5c384219d3699()) {\n const point = optionalTarget;\n if (t === 1) point.copy(this.v2);\n else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n // Line curve is linear, so we can overwrite default getPointAt\n getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n getTangent(t, optionalTarget = new $d5b33d7c30034067$export$64b5c384219d3699()) {\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n copy(source) {\n super.copy(source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$5938c4ee491a43ad extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v1 = new $d5b33d7c30034067$export$c977b3e384af9ae1(), v2 = new $d5b33d7c30034067$export$c977b3e384af9ae1()){\n super();\n this.isQuadraticBezierCurve = true;\n this.type = \"QuadraticBezierCurve\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2;\n point.set($d5b33d7c30034067$var$QuadraticBezier(t, v0.x, v1.x, v2.x), $d5b33d7c30034067$var$QuadraticBezier(t, v0.y, v1.y, v2.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$bf3f4c7e459f90fc extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(v0 = new $d5b33d7c30034067$export$64b5c384219d3699(), v1 = new $d5b33d7c30034067$export$64b5c384219d3699(), v2 = new $d5b33d7c30034067$export$64b5c384219d3699()){\n super();\n this.isQuadraticBezierCurve3 = true;\n this.type = \"QuadraticBezierCurve3\";\n this.v0 = v0;\n this.v1 = v1;\n this.v2 = v2;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$64b5c384219d3699()) {\n const point = optionalTarget;\n const v0 = this.v0, v1 = this.v1, v2 = this.v2;\n point.set($d5b33d7c30034067$var$QuadraticBezier(t, v0.x, v1.x, v2.x), $d5b33d7c30034067$var$QuadraticBezier(t, v0.y, v1.y, v2.y), $d5b33d7c30034067$var$QuadraticBezier(t, v0.z, v1.z, v2.z));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$d3bdd77da77afc1b extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(points = []){\n super();\n this.isSplineCurve = true;\n this.type = \"SplineCurve\";\n this.points = points;\n }\n getPoint(t, optionalTarget = new $d5b33d7c30034067$export$c977b3e384af9ae1()) {\n const point = optionalTarget;\n const points = this.points;\n const p = (points.length - 1) * t;\n const intPoint = Math.floor(p);\n const weight = p - intPoint;\n const p0 = points[intPoint === 0 ? intPoint : intPoint - 1];\n const p1 = points[intPoint];\n const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];\n const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];\n point.set($d5b33d7c30034067$var$CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), $d5b33d7c30034067$var$CatmullRom(weight, p0.y, p1.y, p2.y, p3.y));\n return point;\n }\n copy(source) {\n super.copy(source);\n this.points = [];\n for(let i = 0, l = source.points.length; i < l; i++){\n const point = source.points[i];\n this.points.push(point.clone());\n }\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.points = [];\n for(let i = 0, l = this.points.length; i < l; i++){\n const point = this.points[i];\n data.points.push(point.toArray());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.points = [];\n for(let i = 0, l = json.points.length; i < l; i++){\n const point = json.points[i];\n this.points.push(new $d5b33d7c30034067$export$c977b3e384af9ae1().fromArray(point));\n }\n return this;\n }\n}\nvar $d5b33d7c30034067$var$Curves = /*#__PURE__*/ Object.freeze({\n __proto__: null,\n ArcCurve: $d5b33d7c30034067$export$b1eedc9aab6300e8,\n CatmullRomCurve3: $d5b33d7c30034067$export$b9146b27c24b744c,\n CubicBezierCurve: $d5b33d7c30034067$export$e36650d36468bb39,\n CubicBezierCurve3: $d5b33d7c30034067$export$13d5f1c9525f246c,\n EllipseCurve: $d5b33d7c30034067$export$3f87a931616cde04,\n LineCurve: $d5b33d7c30034067$export$ab2e07e76531a47e,\n LineCurve3: $d5b33d7c30034067$export$1fdfd9d9cf487600,\n QuadraticBezierCurve: $d5b33d7c30034067$export$5938c4ee491a43ad,\n QuadraticBezierCurve3: $d5b33d7c30034067$export$bf3f4c7e459f90fc,\n SplineCurve: $d5b33d7c30034067$export$d3bdd77da77afc1b\n});\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/ class $d5b33d7c30034067$export$4aaf9b66af1bbf2c extends $d5b33d7c30034067$export$b0e83c3ef8d2db1 {\n constructor(){\n super();\n this.type = \"CurvePath\";\n this.curves = [];\n this.autoClose = false; // Automatically closes the path\n }\n add(curve) {\n this.curves.push(curve);\n }\n closePath() {\n // Add a line curve if start and end of lines are not connected\n const startPoint = this.curves[0].getPoint(0);\n const endPoint = this.curves[this.curves.length - 1].getPoint(1);\n if (!startPoint.equals(endPoint)) this.curves.push(new $d5b33d7c30034067$export$ab2e07e76531a47e(endPoint, startPoint));\n }\n // To get accurate point with reference to\n // entire path distance at time t,\n // following has to be done:\n // 1. Length of each sub path have to be known\n // 2. Locate and identify type of curve\n // 3. Get t for the curve\n // 4. Return curve.getPointAt(t')\n getPoint(t, optionalTarget) {\n const d = t * this.getLength();\n const curveLengths = this.getCurveLengths();\n let i = 0;\n // To think about boundaries points.\n while(i < curveLengths.length){\n if (curveLengths[i] >= d) {\n const diff = curveLengths[i] - d;\n const curve = this.curves[i];\n const segmentLength = curve.getLength();\n const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n return curve.getPointAt(u, optionalTarget);\n }\n i++;\n }\n return null;\n // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) points.push(points[0]);\n return points;\n }\n copy(source) {\n super.copy(source);\n this.curves = [];\n for(let i = 0, l = source.curves.length; i < l; i++){\n const curve = source.curves[i];\n this.curves.push(curve.clone());\n }\n this.autoClose = source.autoClose;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.autoClose = this.autoClose;\n data.curves = [];\n for(let i = 0, l = this.curves.length; i < l; i++){\n const curve = this.curves[i];\n data.curves.push(curve.toJSON());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.autoClose = json.autoClose;\n this.curves = [];\n for(let i = 0, l = json.curves.length; i < l; i++){\n const curve = json.curves[i];\n this.curves.push(new $d5b33d7c30034067$var$Curves[curve.type]().fromJSON(curve));\n }\n return this;\n }\n}\nclass $d5b33d7c30034067$export$4b2950bdac9b6ee9 extends $d5b33d7c30034067$export$4aaf9b66af1bbf2c {\n constructor(points){\n super();\n this.type = \"Path\";\n this.currentPoint = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n if (points) this.setFromPoints(points);\n }\n setFromPoints(points) {\n this.moveTo(points[0].x, points[0].y);\n for(let i = 1, l = points.length; i < l; i++)this.lineTo(points[i].x, points[i].y);\n return this;\n }\n moveTo(x, y) {\n this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying?\n return this;\n }\n lineTo(x, y) {\n const curve = new $d5b33d7c30034067$export$ab2e07e76531a47e(this.currentPoint.clone(), new $d5b33d7c30034067$export$c977b3e384af9ae1(x, y));\n this.curves.push(curve);\n this.currentPoint.set(x, y);\n return this;\n }\n quadraticCurveTo(aCPx, aCPy, aX, aY) {\n const curve = new $d5b33d7c30034067$export$5938c4ee491a43ad(this.currentPoint.clone(), new $d5b33d7c30034067$export$c977b3e384af9ae1(aCPx, aCPy), new $d5b33d7c30034067$export$c977b3e384af9ae1(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n const curve = new $d5b33d7c30034067$export$e36650d36468bb39(this.currentPoint.clone(), new $d5b33d7c30034067$export$c977b3e384af9ae1(aCP1x, aCP1y), new $d5b33d7c30034067$export$c977b3e384af9ae1(aCP2x, aCP2y), new $d5b33d7c30034067$export$c977b3e384af9ae1(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n splineThru(pts /*Array of Vector*/ ) {\n const npts = [\n this.currentPoint.clone()\n ].concat(pts);\n const curve = new $d5b33d7c30034067$export$d3bdd77da77afc1b(npts);\n this.curves.push(curve);\n this.currentPoint.copy(pts[pts.length - 1]);\n return this;\n }\n arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n const x0 = this.currentPoint.x;\n const y0 = this.currentPoint.y;\n this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n const x0 = this.currentPoint.x;\n const y0 = this.currentPoint.y;\n this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n return this;\n }\n absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n const curve = new $d5b33d7c30034067$export$3f87a931616cde04(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n if (this.curves.length > 0) {\n // if a previous curve is present, attempt to join\n const firstPoint = curve.getPoint(0);\n if (!firstPoint.equals(this.currentPoint)) this.lineTo(firstPoint.x, firstPoint.y);\n }\n this.curves.push(curve);\n const lastPoint = curve.getPoint(1);\n this.currentPoint.copy(lastPoint);\n return this;\n }\n copy(source) {\n super.copy(source);\n this.currentPoint.copy(source.currentPoint);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.currentPoint = this.currentPoint.toArray();\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.currentPoint.fromArray(json.currentPoint);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$6d839803fcd1882c extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(points = [\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0, -0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, 0),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0, 0.5)\n ], segments = 12, phiStart = 0, phiLength = Math.PI * 2){\n super();\n this.type = \"LatheGeometry\";\n this.parameters = {\n points: points,\n segments: segments,\n phiStart: phiStart,\n phiLength: phiLength\n };\n segments = Math.floor(segments);\n // clamp phiLength so it's in range of [ 0, 2PI ]\n phiLength = $d5b33d7c30034067$var$clamp(phiLength, 0, Math.PI * 2);\n // buffers\n const indices = [];\n const vertices = [];\n const uvs = [];\n const initNormals = [];\n const normals = [];\n // helper variables\n const inverseSegments = 1.0 / segments;\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const uv = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const curNormal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const prevNormal = new $d5b33d7c30034067$export$64b5c384219d3699();\n let dx = 0;\n let dy = 0;\n // pre-compute normals for initial \"meridian\"\n for(let j = 0; j <= points.length - 1; j++)switch(j){\n case 0:\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n prevNormal.copy(normal);\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n break;\n case points.length - 1:\n initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z);\n break;\n default:\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n curNormal.copy(normal);\n normal.x += prevNormal.x;\n normal.y += prevNormal.y;\n normal.z += prevNormal.z;\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n prevNormal.copy(curNormal);\n }\n // generate vertices, uvs and normals\n for(let i = 0; i <= segments; i++){\n const phi = phiStart + i * inverseSegments * phiLength;\n const sin = Math.sin(phi);\n const cos = Math.cos(phi);\n for(let j = 0; j <= points.length - 1; j++){\n // vertex\n vertex.x = points[j].x * sin;\n vertex.y = points[j].y;\n vertex.z = points[j].x * cos;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // uv\n uv.x = i / segments;\n uv.y = j / (points.length - 1);\n uvs.push(uv.x, uv.y);\n // normal\n const x = initNormals[3 * j + 0] * sin;\n const y = initNormals[3 * j + 1];\n const z = initNormals[3 * j + 0] * cos;\n normals.push(x, y, z);\n }\n }\n // indices\n for(let i = 0; i < segments; i++)for(let j = 0; j < points.length - 1; j++){\n const base = j + i * points.length;\n const a = base;\n const b = base + points.length;\n const c = base + points.length + 1;\n const d = base + 1;\n // faces\n indices.push(a, b, d);\n indices.push(c, d, b);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$6d839803fcd1882c(data.points, data.segments, data.phiStart, data.phiLength);\n }\n}\nclass $d5b33d7c30034067$export$41680e8551036033 extends $d5b33d7c30034067$export$6d839803fcd1882c {\n constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8){\n const path = new $d5b33d7c30034067$export$4b2950bdac9b6ee9();\n path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);\n path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);\n super(path.getPoints(capSegments), radialSegments);\n this.type = \"CapsuleGeometry\";\n this.parameters = {\n radius: radius,\n length: length,\n capSegments: capSegments,\n radialSegments: radialSegments\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$41680e8551036033(data.radius, data.length, data.capSegments, data.radialSegments);\n }\n}\nclass $d5b33d7c30034067$export$d5c0e8d607467193 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"CircleGeometry\";\n this.parameters = {\n radius: radius,\n segments: segments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n segments = Math.max(3, segments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const uv = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n // center point\n vertices.push(0, 0, 0);\n normals.push(0, 0, 1);\n uvs.push(0.5, 0.5);\n for(let s = 0, i = 3; s <= segments; s++, i += 3){\n const segment = thetaStart + s / segments * thetaLength;\n // vertex\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, 0, 1);\n // uvs\n uv.x = (vertices[i] / radius + 1) / 2;\n uv.y = (vertices[i + 1] / radius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n // indices\n for(let i = 1; i <= segments; i++)indices.push(i, i + 1, 0);\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$d5c0e8d607467193(data.radius, data.segments, data.thetaStart, data.thetaLength);\n }\n}\nclass $d5b33d7c30034067$export$68f745719dbe5198 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"CylinderGeometry\";\n this.parameters = {\n radiusTop: radiusTop,\n radiusBottom: radiusBottom,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n const scope = this;\n radialSegments = Math.floor(radialSegments);\n heightSegments = Math.floor(heightSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let index = 0;\n const indexArray = [];\n const halfHeight = height / 2;\n let groupStart = 0;\n // generate geometry\n generateTorso();\n if (openEnded === false) {\n if (radiusTop > 0) generateCap(true);\n if (radiusBottom > 0) generateCap(false);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n function generateTorso() {\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n let groupCount = 0;\n // this will be used to calculate the normal\n const slope = (radiusBottom - radiusTop) / height;\n // generate vertices, normals and uvs\n for(let y = 0; y <= heightSegments; y++){\n const indexRow = [];\n const v = y / heightSegments;\n // calculate the radius of the current row\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\n for(let x = 0; x <= radialSegments; x++){\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n // vertex\n vertex.x = radius * sinTheta;\n vertex.y = -v * height + halfHeight;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.set(sinTheta, slope, cosTheta).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u, 1 - v);\n // save index of vertex in respective row\n indexRow.push(index++);\n }\n // now save vertices of the row in our index array\n indexArray.push(indexRow);\n }\n // generate indices\n for(let x = 0; x < radialSegments; x++)for(let y = 0; y < heightSegments; y++){\n // we use the index array to access the correct indices\n const a = indexArray[y][x];\n const b = indexArray[y + 1][x];\n const c = indexArray[y + 1][x + 1];\n const d = indexArray[y][x + 1];\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n // update group counter\n groupCount += 6;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, 0);\n // calculate new start value for groups\n groupStart += groupCount;\n }\n function generateCap(top) {\n // save the index of the first center vertex\n const centerIndexStart = index;\n const uv = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n let groupCount = 0;\n const radius = top === true ? radiusTop : radiusBottom;\n const sign = top === true ? 1 : -1;\n // first we generate the center vertex data of the cap.\n // because the geometry needs one set of uvs per face,\n // we must generate a center vertex per face/segment\n for(let x = 1; x <= radialSegments; x++){\n // vertex\n vertices.push(0, halfHeight * sign, 0);\n // normal\n normals.push(0, sign, 0);\n // uv\n uvs.push(0.5, 0.5);\n // increase index\n index++;\n }\n // save the index of the last center vertex\n const centerIndexEnd = index;\n // now we generate the surrounding vertices, normals and uvs\n for(let x = 0; x <= radialSegments; x++){\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const cosTheta = Math.cos(theta);\n const sinTheta = Math.sin(theta);\n // vertex\n vertex.x = radius * sinTheta;\n vertex.y = halfHeight * sign;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, sign, 0);\n // uv\n uv.x = cosTheta * 0.5 + 0.5;\n uv.y = sinTheta * 0.5 * sign + 0.5;\n uvs.push(uv.x, uv.y);\n // increase index\n index++;\n }\n // generate indices\n for(let x = 0; x < radialSegments; x++){\n const c = centerIndexStart + x;\n const i = centerIndexEnd + x;\n if (top === true) // face top\n indices.push(i, i + 1, c);\n else // face bottom\n indices.push(i + 1, i, c);\n groupCount += 3;\n }\n // add a group to the geometry. this will ensure multi material support\n scope.addGroup(groupStart, groupCount, top === true ? 1 : 2);\n // calculate new start value for groups\n groupStart += groupCount;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$68f745719dbe5198(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n}\nclass $d5b33d7c30034067$export$a7a48974f285c9b3 extends $d5b33d7c30034067$export$68f745719dbe5198 {\n constructor(radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2){\n super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);\n this.type = \"ConeGeometry\";\n this.parameters = {\n radius: radius,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$a7a48974f285c9b3(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n}\nclass $d5b33d7c30034067$export$60e57a7d3f20ff65 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(vertices = [], indices = [], radius = 1, detail = 0){\n super();\n this.type = \"PolyhedronGeometry\";\n this.parameters = {\n vertices: vertices,\n indices: indices,\n radius: radius,\n detail: detail\n };\n // default buffer data\n const vertexBuffer = [];\n const uvBuffer = [];\n // the subdivision creates the vertex buffer data\n subdivide(detail);\n // all vertices should lie on a conceptual sphere with a given radius\n applyRadius(radius);\n // finally, create the uv data\n generateUVs();\n // build non-indexed geometry\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertexBuffer, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertexBuffer.slice(), 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvBuffer, 2));\n if (detail === 0) this.computeVertexNormals(); // flat normals\n else this.normalizeNormals(); // smooth normals\n // helper functions\n function subdivide(detail) {\n const a = new $d5b33d7c30034067$export$64b5c384219d3699();\n const b = new $d5b33d7c30034067$export$64b5c384219d3699();\n const c = new $d5b33d7c30034067$export$64b5c384219d3699();\n // iterate over all faces and apply a subdivision with the given detail value\n for(let i = 0; i < indices.length; i += 3){\n // get the vertices of the face\n getVertexByIndex(indices[i + 0], a);\n getVertexByIndex(indices[i + 1], b);\n getVertexByIndex(indices[i + 2], c);\n // perform subdivision\n subdivideFace(a, b, c, detail);\n }\n }\n function subdivideFace(a, b, c, detail) {\n const cols = detail + 1;\n // we use this multidimensional array as a data structure for creating the subdivision\n const v = [];\n // construct all of the vertices for this subdivision\n for(let i = 0; i <= cols; i++){\n v[i] = [];\n const aj = a.clone().lerp(c, i / cols);\n const bj = b.clone().lerp(c, i / cols);\n const rows = cols - i;\n for(let j = 0; j <= rows; j++)if (j === 0 && i === cols) v[i][j] = aj;\n else v[i][j] = aj.clone().lerp(bj, j / rows);\n }\n // construct all of the faces\n for(let i = 0; i < cols; i++)for(let j = 0; j < 2 * (cols - i) - 1; j++){\n const k = Math.floor(j / 2);\n if (j % 2 === 0) {\n pushVertex(v[i][k + 1]);\n pushVertex(v[i + 1][k]);\n pushVertex(v[i][k]);\n } else {\n pushVertex(v[i][k + 1]);\n pushVertex(v[i + 1][k + 1]);\n pushVertex(v[i + 1][k]);\n }\n }\n }\n function applyRadius(radius) {\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n // iterate over the entire buffer and apply the radius to each vertex\n for(let i = 0; i < vertexBuffer.length; i += 3){\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n vertex.normalize().multiplyScalar(radius);\n vertexBuffer[i + 0] = vertex.x;\n vertexBuffer[i + 1] = vertex.y;\n vertexBuffer[i + 2] = vertex.z;\n }\n }\n function generateUVs() {\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n for(let i = 0; i < vertexBuffer.length; i += 3){\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n const u = azimuth(vertex) / 2 / Math.PI + 0.5;\n const v = inclination(vertex) / Math.PI + 0.5;\n uvBuffer.push(u, 1 - v);\n }\n correctUVs();\n correctSeam();\n }\n function correctSeam() {\n // handle case when face straddles the seam, see #3269\n for(let i = 0; i < uvBuffer.length; i += 6){\n // uv data of a single face\n const x0 = uvBuffer[i + 0];\n const x1 = uvBuffer[i + 2];\n const x2 = uvBuffer[i + 4];\n const max = Math.max(x0, x1, x2);\n const min = Math.min(x0, x1, x2);\n // 0.9 is somewhat arbitrary\n if (max > 0.9 && min < 0.1) {\n if (x0 < 0.2) uvBuffer[i + 0] += 1;\n if (x1 < 0.2) uvBuffer[i + 2] += 1;\n if (x2 < 0.2) uvBuffer[i + 4] += 1;\n }\n }\n }\n function pushVertex(vertex) {\n vertexBuffer.push(vertex.x, vertex.y, vertex.z);\n }\n function getVertexByIndex(index, vertex) {\n const stride = index * 3;\n vertex.x = vertices[stride + 0];\n vertex.y = vertices[stride + 1];\n vertex.z = vertices[stride + 2];\n }\n function correctUVs() {\n const a = new $d5b33d7c30034067$export$64b5c384219d3699();\n const b = new $d5b33d7c30034067$export$64b5c384219d3699();\n const c = new $d5b33d7c30034067$export$64b5c384219d3699();\n const centroid = new $d5b33d7c30034067$export$64b5c384219d3699();\n const uvA = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const uvB = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n const uvC = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n for(let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6){\n a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]);\n b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]);\n c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]);\n uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]);\n uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]);\n uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]);\n centroid.copy(a).add(b).add(c).divideScalar(3);\n const azi = azimuth(centroid);\n correctUV(uvA, j + 0, a, azi);\n correctUV(uvB, j + 2, b, azi);\n correctUV(uvC, j + 4, c, azi);\n }\n }\n function correctUV(uv, stride, vector, azimuth) {\n if (azimuth < 0 && uv.x === 1) uvBuffer[stride] = uv.x - 1;\n if (vector.x === 0 && vector.z === 0) uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5;\n }\n // Angle around the Y axis, counter-clockwise when looking from above.\n function azimuth(vector) {\n return Math.atan2(vector.z, -vector.x);\n }\n // Angle above the XZ plane.\n function inclination(vector) {\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$60e57a7d3f20ff65(data.vertices, data.indices, data.radius, data.details);\n }\n}\nclass $d5b33d7c30034067$export$c0babfeb8708fc9c extends $d5b33d7c30034067$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const t = (1 + Math.sqrt(5)) / 2;\n const r = 1 / t;\n const vertices = [\n // (±1, ±1, ±1)\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n -1,\n 1,\n -1,\n -1,\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n 1,\n 1,\n 1,\n -1,\n 1,\n 1,\n 1,\n // (0, ±1/φ, ±φ)\n 0,\n -r,\n -t,\n 0,\n -r,\n t,\n 0,\n r,\n -t,\n 0,\n r,\n t,\n // (±1/φ, ±φ, 0)\n -r,\n -t,\n 0,\n -r,\n t,\n 0,\n r,\n -t,\n 0,\n r,\n t,\n 0,\n // (±φ, 0, ±1/φ)\n -t,\n 0,\n -r,\n t,\n 0,\n -r,\n -t,\n 0,\n r,\n t,\n 0,\n r\n ];\n const indices = [\n 3,\n 11,\n 7,\n 3,\n 7,\n 15,\n 3,\n 15,\n 13,\n 7,\n 19,\n 17,\n 7,\n 17,\n 6,\n 7,\n 6,\n 15,\n 17,\n 4,\n 8,\n 17,\n 8,\n 10,\n 17,\n 10,\n 6,\n 8,\n 0,\n 16,\n 8,\n 16,\n 2,\n 8,\n 2,\n 10,\n 0,\n 12,\n 1,\n 0,\n 1,\n 18,\n 0,\n 18,\n 16,\n 6,\n 10,\n 2,\n 6,\n 2,\n 13,\n 6,\n 13,\n 15,\n 2,\n 16,\n 18,\n 2,\n 18,\n 3,\n 2,\n 3,\n 13,\n 18,\n 1,\n 9,\n 18,\n 9,\n 11,\n 18,\n 11,\n 3,\n 4,\n 14,\n 12,\n 4,\n 12,\n 0,\n 4,\n 0,\n 8,\n 11,\n 9,\n 5,\n 11,\n 5,\n 19,\n 11,\n 19,\n 7,\n 19,\n 5,\n 14,\n 19,\n 14,\n 4,\n 19,\n 4,\n 17,\n 1,\n 12,\n 14,\n 1,\n 14,\n 5,\n 1,\n 5,\n 9\n ];\n super(vertices, indices, radius, detail);\n this.type = \"DodecahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$c0babfeb8708fc9c(data.radius, data.detail);\n }\n}\nconst $d5b33d7c30034067$var$_v0 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v1$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_normal = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_triangle = /*@__PURE__*/ new $d5b33d7c30034067$export$5a465592bfe74b48();\nclass $d5b33d7c30034067$export$4730b1542707547f extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(geometry = null, thresholdAngle = 1){\n super();\n this.type = \"EdgesGeometry\";\n this.parameters = {\n geometry: geometry,\n thresholdAngle: thresholdAngle\n };\n if (geometry !== null) {\n const precisionPoints = 4;\n const precision = Math.pow(10, precisionPoints);\n const thresholdDot = Math.cos($d5b33d7c30034067$var$DEG2RAD * thresholdAngle);\n const indexAttr = geometry.getIndex();\n const positionAttr = geometry.getAttribute(\"position\");\n const indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n const indexArr = [\n 0,\n 0,\n 0\n ];\n const vertKeys = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const hashes = new Array(3);\n const edgeData = {};\n const vertices = [];\n for(let i = 0; i < indexCount; i += 3){\n if (indexAttr) {\n indexArr[0] = indexAttr.getX(i);\n indexArr[1] = indexAttr.getX(i + 1);\n indexArr[2] = indexAttr.getX(i + 2);\n } else {\n indexArr[0] = i;\n indexArr[1] = i + 1;\n indexArr[2] = i + 2;\n }\n const { a: a, b: b, c: c } = $d5b33d7c30034067$var$_triangle;\n a.fromBufferAttribute(positionAttr, indexArr[0]);\n b.fromBufferAttribute(positionAttr, indexArr[1]);\n c.fromBufferAttribute(positionAttr, indexArr[2]);\n $d5b33d7c30034067$var$_triangle.getNormal($d5b33d7c30034067$var$_normal);\n // create hashes for the edge from the vertices\n hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;\n hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;\n hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`;\n // skip degenerate triangles\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) continue;\n // iterate over every edge\n for(let j = 0; j < 3; j++){\n // get the first and next vertex making up the edge\n const jNext = (j + 1) % 3;\n const vecHash0 = hashes[j];\n const vecHash1 = hashes[jNext];\n const v0 = $d5b33d7c30034067$var$_triangle[vertKeys[j]];\n const v1 = $d5b33d7c30034067$var$_triangle[vertKeys[jNext]];\n const hash = `${vecHash0}_${vecHash1}`;\n const reverseHash = `${vecHash1}_${vecHash0}`;\n if (reverseHash in edgeData && edgeData[reverseHash]) {\n // if we found a sibling edge add it into the vertex array if\n // it meets the angle threshold and delete the edge from the map.\n if ($d5b33d7c30034067$var$_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) {\n vertices.push(v0.x, v0.y, v0.z);\n vertices.push(v1.x, v1.y, v1.z);\n }\n edgeData[reverseHash] = null;\n } else if (!(hash in edgeData)) // if we've already got an edge here then skip adding a new one\n edgeData[hash] = {\n index0: indexArr[j],\n index1: indexArr[jNext],\n normal: $d5b33d7c30034067$var$_normal.clone()\n };\n }\n }\n // iterate over all remaining, unmatched edges and add them to the vertex array\n for(const key in edgeData)if (edgeData[key]) {\n const { index0: index0, index1: index1 } = edgeData[key];\n $d5b33d7c30034067$var$_v0.fromBufferAttribute(positionAttr, index0);\n $d5b33d7c30034067$var$_v1$1.fromBufferAttribute(positionAttr, index1);\n vertices.push($d5b33d7c30034067$var$_v0.x, $d5b33d7c30034067$var$_v0.y, $d5b33d7c30034067$var$_v0.z);\n vertices.push($d5b33d7c30034067$var$_v1$1.x, $d5b33d7c30034067$var$_v1$1.y, $d5b33d7c30034067$var$_v1$1.z);\n }\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n}\nclass $d5b33d7c30034067$export$6428a7f2611ef1fa extends $d5b33d7c30034067$export$4b2950bdac9b6ee9 {\n constructor(points){\n super(points);\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n this.type = \"Shape\";\n this.holes = [];\n }\n getPointsHoles(divisions) {\n const holesPts = [];\n for(let i = 0, l = this.holes.length; i < l; i++)holesPts[i] = this.holes[i].getPoints(divisions);\n return holesPts;\n }\n // get points of shape and holes (keypoints based on segments parameter)\n extractPoints(divisions) {\n return {\n shape: this.getPoints(divisions),\n holes: this.getPointsHoles(divisions)\n };\n }\n copy(source) {\n super.copy(source);\n this.holes = [];\n for(let i = 0, l = source.holes.length; i < l; i++){\n const hole = source.holes[i];\n this.holes.push(hole.clone());\n }\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.uuid = this.uuid;\n data.holes = [];\n for(let i = 0, l = this.holes.length; i < l; i++){\n const hole = this.holes[i];\n data.holes.push(hole.toJSON());\n }\n return data;\n }\n fromJSON(json) {\n super.fromJSON(json);\n this.uuid = json.uuid;\n this.holes = [];\n for(let i = 0, l = json.holes.length; i < l; i++){\n const hole = json.holes[i];\n this.holes.push(new $d5b33d7c30034067$export$4b2950bdac9b6ee9().fromJSON(hole));\n }\n return this;\n }\n}\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */ const $d5b33d7c30034067$var$Earcut = {\n triangulate: function(data, holeIndices, dim = 2) {\n const hasHoles = holeIndices && holeIndices.length;\n const outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n let outerNode = $d5b33d7c30034067$var$linkedList(data, 0, outerLen, dim, true);\n const triangles = [];\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n let minX, minY, maxX, maxY, x, y, invSize;\n if (hasHoles) outerNode = $d5b33d7c30034067$var$eliminateHoles(data, holeIndices, outerNode, dim);\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n for(let i = dim; i < outerLen; i += dim){\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n $d5b33d7c30034067$var$earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n return triangles;\n }\n};\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction $d5b33d7c30034067$var$linkedList(data, start, end, dim, clockwise) {\n let i, last;\n if (clockwise === $d5b33d7c30034067$var$signedArea(data, start, end, dim) > 0) for(i = start; i < end; i += dim)last = $d5b33d7c30034067$var$insertNode(i, data[i], data[i + 1], last);\n else for(i = end - dim; i >= start; i -= dim)last = $d5b33d7c30034067$var$insertNode(i, data[i], data[i + 1], last);\n if (last && $d5b33d7c30034067$var$equals(last, last.next)) {\n $d5b33d7c30034067$var$removeNode(last);\n last = last.next;\n }\n return last;\n}\n// eliminate colinear or duplicate points\nfunction $d5b33d7c30034067$var$filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n let p = start, again;\n do {\n again = false;\n if (!p.steiner && ($d5b33d7c30034067$var$equals(p, p.next) || $d5b33d7c30034067$var$area(p.prev, p, p.next) === 0)) {\n $d5b33d7c30034067$var$removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n } else p = p.next;\n }while (again || p !== end);\n return end;\n}\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction $d5b33d7c30034067$var$earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n // interlink polygon nodes in z-order\n if (!pass && invSize) $d5b33d7c30034067$var$indexCurve(ear, minX, minY, invSize);\n let stop = ear, prev, next;\n // iterate through ears, slicing them one by one\n while(ear.prev !== ear.next){\n prev = ear.prev;\n next = ear.next;\n if (invSize ? $d5b33d7c30034067$var$isEarHashed(ear, minX, minY, invSize) : $d5b33d7c30034067$var$isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n $d5b33d7c30034067$var$removeNode(ear);\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n continue;\n }\n ear = next;\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) $d5b33d7c30034067$var$earcutLinked($d5b33d7c30034067$var$filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n else if (pass === 1) {\n ear = $d5b33d7c30034067$var$cureLocalIntersections($d5b33d7c30034067$var$filterPoints(ear), triangles, dim);\n $d5b33d7c30034067$var$earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) $d5b33d7c30034067$var$splitEarcut(ear, triangles, dim, minX, minY, invSize);\n break;\n }\n }\n}\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction $d5b33d7c30034067$var$isEar(ear) {\n const a = ear.prev, b = ear, c = ear.next;\n if ($d5b33d7c30034067$var$area(a, b, c) >= 0) return false; // reflex, can't be an ear\n // now make sure we don't have other points inside the potential ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n // triangle bbox; min & max are calculated like this for speed\n const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n let p = c.next;\n while(p !== a){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $d5b33d7c30034067$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n return true;\n}\nfunction $d5b33d7c30034067$var$isEarHashed(ear, minX, minY, invSize) {\n const a = ear.prev, b = ear, c = ear.next;\n if ($d5b33d7c30034067$var$area(a, b, c) >= 0) return false; // reflex, can't be an ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n // triangle bbox; min & max are calculated like this for speed\n const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n // z-order range for the current triangle bbox;\n const minZ = $d5b33d7c30034067$var$zOrder(x0, y0, minX, minY, invSize), maxZ = $d5b33d7c30034067$var$zOrder(x1, y1, minX, minY, invSize);\n let p = ear.prevZ, n = ear.nextZ;\n // look for points inside the triangle in both directions\n while(p && p.z >= minZ && n && n.z <= maxZ){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $d5b33d7c30034067$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && $d5b33d7c30034067$var$area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n // look for remaining points in decreasing z-order\n while(p && p.z >= minZ){\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && $d5b33d7c30034067$var$area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n // look for remaining points in increasing z-order\n while(n && n.z <= maxZ){\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && $d5b33d7c30034067$var$area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n return true;\n}\n// go through all polygon nodes and cure small local self-intersections\nfunction $d5b33d7c30034067$var$cureLocalIntersections(start, triangles, dim) {\n let p = start;\n do {\n const a = p.prev, b = p.next.next;\n if (!$d5b33d7c30034067$var$equals(a, b) && $d5b33d7c30034067$var$intersects(a, p, p.next, b) && $d5b33d7c30034067$var$locallyInside(a, b) && $d5b33d7c30034067$var$locallyInside(b, a)) {\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n // remove two nodes involved\n $d5b33d7c30034067$var$removeNode(p);\n $d5b33d7c30034067$var$removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n }while (p !== start);\n return $d5b33d7c30034067$var$filterPoints(p);\n}\n// try splitting polygon into two and triangulate them independently\nfunction $d5b33d7c30034067$var$splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n let a = start;\n do {\n let b = a.next.next;\n while(b !== a.prev){\n if (a.i !== b.i && $d5b33d7c30034067$var$isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n let c = $d5b33d7c30034067$var$splitPolygon(a, b);\n // filter colinear points around the cuts\n a = $d5b33d7c30034067$var$filterPoints(a, a.next);\n c = $d5b33d7c30034067$var$filterPoints(c, c.next);\n // run earcut on each half\n $d5b33d7c30034067$var$earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n $d5b33d7c30034067$var$earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n }while (a !== start);\n}\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction $d5b33d7c30034067$var$eliminateHoles(data, holeIndices, outerNode, dim) {\n const queue = [];\n let i, len, start, end, list;\n for(i = 0, len = holeIndices.length; i < len; i++){\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = $d5b33d7c30034067$var$linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push($d5b33d7c30034067$var$getLeftmost(list));\n }\n queue.sort($d5b33d7c30034067$var$compareX);\n // process holes from left to right\n for(i = 0; i < queue.length; i++)outerNode = $d5b33d7c30034067$var$eliminateHole(queue[i], outerNode);\n return outerNode;\n}\nfunction $d5b33d7c30034067$var$compareX(a, b) {\n return a.x - b.x;\n}\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction $d5b33d7c30034067$var$eliminateHole(hole, outerNode) {\n const bridge = $d5b33d7c30034067$var$findHoleBridge(hole, outerNode);\n if (!bridge) return outerNode;\n const bridgeReverse = $d5b33d7c30034067$var$splitPolygon(bridge, hole);\n // filter collinear points around the cuts\n $d5b33d7c30034067$var$filterPoints(bridgeReverse, bridgeReverse.next);\n return $d5b33d7c30034067$var$filterPoints(bridge, bridge.next);\n}\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction $d5b33d7c30034067$var$findHoleBridge(hole, outerNode) {\n let p = outerNode, qx = -Infinity, m;\n const hx = hole.x, hy = hole.y;\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n }while (p !== outerNode);\n if (!m) return null;\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n const stop = m, mx = m.x, my = m.y;\n let tanMin = Infinity, tan;\n p = m;\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x && $d5b33d7c30034067$var$pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n if ($d5b33d7c30034067$var$locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && $d5b33d7c30034067$var$sectorContainsSector(m, p)))) {\n m = p;\n tanMin = tan;\n }\n }\n p = p.next;\n }while (p !== stop);\n return m;\n}\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction $d5b33d7c30034067$var$sectorContainsSector(m, p) {\n return $d5b33d7c30034067$var$area(m.prev, m, p.prev) < 0 && $d5b33d7c30034067$var$area(p.next, m, m.next) < 0;\n}\n// interlink polygon nodes in z-order\nfunction $d5b33d7c30034067$var$indexCurve(start, minX, minY, invSize) {\n let p = start;\n do {\n if (p.z === 0) p.z = $d5b33d7c30034067$var$zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n }while (p !== start);\n p.prevZ.nextZ = null;\n p.prevZ = null;\n $d5b33d7c30034067$var$sortLinked(p);\n}\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction $d5b33d7c30034067$var$sortLinked(list) {\n let i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n while(p){\n numMerges++;\n q = p;\n pSize = 0;\n for(i = 0; i < inSize; i++){\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n while(pSize > 0 || qSize > 0 && q){\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n if (tail) tail.nextZ = e;\n else list = e;\n e.prevZ = tail;\n tail = e;\n }\n p = q;\n }\n tail.nextZ = null;\n inSize *= 2;\n }while (numMerges > 1);\n return list;\n}\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction $d5b33d7c30034067$var$zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n y = (y | y << 2) & 0x33333333;\n y = (y | y << 1) & 0x55555555;\n return x | y << 1;\n}\n// find the leftmost node of a polygon ring\nfunction $d5b33d7c30034067$var$getLeftmost(start) {\n let p = start, leftmost = start;\n do {\n if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;\n p = p.next;\n }while (p !== start);\n return leftmost;\n}\n// check if a point lies within a convex triangle\nfunction $d5b33d7c30034067$var$pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction $d5b33d7c30034067$var$isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !$d5b33d7c30034067$var$intersectsPolygon(a, b) && // dones't intersect other edges\n ($d5b33d7c30034067$var$locallyInside(a, b) && $d5b33d7c30034067$var$locallyInside(b, a) && $d5b33d7c30034067$var$middleInside(a, b) && // locally visible\n ($d5b33d7c30034067$var$area(a.prev, a, b.prev) || $d5b33d7c30034067$var$area(a, b.prev, b)) || // does not create opposite-facing sectors\n $d5b33d7c30034067$var$equals(a, b) && $d5b33d7c30034067$var$area(a.prev, a, a.next) > 0 && $d5b33d7c30034067$var$area(b.prev, b, b.next) > 0); // special zero-length case\n}\n// signed area of a triangle\nfunction $d5b33d7c30034067$var$area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n// check if two points are equal\nfunction $d5b33d7c30034067$var$equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n// check if two segments intersect\nfunction $d5b33d7c30034067$var$intersects(p1, q1, p2, q2) {\n const o1 = $d5b33d7c30034067$var$sign($d5b33d7c30034067$var$area(p1, q1, p2));\n const o2 = $d5b33d7c30034067$var$sign($d5b33d7c30034067$var$area(p1, q1, q2));\n const o3 = $d5b33d7c30034067$var$sign($d5b33d7c30034067$var$area(p2, q2, p1));\n const o4 = $d5b33d7c30034067$var$sign($d5b33d7c30034067$var$area(p2, q2, q1));\n if (o1 !== o2 && o3 !== o4) return true; // general case\n if (o1 === 0 && $d5b33d7c30034067$var$onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && $d5b33d7c30034067$var$onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && $d5b33d7c30034067$var$onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && $d5b33d7c30034067$var$onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n return false;\n}\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction $d5b33d7c30034067$var$onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\nfunction $d5b33d7c30034067$var$sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n// check if a polygon diagonal intersects any polygon segments\nfunction $d5b33d7c30034067$var$intersectsPolygon(a, b) {\n let p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && $d5b33d7c30034067$var$intersects(p, p.next, a, b)) return true;\n p = p.next;\n }while (p !== a);\n return false;\n}\n// check if a polygon diagonal is locally inside the polygon\nfunction $d5b33d7c30034067$var$locallyInside(a, b) {\n return $d5b33d7c30034067$var$area(a.prev, a, a.next) < 0 ? $d5b33d7c30034067$var$area(a, b, a.next) >= 0 && $d5b33d7c30034067$var$area(a, a.prev, b) >= 0 : $d5b33d7c30034067$var$area(a, b, a.prev) < 0 || $d5b33d7c30034067$var$area(a, a.next, b) < 0;\n}\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction $d5b33d7c30034067$var$middleInside(a, b) {\n let p = a, inside = false;\n const px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;\n p = p.next;\n }while (p !== a);\n return inside;\n}\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction $d5b33d7c30034067$var$splitPolygon(a, b) {\n const a2 = new $d5b33d7c30034067$var$Node(a.i, a.x, a.y), b2 = new $d5b33d7c30034067$var$Node(b.i, b.x, b.y), an = a.next, bp = b.prev;\n a.next = b;\n b.prev = a;\n a2.next = an;\n an.prev = a2;\n b2.next = a2;\n a2.prev = b2;\n bp.next = b2;\n b2.prev = bp;\n return b2;\n}\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction $d5b33d7c30034067$var$insertNode(i, x, y, last) {\n const p = new $d5b33d7c30034067$var$Node(i, x, y);\n if (!last) {\n p.prev = p;\n p.next = p;\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\nfunction $d5b33d7c30034067$var$removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\nfunction $d5b33d7c30034067$var$Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n // vertex coordinates\n this.x = x;\n this.y = y;\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n // z-order curve value\n this.z = 0;\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n // indicates whether this is a steiner point\n this.steiner = false;\n}\nfunction $d5b33d7c30034067$var$signedArea(data, start, end, dim) {\n let sum = 0;\n for(let i = start, j = end - dim; i < end; i += dim){\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\nclass $d5b33d7c30034067$export$96bdf6d9c66d7ba8 {\n // calculate area of the contour polygon\n static area(contour) {\n const n = contour.length;\n let a = 0.0;\n for(let p = n - 1, q = 0; q < n; p = q++)a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;\n return a * 0.5;\n }\n static isClockWise(pts) {\n return $d5b33d7c30034067$export$96bdf6d9c66d7ba8.area(pts) < 0;\n }\n static triangulateShape(contour, holes) {\n const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n const holeIndices = []; // array of hole indices\n const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n $d5b33d7c30034067$var$removeDupEndPts(contour);\n $d5b33d7c30034067$var$addContour(vertices, contour);\n //\n let holeIndex = contour.length;\n holes.forEach($d5b33d7c30034067$var$removeDupEndPts);\n for(let i = 0; i < holes.length; i++){\n holeIndices.push(holeIndex);\n holeIndex += holes[i].length;\n $d5b33d7c30034067$var$addContour(vertices, holes[i]);\n }\n //\n const triangles = $d5b33d7c30034067$var$Earcut.triangulate(vertices, holeIndices);\n //\n for(let i = 0; i < triangles.length; i += 3)faces.push(triangles.slice(i, i + 3));\n return faces;\n }\n}\nfunction $d5b33d7c30034067$var$removeDupEndPts(points) {\n const l = points.length;\n if (l > 2 && points[l - 1].equals(points[0])) points.pop();\n}\nfunction $d5b33d7c30034067$var$addContour(vertices, contour) {\n for(let i = 0; i < contour.length; i++){\n vertices.push(contour[i].x);\n vertices.push(contour[i].y);\n }\n}\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */ class $d5b33d7c30034067$export$598697a1efa63ca7 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(shapes = new $d5b33d7c30034067$export$6428a7f2611ef1fa([\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, 0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(-0.5, 0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(-0.5, -0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, -0.5)\n ]), options = {}){\n super();\n this.type = \"ExtrudeGeometry\";\n this.parameters = {\n shapes: shapes,\n options: options\n };\n shapes = Array.isArray(shapes) ? shapes : [\n shapes\n ];\n const scope = this;\n const verticesArray = [];\n const uvArray = [];\n for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n addShape(shape);\n }\n // build geometry\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(verticesArray, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvArray, 2));\n this.computeVertexNormals();\n // functions\n function addShape(shape) {\n const placeholder = [];\n // options\n const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n const steps = options.steps !== undefined ? options.steps : 1;\n const depth = options.depth !== undefined ? options.depth : 1;\n let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n const extrudePath = options.extrudePath;\n const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : $d5b33d7c30034067$var$WorldUVGenerator;\n //\n let extrudePts, extrudeByPath = false;\n let splineTube, binormal, normal, position2;\n if (extrudePath) {\n extrudePts = extrudePath.getSpacedPoints(steps);\n extrudeByPath = true;\n bevelEnabled = false; // bevels not supported for path extrusion\n // SETUP TNB variables\n // TODO1 - have a .isClosed in spline?\n splineTube = extrudePath.computeFrenetFrames(steps, false);\n // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n binormal = new $d5b33d7c30034067$export$64b5c384219d3699();\n normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n position2 = new $d5b33d7c30034067$export$64b5c384219d3699();\n }\n // Safeguards if bevels are not enabled\n if (!bevelEnabled) {\n bevelSegments = 0;\n bevelThickness = 0;\n bevelSize = 0;\n bevelOffset = 0;\n }\n // Variables initialization\n const shapePoints = shape.extractPoints(curveSegments);\n let vertices = shapePoints.shape;\n const holes = shapePoints.holes;\n const reverse = !$d5b33d7c30034067$export$96bdf6d9c66d7ba8.isClockWise(vertices);\n if (reverse) {\n vertices = vertices.reverse();\n // Maybe we should also check if holes are in the opposite direction, just to be safe ...\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n if ($d5b33d7c30034067$export$96bdf6d9c66d7ba8.isClockWise(ahole)) holes[h] = ahole.reverse();\n }\n }\n const faces = $d5b33d7c30034067$export$96bdf6d9c66d7ba8.triangulateShape(vertices, holes);\n /* Vertices */ const contour = vertices; // vertices has all points but contour has only points of circumference\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n vertices = vertices.concat(ahole);\n }\n function scalePt2(pt, vec, size) {\n if (!vec) console.error(\"THREE.ExtrudeGeometry: vec does not exist\");\n return pt.clone().addScaledVector(vec, size);\n }\n const vlen = vertices.length, flen = faces.length;\n // Find directions for point movement\n function getBevelVec(inPt, inPrev, inNext) {\n // computes for inPt the corresponding point inPt' on a new contour\n // shifted by 1 unit (length of normalized vector) to the left\n // if we walk along contour clockwise, this new contour is outside the old one\n //\n // inPt' is the intersection of the two lines parallel to the two\n // adjacent edges of inPt at a distance of 1 unit on the left side.\n let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n // good reading for geometry algorithms (here: line-line intersection)\n // http://geomalgorithms.com/a05-_intersect-1.html\n const v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y;\n const v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y;\n const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y;\n // check for collinear edges\n const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x;\n if (Math.abs(collinear0) > Number.EPSILON) {\n // not collinear\n // length of vectors for normalizing\n const v_prev_len = Math.sqrt(v_prev_lensq);\n const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y);\n // shift adjacent points by unit vectors to the left\n const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len;\n const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len;\n const ptNextShift_x = inNext.x - v_next_y / v_next_len;\n const ptNextShift_y = inNext.y + v_next_x / v_next_len;\n // scaling factor for v_prev to intersection point\n const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x);\n // vector from inPt to intersection point\n v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x;\n v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y;\n // Don't normalize!, otherwise sharp corners become ugly\n // but prevent crazy spikes\n const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y;\n if (v_trans_lensq <= 2) return new $d5b33d7c30034067$export$c977b3e384af9ae1(v_trans_x, v_trans_y);\n else shrink_by = Math.sqrt(v_trans_lensq / 2);\n } else {\n // handle special case of collinear edges\n let direction_eq = false; // assumes: opposite\n if (v_prev_x > Number.EPSILON) {\n if (v_next_x > Number.EPSILON) direction_eq = true;\n } else {\n if (v_prev_x < -Number.EPSILON) {\n if (v_next_x < -Number.EPSILON) direction_eq = true;\n } else if (Math.sign(v_prev_y) === Math.sign(v_next_y)) direction_eq = true;\n }\n if (direction_eq) {\n // console.log(\"Warning: lines are a straight sequence\");\n v_trans_x = -v_prev_y;\n v_trans_y = v_prev_x;\n shrink_by = Math.sqrt(v_prev_lensq);\n } else {\n // console.log(\"Warning: lines are a straight spike\");\n v_trans_x = v_prev_x;\n v_trans_y = v_prev_y;\n shrink_by = Math.sqrt(v_prev_lensq / 2);\n }\n }\n return new $d5b33d7c30034067$export$c977b3e384af9ae1(v_trans_x / shrink_by, v_trans_y / shrink_by);\n }\n const contourMovements = [];\n for(let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++){\n if (j === il) j = 0;\n if (k === il) k = 0;\n // (j)---(i)---(k)\n // console.log('i,j,k', i, j , k)\n contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]);\n }\n const holesMovements = [];\n let oneHoleMovements, verticesMovements = contourMovements.concat();\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = [];\n for(let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++){\n if (j === il) j = 0;\n if (k === il) k = 0;\n // (j)---(i)---(k)\n oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]);\n }\n holesMovements.push(oneHoleMovements);\n verticesMovements = verticesMovements.concat(oneHoleMovements);\n }\n // Loop bevelSegments, 1 for the front, 1 for the back\n for(let b = 0; b < bevelSegments; b++){\n //for ( b = bevelSegments; b > 0; b -- ) {\n const t = b / bevelSegments;\n const z = bevelThickness * Math.cos(t * Math.PI / 2);\n const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset;\n // contract shape\n for(let i = 0, il = contour.length; i < il; i++){\n const vert = scalePt2(contour[i], contourMovements[i], bs);\n v(vert.x, vert.y, -z);\n }\n // expand holes\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = holesMovements[h];\n for(let i = 0, il = ahole.length; i < il; i++){\n const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);\n v(vert.x, vert.y, -z);\n }\n }\n }\n const bs = bevelSize + bevelOffset;\n // Back facing vertices\n for(let i = 0; i < vlen; i++){\n const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];\n if (!extrudeByPath) v(vert.x, vert.y, 0);\n else {\n // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n normal.copy(splineTube.normals[0]).multiplyScalar(vert.x);\n binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y);\n position2.copy(extrudePts[0]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n // Add stepped vertices...\n // Including front facing vertices\n for(let s = 1; s <= steps; s++)for(let i = 0; i < vlen; i++){\n const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];\n if (!extrudeByPath) v(vert.x, vert.y, depth / steps * s);\n else {\n // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n normal.copy(splineTube.normals[s]).multiplyScalar(vert.x);\n binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y);\n position2.copy(extrudePts[s]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n // Add bevel segments planes\n //for ( b = 1; b <= bevelSegments; b ++ ) {\n for(let b = bevelSegments - 1; b >= 0; b--){\n const t = b / bevelSegments;\n const z = bevelThickness * Math.cos(t * Math.PI / 2);\n const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset;\n // contract shape\n for(let i = 0, il = contour.length; i < il; i++){\n const vert = scalePt2(contour[i], contourMovements[i], bs);\n v(vert.x, vert.y, depth + z);\n }\n // expand holes\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n oneHoleMovements = holesMovements[h];\n for(let i = 0, il = ahole.length; i < il; i++){\n const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);\n if (!extrudeByPath) v(vert.x, vert.y, depth + z);\n else v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z);\n }\n }\n }\n /* Faces */ // Top and bottom faces\n buildLidFaces();\n // Sides faces\n buildSideFaces();\n ///// Internal functions\n function buildLidFaces() {\n const start = verticesArray.length / 3;\n if (bevelEnabled) {\n let layer = 0; // steps + 1\n let offset = vlen * layer;\n // Bottom faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[2] + offset, face[1] + offset, face[0] + offset);\n }\n layer = steps + bevelSegments * 2;\n offset = vlen * layer;\n // Top faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[0] + offset, face[1] + offset, face[2] + offset);\n }\n } else {\n // Bottom faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[2], face[1], face[0]);\n }\n // Top faces\n for(let i = 0; i < flen; i++){\n const face = faces[i];\n f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps);\n }\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 0);\n }\n // Create faces for the z-sides of the shape\n function buildSideFaces() {\n const start = verticesArray.length / 3;\n let layeroffset = 0;\n sidewalls(contour, layeroffset);\n layeroffset += contour.length;\n for(let h = 0, hl = holes.length; h < hl; h++){\n const ahole = holes[h];\n sidewalls(ahole, layeroffset);\n //, true\n layeroffset += ahole.length;\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 1);\n }\n function sidewalls(contour, layeroffset) {\n let i = contour.length;\n while(--i >= 0){\n const j = i;\n let k = i - 1;\n if (k < 0) k = contour.length - 1;\n //console.log('b', i,j, i-1, k,vertices.length);\n for(let s = 0, sl = steps + bevelSegments * 2; s < sl; s++){\n const slen1 = vlen * s;\n const slen2 = vlen * (s + 1);\n const a = layeroffset + j + slen1, b = layeroffset + k + slen1, c = layeroffset + k + slen2, d = layeroffset + j + slen2;\n f4(a, b, c, d);\n }\n }\n }\n function v(x, y, z) {\n placeholder.push(x);\n placeholder.push(y);\n placeholder.push(z);\n }\n function f3(a, b, c) {\n addVertex(a);\n addVertex(b);\n addVertex(c);\n const nextIndex = verticesArray.length / 3;\n const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n }\n function f4(a, b, c, d) {\n addVertex(a);\n addVertex(b);\n addVertex(d);\n addVertex(b);\n addVertex(c);\n addVertex(d);\n const nextIndex = verticesArray.length / 3;\n const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[3]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n addUV(uvs[3]);\n }\n function addVertex(index) {\n verticesArray.push(placeholder[index * 3 + 0]);\n verticesArray.push(placeholder[index * 3 + 1]);\n verticesArray.push(placeholder[index * 3 + 2]);\n }\n function addUV(vector2) {\n uvArray.push(vector2.x);\n uvArray.push(vector2.y);\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n const shapes = this.parameters.shapes;\n const options = this.parameters.options;\n return $d5b33d7c30034067$var$toJSON$1(shapes, options, data);\n }\n static fromJSON(data, shapes) {\n const geometryShapes = [];\n for(let j = 0, jl = data.shapes.length; j < jl; j++){\n const shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n const extrudePath = data.options.extrudePath;\n if (extrudePath !== undefined) data.options.extrudePath = new $d5b33d7c30034067$var$Curves[extrudePath.type]().fromJSON(extrudePath);\n return new $d5b33d7c30034067$export$598697a1efa63ca7(geometryShapes, data.options);\n }\n}\nconst $d5b33d7c30034067$var$WorldUVGenerator = {\n generateTopUV: function(geometry, vertices, indexA, indexB, indexC) {\n const a_x = vertices[indexA * 3];\n const a_y = vertices[indexA * 3 + 1];\n const b_x = vertices[indexB * 3];\n const b_y = vertices[indexB * 3 + 1];\n const c_x = vertices[indexC * 3];\n const c_y = vertices[indexC * 3 + 1];\n return [\n new $d5b33d7c30034067$export$c977b3e384af9ae1(a_x, a_y),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(b_x, b_y),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(c_x, c_y)\n ];\n },\n generateSideWallUV: function(geometry, vertices, indexA, indexB, indexC, indexD) {\n const a_x = vertices[indexA * 3];\n const a_y = vertices[indexA * 3 + 1];\n const a_z = vertices[indexA * 3 + 2];\n const b_x = vertices[indexB * 3];\n const b_y = vertices[indexB * 3 + 1];\n const b_z = vertices[indexB * 3 + 2];\n const c_x = vertices[indexC * 3];\n const c_y = vertices[indexC * 3 + 1];\n const c_z = vertices[indexC * 3 + 2];\n const d_x = vertices[indexD * 3];\n const d_y = vertices[indexD * 3 + 1];\n const d_z = vertices[indexD * 3 + 2];\n if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) return [\n new $d5b33d7c30034067$export$c977b3e384af9ae1(a_x, 1 - a_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(b_x, 1 - b_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(c_x, 1 - c_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(d_x, 1 - d_z)\n ];\n else return [\n new $d5b33d7c30034067$export$c977b3e384af9ae1(a_y, 1 - a_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(b_y, 1 - b_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(c_y, 1 - c_z),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(d_y, 1 - d_z)\n ];\n }\n};\nfunction $d5b33d7c30034067$var$toJSON$1(shapes, options, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n else data.shapes.push(shapes.uuid);\n data.options = Object.assign({}, options);\n if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON();\n return data;\n}\nclass $d5b33d7c30034067$export$9567cc828c9535da extends $d5b33d7c30034067$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const t = (1 + Math.sqrt(5)) / 2;\n const vertices = [\n -1,\n t,\n 0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n 0,\n 0,\n -1,\n t,\n 0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n t,\n 0,\n -1,\n t,\n 0,\n 1,\n -t,\n 0,\n -1,\n -t,\n 0,\n 1\n ];\n const indices = [\n 0,\n 11,\n 5,\n 0,\n 5,\n 1,\n 0,\n 1,\n 7,\n 0,\n 7,\n 10,\n 0,\n 10,\n 11,\n 1,\n 5,\n 9,\n 5,\n 11,\n 4,\n 11,\n 10,\n 2,\n 10,\n 7,\n 6,\n 7,\n 1,\n 8,\n 3,\n 9,\n 4,\n 3,\n 4,\n 2,\n 3,\n 2,\n 6,\n 3,\n 6,\n 8,\n 3,\n 8,\n 9,\n 4,\n 9,\n 5,\n 2,\n 4,\n 11,\n 6,\n 2,\n 10,\n 8,\n 6,\n 7,\n 9,\n 8,\n 1\n ];\n super(vertices, indices, radius, detail);\n this.type = \"IcosahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$9567cc828c9535da(data.radius, data.detail);\n }\n}\nclass $d5b33d7c30034067$export$1954e2b809fe361e extends $d5b33d7c30034067$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const vertices = [\n 1,\n 0,\n 0,\n -1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -1\n ];\n const indices = [\n 0,\n 2,\n 4,\n 0,\n 4,\n 3,\n 0,\n 3,\n 5,\n 0,\n 5,\n 2,\n 1,\n 2,\n 5,\n 1,\n 5,\n 3,\n 1,\n 3,\n 4,\n 1,\n 4,\n 2\n ];\n super(vertices, indices, radius, detail);\n this.type = \"OctahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$1954e2b809fe361e(data.radius, data.detail);\n }\n}\nclass $d5b33d7c30034067$export$68cb731f50f614af extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2){\n super();\n this.type = \"RingGeometry\";\n this.parameters = {\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n thetaSegments: thetaSegments,\n phiSegments: phiSegments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n thetaSegments = Math.max(3, thetaSegments);\n phiSegments = Math.max(1, phiSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // some helper variables\n let radius = innerRadius;\n const radiusStep = (outerRadius - innerRadius) / phiSegments;\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const uv = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n // generate vertices, normals and uvs\n for(let j = 0; j <= phiSegments; j++){\n for(let i = 0; i <= thetaSegments; i++){\n // values are generate from the inside of the ring to the outside\n const segment = thetaStart + i / thetaSegments * thetaLength;\n // vertex\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normals.push(0, 0, 1);\n // uv\n uv.x = (vertex.x / outerRadius + 1) / 2;\n uv.y = (vertex.y / outerRadius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n // increase the radius for next row of vertices\n radius += radiusStep;\n }\n // indices\n for(let j = 0; j < phiSegments; j++){\n const thetaSegmentLevel = j * (thetaSegments + 1);\n for(let i = 0; i < thetaSegments; i++){\n const segment = i + thetaSegmentLevel;\n const a = segment;\n const b = segment + thetaSegments + 1;\n const c = segment + thetaSegments + 2;\n const d = segment + 1;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$68cb731f50f614af(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength);\n }\n}\nclass $d5b33d7c30034067$export$57a29a1c803e9065 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(shapes = new $d5b33d7c30034067$export$6428a7f2611ef1fa([\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0, 0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(-0.5, -0.5),\n new $d5b33d7c30034067$export$c977b3e384af9ae1(0.5, -0.5)\n ]), curveSegments = 12){\n super();\n this.type = \"ShapeGeometry\";\n this.parameters = {\n shapes: shapes,\n curveSegments: curveSegments\n };\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n let groupStart = 0;\n let groupCount = 0;\n // allow single and array values for \"shapes\" parameter\n if (Array.isArray(shapes) === false) addShape(shapes);\n else for(let i = 0; i < shapes.length; i++){\n addShape(shapes[i]);\n this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support\n groupStart += groupCount;\n groupCount = 0;\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n // helper functions\n function addShape(shape) {\n const indexOffset = vertices.length / 3;\n const points = shape.extractPoints(curveSegments);\n let shapeVertices = points.shape;\n const shapeHoles = points.holes;\n // check direction of vertices\n if ($d5b33d7c30034067$export$96bdf6d9c66d7ba8.isClockWise(shapeVertices) === false) shapeVertices = shapeVertices.reverse();\n for(let i = 0, l = shapeHoles.length; i < l; i++){\n const shapeHole = shapeHoles[i];\n if ($d5b33d7c30034067$export$96bdf6d9c66d7ba8.isClockWise(shapeHole) === true) shapeHoles[i] = shapeHole.reverse();\n }\n const faces = $d5b33d7c30034067$export$96bdf6d9c66d7ba8.triangulateShape(shapeVertices, shapeHoles);\n // join vertices of inner and outer paths to a single array\n for(let i = 0, l = shapeHoles.length; i < l; i++){\n const shapeHole = shapeHoles[i];\n shapeVertices = shapeVertices.concat(shapeHole);\n }\n // vertices, normals, uvs\n for(let i = 0, l = shapeVertices.length; i < l; i++){\n const vertex = shapeVertices[i];\n vertices.push(vertex.x, vertex.y, 0);\n normals.push(0, 0, 1);\n uvs.push(vertex.x, vertex.y); // world uvs\n }\n // indices\n for(let i = 0, l = faces.length; i < l; i++){\n const face = faces[i];\n const a = face[0] + indexOffset;\n const b = face[1] + indexOffset;\n const c = face[2] + indexOffset;\n indices.push(a, b, c);\n groupCount += 3;\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n const shapes = this.parameters.shapes;\n return $d5b33d7c30034067$var$toJSON(shapes, data);\n }\n static fromJSON(data, shapes) {\n const geometryShapes = [];\n for(let j = 0, jl = data.shapes.length; j < jl; j++){\n const shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n return new $d5b33d7c30034067$export$57a29a1c803e9065(geometryShapes, data.curveSegments);\n }\n}\nfunction $d5b33d7c30034067$var$toJSON(shapes, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) for(let i = 0, l = shapes.length; i < l; i++){\n const shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n else data.shapes.push(shapes.uuid);\n return data;\n}\nclass $d5b33d7c30034067$export$1b417fc3b307a251 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI){\n super();\n this.type = \"SphereGeometry\";\n this.parameters = {\n radius: radius,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n phiStart: phiStart,\n phiLength: phiLength,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n widthSegments = Math.max(3, Math.floor(widthSegments));\n heightSegments = Math.max(2, Math.floor(heightSegments));\n const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);\n let index = 0;\n const grid = [];\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // generate vertices, normals and uvs\n for(let iy = 0; iy <= heightSegments; iy++){\n const verticesRow = [];\n const v = iy / heightSegments;\n // special case for the poles\n let uOffset = 0;\n if (iy === 0 && thetaStart === 0) uOffset = 0.5 / widthSegments;\n else if (iy === heightSegments && thetaEnd === Math.PI) uOffset = -0.5 / widthSegments;\n for(let ix = 0; ix <= widthSegments; ix++){\n const u = ix / widthSegments;\n // vertex\n vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertex.y = radius * Math.cos(thetaStart + v * thetaLength);\n vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.copy(vertex).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u + uOffset, 1 - v);\n verticesRow.push(index++);\n }\n grid.push(verticesRow);\n }\n // indices\n for(let iy = 0; iy < heightSegments; iy++)for(let ix = 0; ix < widthSegments; ix++){\n const a = grid[iy][ix + 1];\n const b = grid[iy][ix];\n const c = grid[iy + 1][ix];\n const d = grid[iy + 1][ix + 1];\n if (iy !== 0 || thetaStart > 0) indices.push(a, b, d);\n if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$1b417fc3b307a251(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);\n }\n}\nclass $d5b33d7c30034067$export$fb3f7adc68bd6e02 extends $d5b33d7c30034067$export$60e57a7d3f20ff65 {\n constructor(radius = 1, detail = 0){\n const vertices = [\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n 1,\n -1,\n 1,\n -1,\n -1\n ];\n const indices = [\n 2,\n 1,\n 0,\n 0,\n 3,\n 2,\n 1,\n 3,\n 0,\n 2,\n 3,\n 1\n ];\n super(vertices, indices, radius, detail);\n this.type = \"TetrahedronGeometry\";\n this.parameters = {\n radius: radius,\n detail: detail\n };\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$fb3f7adc68bd6e02(data.radius, data.detail);\n }\n}\nclass $d5b33d7c30034067$export$a2312a2a1fa56495 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2){\n super();\n this.type = \"TorusGeometry\";\n this.parameters = {\n radius: radius,\n tube: tube,\n radialSegments: radialSegments,\n tubularSegments: tubularSegments,\n arc: arc\n };\n radialSegments = Math.floor(radialSegments);\n tubularSegments = Math.floor(tubularSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const center = new $d5b33d7c30034067$export$64b5c384219d3699();\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let j = 0; j <= radialSegments; j++)for(let i = 0; i <= tubularSegments; i++){\n const u = i / tubularSegments * arc;\n const v = j / radialSegments * Math.PI * 2;\n // vertex\n vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u);\n vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u);\n vertex.z = tube * Math.sin(v);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n center.x = radius * Math.cos(u);\n center.y = radius * Math.sin(u);\n normal.subVectors(vertex, center).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n // generate indices\n for(let j = 1; j <= radialSegments; j++)for(let i = 1; i <= tubularSegments; i++){\n // indices\n const a = (tubularSegments + 1) * j + i - 1;\n const b = (tubularSegments + 1) * (j - 1) + i - 1;\n const c = (tubularSegments + 1) * (j - 1) + i;\n const d = (tubularSegments + 1) * j + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$a2312a2a1fa56495(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);\n }\n}\nclass $d5b33d7c30034067$export$77e9bfadfb9ab8c8 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3){\n super();\n this.type = \"TorusKnotGeometry\";\n this.parameters = {\n radius: radius,\n tube: tube,\n tubularSegments: tubularSegments,\n radialSegments: radialSegments,\n p: p,\n q: q\n };\n tubularSegments = Math.floor(tubularSegments);\n radialSegments = Math.floor(radialSegments);\n // buffers\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n // helper variables\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const P1 = new $d5b33d7c30034067$export$64b5c384219d3699();\n const P2 = new $d5b33d7c30034067$export$64b5c384219d3699();\n const B = new $d5b33d7c30034067$export$64b5c384219d3699();\n const T = new $d5b33d7c30034067$export$64b5c384219d3699();\n const N = new $d5b33d7c30034067$export$64b5c384219d3699();\n // generate vertices, normals and uvs\n for(let i = 0; i <= tubularSegments; ++i){\n // the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n const u = i / tubularSegments * p * Math.PI * 2;\n // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n // these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n calculatePositionOnCurve(u, p, q, radius, P1);\n calculatePositionOnCurve(u + 0.01, p, q, radius, P2);\n // calculate orthonormal basis\n T.subVectors(P2, P1);\n N.addVectors(P2, P1);\n B.crossVectors(T, N);\n N.crossVectors(B, T);\n // normalize B, N. T can be ignored, we don't use it\n B.normalize();\n N.normalize();\n for(let j = 0; j <= radialSegments; ++j){\n // now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n // because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n const v = j / radialSegments * Math.PI * 2;\n const cx = -tube * Math.cos(v);\n const cy = tube * Math.sin(v);\n // now calculate the final vertex position.\n // first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n vertex.x = P1.x + (cx * N.x + cy * B.x);\n vertex.y = P1.y + (cx * N.y + cy * B.y);\n vertex.z = P1.z + (cx * N.z + cy * B.z);\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n normal.subVectors(vertex, P1).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n }\n // generate indices\n for(let j = 1; j <= tubularSegments; j++)for(let i = 1; i <= radialSegments; i++){\n // indices\n const a = (radialSegments + 1) * (j - 1) + (i - 1);\n const b = (radialSegments + 1) * j + (i - 1);\n const c = (radialSegments + 1) * j + i;\n const d = (radialSegments + 1) * (j - 1) + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n // this function calculates the current position on the torus curve\n function calculatePositionOnCurve(u, p, q, radius, position) {\n const cu = Math.cos(u);\n const su = Math.sin(u);\n const quOverP = q / p * u;\n const cs = Math.cos(quOverP);\n position.x = radius * (2 + cs) * 0.5 * cu;\n position.y = radius * (2 + cs) * su * 0.5;\n position.z = radius * Math.sin(quOverP) * 0.5;\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n static fromJSON(data) {\n return new $d5b33d7c30034067$export$77e9bfadfb9ab8c8(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q);\n }\n}\nclass $d5b33d7c30034067$export$7897d9d48904490c extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(path = new $d5b33d7c30034067$export$bf3f4c7e459f90fc(new $d5b33d7c30034067$export$64b5c384219d3699(-1, -1, 0), new $d5b33d7c30034067$export$64b5c384219d3699(-1, 1, 0), new $d5b33d7c30034067$export$64b5c384219d3699(1, 1, 0)), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false){\n super();\n this.type = \"TubeGeometry\";\n this.parameters = {\n path: path,\n tubularSegments: tubularSegments,\n radius: radius,\n radialSegments: radialSegments,\n closed: closed\n };\n const frames = path.computeFrenetFrames(tubularSegments, closed);\n // expose internals\n this.tangents = frames.tangents;\n this.normals = frames.normals;\n this.binormals = frames.binormals;\n // helper variables\n const vertex = new $d5b33d7c30034067$export$64b5c384219d3699();\n const normal = new $d5b33d7c30034067$export$64b5c384219d3699();\n const uv = new $d5b33d7c30034067$export$c977b3e384af9ae1();\n let P = new $d5b33d7c30034067$export$64b5c384219d3699();\n // buffer\n const vertices = [];\n const normals = [];\n const uvs = [];\n const indices = [];\n // create buffer data\n generateBufferData();\n // build geometry\n this.setIndex(indices);\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n this.setAttribute(\"normal\", new $d5b33d7c30034067$export$cbe7a62641830ebd(normals, 3));\n this.setAttribute(\"uv\", new $d5b33d7c30034067$export$cbe7a62641830ebd(uvs, 2));\n // functions\n function generateBufferData() {\n for(let i = 0; i < tubularSegments; i++)generateSegment(i);\n // if the geometry is not closed, generate the last row of vertices and normals\n // at the regular position on the given path\n //\n // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n generateSegment(closed === false ? tubularSegments : 0);\n // uvs are generated in a separate function.\n // this makes it easy compute correct values for closed geometries\n generateUVs();\n // finally create faces\n generateIndices();\n }\n function generateSegment(i) {\n // we use getPointAt to sample evenly distributed points from the given path\n P = path.getPointAt(i / tubularSegments, P);\n // retrieve corresponding normal and binormal\n const N = frames.normals[i];\n const B = frames.binormals[i];\n // generate normals and vertices for the current segment\n for(let j = 0; j <= radialSegments; j++){\n const v = j / radialSegments * Math.PI * 2;\n const sin = Math.sin(v);\n const cos = -Math.cos(v);\n // normal\n normal.x = cos * N.x + sin * B.x;\n normal.y = cos * N.y + sin * B.y;\n normal.z = cos * N.z + sin * B.z;\n normal.normalize();\n normals.push(normal.x, normal.y, normal.z);\n // vertex\n vertex.x = P.x + radius * normal.x;\n vertex.y = P.y + radius * normal.y;\n vertex.z = P.z + radius * normal.z;\n vertices.push(vertex.x, vertex.y, vertex.z);\n }\n }\n function generateIndices() {\n for(let j = 1; j <= tubularSegments; j++)for(let i = 1; i <= radialSegments; i++){\n const a = (radialSegments + 1) * (j - 1) + (i - 1);\n const b = (radialSegments + 1) * j + (i - 1);\n const c = (radialSegments + 1) * j + i;\n const d = (radialSegments + 1) * (j - 1) + i;\n // faces\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n function generateUVs() {\n for(let i = 0; i <= tubularSegments; i++)for(let j = 0; j <= radialSegments; j++){\n uv.x = i / tubularSegments;\n uv.y = j / radialSegments;\n uvs.push(uv.x, uv.y);\n }\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.path = this.parameters.path.toJSON();\n return data;\n }\n static fromJSON(data) {\n // This only works for built-in curves (e.g. CatmullRomCurve3).\n // User defined curves or instances of CurvePath will not be deserialized.\n return new $d5b33d7c30034067$export$7897d9d48904490c(new $d5b33d7c30034067$var$Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed);\n }\n}\nclass $d5b33d7c30034067$export$4b739da06d24892b extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(geometry = null){\n super();\n this.type = \"WireframeGeometry\";\n this.parameters = {\n geometry: geometry\n };\n if (geometry !== null) {\n // buffer\n const vertices = [];\n const edges = new Set();\n // helper variables\n const start = new $d5b33d7c30034067$export$64b5c384219d3699();\n const end = new $d5b33d7c30034067$export$64b5c384219d3699();\n if (geometry.index !== null) {\n // indexed BufferGeometry\n const position = geometry.attributes.position;\n const indices = geometry.index;\n let groups = geometry.groups;\n if (groups.length === 0) groups = [\n {\n start: 0,\n count: indices.count,\n materialIndex: 0\n }\n ];\n // create a data structure that contains all edges without duplicates\n for(let o = 0, ol = groups.length; o < ol; ++o){\n const group = groups[o];\n const groupStart = group.start;\n const groupCount = group.count;\n for(let i = groupStart, l = groupStart + groupCount; i < l; i += 3)for(let j = 0; j < 3; j++){\n const index1 = indices.getX(i + j);\n const index2 = indices.getX(i + (j + 1) % 3);\n start.fromBufferAttribute(position, index1);\n end.fromBufferAttribute(position, index2);\n if ($d5b33d7c30034067$var$isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n } else {\n // non-indexed BufferGeometry\n const position = geometry.attributes.position;\n for(let i = 0, l = position.count / 3; i < l; i++)for(let j = 0; j < 3; j++){\n // three edges per triangle, an edge is represented as (index1, index2)\n // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n const index1 = 3 * i + j;\n const index2 = 3 * i + (j + 1) % 3;\n start.fromBufferAttribute(position, index1);\n end.fromBufferAttribute(position, index2);\n if ($d5b33d7c30034067$var$isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n // build geometry\n this.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n }\n }\n copy(source) {\n super.copy(source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n}\nfunction $d5b33d7c30034067$var$isUniqueEdge(start, end, edges) {\n const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n if (edges.has(hash1) === true || edges.has(hash2) === true) return false;\n else {\n edges.add(hash1);\n edges.add(hash2);\n return true;\n }\n}\nvar $d5b33d7c30034067$var$Geometries = /*#__PURE__*/ Object.freeze({\n __proto__: null,\n BoxGeometry: $d5b33d7c30034067$export$33e43285f7406bd5,\n CapsuleGeometry: $d5b33d7c30034067$export$41680e8551036033,\n CircleGeometry: $d5b33d7c30034067$export$d5c0e8d607467193,\n ConeGeometry: $d5b33d7c30034067$export$a7a48974f285c9b3,\n CylinderGeometry: $d5b33d7c30034067$export$68f745719dbe5198,\n DodecahedronGeometry: $d5b33d7c30034067$export$c0babfeb8708fc9c,\n EdgesGeometry: $d5b33d7c30034067$export$4730b1542707547f,\n ExtrudeGeometry: $d5b33d7c30034067$export$598697a1efa63ca7,\n IcosahedronGeometry: $d5b33d7c30034067$export$9567cc828c9535da,\n LatheGeometry: $d5b33d7c30034067$export$6d839803fcd1882c,\n OctahedronGeometry: $d5b33d7c30034067$export$1954e2b809fe361e,\n PlaneGeometry: $d5b33d7c30034067$export$967d831af31f69ce,\n PolyhedronGeometry: $d5b33d7c30034067$export$60e57a7d3f20ff65,\n RingGeometry: $d5b33d7c30034067$export$68cb731f50f614af,\n ShapeGeometry: $d5b33d7c30034067$export$57a29a1c803e9065,\n SphereGeometry: $d5b33d7c30034067$export$1b417fc3b307a251,\n TetrahedronGeometry: $d5b33d7c30034067$export$fb3f7adc68bd6e02,\n TorusGeometry: $d5b33d7c30034067$export$a2312a2a1fa56495,\n TorusKnotGeometry: $d5b33d7c30034067$export$77e9bfadfb9ab8c8,\n TubeGeometry: $d5b33d7c30034067$export$7897d9d48904490c,\n WireframeGeometry: $d5b33d7c30034067$export$4b739da06d24892b\n});\nclass $d5b33d7c30034067$export$e8564da406055a3 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isShadowMaterial = true;\n this.type = \"ShadowMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.transparent = true;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$21c421a2e1df9d22 extends $d5b33d7c30034067$export$83c7d75d550a8b0d {\n constructor(parameters){\n super(parameters);\n this.isRawShaderMaterial = true;\n this.type = \"RawShaderMaterial\";\n }\n}\nclass $d5b33d7c30034067$export$f2980790215acccd extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshStandardMaterial = true;\n this.defines = {\n \"STANDARD\": \"\"\n };\n this.type = \"MeshStandardMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff); // diffuse\n this.roughness = 1.0;\n this.metalness = 0.0;\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.roughnessMap = null;\n this.metalnessMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.envMapIntensity = 1.0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"STANDARD\": \"\"\n };\n this.color.copy(source.color);\n this.roughness = source.roughness;\n this.metalness = source.metalness;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.roughnessMap = source.roughnessMap;\n this.metalnessMap = source.metalnessMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.envMapIntensity = source.envMapIntensity;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$28d04986c4269c9f extends $d5b33d7c30034067$export$f2980790215acccd {\n constructor(parameters){\n super();\n this.isMeshPhysicalMaterial = true;\n this.defines = {\n \"STANDARD\": \"\",\n \"PHYSICAL\": \"\"\n };\n this.type = \"MeshPhysicalMaterial\";\n this.anisotropyRotation = 0;\n this.anisotropyMap = null;\n this.clearcoatMap = null;\n this.clearcoatRoughness = 0.0;\n this.clearcoatRoughnessMap = null;\n this.clearcoatNormalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.clearcoatNormalMap = null;\n this.ior = 1.5;\n Object.defineProperty(this, \"reflectivity\", {\n get: function() {\n return $d5b33d7c30034067$var$clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);\n },\n set: function(reflectivity) {\n this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity);\n }\n });\n this.iridescenceMap = null;\n this.iridescenceIOR = 1.3;\n this.iridescenceThicknessRange = [\n 100,\n 400\n ];\n this.iridescenceThicknessMap = null;\n this.sheenColor = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.sheenColorMap = null;\n this.sheenRoughness = 1.0;\n this.sheenRoughnessMap = null;\n this.transmissionMap = null;\n this.thickness = 0;\n this.thicknessMap = null;\n this.attenuationDistance = Infinity;\n this.attenuationColor = new $d5b33d7c30034067$export$892596cec99bc70e(1, 1, 1);\n this.specularIntensity = 1.0;\n this.specularIntensityMap = null;\n this.specularColor = new $d5b33d7c30034067$export$892596cec99bc70e(1, 1, 1);\n this.specularColorMap = null;\n this._anisotropy = 0;\n this._clearcoat = 0;\n this._iridescence = 0;\n this._sheen = 0.0;\n this._transmission = 0;\n this.setValues(parameters);\n }\n get anisotropy() {\n return this._anisotropy;\n }\n set anisotropy(value) {\n if (this._anisotropy > 0 !== value > 0) this.version++;\n this._anisotropy = value;\n }\n get clearcoat() {\n return this._clearcoat;\n }\n set clearcoat(value) {\n if (this._clearcoat > 0 !== value > 0) this.version++;\n this._clearcoat = value;\n }\n get iridescence() {\n return this._iridescence;\n }\n set iridescence(value) {\n if (this._iridescence > 0 !== value > 0) this.version++;\n this._iridescence = value;\n }\n get sheen() {\n return this._sheen;\n }\n set sheen(value) {\n if (this._sheen > 0 !== value > 0) this.version++;\n this._sheen = value;\n }\n get transmission() {\n return this._transmission;\n }\n set transmission(value) {\n if (this._transmission > 0 !== value > 0) this.version++;\n this._transmission = value;\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"STANDARD\": \"\",\n \"PHYSICAL\": \"\"\n };\n this.anisotropy = source.anisotropy;\n this.anisotropyRotation = source.anisotropyRotation;\n this.anisotropyMap = source.anisotropyMap;\n this.clearcoat = source.clearcoat;\n this.clearcoatMap = source.clearcoatMap;\n this.clearcoatRoughness = source.clearcoatRoughness;\n this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n this.clearcoatNormalMap = source.clearcoatNormalMap;\n this.clearcoatNormalScale.copy(source.clearcoatNormalScale);\n this.ior = source.ior;\n this.iridescence = source.iridescence;\n this.iridescenceMap = source.iridescenceMap;\n this.iridescenceIOR = source.iridescenceIOR;\n this.iridescenceThicknessRange = [\n ...source.iridescenceThicknessRange\n ];\n this.iridescenceThicknessMap = source.iridescenceThicknessMap;\n this.sheen = source.sheen;\n this.sheenColor.copy(source.sheenColor);\n this.sheenColorMap = source.sheenColorMap;\n this.sheenRoughness = source.sheenRoughness;\n this.sheenRoughnessMap = source.sheenRoughnessMap;\n this.transmission = source.transmission;\n this.transmissionMap = source.transmissionMap;\n this.thickness = source.thickness;\n this.thicknessMap = source.thicknessMap;\n this.attenuationDistance = source.attenuationDistance;\n this.attenuationColor.copy(source.attenuationColor);\n this.specularIntensity = source.specularIntensity;\n this.specularIntensityMap = source.specularIntensityMap;\n this.specularColor.copy(source.specularColor);\n this.specularColorMap = source.specularColorMap;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$24c72f71cbaf0678 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshPhongMaterial = true;\n this.type = \"MeshPhongMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff); // diffuse\n this.specular = new $d5b33d7c30034067$export$892596cec99bc70e(0x111111);\n this.shininess = 30;\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $d5b33d7c30034067$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.specular.copy(source.specular);\n this.shininess = source.shininess;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$df893cf97e765622 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshToonMaterial = true;\n this.defines = {\n \"TOON\": \"\"\n };\n this.type = \"MeshToonMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff);\n this.map = null;\n this.gradientMap = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.alphaMap = null;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.gradientMap = source.gradientMap;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$bfe8c0a091f41ae7 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshNormalMaterial = true;\n this.type = \"MeshNormalMaterial\";\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.flatShading = false;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.flatShading = source.flatShading;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$5023a9a8114806b8 extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshLambertMaterial = true;\n this.type = \"MeshLambertMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff); // diffuse\n this.map = null;\n this.lightMap = null;\n this.lightMapIntensity = 1.0;\n this.aoMap = null;\n this.aoMapIntensity = 1.0;\n this.emissive = new $d5b33d7c30034067$export$892596cec99bc70e(0x000000);\n this.emissiveIntensity = 1.0;\n this.emissiveMap = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.specularMap = null;\n this.alphaMap = null;\n this.envMap = null;\n this.combine = $d5b33d7c30034067$export$e50ac29801f1774d;\n this.reflectivity = 1;\n this.refractionRatio = 0.98;\n this.wireframe = false;\n this.wireframeLinewidth = 1;\n this.wireframeLinecap = \"round\";\n this.wireframeLinejoin = \"round\";\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$6f5fef6235ec12ee extends $d5b33d7c30034067$export$a2d8b23205c25948 {\n constructor(parameters){\n super();\n this.isMeshMatcapMaterial = true;\n this.defines = {\n \"MATCAP\": \"\"\n };\n this.type = \"MeshMatcapMaterial\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff); // diffuse\n this.matcap = null;\n this.map = null;\n this.bumpMap = null;\n this.bumpScale = 1;\n this.normalMap = null;\n this.normalMapType = $d5b33d7c30034067$export$2852a58ebdac27b8;\n this.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this.displacementMap = null;\n this.displacementScale = 1;\n this.displacementBias = 0;\n this.alphaMap = null;\n this.flatShading = false;\n this.fog = true;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.defines = {\n \"MATCAP\": \"\"\n };\n this.color.copy(source.color);\n this.matcap = source.matcap;\n this.map = source.map;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$327886a3efaeaebe extends $d5b33d7c30034067$export$fbaaa33907730a0c {\n constructor(parameters){\n super();\n this.isLineDashedMaterial = true;\n this.type = \"LineDashedMaterial\";\n this.scale = 1;\n this.dashSize = 3;\n this.gapSize = 1;\n this.setValues(parameters);\n }\n copy(source) {\n super.copy(source);\n this.scale = source.scale;\n this.dashSize = source.dashSize;\n this.gapSize = source.gapSize;\n return this;\n }\n}\n// same as Array.prototype.slice, but also works on typed arrays\nfunction $d5b33d7c30034067$var$arraySlice(array, from, to) {\n if ($d5b33d7c30034067$var$isTypedArray(array)) // in ios9 array.subarray(from, undefined) will return empty array\n // but array.subarray(from) or array.subarray(from, len) is correct\n return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));\n return array.slice(from, to);\n}\n// converts an array to a specific type\nfunction $d5b33d7c30034067$var$convertArray(array, type, forceClone) {\n if (!array || // let 'undefined' and 'null' pass\n !forceClone && array.constructor === type) return array;\n if (typeof type.BYTES_PER_ELEMENT === \"number\") return new type(array); // create typed array\n return Array.prototype.slice.call(array); // create Array\n}\nfunction $d5b33d7c30034067$var$isTypedArray(object) {\n return ArrayBuffer.isView(object) && !(object instanceof DataView);\n}\n// returns an array by which times and values can be sorted\nfunction $d5b33d7c30034067$var$getKeyframeOrder(times) {\n function compareTime(i, j) {\n return times[i] - times[j];\n }\n const n = times.length;\n const result = new Array(n);\n for(let i = 0; i !== n; ++i)result[i] = i;\n result.sort(compareTime);\n return result;\n}\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction $d5b33d7c30034067$var$sortedArray(values, stride, order) {\n const nValues = values.length;\n const result = new values.constructor(nValues);\n for(let i = 0, dstOffset = 0; dstOffset !== nValues; ++i){\n const srcOffset = order[i] * stride;\n for(let j = 0; j !== stride; ++j)result[dstOffset++] = values[srcOffset + j];\n }\n return result;\n}\n// function for parsing AOS keyframe formats\nfunction $d5b33d7c30034067$var$flattenJSON(jsonKeys, times, values, valuePropertyName) {\n let i = 1, key = jsonKeys[0];\n while(key !== undefined && key[valuePropertyName] === undefined)key = jsonKeys[i++];\n if (key === undefined) return; // no data\n let value = key[valuePropertyName];\n if (value === undefined) return; // no data\n if (Array.isArray(value)) do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push.apply(values, value); // push all elements\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n else if (value.toArray !== undefined) // ...assume THREE.Math-ish\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n value.toArray(values, values.length);\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n else // otherwise push as-is\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push(value);\n }\n key = jsonKeys[i++];\n }while (key !== undefined);\n}\nfunction $d5b33d7c30034067$var$subclip(sourceClip, name, startFrame, endFrame, fps = 30) {\n const clip = sourceClip.clone();\n clip.name = name;\n const tracks = [];\n for(let i = 0; i < clip.tracks.length; ++i){\n const track = clip.tracks[i];\n const valueSize = track.getValueSize();\n const times = [];\n const values = [];\n for(let j = 0; j < track.times.length; ++j){\n const frame = track.times[j] * fps;\n if (frame < startFrame || frame >= endFrame) continue;\n times.push(track.times[j]);\n for(let k = 0; k < valueSize; ++k)values.push(track.values[j * valueSize + k]);\n }\n if (times.length === 0) continue;\n track.times = $d5b33d7c30034067$var$convertArray(times, track.times.constructor);\n track.values = $d5b33d7c30034067$var$convertArray(values, track.values.constructor);\n tracks.push(track);\n }\n clip.tracks = tracks;\n // find minimum .times value across all tracks in the trimmed clip\n let minStartTime = Infinity;\n for(let i = 0; i < clip.tracks.length; ++i)if (minStartTime > clip.tracks[i].times[0]) minStartTime = clip.tracks[i].times[0];\n // shift all tracks such that clip begins at t=0\n for(let i = 0; i < clip.tracks.length; ++i)clip.tracks[i].shift(-1 * minStartTime);\n clip.resetDuration();\n return clip;\n}\nfunction $d5b33d7c30034067$var$makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {\n if (fps <= 0) fps = 30;\n const numTracks = referenceClip.tracks.length;\n const referenceTime = referenceFrame / fps;\n // Make each track's values relative to the values at the reference frame\n for(let i = 0; i < numTracks; ++i){\n const referenceTrack = referenceClip.tracks[i];\n const referenceTrackType = referenceTrack.ValueTypeName;\n // Skip this track if it's non-numeric\n if (referenceTrackType === \"bool\" || referenceTrackType === \"string\") continue;\n // Find the track in the target clip whose name and type matches the reference track\n const targetTrack = targetClip.tracks.find(function(track) {\n return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;\n });\n if (targetTrack === undefined) continue;\n let referenceOffset = 0;\n const referenceValueSize = referenceTrack.getValueSize();\n if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) referenceOffset = referenceValueSize / 3;\n let targetOffset = 0;\n const targetValueSize = targetTrack.getValueSize();\n if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) targetOffset = targetValueSize / 3;\n const lastIndex = referenceTrack.times.length - 1;\n let referenceValue;\n // Find the value to subtract out of the track\n if (referenceTime <= referenceTrack.times[0]) {\n // Reference frame is earlier than the first keyframe, so just use the first keyframe\n const startIndex = referenceOffset;\n const endIndex = referenceValueSize - referenceOffset;\n referenceValue = $d5b33d7c30034067$var$arraySlice(referenceTrack.values, startIndex, endIndex);\n } else if (referenceTime >= referenceTrack.times[lastIndex]) {\n // Reference frame is after the last keyframe, so just use the last keyframe\n const startIndex = lastIndex * referenceValueSize + referenceOffset;\n const endIndex = startIndex + referenceValueSize - referenceOffset;\n referenceValue = $d5b33d7c30034067$var$arraySlice(referenceTrack.values, startIndex, endIndex);\n } else {\n // Interpolate to the reference value\n const interpolant = referenceTrack.createInterpolant();\n const startIndex = referenceOffset;\n const endIndex = referenceValueSize - referenceOffset;\n interpolant.evaluate(referenceTime);\n referenceValue = $d5b33d7c30034067$var$arraySlice(interpolant.resultBuffer, startIndex, endIndex);\n }\n // Conjugate the quaternion\n if (referenceTrackType === \"quaternion\") {\n const referenceQuat = new $d5b33d7c30034067$export$23d6a54f0bbc85a3().fromArray(referenceValue).normalize().conjugate();\n referenceQuat.toArray(referenceValue);\n }\n // Subtract the reference value from all of the track values\n const numTimes = targetTrack.times.length;\n for(let j = 0; j < numTimes; ++j){\n const valueStart = j * targetValueSize + targetOffset;\n if (referenceTrackType === \"quaternion\") // Multiply the conjugate for quaternion track types\n $d5b33d7c30034067$export$23d6a54f0bbc85a3.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);\n else {\n const valueEnd = targetValueSize - targetOffset * 2;\n // Subtract each value for all other numeric track types\n for(let k = 0; k < valueEnd; ++k)targetTrack.values[valueStart + k] -= referenceValue[k];\n }\n }\n }\n targetClip.blendMode = $d5b33d7c30034067$export$d875e029ef558d3;\n return targetClip;\n}\nconst $d5b33d7c30034067$export$7ee8caa573e71ad1 = {\n arraySlice: $d5b33d7c30034067$var$arraySlice,\n convertArray: $d5b33d7c30034067$var$convertArray,\n isTypedArray: $d5b33d7c30034067$var$isTypedArray,\n getKeyframeOrder: $d5b33d7c30034067$var$getKeyframeOrder,\n sortedArray: $d5b33d7c30034067$var$sortedArray,\n flattenJSON: $d5b33d7c30034067$var$flattenJSON,\n subclip: $d5b33d7c30034067$var$subclip,\n makeClipAdditive: $d5b33d7c30034067$var$makeClipAdditive\n};\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */ class $d5b33d7c30034067$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n this.parameterPositions = parameterPositions;\n this._cachedIndex = 0;\n this.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor(sampleSize);\n this.sampleValues = sampleValues;\n this.valueSize = sampleSize;\n this.settings = null;\n this.DefaultSettings_ = {};\n }\n evaluate(t) {\n const pp = this.parameterPositions;\n let i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1];\n validate_interval: {\n seek: {\n let right;\n linear_scan: {\n //- See http://jsperf.com/comparison-to-undefined/3\n //- slower code:\n //-\n //- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n forward_scan: if (!(t < t1)) {\n for(let giveUpAt = i1 + 2;;){\n if (t1 === undefined) {\n if (t < t0) break forward_scan;\n // after end\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n if (i1 === giveUpAt) break; // this loop\n t0 = t1;\n t1 = pp[++i1];\n if (t < t1) break seek;\n }\n // prepare binary search on the right side of the index\n right = pp.length;\n break linear_scan;\n }\n //- slower code:\n //-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n if (!(t >= t0)) {\n // looping?\n const t1global = pp[1];\n if (t < t1global) {\n i1 = 2; // + 1, using the scan for the details\n t0 = t1global;\n }\n // linear reverse scan\n for(let giveUpAt = i1 - 2;;){\n if (t0 === undefined) {\n // before start\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (i1 === giveUpAt) break; // this loop\n t1 = t0;\n t0 = pp[--i1 - 1];\n if (t >= t0) break seek;\n }\n // prepare binary search on the left side of the index\n right = i1;\n i1 = 0;\n break linear_scan;\n }\n break validate_interval;\n } // linear scan\n // binary search\n while(i1 < right){\n const mid = i1 + right >>> 1;\n if (t < pp[mid]) right = mid;\n else i1 = mid + 1;\n }\n t1 = pp[i1];\n t0 = pp[i1 - 1];\n // check boundary cases, again\n if (t0 === undefined) {\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (t1 === undefined) {\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n } // seek\n this._cachedIndex = i1;\n this.intervalChanged_(i1, t0, t1);\n } // validate_interval\n return this.interpolate_(i1, t0, t, t1);\n }\n getSettings_() {\n return this.settings || this.DefaultSettings_;\n }\n copySampleValue_(index) {\n // copies a sample value to the result buffer\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride;\n for(let i = 0; i !== stride; ++i)result[i] = values[offset + i];\n return result;\n }\n // Template methods for derived classes:\n interpolate_() {\n throw new Error(\"call to abstract method\");\n // implementations shall return this.resultBuffer\n }\n intervalChanged_() {\n // empty\n }\n}\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */ class $d5b33d7c30034067$export$3646682e7a3959 extends $d5b33d7c30034067$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n this._weightPrev = -0;\n this._offsetPrev = -0;\n this._weightNext = -0;\n this._offsetNext = -0;\n this.DefaultSettings_ = {\n endingStart: $d5b33d7c30034067$export$7f795934b84ab523,\n endingEnd: $d5b33d7c30034067$export$7f795934b84ab523\n };\n }\n intervalChanged_(i1, t0, t1) {\n const pp = this.parameterPositions;\n let iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext];\n if (tPrev === undefined) switch(this.getSettings_().endingStart){\n case $d5b33d7c30034067$export$24a4ccb5099273b5:\n // f'(t0) = 0\n iPrev = i1;\n tPrev = 2 * t0 - t1;\n break;\n case $d5b33d7c30034067$export$8e8c3ecdcd8e1fee:\n // use the other end of the curve\n iPrev = pp.length - 2;\n tPrev = t0 + pp[iPrev] - pp[iPrev + 1];\n break;\n default:\n // f''(t0) = 0 a.k.a. Natural Spline\n iPrev = i1;\n tPrev = t1;\n }\n if (tNext === undefined) switch(this.getSettings_().endingEnd){\n case $d5b33d7c30034067$export$24a4ccb5099273b5:\n // f'(tN) = 0\n iNext = i1;\n tNext = 2 * t1 - t0;\n break;\n case $d5b33d7c30034067$export$8e8c3ecdcd8e1fee:\n // use the other end of the curve\n iNext = 1;\n tNext = t1 + pp[1] - pp[0];\n break;\n default:\n // f''(tN) = 0, a.k.a. Natural Spline\n iNext = i1 - 1;\n tNext = t0;\n }\n const halfDt = (t1 - t0) * 0.5, stride = this.valueSize;\n this._weightPrev = halfDt / (t0 - tPrev);\n this._weightNext = halfDt / (tNext - t1);\n this._offsetPrev = iPrev * stride;\n this._offsetNext = iNext * stride;\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p = (t - t0) / (t1 - t0), pp = p * p, ppp = pp * p;\n // evaluate polynomials\n const sP = -wP * ppp + 2 * wP * pp - wP * p;\n const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1;\n const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p;\n const sN = wN * ppp - wN * pp;\n // combine data linearly\n for(let i = 0; i !== stride; ++i)result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];\n return result;\n }\n}\nclass $d5b33d7c30034067$export$a8e6009059f51e1a extends $d5b33d7c30034067$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t - t0) / (t1 - t0), weight0 = 1 - weight1;\n for(let i = 0; i !== stride; ++i)result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;\n return result;\n }\n}\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */ class $d5b33d7c30034067$export$fb9758ef7ef8d5cc extends $d5b33d7c30034067$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1 /*, t0, t, t1 */ ) {\n return this.copySampleValue_(i1 - 1);\n }\n}\nclass $d5b33d7c30034067$export$b0e479f45b7006d6 {\n constructor(name, times, values, interpolation){\n if (name === undefined) throw new Error(\"THREE.KeyframeTrack: track name is undefined\");\n if (times === undefined || times.length === 0) throw new Error(\"THREE.KeyframeTrack: no keyframes in track named \" + name);\n this.name = name;\n this.times = $d5b33d7c30034067$var$convertArray(times, this.TimeBufferType);\n this.values = $d5b33d7c30034067$var$convertArray(values, this.ValueBufferType);\n this.setInterpolation(interpolation || this.DefaultInterpolation);\n }\n // Serialization (in static context, because of constructor invocation\n // and automatic invocation of .toJSON):\n static toJSON(track) {\n const trackType = track.constructor;\n let json;\n // derived classes can define a static toJSON method\n if (trackType.toJSON !== this.toJSON) json = trackType.toJSON(track);\n else {\n // by default, we assume the data can be serialized as-is\n json = {\n \"name\": track.name,\n \"times\": $d5b33d7c30034067$var$convertArray(track.times, Array),\n \"values\": $d5b33d7c30034067$var$convertArray(track.values, Array)\n };\n const interpolation = track.getInterpolation();\n if (interpolation !== track.DefaultInterpolation) json.interpolation = interpolation;\n }\n json.type = track.ValueTypeName; // mandatory\n return json;\n }\n InterpolantFactoryMethodDiscrete(result) {\n return new $d5b33d7c30034067$export$fb9758ef7ef8d5cc(this.times, this.values, this.getValueSize(), result);\n }\n InterpolantFactoryMethodLinear(result) {\n return new $d5b33d7c30034067$export$a8e6009059f51e1a(this.times, this.values, this.getValueSize(), result);\n }\n InterpolantFactoryMethodSmooth(result) {\n return new $d5b33d7c30034067$export$3646682e7a3959(this.times, this.values, this.getValueSize(), result);\n }\n setInterpolation(interpolation) {\n let factoryMethod;\n switch(interpolation){\n case $d5b33d7c30034067$export$995b32462a65e855:\n factoryMethod = this.InterpolantFactoryMethodDiscrete;\n break;\n case $d5b33d7c30034067$export$30fac1aace31cf4d:\n factoryMethod = this.InterpolantFactoryMethodLinear;\n break;\n case $d5b33d7c30034067$export$198b11ff4c72bb30:\n factoryMethod = this.InterpolantFactoryMethodSmooth;\n break;\n }\n if (factoryMethod === undefined) {\n const message = \"unsupported interpolation for \" + this.ValueTypeName + \" keyframe track named \" + this.name;\n if (this.createInterpolant === undefined) {\n // fall back to default, unless the default itself is messed up\n if (interpolation !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation);\n else throw new Error(message); // fatal, in this case\n }\n console.warn(\"THREE.KeyframeTrack:\", message);\n return this;\n }\n this.createInterpolant = factoryMethod;\n return this;\n }\n getInterpolation() {\n switch(this.createInterpolant){\n case this.InterpolantFactoryMethodDiscrete:\n return $d5b33d7c30034067$export$995b32462a65e855;\n case this.InterpolantFactoryMethodLinear:\n return $d5b33d7c30034067$export$30fac1aace31cf4d;\n case this.InterpolantFactoryMethodSmooth:\n return $d5b33d7c30034067$export$198b11ff4c72bb30;\n }\n }\n getValueSize() {\n return this.values.length / this.times.length;\n }\n // move all keyframes either forwards or backwards in time\n shift(timeOffset) {\n if (timeOffset !== 0.0) {\n const times = this.times;\n for(let i = 0, n = times.length; i !== n; ++i)times[i] += timeOffset;\n }\n return this;\n }\n // scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n scale(timeScale) {\n if (timeScale !== 1.0) {\n const times = this.times;\n for(let i = 0, n = times.length; i !== n; ++i)times[i] *= timeScale;\n }\n return this;\n }\n // removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n trim(startTime, endTime) {\n const times = this.times, nKeys = times.length;\n let from = 0, to = nKeys - 1;\n while(from !== nKeys && times[from] < startTime)++from;\n while(to !== -1 && times[to] > endTime)--to;\n ++to; // inclusive -> exclusive bound\n if (from !== 0 || to !== nKeys) {\n // empty tracks are forbidden, so keep at least one keyframe\n if (from >= to) {\n to = Math.max(to, 1);\n from = to - 1;\n }\n const stride = this.getValueSize();\n this.times = $d5b33d7c30034067$var$arraySlice(times, from, to);\n this.values = $d5b33d7c30034067$var$arraySlice(this.values, from * stride, to * stride);\n }\n return this;\n }\n // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n validate() {\n let valid = true;\n const valueSize = this.getValueSize();\n if (valueSize - Math.floor(valueSize) !== 0) {\n console.error(\"THREE.KeyframeTrack: Invalid value size in track.\", this);\n valid = false;\n }\n const times = this.times, values = this.values, nKeys = times.length;\n if (nKeys === 0) {\n console.error(\"THREE.KeyframeTrack: Track is empty.\", this);\n valid = false;\n }\n let prevTime = null;\n for(let i = 0; i !== nKeys; i++){\n const currTime = times[i];\n if (typeof currTime === \"number\" && isNaN(currTime)) {\n console.error(\"THREE.KeyframeTrack: Time is not a valid number.\", this, i, currTime);\n valid = false;\n break;\n }\n if (prevTime !== null && prevTime > currTime) {\n console.error(\"THREE.KeyframeTrack: Out of order keys.\", this, i, currTime, prevTime);\n valid = false;\n break;\n }\n prevTime = currTime;\n }\n if (values !== undefined) {\n if ($d5b33d7c30034067$var$isTypedArray(values)) for(let i = 0, n = values.length; i !== n; ++i){\n const value = values[i];\n if (isNaN(value)) {\n console.error(\"THREE.KeyframeTrack: Value is not a valid number.\", this, i, value);\n valid = false;\n break;\n }\n }\n }\n return valid;\n }\n // removes equivalent sequential keys as common in morph target sequences\n // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n optimize() {\n // times or values may be shared with other tracks, so overwriting is unsafe\n const times = $d5b33d7c30034067$var$arraySlice(this.times), values = $d5b33d7c30034067$var$arraySlice(this.values), stride = this.getValueSize(), smoothInterpolation = this.getInterpolation() === $d5b33d7c30034067$export$198b11ff4c72bb30, lastIndex = times.length - 1;\n let writeIndex = 1;\n for(let i = 1; i < lastIndex; ++i){\n let keep = false;\n const time = times[i];\n const timeNext = times[i + 1];\n // remove adjacent keyframes scheduled at the same time\n if (time !== timeNext && (i !== 1 || time !== times[0])) {\n if (!smoothInterpolation) {\n // remove unnecessary keyframes same as their neighbors\n const offset = i * stride, offsetP = offset - stride, offsetN = offset + stride;\n for(let j = 0; j !== stride; ++j){\n const value = values[offset + j];\n if (value !== values[offsetP + j] || value !== values[offsetN + j]) {\n keep = true;\n break;\n }\n }\n } else keep = true;\n }\n // in-place compaction\n if (keep) {\n if (i !== writeIndex) {\n times[writeIndex] = times[i];\n const readOffset = i * stride, writeOffset = writeIndex * stride;\n for(let j = 0; j !== stride; ++j)values[writeOffset + j] = values[readOffset + j];\n }\n ++writeIndex;\n }\n }\n // flush last keyframe (compaction looks ahead)\n if (lastIndex > 0) {\n times[writeIndex] = times[lastIndex];\n for(let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j)values[writeOffset + j] = values[readOffset + j];\n ++writeIndex;\n }\n if (writeIndex !== times.length) {\n this.times = $d5b33d7c30034067$var$arraySlice(times, 0, writeIndex);\n this.values = $d5b33d7c30034067$var$arraySlice(values, 0, writeIndex * stride);\n } else {\n this.times = times;\n this.values = values;\n }\n return this;\n }\n clone() {\n const times = $d5b33d7c30034067$var$arraySlice(this.times, 0);\n const values = $d5b33d7c30034067$var$arraySlice(this.values, 0);\n const TypedKeyframeTrack = this.constructor;\n const track = new TypedKeyframeTrack(this.name, times, values);\n // Interpolant argument to constructor is not saved, so copy the factory method directly.\n track.createInterpolant = this.createInterpolant;\n return track;\n }\n}\n$d5b33d7c30034067$export$b0e479f45b7006d6.prototype.TimeBufferType = Float32Array;\n$d5b33d7c30034067$export$b0e479f45b7006d6.prototype.ValueBufferType = Float32Array;\n$d5b33d7c30034067$export$b0e479f45b7006d6.prototype.DefaultInterpolation = $d5b33d7c30034067$export$30fac1aace31cf4d;\n/**\n * A Track of Boolean keyframe values.\n */ class $d5b33d7c30034067$export$d3a344b98cf0b775 extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n}\n$d5b33d7c30034067$export$d3a344b98cf0b775.prototype.ValueTypeName = \"bool\";\n$d5b33d7c30034067$export$d3a344b98cf0b775.prototype.ValueBufferType = Array;\n$d5b33d7c30034067$export$d3a344b98cf0b775.prototype.DefaultInterpolation = $d5b33d7c30034067$export$995b32462a65e855;\n$d5b33d7c30034067$export$d3a344b98cf0b775.prototype.InterpolantFactoryMethodLinear = undefined;\n$d5b33d7c30034067$export$d3a344b98cf0b775.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track of keyframe values that represent color.\n */ class $d5b33d7c30034067$export$83444c5d885347d8 extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n}\n$d5b33d7c30034067$export$83444c5d885347d8.prototype.ValueTypeName = \"color\";\n/**\n * A Track of numeric keyframe values.\n */ class $d5b33d7c30034067$export$d45f0d1a4d9a9314 extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n}\n$d5b33d7c30034067$export$d45f0d1a4d9a9314.prototype.ValueTypeName = \"number\";\n/**\n * Spherical linear unit quaternion interpolant.\n */ class $d5b33d7c30034067$export$2db1cfb7923d931e extends $d5b33d7c30034067$export$b558baee9c0f72d3 {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer){\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t - t0) / (t1 - t0);\n let offset = i1 * stride;\n for(let end = offset + stride; offset !== end; offset += 4)$d5b33d7c30034067$export$23d6a54f0bbc85a3.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);\n return result;\n }\n}\n/**\n * A Track of quaternion keyframe values.\n */ class $d5b33d7c30034067$export$b8043f12b5aafbd7 extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n InterpolantFactoryMethodLinear(result) {\n return new $d5b33d7c30034067$export$2db1cfb7923d931e(this.times, this.values, this.getValueSize(), result);\n }\n}\n$d5b33d7c30034067$export$b8043f12b5aafbd7.prototype.ValueTypeName = \"quaternion\";\n// ValueBufferType is inherited\n$d5b33d7c30034067$export$b8043f12b5aafbd7.prototype.DefaultInterpolation = $d5b33d7c30034067$export$30fac1aace31cf4d;\n$d5b33d7c30034067$export$b8043f12b5aafbd7.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track that interpolates Strings\n */ class $d5b33d7c30034067$export$6ce41d4f3a8df9cd extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n}\n$d5b33d7c30034067$export$6ce41d4f3a8df9cd.prototype.ValueTypeName = \"string\";\n$d5b33d7c30034067$export$6ce41d4f3a8df9cd.prototype.ValueBufferType = Array;\n$d5b33d7c30034067$export$6ce41d4f3a8df9cd.prototype.DefaultInterpolation = $d5b33d7c30034067$export$995b32462a65e855;\n$d5b33d7c30034067$export$6ce41d4f3a8df9cd.prototype.InterpolantFactoryMethodLinear = undefined;\n$d5b33d7c30034067$export$6ce41d4f3a8df9cd.prototype.InterpolantFactoryMethodSmooth = undefined;\n/**\n * A Track of vectored keyframe values.\n */ class $d5b33d7c30034067$export$5ce2dcb4cc9f2bff extends $d5b33d7c30034067$export$b0e479f45b7006d6 {\n}\n$d5b33d7c30034067$export$5ce2dcb4cc9f2bff.prototype.ValueTypeName = \"vector\";\nclass $d5b33d7c30034067$export$d942c706bf23829c {\n constructor(name, duration = -1, tracks, blendMode = $d5b33d7c30034067$export$bcfbbdcf8de7f8cd){\n this.name = name;\n this.tracks = tracks;\n this.duration = duration;\n this.blendMode = blendMode;\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n // this means it should figure out its duration by scanning the tracks\n if (this.duration < 0) this.resetDuration();\n }\n static parse(json) {\n const tracks = [], jsonTracks = json.tracks, frameTime = 1.0 / (json.fps || 1.0);\n for(let i = 0, n = jsonTracks.length; i !== n; ++i)tracks.push($d5b33d7c30034067$var$parseKeyframeTrack(jsonTracks[i]).scale(frameTime));\n const clip = new this(json.name, json.duration, tracks, json.blendMode);\n clip.uuid = json.uuid;\n return clip;\n }\n static toJSON(clip) {\n const tracks = [], clipTracks = clip.tracks;\n const json = {\n \"name\": clip.name,\n \"duration\": clip.duration,\n \"tracks\": tracks,\n \"uuid\": clip.uuid,\n \"blendMode\": clip.blendMode\n };\n for(let i = 0, n = clipTracks.length; i !== n; ++i)tracks.push($d5b33d7c30034067$export$b0e479f45b7006d6.toJSON(clipTracks[i]));\n return json;\n }\n static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) {\n const numMorphTargets = morphTargetSequence.length;\n const tracks = [];\n for(let i = 0; i < numMorphTargets; i++){\n let times = [];\n let values = [];\n times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);\n values.push(0, 1, 0);\n const order = $d5b33d7c30034067$var$getKeyframeOrder(times);\n times = $d5b33d7c30034067$var$sortedArray(times, 1, order);\n values = $d5b33d7c30034067$var$sortedArray(values, 1, order);\n // if there is a key at the first frame, duplicate it as the\n // last frame as well for perfect loop.\n if (!noLoop && times[0] === 0) {\n times.push(numMorphTargets);\n values.push(values[0]);\n }\n tracks.push(new $d5b33d7c30034067$export$d45f0d1a4d9a9314(\".morphTargetInfluences[\" + morphTargetSequence[i].name + \"]\", times, values).scale(1.0 / fps));\n }\n return new this(name, -1, tracks);\n }\n static findByName(objectOrClipArray, name) {\n let clipArray = objectOrClipArray;\n if (!Array.isArray(objectOrClipArray)) {\n const o = objectOrClipArray;\n clipArray = o.geometry && o.geometry.animations || o.animations;\n }\n for(let i = 0; i < clipArray.length; i++){\n if (clipArray[i].name === name) return clipArray[i];\n }\n return null;\n }\n static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) {\n const animationToMorphTargets = {};\n // tested with https://regex101.com/ on trick sequences\n // such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n const pattern = /^([\\w-]*?)([\\d]+)$/;\n // sort morph target names into animation groups based\n // patterns like Walk_001, Walk_002, Run_001, Run_002\n for(let i = 0, il = morphTargets.length; i < il; i++){\n const morphTarget = morphTargets[i];\n const parts = morphTarget.name.match(pattern);\n if (parts && parts.length > 1) {\n const name = parts[1];\n let animationMorphTargets = animationToMorphTargets[name];\n if (!animationMorphTargets) animationToMorphTargets[name] = animationMorphTargets = [];\n animationMorphTargets.push(morphTarget);\n }\n }\n const clips = [];\n for(const name in animationToMorphTargets)clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop));\n return clips;\n }\n // parse the animation.hierarchy format\n static parseAnimation(animation, bones) {\n if (!animation) {\n console.error(\"THREE.AnimationClip: No animation in JSONLoader data.\");\n return null;\n }\n const addNonemptyTrack = function(trackType, trackName, animationKeys, propertyName, destTracks) {\n // only return track if there are actually keys.\n if (animationKeys.length !== 0) {\n const times = [];\n const values = [];\n $d5b33d7c30034067$var$flattenJSON(animationKeys, times, values, propertyName);\n // empty keys are filtered out, so check again\n if (times.length !== 0) destTracks.push(new trackType(trackName, times, values));\n }\n };\n const tracks = [];\n const clipName = animation.name || \"default\";\n const fps = animation.fps || 30;\n const blendMode = animation.blendMode;\n // automatic length determination in AnimationClip.\n let duration = animation.length || -1;\n const hierarchyTracks = animation.hierarchy || [];\n for(let h = 0; h < hierarchyTracks.length; h++){\n const animationKeys = hierarchyTracks[h].keys;\n // skip empty tracks\n if (!animationKeys || animationKeys.length === 0) continue;\n // process morph targets\n if (animationKeys[0].morphTargets) {\n // figure out all morph targets used in this track\n const morphTargetNames = {};\n let k;\n for(k = 0; k < animationKeys.length; k++){\n if (animationKeys[k].morphTargets) for(let m = 0; m < animationKeys[k].morphTargets.length; m++)morphTargetNames[animationKeys[k].morphTargets[m]] = -1;\n }\n // create a track for each morph target with all zero\n // morphTargetInfluences except for the keys in which\n // the morphTarget is named.\n for(const morphTargetName in morphTargetNames){\n const times = [];\n const values = [];\n for(let m = 0; m !== animationKeys[k].morphTargets.length; ++m){\n const animationKey = animationKeys[k];\n times.push(animationKey.time);\n values.push(animationKey.morphTarget === morphTargetName ? 1 : 0);\n }\n tracks.push(new $d5b33d7c30034067$export$d45f0d1a4d9a9314(\".morphTargetInfluence[\" + morphTargetName + \"]\", times, values));\n }\n duration = morphTargetNames.length * fps;\n } else {\n // ...assume skeletal animation\n const boneName = \".bones[\" + bones[h].name + \"]\";\n addNonemptyTrack($d5b33d7c30034067$export$5ce2dcb4cc9f2bff, boneName + \".position\", animationKeys, \"pos\", tracks);\n addNonemptyTrack($d5b33d7c30034067$export$b8043f12b5aafbd7, boneName + \".quaternion\", animationKeys, \"rot\", tracks);\n addNonemptyTrack($d5b33d7c30034067$export$5ce2dcb4cc9f2bff, boneName + \".scale\", animationKeys, \"scl\", tracks);\n }\n }\n if (tracks.length === 0) return null;\n const clip = new this(clipName, duration, tracks, blendMode);\n return clip;\n }\n resetDuration() {\n const tracks = this.tracks;\n let duration = 0;\n for(let i = 0, n = tracks.length; i !== n; ++i){\n const track = this.tracks[i];\n duration = Math.max(duration, track.times[track.times.length - 1]);\n }\n this.duration = duration;\n return this;\n }\n trim() {\n for(let i = 0; i < this.tracks.length; i++)this.tracks[i].trim(0, this.duration);\n return this;\n }\n validate() {\n let valid = true;\n for(let i = 0; i < this.tracks.length; i++)valid = valid && this.tracks[i].validate();\n return valid;\n }\n optimize() {\n for(let i = 0; i < this.tracks.length; i++)this.tracks[i].optimize();\n return this;\n }\n clone() {\n const tracks = [];\n for(let i = 0; i < this.tracks.length; i++)tracks.push(this.tracks[i].clone());\n return new this.constructor(this.name, this.duration, tracks, this.blendMode);\n }\n toJSON() {\n return this.constructor.toJSON(this);\n }\n}\nfunction $d5b33d7c30034067$var$getTrackTypeForValueTypeName(typeName) {\n switch(typeName.toLowerCase()){\n case \"scalar\":\n case \"double\":\n case \"float\":\n case \"number\":\n case \"integer\":\n return $d5b33d7c30034067$export$d45f0d1a4d9a9314;\n case \"vector\":\n case \"vector2\":\n case \"vector3\":\n case \"vector4\":\n return $d5b33d7c30034067$export$5ce2dcb4cc9f2bff;\n case \"color\":\n return $d5b33d7c30034067$export$83444c5d885347d8;\n case \"quaternion\":\n return $d5b33d7c30034067$export$b8043f12b5aafbd7;\n case \"bool\":\n case \"boolean\":\n return $d5b33d7c30034067$export$d3a344b98cf0b775;\n case \"string\":\n return $d5b33d7c30034067$export$6ce41d4f3a8df9cd;\n }\n throw new Error(\"THREE.KeyframeTrack: Unsupported typeName: \" + typeName);\n}\nfunction $d5b33d7c30034067$var$parseKeyframeTrack(json) {\n if (json.type === undefined) throw new Error(\"THREE.KeyframeTrack: track type undefined, can not parse\");\n const trackType = $d5b33d7c30034067$var$getTrackTypeForValueTypeName(json.type);\n if (json.times === undefined) {\n const times = [], values = [];\n $d5b33d7c30034067$var$flattenJSON(json.keys, times, values, \"value\");\n json.times = times;\n json.values = values;\n }\n // derived classes can define a static parse method\n if (trackType.parse !== undefined) return trackType.parse(json);\n else // by default, we assume a constructor compatible with the base\n return new trackType(json.name, json.times, json.values, json.interpolation);\n}\nconst $d5b33d7c30034067$export$94affb487e701bf2 = {\n enabled: false,\n files: {},\n add: function(key, file) {\n if (this.enabled === false) return;\n // console.log( 'THREE.Cache', 'Adding key:', key );\n this.files[key] = file;\n },\n get: function(key) {\n if (this.enabled === false) return;\n // console.log( 'THREE.Cache', 'Checking key:', key );\n return this.files[key];\n },\n remove: function(key) {\n delete this.files[key];\n },\n clear: function() {\n this.files = {};\n }\n};\nclass $d5b33d7c30034067$export$99cc795e99919eed {\n constructor(onLoad, onProgress, onError){\n const scope = this;\n let isLoading = false;\n let itemsLoaded = 0;\n let itemsTotal = 0;\n let urlModifier = undefined;\n const handlers = [];\n // Refer to #5689 for the reason why we don't set .onStart\n // in the constructor\n this.onStart = undefined;\n this.onLoad = onLoad;\n this.onProgress = onProgress;\n this.onError = onError;\n this.itemStart = function(url) {\n itemsTotal++;\n if (isLoading === false) {\n if (scope.onStart !== undefined) scope.onStart(url, itemsLoaded, itemsTotal);\n }\n isLoading = true;\n };\n this.itemEnd = function(url) {\n itemsLoaded++;\n if (scope.onProgress !== undefined) scope.onProgress(url, itemsLoaded, itemsTotal);\n if (itemsLoaded === itemsTotal) {\n isLoading = false;\n if (scope.onLoad !== undefined) scope.onLoad();\n }\n };\n this.itemError = function(url) {\n if (scope.onError !== undefined) scope.onError(url);\n };\n this.resolveURL = function(url) {\n if (urlModifier) return urlModifier(url);\n return url;\n };\n this.setURLModifier = function(transform) {\n urlModifier = transform;\n return this;\n };\n this.addHandler = function(regex, loader) {\n handlers.push(regex, loader);\n return this;\n };\n this.removeHandler = function(regex) {\n const index = handlers.indexOf(regex);\n if (index !== -1) handlers.splice(index, 2);\n return this;\n };\n this.getHandler = function(file) {\n for(let i = 0, l = handlers.length; i < l; i += 2){\n const regex = handlers[i];\n const loader = handlers[i + 1];\n if (regex.global) regex.lastIndex = 0; // see #17920\n if (regex.test(file)) return loader;\n }\n return null;\n };\n }\n}\nconst $d5b33d7c30034067$export$b033c3f9a95c6a16 = /*@__PURE__*/ new $d5b33d7c30034067$export$99cc795e99919eed();\nclass $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n this.manager = manager !== undefined ? manager : $d5b33d7c30034067$export$b033c3f9a95c6a16;\n this.crossOrigin = \"anonymous\";\n this.withCredentials = false;\n this.path = \"\";\n this.resourcePath = \"\";\n this.requestHeader = {};\n }\n load() {}\n loadAsync(url, onProgress) {\n const scope = this;\n return new Promise(function(resolve, reject) {\n scope.load(url, resolve, onProgress, reject);\n });\n }\n parse() {}\n setCrossOrigin(crossOrigin) {\n this.crossOrigin = crossOrigin;\n return this;\n }\n setWithCredentials(value) {\n this.withCredentials = value;\n return this;\n }\n setPath(path) {\n this.path = path;\n return this;\n }\n setResourcePath(resourcePath) {\n this.resourcePath = resourcePath;\n return this;\n }\n setRequestHeader(requestHeader) {\n this.requestHeader = requestHeader;\n return this;\n }\n}\n$d5b33d7c30034067$export$3b0d6d7590275603.DEFAULT_MATERIAL_NAME = \"__DEFAULT\";\nconst $d5b33d7c30034067$var$loading = {};\nclass $d5b33d7c30034067$var$HttpError extends Error {\n constructor(message, response){\n super(message);\n this.response = response;\n }\n}\nclass $d5b33d7c30034067$export$98435a25b5cf7b2b extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n if (url === undefined) url = \"\";\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const cached = $d5b33d7c30034067$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n this.manager.itemStart(url);\n setTimeout(()=>{\n if (onLoad) onLoad(cached);\n this.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n // Check if request is duplicate\n if ($d5b33d7c30034067$var$loading[url] !== undefined) {\n $d5b33d7c30034067$var$loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n return;\n }\n // Initialise array for duplicate requests\n $d5b33d7c30034067$var$loading[url] = [];\n $d5b33d7c30034067$var$loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n // create request\n const req = new Request(url, {\n headers: new Headers(this.requestHeader),\n credentials: this.withCredentials ? \"include\" : \"same-origin\"\n });\n // record states ( avoid data race )\n const mimeType = this.mimeType;\n const responseType = this.responseType;\n // start the fetch\n fetch(req).then((response)=>{\n if (response.status === 200 || response.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n if (response.status === 0) console.warn(\"THREE.FileLoader: HTTP Status 0 received.\");\n // Workaround: Checking if response.body === undefined for Alipay browser #23548\n if (typeof ReadableStream === \"undefined\" || response.body === undefined || response.body.getReader === undefined) return response;\n const callbacks = $d5b33d7c30034067$var$loading[url];\n const reader = response.body.getReader();\n // Nginx needs X-File-Size check\n // https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n const contentLength = response.headers.get(\"Content-Length\") || response.headers.get(\"X-File-Size\");\n const total = contentLength ? parseInt(contentLength) : 0;\n const lengthComputable = total !== 0;\n let loaded = 0;\n // periodically read data into the new stream tracking while download progress\n const stream = new ReadableStream({\n start (controller) {\n readData();\n function readData() {\n reader.read().then(({ done: done, value: value })=>{\n if (done) controller.close();\n else {\n loaded += value.byteLength;\n const event = new ProgressEvent(\"progress\", {\n lengthComputable: lengthComputable,\n loaded: loaded,\n total: total\n });\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onProgress) callback.onProgress(event);\n }\n controller.enqueue(value);\n readData();\n }\n });\n }\n }\n });\n return new Response(stream);\n } else throw new $d5b33d7c30034067$var$HttpError(`fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response);\n }).then((response)=>{\n switch(responseType){\n case \"arraybuffer\":\n return response.arrayBuffer();\n case \"blob\":\n return response.blob();\n case \"document\":\n return response.text().then((text)=>{\n const parser = new DOMParser();\n return parser.parseFromString(text, mimeType);\n });\n case \"json\":\n return response.json();\n default:\n if (mimeType === undefined) return response.text();\n else {\n // sniff encoding\n const re = /charset=\"?([^;\"\\s]*)\"?/i;\n const exec = re.exec(mimeType);\n const label = exec && exec[1] ? exec[1].toLowerCase() : undefined;\n const decoder = new TextDecoder(label);\n return response.arrayBuffer().then((ab)=>decoder.decode(ab));\n }\n }\n }).then((data)=>{\n // Add to cache only on HTTP success, so that we do not cache\n // error response bodies as proper responses to requests.\n $d5b33d7c30034067$export$94affb487e701bf2.add(url, data);\n const callbacks = $d5b33d7c30034067$var$loading[url];\n delete $d5b33d7c30034067$var$loading[url];\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onLoad) callback.onLoad(data);\n }\n }).catch((err)=>{\n // Abort errors and other errors are handled the same\n const callbacks = $d5b33d7c30034067$var$loading[url];\n if (callbacks === undefined) {\n // When onLoad was called and url was deleted in `loading`\n this.manager.itemError(url);\n throw err;\n }\n delete $d5b33d7c30034067$var$loading[url];\n for(let i = 0, il = callbacks.length; i < il; i++){\n const callback = callbacks[i];\n if (callback.onError) callback.onError(err);\n }\n this.manager.itemError(url);\n }).finally(()=>{\n this.manager.itemEnd(url);\n });\n this.manager.itemStart(url);\n }\n setResponseType(value) {\n this.responseType = value;\n return this;\n }\n setMimeType(value) {\n this.mimeType = value;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$29711c7e14f61db extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const animations = [];\n for(let i = 0; i < json.length; i++){\n const clip = $d5b33d7c30034067$export$d942c706bf23829c.parse(json[i]);\n animations.push(clip);\n }\n return animations;\n }\n}\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */ class $d5b33d7c30034067$export$bd73ce947a280350 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const images = [];\n const texture = new $d5b33d7c30034067$export$3466bac9141a5cc4();\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n let loaded = 0;\n function loadTexture(i) {\n loader.load(url[i], function(buffer) {\n const texDatas = scope.parse(buffer, true);\n images[i] = {\n width: texDatas.width,\n height: texDatas.height,\n format: texDatas.format,\n mipmaps: texDatas.mipmaps\n };\n loaded += 1;\n if (loaded === 6) {\n if (texDatas.mipmapCount === 1) texture.minFilter = $d5b33d7c30034067$export$8a72f490b25c56c8;\n texture.image = images;\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, onProgress, onError);\n }\n if (Array.isArray(url)) for(let i = 0, il = url.length; i < il; ++i)loadTexture(i);\n else // compressed cubemap texture stored in a single DDS file\n loader.load(url, function(buffer) {\n const texDatas = scope.parse(buffer, true);\n if (texDatas.isCubemap) {\n const faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n for(let f = 0; f < faces; f++){\n images[f] = {\n mipmaps: []\n };\n for(let i = 0; i < texDatas.mipmapCount; i++){\n images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]);\n images[f].format = texDatas.format;\n images[f].width = texDatas.width;\n images[f].height = texDatas.height;\n }\n }\n texture.image = images;\n } else {\n texture.image.width = texDatas.width;\n texture.image.height = texDatas.height;\n texture.mipmaps = texDatas.mipmaps;\n }\n if (texDatas.mipmapCount === 1) texture.minFilter = $d5b33d7c30034067$export$8a72f490b25c56c8;\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $d5b33d7c30034067$export$8905ce1c7a2464a1 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const scope = this;\n const cached = $d5b33d7c30034067$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function() {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n const image = $d5b33d7c30034067$var$createElementNS(\"img\");\n function onImageLoad() {\n removeEventListeners();\n $d5b33d7c30034067$export$94affb487e701bf2.add(url, this);\n if (onLoad) onLoad(this);\n scope.manager.itemEnd(url);\n }\n function onImageError(event) {\n removeEventListeners();\n if (onError) onError(event);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n }\n function removeEventListeners() {\n image.removeEventListener(\"load\", onImageLoad, false);\n image.removeEventListener(\"error\", onImageError, false);\n }\n image.addEventListener(\"load\", onImageLoad, false);\n image.addEventListener(\"error\", onImageError, false);\n if (url.slice(0, 5) !== \"data:\") {\n if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin;\n }\n scope.manager.itemStart(url);\n image.src = url;\n return image;\n }\n}\nclass $d5b33d7c30034067$export$2ec114afc2cf6308 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(urls, onLoad, onProgress, onError) {\n const texture = new $d5b33d7c30034067$export$ee2e5a18258a4049();\n texture.colorSpace = $d5b33d7c30034067$export$561f394b24edfcaa;\n const loader = new $d5b33d7c30034067$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n let loaded = 0;\n function loadTexture(i) {\n loader.load(urls[i], function(image) {\n texture.images[i] = image;\n loaded++;\n if (loaded === 6) {\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, undefined, onError);\n }\n for(let i = 0; i < urls.length; ++i)loadTexture(i);\n return texture;\n }\n}\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */ class $d5b33d7c30034067$export$792d8a18f2c55855 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const texture = new $d5b33d7c30034067$export$b691f601014eabe1();\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setPath(this.path);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(buffer) {\n let texData;\n try {\n texData = scope.parse(buffer);\n } catch (error) {\n if (onError !== undefined) onError(error);\n else {\n console.error(error);\n return;\n }\n }\n if (!texData) return onError(); // TODO: Remove this when all loaders properly throw errors\n if (texData.image !== undefined) texture.image = texData.image;\n else if (texData.data !== undefined) {\n texture.image.width = texData.width;\n texture.image.height = texData.height;\n texture.image.data = texData.data;\n }\n texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : $d5b33d7c30034067$export$9d9334239a5a5e06;\n texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : $d5b33d7c30034067$export$9d9334239a5a5e06;\n texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : $d5b33d7c30034067$export$8a72f490b25c56c8;\n texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n if (texData.colorSpace !== undefined) texture.colorSpace = texData.colorSpace;\n else if (texData.encoding !== undefined) texture.encoding = texData.encoding;\n if (texData.flipY !== undefined) texture.flipY = texData.flipY;\n if (texData.format !== undefined) texture.format = texData.format;\n if (texData.type !== undefined) texture.type = texData.type;\n if (texData.mipmaps !== undefined) {\n texture.mipmaps = texData.mipmaps;\n texture.minFilter = $d5b33d7c30034067$export$5d8599b6a933fb1b; // presumably...\n }\n if (texData.mipmapCount === 1) texture.minFilter = $d5b33d7c30034067$export$8a72f490b25c56c8;\n if (texData.generateMipmaps !== undefined) texture.generateMipmaps = texData.generateMipmaps;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture, texData);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $d5b33d7c30034067$export$fd1bfc71f64c538c extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const texture = new $d5b33d7c30034067$export$5431306cf43de24a();\n const loader = new $d5b33d7c30034067$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n loader.load(url, function(image) {\n texture.image = image;\n texture.needsUpdate = true;\n if (onLoad !== undefined) onLoad(texture);\n }, onProgress, onError);\n return texture;\n }\n}\nclass $d5b33d7c30034067$export$6ecadb6ed240d696 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(color, intensity = 1){\n super();\n this.isLight = true;\n this.type = \"Light\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e(color);\n this.intensity = intensity;\n }\n dispose() {\n // Empty here in base class; some subclasses override.\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.color.copy(source.color);\n this.intensity = source.intensity;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.color = this.color.getHex();\n data.object.intensity = this.intensity;\n if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex();\n if (this.distance !== undefined) data.object.distance = this.distance;\n if (this.angle !== undefined) data.object.angle = this.angle;\n if (this.decay !== undefined) data.object.decay = this.decay;\n if (this.penumbra !== undefined) data.object.penumbra = this.penumbra;\n if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON();\n return data;\n }\n}\nclass $d5b33d7c30034067$export$8d474f55edbb9624 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(skyColor, groundColor, intensity){\n super(skyColor, intensity);\n this.isHemisphereLight = true;\n this.type = \"HemisphereLight\";\n this.position.copy($d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.groundColor = new $d5b33d7c30034067$export$892596cec99bc70e(groundColor);\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.groundColor.copy(source.groundColor);\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_projScreenMatrix$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_lightPositionWorld$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_lookTarget$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$var$LightShadow {\n constructor(camera){\n this.camera = camera;\n this.bias = 0;\n this.normalBias = 0;\n this.radius = 1;\n this.blurSamples = 8;\n this.mapSize = new $d5b33d7c30034067$export$c977b3e384af9ae1(512, 512);\n this.map = null;\n this.mapPass = null;\n this.matrix = new $d5b33d7c30034067$export$2ae72fc923e5eb5();\n this.autoUpdate = true;\n this.needsUpdate = false;\n this._frustum = new $d5b33d7c30034067$export$35efe6f4c85463d2();\n this._frameExtents = new $d5b33d7c30034067$export$c977b3e384af9ae1(1, 1);\n this._viewportCount = 1;\n this._viewports = [\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 0, 1, 1)\n ];\n }\n getViewportCount() {\n return this._viewportCount;\n }\n getFrustum() {\n return this._frustum;\n }\n updateMatrices(light) {\n const shadowCamera = this.camera;\n const shadowMatrix = this.matrix;\n $d5b33d7c30034067$var$_lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);\n shadowCamera.position.copy($d5b33d7c30034067$var$_lightPositionWorld$1);\n $d5b33d7c30034067$var$_lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);\n shadowCamera.lookAt($d5b33d7c30034067$var$_lookTarget$1);\n shadowCamera.updateMatrixWorld();\n $d5b33d7c30034067$var$_projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix($d5b33d7c30034067$var$_projScreenMatrix$1);\n shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);\n shadowMatrix.multiply($d5b33d7c30034067$var$_projScreenMatrix$1);\n }\n getViewport(viewportIndex) {\n return this._viewports[viewportIndex];\n }\n getFrameExtents() {\n return this._frameExtents;\n }\n dispose() {\n if (this.map) this.map.dispose();\n if (this.mapPass) this.mapPass.dispose();\n }\n copy(source) {\n this.camera = source.camera.clone();\n this.bias = source.bias;\n this.radius = source.radius;\n this.mapSize.copy(source.mapSize);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n toJSON() {\n const object = {};\n if (this.bias !== 0) object.bias = this.bias;\n if (this.normalBias !== 0) object.normalBias = this.normalBias;\n if (this.radius !== 1) object.radius = this.radius;\n if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();\n object.camera = this.camera.toJSON(false).object;\n delete object.camera.matrix;\n return object;\n }\n}\nclass $d5b33d7c30034067$var$SpotLightShadow extends $d5b33d7c30034067$var$LightShadow {\n constructor(){\n super(new $d5b33d7c30034067$export$74e4ae24825f68d7(50, 1, 0.5, 500));\n this.isSpotLightShadow = true;\n this.focus = 1;\n }\n updateMatrices(light) {\n const camera = this.camera;\n const fov = $d5b33d7c30034067$var$RAD2DEG * 2 * light.angle * this.focus;\n const aspect = this.mapSize.width / this.mapSize.height;\n const far = light.distance || camera.far;\n if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) {\n camera.fov = fov;\n camera.aspect = aspect;\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n super.updateMatrices(light);\n }\n copy(source) {\n super.copy(source);\n this.focus = source.focus;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$81495cbb73897362 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2){\n super(color, intensity);\n this.isSpotLight = true;\n this.type = \"SpotLight\";\n this.position.copy($d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.target = new $d5b33d7c30034067$export$e4dd07dff30cc924();\n this.distance = distance;\n this.angle = angle;\n this.penumbra = penumbra;\n this.decay = decay;\n this.map = null;\n this.shadow = new $d5b33d7c30034067$var$SpotLightShadow();\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n return this.intensity * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / Math.PI;\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.distance = source.distance;\n this.angle = source.angle;\n this.penumbra = source.penumbra;\n this.decay = source.decay;\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_projScreenMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_lightPositionWorld = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_lookTarget = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$var$PointLightShadow extends $d5b33d7c30034067$var$LightShadow {\n constructor(){\n super(new $d5b33d7c30034067$export$74e4ae24825f68d7(90, 1, 0.5, 500));\n this.isPointLightShadow = true;\n this._frameExtents = new $d5b33d7c30034067$export$c977b3e384af9ae1(4, 2);\n this._viewportCount = 6;\n this._viewports = [\n // These viewports map a cube-map onto a 2D texture with the\n // following orientation:\n //\n // xzXZ\n // y Y\n //\n // X - Positive x direction\n // x - Negative x direction\n // Y - Positive y direction\n // y - Negative y direction\n // Z - Positive z direction\n // z - Negative z direction\n // positive X\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(2, 1, 1, 1),\n // negative X\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(0, 1, 1, 1),\n // positive Z\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(3, 1, 1, 1),\n // negative Z\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(1, 1, 1, 1),\n // positive Y\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(3, 0, 1, 1),\n // negative Y\n new $d5b33d7c30034067$export$fa7daccca11cdbe3(1, 0, 1, 1)\n ];\n this._cubeDirections = [\n new $d5b33d7c30034067$export$64b5c384219d3699(1, 0, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(-1, 0, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 1),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, -1),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, -1, 0)\n ];\n this._cubeUps = [\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 1, 0),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 1),\n new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, -1)\n ];\n }\n updateMatrices(light, viewportIndex = 0) {\n const camera = this.camera;\n const shadowMatrix = this.matrix;\n const far = light.distance || camera.far;\n if (far !== camera.far) {\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n $d5b33d7c30034067$var$_lightPositionWorld.setFromMatrixPosition(light.matrixWorld);\n camera.position.copy($d5b33d7c30034067$var$_lightPositionWorld);\n $d5b33d7c30034067$var$_lookTarget.copy(camera.position);\n $d5b33d7c30034067$var$_lookTarget.add(this._cubeDirections[viewportIndex]);\n camera.up.copy(this._cubeUps[viewportIndex]);\n camera.lookAt($d5b33d7c30034067$var$_lookTarget);\n camera.updateMatrixWorld();\n shadowMatrix.makeTranslation(-$d5b33d7c30034067$var$_lightPositionWorld.x, -$d5b33d7c30034067$var$_lightPositionWorld.y, -$d5b33d7c30034067$var$_lightPositionWorld.z);\n $d5b33d7c30034067$var$_projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix($d5b33d7c30034067$var$_projScreenMatrix);\n }\n}\nclass $d5b33d7c30034067$export$4c9c1cb3f0b6f455 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(color, intensity, distance = 0, decay = 2){\n super(color, intensity);\n this.isPointLight = true;\n this.type = \"PointLight\";\n this.distance = distance;\n this.decay = decay;\n this.shadow = new $d5b33d7c30034067$var$PointLightShadow();\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n return this.intensity * 4 * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / (4 * Math.PI);\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.distance = source.distance;\n this.decay = source.decay;\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nclass $d5b33d7c30034067$var$DirectionalLightShadow extends $d5b33d7c30034067$var$LightShadow {\n constructor(){\n super(new $d5b33d7c30034067$export$9ebf355ee4ed261b(-5, 5, 5, -5, 0.5, 500));\n this.isDirectionalLightShadow = true;\n }\n}\nclass $d5b33d7c30034067$export$3fea33cc9972c868 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(color, intensity){\n super(color, intensity);\n this.isDirectionalLight = true;\n this.type = \"DirectionalLight\";\n this.position.copy($d5b33d7c30034067$export$e4dd07dff30cc924.DEFAULT_UP);\n this.updateMatrix();\n this.target = new $d5b33d7c30034067$export$e4dd07dff30cc924();\n this.shadow = new $d5b33d7c30034067$var$DirectionalLightShadow();\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(source) {\n super.copy(source);\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n}\nclass $d5b33d7c30034067$export$af279bfef9ec2c96 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(color, intensity){\n super(color, intensity);\n this.isAmbientLight = true;\n this.type = \"AmbientLight\";\n }\n}\nclass $d5b33d7c30034067$export$61db2d908bbd2429 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(color, intensity, width = 10, height = 10){\n super(color, intensity);\n this.isRectAreaLight = true;\n this.type = \"RectAreaLight\";\n this.width = width;\n this.height = height;\n }\n get power() {\n // compute the light's luminous power (in lumens) from its intensity (in nits)\n return this.intensity * this.width * this.height * Math.PI;\n }\n set power(power) {\n // set the light's intensity (in nits) from the desired luminous power (in lumens)\n this.intensity = power / (this.width * this.height * Math.PI);\n }\n copy(source) {\n super.copy(source);\n this.width = source.width;\n this.height = source.height;\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.width = this.width;\n data.object.height = this.height;\n return data;\n }\n}\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */ // 3-band SH defined by 9 coefficients\nclass $d5b33d7c30034067$export$ba61ce607e1f405a {\n constructor(){\n this.isSphericalHarmonics3 = true;\n this.coefficients = [];\n for(let i = 0; i < 9; i++)this.coefficients.push(new $d5b33d7c30034067$export$64b5c384219d3699());\n }\n set(coefficients) {\n for(let i = 0; i < 9; i++)this.coefficients[i].copy(coefficients[i]);\n return this;\n }\n zero() {\n for(let i = 0; i < 9; i++)this.coefficients[i].set(0, 0, 0);\n return this;\n }\n // get the radiance in the direction of the normal\n // target is a Vector3\n getAt(normal, target) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n const coeff = this.coefficients;\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.282095);\n // band 1\n target.addScaledVector(coeff[1], 0.488603 * y);\n target.addScaledVector(coeff[2], 0.488603 * z);\n target.addScaledVector(coeff[3], 0.488603 * x);\n // band 2\n target.addScaledVector(coeff[4], 1.092548 * (x * y));\n target.addScaledVector(coeff[5], 1.092548 * (y * z));\n target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0));\n target.addScaledVector(coeff[7], 1.092548 * (x * z));\n target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y));\n return target;\n }\n // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n // target is a Vector3\n // https://graphics.stanford.edu/papers/envmap/envmap.pdf\n getIrradianceAt(normal, target) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n const coeff = this.coefficients;\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095\n // band 1\n target.addScaledVector(coeff[1], 1.023328 * y); // ( 2 * π / 3 ) * 0.488603\n target.addScaledVector(coeff[2], 1.023328 * z);\n target.addScaledVector(coeff[3], 1.023328 * x);\n // band 2\n target.addScaledVector(coeff[4], 0.858086 * x * y); // ( π / 4 ) * 1.092548\n target.addScaledVector(coeff[5], 0.858086 * y * z);\n target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( π / 4 ) * 0.315392 * 3\n target.addScaledVector(coeff[7], 0.858086 * x * z);\n target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274\n return target;\n }\n add(sh) {\n for(let i = 0; i < 9; i++)this.coefficients[i].add(sh.coefficients[i]);\n return this;\n }\n addScaledSH(sh, s) {\n for(let i = 0; i < 9; i++)this.coefficients[i].addScaledVector(sh.coefficients[i], s);\n return this;\n }\n scale(s) {\n for(let i = 0; i < 9; i++)this.coefficients[i].multiplyScalar(s);\n return this;\n }\n lerp(sh, alpha) {\n for(let i = 0; i < 9; i++)this.coefficients[i].lerp(sh.coefficients[i], alpha);\n return this;\n }\n equals(sh) {\n for(let i = 0; i < 9; i++){\n if (!this.coefficients[i].equals(sh.coefficients[i])) return false;\n }\n return true;\n }\n copy(sh) {\n return this.set(sh.coefficients);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n fromArray(array, offset = 0) {\n const coefficients = this.coefficients;\n for(let i = 0; i < 9; i++)coefficients[i].fromArray(array, offset + i * 3);\n return this;\n }\n toArray(array = [], offset = 0) {\n const coefficients = this.coefficients;\n for(let i = 0; i < 9; i++)coefficients[i].toArray(array, offset + i * 3);\n return array;\n }\n // evaluate the basis functions\n // shBasis is an Array[ 9 ]\n static getBasisAt(normal, shBasis) {\n // normal is assumed to be unit length\n const x = normal.x, y = normal.y, z = normal.z;\n // band 0\n shBasis[0] = 0.282095;\n // band 1\n shBasis[1] = 0.488603 * y;\n shBasis[2] = 0.488603 * z;\n shBasis[3] = 0.488603 * x;\n // band 2\n shBasis[4] = 1.092548 * x * y;\n shBasis[5] = 1.092548 * y * z;\n shBasis[6] = 0.315392 * (3 * z * z - 1);\n shBasis[7] = 1.092548 * x * z;\n shBasis[8] = 0.546274 * (x * x - y * y);\n }\n}\nclass $d5b33d7c30034067$export$e7ef036e309b38d2 extends $d5b33d7c30034067$export$6ecadb6ed240d696 {\n constructor(sh = new $d5b33d7c30034067$export$ba61ce607e1f405a(), intensity = 1){\n super(undefined, intensity);\n this.isLightProbe = true;\n this.sh = sh;\n }\n copy(source) {\n super.copy(source);\n this.sh.copy(source.sh);\n return this;\n }\n fromJSON(json) {\n this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n this.sh.fromArray(json.sh);\n return this;\n }\n toJSON(meta) {\n const data = super.toJSON(meta);\n data.object.sh = this.sh.toArray();\n return data;\n }\n}\nclass $d5b33d7c30034067$export$3bd6d323353dcf96 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n this.textures = {};\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const textures = this.textures;\n function getTexture(name) {\n if (textures[name] === undefined) console.warn(\"THREE.MaterialLoader: Undefined texture\", name);\n return textures[name];\n }\n const material = $d5b33d7c30034067$export$3bd6d323353dcf96.createMaterialFromType(json.type);\n if (json.uuid !== undefined) material.uuid = json.uuid;\n if (json.name !== undefined) material.name = json.name;\n if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);\n if (json.roughness !== undefined) material.roughness = json.roughness;\n if (json.metalness !== undefined) material.metalness = json.metalness;\n if (json.sheen !== undefined) material.sheen = json.sheen;\n if (json.sheenColor !== undefined) material.sheenColor = new $d5b33d7c30034067$export$892596cec99bc70e().setHex(json.sheenColor);\n if (json.sheenRoughness !== undefined) material.sheenRoughness = json.sheenRoughness;\n if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);\n if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);\n if (json.specularIntensity !== undefined) material.specularIntensity = json.specularIntensity;\n if (json.specularColor !== undefined && material.specularColor !== undefined) material.specularColor.setHex(json.specularColor);\n if (json.shininess !== undefined) material.shininess = json.shininess;\n if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;\n if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;\n if (json.iridescence !== undefined) material.iridescence = json.iridescence;\n if (json.iridescenceIOR !== undefined) material.iridescenceIOR = json.iridescenceIOR;\n if (json.iridescenceThicknessRange !== undefined) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n if (json.transmission !== undefined) material.transmission = json.transmission;\n if (json.thickness !== undefined) material.thickness = json.thickness;\n if (json.attenuationDistance !== undefined) material.attenuationDistance = json.attenuationDistance;\n if (json.attenuationColor !== undefined && material.attenuationColor !== undefined) material.attenuationColor.setHex(json.attenuationColor);\n if (json.anisotropy !== undefined) material.anisotropy = json.anisotropy;\n if (json.anisotropyRotation !== undefined) material.anisotropyRotation = json.anisotropyRotation;\n if (json.fog !== undefined) material.fog = json.fog;\n if (json.flatShading !== undefined) material.flatShading = json.flatShading;\n if (json.blending !== undefined) material.blending = json.blending;\n if (json.combine !== undefined) material.combine = json.combine;\n if (json.side !== undefined) material.side = json.side;\n if (json.shadowSide !== undefined) material.shadowSide = json.shadowSide;\n if (json.opacity !== undefined) material.opacity = json.opacity;\n if (json.transparent !== undefined) material.transparent = json.transparent;\n if (json.alphaTest !== undefined) material.alphaTest = json.alphaTest;\n if (json.alphaHash !== undefined) material.alphaHash = json.alphaHash;\n if (json.depthTest !== undefined) material.depthTest = json.depthTest;\n if (json.depthWrite !== undefined) material.depthWrite = json.depthWrite;\n if (json.colorWrite !== undefined) material.colorWrite = json.colorWrite;\n if (json.stencilWrite !== undefined) material.stencilWrite = json.stencilWrite;\n if (json.stencilWriteMask !== undefined) material.stencilWriteMask = json.stencilWriteMask;\n if (json.stencilFunc !== undefined) material.stencilFunc = json.stencilFunc;\n if (json.stencilRef !== undefined) material.stencilRef = json.stencilRef;\n if (json.stencilFuncMask !== undefined) material.stencilFuncMask = json.stencilFuncMask;\n if (json.stencilFail !== undefined) material.stencilFail = json.stencilFail;\n if (json.stencilZFail !== undefined) material.stencilZFail = json.stencilZFail;\n if (json.stencilZPass !== undefined) material.stencilZPass = json.stencilZPass;\n if (json.wireframe !== undefined) material.wireframe = json.wireframe;\n if (json.wireframeLinewidth !== undefined) material.wireframeLinewidth = json.wireframeLinewidth;\n if (json.wireframeLinecap !== undefined) material.wireframeLinecap = json.wireframeLinecap;\n if (json.wireframeLinejoin !== undefined) material.wireframeLinejoin = json.wireframeLinejoin;\n if (json.rotation !== undefined) material.rotation = json.rotation;\n if (json.linewidth !== 1) material.linewidth = json.linewidth;\n if (json.dashSize !== undefined) material.dashSize = json.dashSize;\n if (json.gapSize !== undefined) material.gapSize = json.gapSize;\n if (json.scale !== undefined) material.scale = json.scale;\n if (json.polygonOffset !== undefined) material.polygonOffset = json.polygonOffset;\n if (json.polygonOffsetFactor !== undefined) material.polygonOffsetFactor = json.polygonOffsetFactor;\n if (json.polygonOffsetUnits !== undefined) material.polygonOffsetUnits = json.polygonOffsetUnits;\n if (json.dithering !== undefined) material.dithering = json.dithering;\n if (json.alphaToCoverage !== undefined) material.alphaToCoverage = json.alphaToCoverage;\n if (json.premultipliedAlpha !== undefined) material.premultipliedAlpha = json.premultipliedAlpha;\n if (json.forceSinglePass !== undefined) material.forceSinglePass = json.forceSinglePass;\n if (json.visible !== undefined) material.visible = json.visible;\n if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped;\n if (json.userData !== undefined) material.userData = json.userData;\n if (json.vertexColors !== undefined) {\n if (typeof json.vertexColors === \"number\") material.vertexColors = json.vertexColors > 0 ? true : false;\n else material.vertexColors = json.vertexColors;\n }\n // Shader Material\n if (json.uniforms !== undefined) for(const name in json.uniforms){\n const uniform = json.uniforms[name];\n material.uniforms[name] = {};\n switch(uniform.type){\n case \"t\":\n material.uniforms[name].value = getTexture(uniform.value);\n break;\n case \"c\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$892596cec99bc70e().setHex(uniform.value);\n break;\n case \"v2\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$c977b3e384af9ae1().fromArray(uniform.value);\n break;\n case \"v3\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$64b5c384219d3699().fromArray(uniform.value);\n break;\n case \"v4\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$fa7daccca11cdbe3().fromArray(uniform.value);\n break;\n case \"m3\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$8ff26dafa08918().fromArray(uniform.value);\n break;\n case \"m4\":\n material.uniforms[name].value = new $d5b33d7c30034067$export$2ae72fc923e5eb5().fromArray(uniform.value);\n break;\n default:\n material.uniforms[name].value = uniform.value;\n }\n }\n if (json.defines !== undefined) material.defines = json.defines;\n if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;\n if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;\n if (json.glslVersion !== undefined) material.glslVersion = json.glslVersion;\n if (json.extensions !== undefined) for(const key in json.extensions)material.extensions[key] = json.extensions[key];\n if (json.lights !== undefined) material.lights = json.lights;\n if (json.clipping !== undefined) material.clipping = json.clipping;\n // for PointsMaterial\n if (json.size !== undefined) material.size = json.size;\n if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation;\n // maps\n if (json.map !== undefined) material.map = getTexture(json.map);\n if (json.matcap !== undefined) material.matcap = getTexture(json.matcap);\n if (json.alphaMap !== undefined) material.alphaMap = getTexture(json.alphaMap);\n if (json.bumpMap !== undefined) material.bumpMap = getTexture(json.bumpMap);\n if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale;\n if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap);\n if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType;\n if (json.normalScale !== undefined) {\n let normalScale = json.normalScale;\n if (Array.isArray(normalScale) === false) // Blender exporter used to export a scalar. See #7459\n normalScale = [\n normalScale,\n normalScale\n ];\n material.normalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1().fromArray(normalScale);\n }\n if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap);\n if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale;\n if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias;\n if (json.roughnessMap !== undefined) material.roughnessMap = getTexture(json.roughnessMap);\n if (json.metalnessMap !== undefined) material.metalnessMap = getTexture(json.metalnessMap);\n if (json.emissiveMap !== undefined) material.emissiveMap = getTexture(json.emissiveMap);\n if (json.emissiveIntensity !== undefined) material.emissiveIntensity = json.emissiveIntensity;\n if (json.specularMap !== undefined) material.specularMap = getTexture(json.specularMap);\n if (json.specularIntensityMap !== undefined) material.specularIntensityMap = getTexture(json.specularIntensityMap);\n if (json.specularColorMap !== undefined) material.specularColorMap = getTexture(json.specularColorMap);\n if (json.envMap !== undefined) material.envMap = getTexture(json.envMap);\n if (json.envMapIntensity !== undefined) material.envMapIntensity = json.envMapIntensity;\n if (json.reflectivity !== undefined) material.reflectivity = json.reflectivity;\n if (json.refractionRatio !== undefined) material.refractionRatio = json.refractionRatio;\n if (json.lightMap !== undefined) material.lightMap = getTexture(json.lightMap);\n if (json.lightMapIntensity !== undefined) material.lightMapIntensity = json.lightMapIntensity;\n if (json.aoMap !== undefined) material.aoMap = getTexture(json.aoMap);\n if (json.aoMapIntensity !== undefined) material.aoMapIntensity = json.aoMapIntensity;\n if (json.gradientMap !== undefined) material.gradientMap = getTexture(json.gradientMap);\n if (json.clearcoatMap !== undefined) material.clearcoatMap = getTexture(json.clearcoatMap);\n if (json.clearcoatRoughnessMap !== undefined) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap);\n if (json.clearcoatNormalMap !== undefined) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap);\n if (json.clearcoatNormalScale !== undefined) material.clearcoatNormalScale = new $d5b33d7c30034067$export$c977b3e384af9ae1().fromArray(json.clearcoatNormalScale);\n if (json.iridescenceMap !== undefined) material.iridescenceMap = getTexture(json.iridescenceMap);\n if (json.iridescenceThicknessMap !== undefined) material.iridescenceThicknessMap = getTexture(json.iridescenceThicknessMap);\n if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap);\n if (json.thicknessMap !== undefined) material.thicknessMap = getTexture(json.thicknessMap);\n if (json.anisotropyMap !== undefined) material.anisotropyMap = getTexture(json.anisotropyMap);\n if (json.sheenColorMap !== undefined) material.sheenColorMap = getTexture(json.sheenColorMap);\n if (json.sheenRoughnessMap !== undefined) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap);\n return material;\n }\n setTextures(value) {\n this.textures = value;\n return this;\n }\n static createMaterialFromType(type) {\n const materialLib = {\n ShadowMaterial: $d5b33d7c30034067$export$e8564da406055a3,\n SpriteMaterial: $d5b33d7c30034067$export$5ec7dd1c6994bf8e,\n RawShaderMaterial: $d5b33d7c30034067$export$21c421a2e1df9d22,\n ShaderMaterial: $d5b33d7c30034067$export$83c7d75d550a8b0d,\n PointsMaterial: $d5b33d7c30034067$export$a178c45366ce5d6b,\n MeshPhysicalMaterial: $d5b33d7c30034067$export$28d04986c4269c9f,\n MeshStandardMaterial: $d5b33d7c30034067$export$f2980790215acccd,\n MeshPhongMaterial: $d5b33d7c30034067$export$24c72f71cbaf0678,\n MeshToonMaterial: $d5b33d7c30034067$export$df893cf97e765622,\n MeshNormalMaterial: $d5b33d7c30034067$export$bfe8c0a091f41ae7,\n MeshLambertMaterial: $d5b33d7c30034067$export$5023a9a8114806b8,\n MeshDepthMaterial: $d5b33d7c30034067$export$2698c22ec13825db,\n MeshDistanceMaterial: $d5b33d7c30034067$export$33e187ed002f2a19,\n MeshBasicMaterial: $d5b33d7c30034067$export$55cbcc9b622fe1f5,\n MeshMatcapMaterial: $d5b33d7c30034067$export$6f5fef6235ec12ee,\n LineDashedMaterial: $d5b33d7c30034067$export$327886a3efaeaebe,\n LineBasicMaterial: $d5b33d7c30034067$export$fbaaa33907730a0c,\n Material: $d5b33d7c30034067$export$a2d8b23205c25948\n };\n return new materialLib[type]();\n }\n}\nclass $d5b33d7c30034067$export$b5d2dc08d867e41a {\n static decodeText(array) {\n if (typeof TextDecoder !== \"undefined\") return new TextDecoder().decode(array);\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n let s = \"\";\n for(let i = 0, il = array.length; i < il; i++)// Implicitly assumes little-endian.\n s += String.fromCharCode(array[i]);\n try {\n // merges multi-byte utf-8 characters.\n return decodeURIComponent(escape(s));\n } catch (e) {\n return s;\n }\n }\n static extractUrlBase(url) {\n const index = url.lastIndexOf(\"/\");\n if (index === -1) return \"./\";\n return url.slice(0, index + 1);\n }\n static resolveURL(url, path) {\n // Invalid URL\n if (typeof url !== \"string\" || url === \"\") return \"\";\n // Host Relative URL\n if (/^https?:\\/\\//i.test(path) && /^\\//.test(url)) path = path.replace(/(^https?:\\/\\/[^\\/]+).*/i, \"$1\");\n // Absolute URL http://,https://,//\n if (/^(https?:)?\\/\\//i.test(url)) return url;\n // Data URI\n if (/^data:.*,.*$/i.test(url)) return url;\n // Blob URL\n if (/^blob:.*$/i.test(url)) return url;\n // Relative URL\n return path + url;\n }\n}\nclass $d5b33d7c30034067$export$231f009cbe414146 extends $d5b33d7c30034067$export$b7be63a67df8959 {\n constructor(){\n super();\n this.isInstancedBufferGeometry = true;\n this.type = \"InstancedBufferGeometry\";\n this.instanceCount = Infinity;\n }\n copy(source) {\n super.copy(source);\n this.instanceCount = source.instanceCount;\n return this;\n }\n toJSON() {\n const data = super.toJSON();\n data.instanceCount = this.instanceCount;\n data.isInstancedBufferGeometry = true;\n return data;\n }\n}\nclass $d5b33d7c30034067$export$dc275bb96327833a extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function(text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n parse(json) {\n const interleavedBufferMap = {};\n const arrayBufferMap = {};\n function getInterleavedBuffer(json, uuid) {\n if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid];\n const interleavedBuffers = json.interleavedBuffers;\n const interleavedBuffer = interleavedBuffers[uuid];\n const buffer = getArrayBuffer(json, interleavedBuffer.buffer);\n const array = $d5b33d7c30034067$var$getTypedArray(interleavedBuffer.type, buffer);\n const ib = new $d5b33d7c30034067$export$3d5cd879f108f53f(array, interleavedBuffer.stride);\n ib.uuid = interleavedBuffer.uuid;\n interleavedBufferMap[uuid] = ib;\n return ib;\n }\n function getArrayBuffer(json, uuid) {\n if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid];\n const arrayBuffers = json.arrayBuffers;\n const arrayBuffer = arrayBuffers[uuid];\n const ab = new Uint32Array(arrayBuffer).buffer;\n arrayBufferMap[uuid] = ab;\n return ab;\n }\n const geometry = json.isInstancedBufferGeometry ? new $d5b33d7c30034067$export$231f009cbe414146() : new $d5b33d7c30034067$export$b7be63a67df8959();\n const index = json.data.index;\n if (index !== undefined) {\n const typedArray = $d5b33d7c30034067$var$getTypedArray(index.type, index.array);\n geometry.setIndex(new $d5b33d7c30034067$export$8dea267bd6bde117(typedArray, 1));\n }\n const attributes = json.data.attributes;\n for(const key in attributes){\n const attribute = attributes[key];\n let bufferAttribute;\n if (attribute.isInterleavedBufferAttribute) {\n const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);\n bufferAttribute = new $d5b33d7c30034067$export$920b6d07334599c7(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);\n } else {\n const typedArray = $d5b33d7c30034067$var$getTypedArray(attribute.type, attribute.array);\n const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? $d5b33d7c30034067$export$32ea87a8b54d744a : $d5b33d7c30034067$export$8dea267bd6bde117;\n bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized);\n }\n if (attribute.name !== undefined) bufferAttribute.name = attribute.name;\n if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage);\n if (attribute.updateRange !== undefined) {\n bufferAttribute.updateRange.offset = attribute.updateRange.offset;\n bufferAttribute.updateRange.count = attribute.updateRange.count;\n }\n geometry.setAttribute(key, bufferAttribute);\n }\n const morphAttributes = json.data.morphAttributes;\n if (morphAttributes) for(const key in morphAttributes){\n const attributeArray = morphAttributes[key];\n const array = [];\n for(let i = 0, il = attributeArray.length; i < il; i++){\n const attribute = attributeArray[i];\n let bufferAttribute;\n if (attribute.isInterleavedBufferAttribute) {\n const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);\n bufferAttribute = new $d5b33d7c30034067$export$920b6d07334599c7(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);\n } else {\n const typedArray = $d5b33d7c30034067$var$getTypedArray(attribute.type, attribute.array);\n bufferAttribute = new $d5b33d7c30034067$export$8dea267bd6bde117(typedArray, attribute.itemSize, attribute.normalized);\n }\n if (attribute.name !== undefined) bufferAttribute.name = attribute.name;\n array.push(bufferAttribute);\n }\n geometry.morphAttributes[key] = array;\n }\n const morphTargetsRelative = json.data.morphTargetsRelative;\n if (morphTargetsRelative) geometry.morphTargetsRelative = true;\n const groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n if (groups !== undefined) for(let i = 0, n = groups.length; i !== n; ++i){\n const group = groups[i];\n geometry.addGroup(group.start, group.count, group.materialIndex);\n }\n const boundingSphere = json.data.boundingSphere;\n if (boundingSphere !== undefined) {\n const center = new $d5b33d7c30034067$export$64b5c384219d3699();\n if (boundingSphere.center !== undefined) center.fromArray(boundingSphere.center);\n geometry.boundingSphere = new $d5b33d7c30034067$export$805e8b72413ccaba(center, boundingSphere.radius);\n }\n if (json.name) geometry.name = json.name;\n if (json.userData) geometry.userData = json.userData;\n return geometry;\n }\n}\nclass $d5b33d7c30034067$export$40110c8505c5ad19 extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const path = this.path === \"\" ? $d5b33d7c30034067$export$b5d2dc08d867e41a.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(text) {\n let json = null;\n try {\n json = JSON.parse(text);\n } catch (error) {\n if (onError !== undefined) onError(error);\n console.error(\"THREE:ObjectLoader: Can't parse \" + url + \".\", error.message);\n return;\n }\n const metadata = json.metadata;\n if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === \"geometry\") {\n if (onError !== undefined) onError(new Error(\"THREE.ObjectLoader: Can't load \" + url));\n console.error(\"THREE.ObjectLoader: Can't load \" + url);\n return;\n }\n scope.parse(json, onLoad);\n }, onProgress, onError);\n }\n async loadAsync(url, onProgress) {\n const scope = this;\n const path = this.path === \"\" ? $d5b33d7c30034067$export$b5d2dc08d867e41a.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n const text = await loader.loadAsync(url, onProgress);\n const json = JSON.parse(text);\n const metadata = json.metadata;\n if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === \"geometry\") throw new Error(\"THREE.ObjectLoader: Can't load \" + url);\n return await scope.parseAsync(json);\n }\n parse(json, onLoad) {\n const animations = this.parseAnimations(json.animations);\n const shapes = this.parseShapes(json.shapes);\n const geometries = this.parseGeometries(json.geometries, shapes);\n const images = this.parseImages(json.images, function() {\n if (onLoad !== undefined) onLoad(object);\n });\n const textures = this.parseTextures(json.textures, images);\n const materials = this.parseMaterials(json.materials, textures);\n const object = this.parseObject(json.object, geometries, materials, textures, animations);\n const skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n //\n if (onLoad !== undefined) {\n let hasImages = false;\n for(const uuid in images)if (images[uuid].data instanceof HTMLImageElement) {\n hasImages = true;\n break;\n }\n if (hasImages === false) onLoad(object);\n }\n return object;\n }\n async parseAsync(json) {\n const animations = this.parseAnimations(json.animations);\n const shapes = this.parseShapes(json.shapes);\n const geometries = this.parseGeometries(json.geometries, shapes);\n const images = await this.parseImagesAsync(json.images);\n const textures = this.parseTextures(json.textures, images);\n const materials = this.parseMaterials(json.materials, textures);\n const object = this.parseObject(json.object, geometries, materials, textures, animations);\n const skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n return object;\n }\n parseShapes(json) {\n const shapes = {};\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const shape = new $d5b33d7c30034067$export$6428a7f2611ef1fa().fromJSON(json[i]);\n shapes[shape.uuid] = shape;\n }\n return shapes;\n }\n parseSkeletons(json, object) {\n const skeletons = {};\n const bones = {};\n // generate bone lookup table\n object.traverse(function(child) {\n if (child.isBone) bones[child.uuid] = child;\n });\n // create skeletons\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const skeleton = new $d5b33d7c30034067$export$8f31e4c4a37b8e9c().fromJSON(json[i], bones);\n skeletons[skeleton.uuid] = skeleton;\n }\n return skeletons;\n }\n parseGeometries(json, shapes) {\n const geometries = {};\n if (json !== undefined) {\n const bufferGeometryLoader = new $d5b33d7c30034067$export$dc275bb96327833a();\n for(let i = 0, l = json.length; i < l; i++){\n let geometry;\n const data = json[i];\n switch(data.type){\n case \"BufferGeometry\":\n case \"InstancedBufferGeometry\":\n geometry = bufferGeometryLoader.parse(data);\n break;\n default:\n if (data.type in $d5b33d7c30034067$var$Geometries) geometry = $d5b33d7c30034067$var$Geometries[data.type].fromJSON(data, shapes);\n else console.warn(`THREE.ObjectLoader: Unsupported geometry type \"${data.type}\"`);\n }\n geometry.uuid = data.uuid;\n if (data.name !== undefined) geometry.name = data.name;\n if (data.userData !== undefined) geometry.userData = data.userData;\n geometries[data.uuid] = geometry;\n }\n }\n return geometries;\n }\n parseMaterials(json, textures) {\n const cache = {}; // MultiMaterial\n const materials = {};\n if (json !== undefined) {\n const loader = new $d5b33d7c30034067$export$3bd6d323353dcf96();\n loader.setTextures(textures);\n for(let i = 0, l = json.length; i < l; i++){\n const data = json[i];\n if (cache[data.uuid] === undefined) cache[data.uuid] = loader.parse(data);\n materials[data.uuid] = cache[data.uuid];\n }\n }\n return materials;\n }\n parseAnimations(json) {\n const animations = {};\n if (json !== undefined) for(let i = 0; i < json.length; i++){\n const data = json[i];\n const clip = $d5b33d7c30034067$export$d942c706bf23829c.parse(data);\n animations[clip.uuid] = clip;\n }\n return animations;\n }\n parseImages(json, onLoad) {\n const scope = this;\n const images = {};\n let loader;\n function loadImage(url) {\n scope.manager.itemStart(url);\n return loader.load(url, function() {\n scope.manager.itemEnd(url);\n }, undefined, function() {\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n }\n function deserializeImage(image) {\n if (typeof image === \"string\") {\n const url = image;\n const path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(url) ? url : scope.resourcePath + url;\n return loadImage(path);\n } else {\n if (image.data) return {\n data: $d5b33d7c30034067$var$getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n };\n else return null;\n }\n }\n if (json !== undefined && json.length > 0) {\n const manager = new $d5b33d7c30034067$export$99cc795e99919eed(onLoad);\n loader = new $d5b33d7c30034067$export$8905ce1c7a2464a1(manager);\n loader.setCrossOrigin(this.crossOrigin);\n for(let i = 0, il = json.length; i < il; i++){\n const image = json[i];\n const url = image.url;\n if (Array.isArray(url)) {\n // load array of images e.g CubeTexture\n const imageArray = [];\n for(let j = 0, jl = url.length; j < jl; j++){\n const currentUrl = url[j];\n const deserializedImage = deserializeImage(currentUrl);\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) imageArray.push(deserializedImage);\n else // special case: handle array of data textures for cube textures\n imageArray.push(new $d5b33d7c30034067$export$b691f601014eabe1(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n images[image.uuid] = new $d5b33d7c30034067$export$1d2df86270c81ecb(imageArray);\n } else {\n // load single image\n const deserializedImage = deserializeImage(image.url);\n images[image.uuid] = new $d5b33d7c30034067$export$1d2df86270c81ecb(deserializedImage);\n }\n }\n }\n return images;\n }\n async parseImagesAsync(json) {\n const scope = this;\n const images = {};\n let loader;\n async function deserializeImage(image) {\n if (typeof image === \"string\") {\n const url = image;\n const path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(url) ? url : scope.resourcePath + url;\n return await loader.loadAsync(path);\n } else {\n if (image.data) return {\n data: $d5b33d7c30034067$var$getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n };\n else return null;\n }\n }\n if (json !== undefined && json.length > 0) {\n loader = new $d5b33d7c30034067$export$8905ce1c7a2464a1(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n for(let i = 0, il = json.length; i < il; i++){\n const image = json[i];\n const url = image.url;\n if (Array.isArray(url)) {\n // load array of images e.g CubeTexture\n const imageArray = [];\n for(let j = 0, jl = url.length; j < jl; j++){\n const currentUrl = url[j];\n const deserializedImage = await deserializeImage(currentUrl);\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) imageArray.push(deserializedImage);\n else // special case: handle array of data textures for cube textures\n imageArray.push(new $d5b33d7c30034067$export$b691f601014eabe1(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n images[image.uuid] = new $d5b33d7c30034067$export$1d2df86270c81ecb(imageArray);\n } else {\n // load single image\n const deserializedImage = await deserializeImage(image.url);\n images[image.uuid] = new $d5b33d7c30034067$export$1d2df86270c81ecb(deserializedImage);\n }\n }\n }\n return images;\n }\n parseTextures(json, images) {\n function parseConstant(value, type) {\n if (typeof value === \"number\") return value;\n console.warn(\"THREE.ObjectLoader.parseTexture: Constant should be in numeric form.\", value);\n return type[value];\n }\n const textures = {};\n if (json !== undefined) for(let i = 0, l = json.length; i < l; i++){\n const data = json[i];\n if (data.image === undefined) console.warn('THREE.ObjectLoader: No \"image\" specified for', data.uuid);\n if (images[data.image] === undefined) console.warn(\"THREE.ObjectLoader: Undefined image\", data.image);\n const source = images[data.image];\n const image = source.data;\n let texture;\n if (Array.isArray(image)) {\n texture = new $d5b33d7c30034067$export$ee2e5a18258a4049();\n if (image.length === 6) texture.needsUpdate = true;\n } else {\n if (image && image.data) texture = new $d5b33d7c30034067$export$b691f601014eabe1();\n else texture = new $d5b33d7c30034067$export$5431306cf43de24a();\n if (image) texture.needsUpdate = true; // textures can have undefined image data\n }\n texture.source = source;\n texture.uuid = data.uuid;\n if (data.name !== undefined) texture.name = data.name;\n if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, $d5b33d7c30034067$var$TEXTURE_MAPPING);\n if (data.channel !== undefined) texture.channel = data.channel;\n if (data.offset !== undefined) texture.offset.fromArray(data.offset);\n if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat);\n if (data.center !== undefined) texture.center.fromArray(data.center);\n if (data.rotation !== undefined) texture.rotation = data.rotation;\n if (data.wrap !== undefined) {\n texture.wrapS = parseConstant(data.wrap[0], $d5b33d7c30034067$var$TEXTURE_WRAPPING);\n texture.wrapT = parseConstant(data.wrap[1], $d5b33d7c30034067$var$TEXTURE_WRAPPING);\n }\n if (data.format !== undefined) texture.format = data.format;\n if (data.internalFormat !== undefined) texture.internalFormat = data.internalFormat;\n if (data.type !== undefined) texture.type = data.type;\n if (data.colorSpace !== undefined) texture.colorSpace = data.colorSpace;\n if (data.encoding !== undefined) texture.encoding = data.encoding; // @deprecated, r152\n if (data.minFilter !== undefined) texture.minFilter = parseConstant(data.minFilter, $d5b33d7c30034067$var$TEXTURE_FILTER);\n if (data.magFilter !== undefined) texture.magFilter = parseConstant(data.magFilter, $d5b33d7c30034067$var$TEXTURE_FILTER);\n if (data.anisotropy !== undefined) texture.anisotropy = data.anisotropy;\n if (data.flipY !== undefined) texture.flipY = data.flipY;\n if (data.generateMipmaps !== undefined) texture.generateMipmaps = data.generateMipmaps;\n if (data.premultiplyAlpha !== undefined) texture.premultiplyAlpha = data.premultiplyAlpha;\n if (data.unpackAlignment !== undefined) texture.unpackAlignment = data.unpackAlignment;\n if (data.compareFunction !== undefined) texture.compareFunction = data.compareFunction;\n if (data.userData !== undefined) texture.userData = data.userData;\n textures[data.uuid] = texture;\n }\n return textures;\n }\n parseObject(data, geometries, materials, textures, animations) {\n let object;\n function getGeometry(name) {\n if (geometries[name] === undefined) console.warn(\"THREE.ObjectLoader: Undefined geometry\", name);\n return geometries[name];\n }\n function getMaterial(name) {\n if (name === undefined) return undefined;\n if (Array.isArray(name)) {\n const array = [];\n for(let i = 0, l = name.length; i < l; i++){\n const uuid = name[i];\n if (materials[uuid] === undefined) console.warn(\"THREE.ObjectLoader: Undefined material\", uuid);\n array.push(materials[uuid]);\n }\n return array;\n }\n if (materials[name] === undefined) console.warn(\"THREE.ObjectLoader: Undefined material\", name);\n return materials[name];\n }\n function getTexture(uuid) {\n if (textures[uuid] === undefined) console.warn(\"THREE.ObjectLoader: Undefined texture\", uuid);\n return textures[uuid];\n }\n let geometry, material;\n switch(data.type){\n case \"Scene\":\n object = new $d5b33d7c30034067$export$38af1803e3442a7f();\n if (data.background !== undefined) {\n if (Number.isInteger(data.background)) object.background = new $d5b33d7c30034067$export$892596cec99bc70e(data.background);\n else object.background = getTexture(data.background);\n }\n if (data.environment !== undefined) object.environment = getTexture(data.environment);\n if (data.fog !== undefined) {\n if (data.fog.type === \"Fog\") object.fog = new $d5b33d7c30034067$export$3c890837b09508d4(data.fog.color, data.fog.near, data.fog.far);\n else if (data.fog.type === \"FogExp2\") object.fog = new $d5b33d7c30034067$export$6f1519f023b8d0f6(data.fog.color, data.fog.density);\n }\n if (data.backgroundBlurriness !== undefined) object.backgroundBlurriness = data.backgroundBlurriness;\n if (data.backgroundIntensity !== undefined) object.backgroundIntensity = data.backgroundIntensity;\n break;\n case \"PerspectiveCamera\":\n object = new $d5b33d7c30034067$export$74e4ae24825f68d7(data.fov, data.aspect, data.near, data.far);\n if (data.focus !== undefined) object.focus = data.focus;\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.filmGauge !== undefined) object.filmGauge = data.filmGauge;\n if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case \"OrthographicCamera\":\n object = new $d5b33d7c30034067$export$9ebf355ee4ed261b(data.left, data.right, data.top, data.bottom, data.near, data.far);\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case \"AmbientLight\":\n object = new $d5b33d7c30034067$export$af279bfef9ec2c96(data.color, data.intensity);\n break;\n case \"DirectionalLight\":\n object = new $d5b33d7c30034067$export$3fea33cc9972c868(data.color, data.intensity);\n break;\n case \"PointLight\":\n object = new $d5b33d7c30034067$export$4c9c1cb3f0b6f455(data.color, data.intensity, data.distance, data.decay);\n break;\n case \"RectAreaLight\":\n object = new $d5b33d7c30034067$export$61db2d908bbd2429(data.color, data.intensity, data.width, data.height);\n break;\n case \"SpotLight\":\n object = new $d5b33d7c30034067$export$81495cbb73897362(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay);\n break;\n case \"HemisphereLight\":\n object = new $d5b33d7c30034067$export$8d474f55edbb9624(data.color, data.groundColor, data.intensity);\n break;\n case \"LightProbe\":\n object = new $d5b33d7c30034067$export$e7ef036e309b38d2().fromJSON(data);\n break;\n case \"SkinnedMesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new $d5b33d7c30034067$export$b303577035157ecf(geometry, material);\n if (data.bindMode !== undefined) object.bindMode = data.bindMode;\n if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix);\n if (data.skeleton !== undefined) object.skeleton = data.skeleton;\n break;\n case \"Mesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new $d5b33d7c30034067$export$e176487c05830cc5(geometry, material);\n break;\n case \"InstancedMesh\":\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n const count = data.count;\n const instanceMatrix = data.instanceMatrix;\n const instanceColor = data.instanceColor;\n object = new $d5b33d7c30034067$export$f3c979c331175ad7(geometry, material, count);\n object.instanceMatrix = new $d5b33d7c30034067$export$32ea87a8b54d744a(new Float32Array(instanceMatrix.array), 16);\n if (instanceColor !== undefined) object.instanceColor = new $d5b33d7c30034067$export$32ea87a8b54d744a(new Float32Array(instanceColor.array), instanceColor.itemSize);\n break;\n case \"LOD\":\n object = new $d5b33d7c30034067$export$112e7237be0c5f30();\n break;\n case \"Line\":\n object = new $d5b33d7c30034067$export$17d680238e50603e(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"LineLoop\":\n object = new $d5b33d7c30034067$export$f85a24d745e4f17d(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"LineSegments\":\n object = new $d5b33d7c30034067$export$ff1ed10fedfdd604(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"PointCloud\":\n case \"Points\":\n object = new $d5b33d7c30034067$export$1c787534cb11aa3e(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case \"Sprite\":\n object = new $d5b33d7c30034067$export$3075603db8e6204c(getMaterial(data.material));\n break;\n case \"Group\":\n object = new $d5b33d7c30034067$export$eb2fcfdbd7ba97d4();\n break;\n case \"Bone\":\n object = new $d5b33d7c30034067$export$b127726e56765aa4();\n break;\n default:\n object = new $d5b33d7c30034067$export$e4dd07dff30cc924();\n }\n object.uuid = data.uuid;\n if (data.name !== undefined) object.name = data.name;\n if (data.matrix !== undefined) {\n object.matrix.fromArray(data.matrix);\n if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate;\n if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale);\n } else {\n if (data.position !== undefined) object.position.fromArray(data.position);\n if (data.rotation !== undefined) object.rotation.fromArray(data.rotation);\n if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion);\n if (data.scale !== undefined) object.scale.fromArray(data.scale);\n }\n if (data.up !== undefined) object.up.fromArray(data.up);\n if (data.castShadow !== undefined) object.castShadow = data.castShadow;\n if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow;\n if (data.shadow) {\n if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias;\n if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias;\n if (data.shadow.radius !== undefined) object.shadow.radius = data.shadow.radius;\n if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize);\n if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera);\n }\n if (data.visible !== undefined) object.visible = data.visible;\n if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled;\n if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder;\n if (data.userData !== undefined) object.userData = data.userData;\n if (data.layers !== undefined) object.layers.mask = data.layers;\n if (data.children !== undefined) {\n const children = data.children;\n for(let i = 0; i < children.length; i++)object.add(this.parseObject(children[i], geometries, materials, textures, animations));\n }\n if (data.animations !== undefined) {\n const objectAnimations = data.animations;\n for(let i = 0; i < objectAnimations.length; i++){\n const uuid = objectAnimations[i];\n object.animations.push(animations[uuid]);\n }\n }\n if (data.type === \"LOD\") {\n if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate;\n const levels = data.levels;\n for(let l = 0; l < levels.length; l++){\n const level = levels[l];\n const child = object.getObjectByProperty(\"uuid\", level.object);\n if (child !== undefined) object.addLevel(child, level.distance, level.hysteresis);\n }\n }\n return object;\n }\n bindSkeletons(object, skeletons) {\n if (Object.keys(skeletons).length === 0) return;\n object.traverse(function(child) {\n if (child.isSkinnedMesh === true && child.skeleton !== undefined) {\n const skeleton = skeletons[child.skeleton];\n if (skeleton === undefined) console.warn(\"THREE.ObjectLoader: No skeleton found with UUID:\", child.skeleton);\n else child.bind(skeleton, child.bindMatrix);\n }\n });\n }\n}\nconst $d5b33d7c30034067$var$TEXTURE_MAPPING = {\n UVMapping: $d5b33d7c30034067$export$1beec6768cbb3d2d,\n CubeReflectionMapping: $d5b33d7c30034067$export$8759762a6477f2c4,\n CubeRefractionMapping: $d5b33d7c30034067$export$dc59f8aed047f61d,\n EquirectangularReflectionMapping: $d5b33d7c30034067$export$d64030b316d3b087,\n EquirectangularRefractionMapping: $d5b33d7c30034067$export$ee99d97d46898098,\n CubeUVReflectionMapping: $d5b33d7c30034067$export$dbf3e70ff37af79\n};\nconst $d5b33d7c30034067$var$TEXTURE_WRAPPING = {\n RepeatWrapping: $d5b33d7c30034067$export$533346c8e8dac0f5,\n ClampToEdgeWrapping: $d5b33d7c30034067$export$9d9334239a5a5e06,\n MirroredRepeatWrapping: $d5b33d7c30034067$export$c7e7c00b14f51a4f\n};\nconst $d5b33d7c30034067$var$TEXTURE_FILTER = {\n NearestFilter: $d5b33d7c30034067$export$727aa5ec3fe39bf0,\n NearestMipmapNearestFilter: $d5b33d7c30034067$export$d129e38cf6feaa8c,\n NearestMipmapLinearFilter: $d5b33d7c30034067$export$d2327c1afe5bfdf2,\n LinearFilter: $d5b33d7c30034067$export$8a72f490b25c56c8,\n LinearMipmapNearestFilter: $d5b33d7c30034067$export$19a719f377145a13,\n LinearMipmapLinearFilter: $d5b33d7c30034067$export$5d8599b6a933fb1b\n};\nclass $d5b33d7c30034067$export$52286b55c4a9b51f extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n this.isImageBitmapLoader = true;\n if (typeof createImageBitmap === \"undefined\") console.warn(\"THREE.ImageBitmapLoader: createImageBitmap() not supported.\");\n if (typeof fetch === \"undefined\") console.warn(\"THREE.ImageBitmapLoader: fetch() not supported.\");\n this.options = {\n premultiplyAlpha: \"none\"\n };\n }\n setOptions(options) {\n this.options = options;\n return this;\n }\n load(url, onLoad, onProgress, onError) {\n if (url === undefined) url = \"\";\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n const scope = this;\n const cached = $d5b33d7c30034067$export$94affb487e701bf2.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function() {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n const fetchOptions = {};\n fetchOptions.credentials = this.crossOrigin === \"anonymous\" ? \"same-origin\" : \"include\";\n fetchOptions.headers = this.requestHeader;\n fetch(url, fetchOptions).then(function(res) {\n return res.blob();\n }).then(function(blob) {\n return createImageBitmap(blob, Object.assign(scope.options, {\n colorSpaceConversion: \"none\"\n }));\n }).then(function(imageBitmap) {\n $d5b33d7c30034067$export$94affb487e701bf2.add(url, imageBitmap);\n if (onLoad) onLoad(imageBitmap);\n scope.manager.itemEnd(url);\n }).catch(function(e) {\n if (onError) onError(e);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n scope.manager.itemStart(url);\n }\n}\nlet $d5b33d7c30034067$var$_context;\nclass $d5b33d7c30034067$export$fcbc63750ec2a81f {\n static getContext() {\n if ($d5b33d7c30034067$var$_context === undefined) $d5b33d7c30034067$var$_context = new (window.AudioContext || window.webkitAudioContext)();\n return $d5b33d7c30034067$var$_context;\n }\n static setContext(value) {\n $d5b33d7c30034067$var$_context = value;\n }\n}\nclass $d5b33d7c30034067$export$d8d5fccfbf47714e extends $d5b33d7c30034067$export$3b0d6d7590275603 {\n constructor(manager){\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new $d5b33d7c30034067$export$98435a25b5cf7b2b(this.manager);\n loader.setResponseType(\"arraybuffer\");\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function(buffer) {\n try {\n // Create a copy of the buffer. The `decodeAudioData` method\n // detaches the buffer when complete, preventing reuse.\n const bufferCopy = buffer.slice(0);\n const context = $d5b33d7c30034067$export$fcbc63750ec2a81f.getContext();\n context.decodeAudioData(bufferCopy, function(audioBuffer) {\n onLoad(audioBuffer);\n }, handleError);\n } catch (e) {\n handleError(e);\n }\n }, onProgress, onError);\n function handleError(e) {\n if (onError) onError(e);\n else console.error(e);\n scope.manager.itemError(url);\n }\n }\n}\nclass $d5b33d7c30034067$export$2f22dadc8bc42820 extends $d5b33d7c30034067$export$e7ef036e309b38d2 {\n constructor(skyColor, groundColor, intensity = 1){\n super(undefined, intensity);\n this.isHemisphereLightProbe = true;\n const color1 = new $d5b33d7c30034067$export$892596cec99bc70e().set(skyColor);\n const color2 = new $d5b33d7c30034067$export$892596cec99bc70e().set(groundColor);\n const sky = new $d5b33d7c30034067$export$64b5c384219d3699(color1.r, color1.g, color1.b);\n const ground = new $d5b33d7c30034067$export$64b5c384219d3699(color2.r, color2.g, color2.b);\n // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n const c0 = Math.sqrt(Math.PI);\n const c1 = c0 * Math.sqrt(0.75);\n this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);\n this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);\n }\n}\nclass $d5b33d7c30034067$export$afe310a21c86023d extends $d5b33d7c30034067$export$e7ef036e309b38d2 {\n constructor(color, intensity = 1){\n super(undefined, intensity);\n this.isAmbientLightProbe = true;\n const color1 = new $d5b33d7c30034067$export$892596cec99bc70e().set(color);\n // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI));\n }\n}\nconst $d5b33d7c30034067$var$_eyeRight = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_eyeLeft = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_projectionMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nclass $d5b33d7c30034067$export$bc7f73a1065bee0c {\n constructor(){\n this.type = \"StereoCamera\";\n this.aspect = 1;\n this.eyeSep = 0.064;\n this.cameraL = new $d5b33d7c30034067$export$74e4ae24825f68d7();\n this.cameraL.layers.enable(1);\n this.cameraL.matrixAutoUpdate = false;\n this.cameraR = new $d5b33d7c30034067$export$74e4ae24825f68d7();\n this.cameraR.layers.enable(2);\n this.cameraR.matrixAutoUpdate = false;\n this._cache = {\n focus: null,\n fov: null,\n aspect: null,\n near: null,\n far: null,\n zoom: null,\n eyeSep: null\n };\n }\n update(camera) {\n const cache = this._cache;\n const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n if (needsUpdate) {\n cache.focus = camera.focus;\n cache.fov = camera.fov;\n cache.aspect = camera.aspect * this.aspect;\n cache.near = camera.near;\n cache.far = camera.far;\n cache.zoom = camera.zoom;\n cache.eyeSep = this.eyeSep;\n // Off-axis stereoscopic effect based on\n // http://paulbourke.net/stereographics/stereorender/\n $d5b33d7c30034067$var$_projectionMatrix.copy(camera.projectionMatrix);\n const eyeSepHalf = cache.eyeSep / 2;\n const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n const ymax = cache.near * Math.tan($d5b33d7c30034067$var$DEG2RAD * cache.fov * 0.5) / cache.zoom;\n let xmin, xmax;\n // translate xOffset\n $d5b33d7c30034067$var$_eyeLeft.elements[12] = -eyeSepHalf;\n $d5b33d7c30034067$var$_eyeRight.elements[12] = eyeSepHalf;\n // for left eye\n xmin = -ymax * cache.aspect + eyeSepOnProjection;\n xmax = ymax * cache.aspect + eyeSepOnProjection;\n $d5b33d7c30034067$var$_projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n $d5b33d7c30034067$var$_projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraL.projectionMatrix.copy($d5b33d7c30034067$var$_projectionMatrix);\n // for right eye\n xmin = -ymax * cache.aspect - eyeSepOnProjection;\n xmax = ymax * cache.aspect - eyeSepOnProjection;\n $d5b33d7c30034067$var$_projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n $d5b33d7c30034067$var$_projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraR.projectionMatrix.copy($d5b33d7c30034067$var$_projectionMatrix);\n }\n this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply($d5b33d7c30034067$var$_eyeLeft);\n this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply($d5b33d7c30034067$var$_eyeRight);\n }\n}\nclass $d5b33d7c30034067$export$9735c82c4bae3302 {\n constructor(autoStart = true){\n this.autoStart = autoStart;\n this.startTime = 0;\n this.oldTime = 0;\n this.elapsedTime = 0;\n this.running = false;\n }\n start() {\n this.startTime = $d5b33d7c30034067$var$now();\n this.oldTime = this.startTime;\n this.elapsedTime = 0;\n this.running = true;\n }\n stop() {\n this.getElapsedTime();\n this.running = false;\n this.autoStart = false;\n }\n getElapsedTime() {\n this.getDelta();\n return this.elapsedTime;\n }\n getDelta() {\n let diff = 0;\n if (this.autoStart && !this.running) {\n this.start();\n return 0;\n }\n if (this.running) {\n const newTime = $d5b33d7c30034067$var$now();\n diff = (newTime - this.oldTime) / 1000;\n this.oldTime = newTime;\n this.elapsedTime += diff;\n }\n return diff;\n }\n}\nfunction $d5b33d7c30034067$var$now() {\n return (typeof performance === \"undefined\" ? Date : performance).now(); // see #10732\n}\nconst $d5b33d7c30034067$var$_position$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_quaternion$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nconst $d5b33d7c30034067$var$_scale$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_orientation$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$8a1b810c6fde8951 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(){\n super();\n this.type = \"AudioListener\";\n this.context = $d5b33d7c30034067$export$fcbc63750ec2a81f.getContext();\n this.gain = this.context.createGain();\n this.gain.connect(this.context.destination);\n this.filter = null;\n this.timeDelta = 0;\n // private\n this._clock = new $d5b33d7c30034067$export$9735c82c4bae3302();\n }\n getInput() {\n return this.gain;\n }\n removeFilter() {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n this.gain.connect(this.context.destination);\n this.filter = null;\n }\n return this;\n }\n getFilter() {\n return this.filter;\n }\n setFilter(value) {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n } else this.gain.disconnect(this.context.destination);\n this.filter = value;\n this.gain.connect(this.filter);\n this.filter.connect(this.context.destination);\n return this;\n }\n getMasterVolume() {\n return this.gain.gain.value;\n }\n setMasterVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n const listener = this.context.listener;\n const up = this.up;\n this.timeDelta = this._clock.getDelta();\n this.matrixWorld.decompose($d5b33d7c30034067$var$_position$1, $d5b33d7c30034067$var$_quaternion$1, $d5b33d7c30034067$var$_scale$1);\n $d5b33d7c30034067$var$_orientation$1.set(0, 0, -1).applyQuaternion($d5b33d7c30034067$var$_quaternion$1);\n if (listener.positionX) {\n // code path for Chrome (see #14393)\n const endTime = this.context.currentTime + this.timeDelta;\n listener.positionX.linearRampToValueAtTime($d5b33d7c30034067$var$_position$1.x, endTime);\n listener.positionY.linearRampToValueAtTime($d5b33d7c30034067$var$_position$1.y, endTime);\n listener.positionZ.linearRampToValueAtTime($d5b33d7c30034067$var$_position$1.z, endTime);\n listener.forwardX.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation$1.x, endTime);\n listener.forwardY.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation$1.y, endTime);\n listener.forwardZ.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation$1.z, endTime);\n listener.upX.linearRampToValueAtTime(up.x, endTime);\n listener.upY.linearRampToValueAtTime(up.y, endTime);\n listener.upZ.linearRampToValueAtTime(up.z, endTime);\n } else {\n listener.setPosition($d5b33d7c30034067$var$_position$1.x, $d5b33d7c30034067$var$_position$1.y, $d5b33d7c30034067$var$_position$1.z);\n listener.setOrientation($d5b33d7c30034067$var$_orientation$1.x, $d5b33d7c30034067$var$_orientation$1.y, $d5b33d7c30034067$var$_orientation$1.z, up.x, up.y, up.z);\n }\n }\n}\nclass $d5b33d7c30034067$export$153755f98d9861de extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(listener){\n super();\n this.type = \"Audio\";\n this.listener = listener;\n this.context = listener.context;\n this.gain = this.context.createGain();\n this.gain.connect(listener.getInput());\n this.autoplay = false;\n this.buffer = null;\n this.detune = 0;\n this.loop = false;\n this.loopStart = 0;\n this.loopEnd = 0;\n this.offset = 0;\n this.duration = undefined;\n this.playbackRate = 1;\n this.isPlaying = false;\n this.hasPlaybackControl = true;\n this.source = null;\n this.sourceType = \"empty\";\n this._startedAt = 0;\n this._progress = 0;\n this._connected = false;\n this.filters = [];\n }\n getOutput() {\n return this.gain;\n }\n setNodeSource(audioNode) {\n this.hasPlaybackControl = false;\n this.sourceType = \"audioNode\";\n this.source = audioNode;\n this.connect();\n return this;\n }\n setMediaElementSource(mediaElement) {\n this.hasPlaybackControl = false;\n this.sourceType = \"mediaNode\";\n this.source = this.context.createMediaElementSource(mediaElement);\n this.connect();\n return this;\n }\n setMediaStreamSource(mediaStream) {\n this.hasPlaybackControl = false;\n this.sourceType = \"mediaStreamNode\";\n this.source = this.context.createMediaStreamSource(mediaStream);\n this.connect();\n return this;\n }\n setBuffer(audioBuffer) {\n this.buffer = audioBuffer;\n this.sourceType = \"buffer\";\n if (this.autoplay) this.play();\n return this;\n }\n play(delay = 0) {\n if (this.isPlaying === true) {\n console.warn(\"THREE.Audio: Audio is already playing.\");\n return;\n }\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this._startedAt = this.context.currentTime + delay;\n const source = this.context.createBufferSource();\n source.buffer = this.buffer;\n source.loop = this.loop;\n source.loopStart = this.loopStart;\n source.loopEnd = this.loopEnd;\n source.onended = this.onEnded.bind(this);\n source.start(this._startedAt, this._progress + this.offset, this.duration);\n this.isPlaying = true;\n this.source = source;\n this.setDetune(this.detune);\n this.setPlaybackRate(this.playbackRate);\n return this.connect();\n }\n pause() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n if (this.isPlaying === true) {\n // update current progress\n this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate;\n if (this.loop === true) // ensure _progress does not exceed duration with looped audios\n this._progress = this._progress % (this.duration || this.buffer.duration);\n this.source.stop();\n this.source.onended = null;\n this.isPlaying = false;\n }\n return this;\n }\n stop() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this._progress = 0;\n if (this.source !== null) {\n this.source.stop();\n this.source.onended = null;\n }\n this.isPlaying = false;\n return this;\n }\n connect() {\n if (this.filters.length > 0) {\n this.source.connect(this.filters[0]);\n for(let i = 1, l = this.filters.length; i < l; i++)this.filters[i - 1].connect(this.filters[i]);\n this.filters[this.filters.length - 1].connect(this.getOutput());\n } else this.source.connect(this.getOutput());\n this._connected = true;\n return this;\n }\n disconnect() {\n if (this.filters.length > 0) {\n this.source.disconnect(this.filters[0]);\n for(let i = 1, l = this.filters.length; i < l; i++)this.filters[i - 1].disconnect(this.filters[i]);\n this.filters[this.filters.length - 1].disconnect(this.getOutput());\n } else this.source.disconnect(this.getOutput());\n this._connected = false;\n return this;\n }\n getFilters() {\n return this.filters;\n }\n setFilters(value) {\n if (!value) value = [];\n if (this._connected === true) {\n this.disconnect();\n this.filters = value.slice();\n this.connect();\n } else this.filters = value.slice();\n return this;\n }\n setDetune(value) {\n this.detune = value;\n if (this.source.detune === undefined) return; // only set detune when available\n if (this.isPlaying === true) this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01);\n return this;\n }\n getDetune() {\n return this.detune;\n }\n getFilter() {\n return this.getFilters()[0];\n }\n setFilter(filter) {\n return this.setFilters(filter ? [\n filter\n ] : []);\n }\n setPlaybackRate(value) {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this.playbackRate = value;\n if (this.isPlaying === true) this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01);\n return this;\n }\n getPlaybackRate() {\n return this.playbackRate;\n }\n onEnded() {\n this.isPlaying = false;\n }\n getLoop() {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return false;\n }\n return this.loop;\n }\n setLoop(value) {\n if (this.hasPlaybackControl === false) {\n console.warn(\"THREE.Audio: this Audio has no playback control.\");\n return;\n }\n this.loop = value;\n if (this.isPlaying === true) this.source.loop = this.loop;\n return this;\n }\n setLoopStart(value) {\n this.loopStart = value;\n return this;\n }\n setLoopEnd(value) {\n this.loopEnd = value;\n return this;\n }\n getVolume() {\n return this.gain.gain.value;\n }\n setVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_position = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_quaternion = /*@__PURE__*/ new $d5b33d7c30034067$export$23d6a54f0bbc85a3();\nconst $d5b33d7c30034067$var$_scale = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_orientation = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$4b3e397ef1832507 extends $d5b33d7c30034067$export$153755f98d9861de {\n constructor(listener){\n super(listener);\n this.panner = this.context.createPanner();\n this.panner.panningModel = \"HRTF\";\n this.panner.connect(this.gain);\n }\n connect() {\n super.connect();\n this.panner.connect(this.gain);\n }\n disconnect() {\n super.disconnect();\n this.panner.disconnect(this.gain);\n }\n getOutput() {\n return this.panner;\n }\n getRefDistance() {\n return this.panner.refDistance;\n }\n setRefDistance(value) {\n this.panner.refDistance = value;\n return this;\n }\n getRolloffFactor() {\n return this.panner.rolloffFactor;\n }\n setRolloffFactor(value) {\n this.panner.rolloffFactor = value;\n return this;\n }\n getDistanceModel() {\n return this.panner.distanceModel;\n }\n setDistanceModel(value) {\n this.panner.distanceModel = value;\n return this;\n }\n getMaxDistance() {\n return this.panner.maxDistance;\n }\n setMaxDistance(value) {\n this.panner.maxDistance = value;\n return this;\n }\n setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {\n this.panner.coneInnerAngle = coneInnerAngle;\n this.panner.coneOuterAngle = coneOuterAngle;\n this.panner.coneOuterGain = coneOuterGain;\n return this;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.hasPlaybackControl === true && this.isPlaying === false) return;\n this.matrixWorld.decompose($d5b33d7c30034067$var$_position, $d5b33d7c30034067$var$_quaternion, $d5b33d7c30034067$var$_scale);\n $d5b33d7c30034067$var$_orientation.set(0, 0, 1).applyQuaternion($d5b33d7c30034067$var$_quaternion);\n const panner = this.panner;\n if (panner.positionX) {\n // code path for Chrome and Firefox (see #14393)\n const endTime = this.context.currentTime + this.listener.timeDelta;\n panner.positionX.linearRampToValueAtTime($d5b33d7c30034067$var$_position.x, endTime);\n panner.positionY.linearRampToValueAtTime($d5b33d7c30034067$var$_position.y, endTime);\n panner.positionZ.linearRampToValueAtTime($d5b33d7c30034067$var$_position.z, endTime);\n panner.orientationX.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation.x, endTime);\n panner.orientationY.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation.y, endTime);\n panner.orientationZ.linearRampToValueAtTime($d5b33d7c30034067$var$_orientation.z, endTime);\n } else {\n panner.setPosition($d5b33d7c30034067$var$_position.x, $d5b33d7c30034067$var$_position.y, $d5b33d7c30034067$var$_position.z);\n panner.setOrientation($d5b33d7c30034067$var$_orientation.x, $d5b33d7c30034067$var$_orientation.y, $d5b33d7c30034067$var$_orientation.z);\n }\n }\n}\nclass $d5b33d7c30034067$export$d47da1ef3d382827 {\n constructor(audio, fftSize = 2048){\n this.analyser = audio.context.createAnalyser();\n this.analyser.fftSize = fftSize;\n this.data = new Uint8Array(this.analyser.frequencyBinCount);\n audio.getOutput().connect(this.analyser);\n }\n getFrequencyData() {\n this.analyser.getByteFrequencyData(this.data);\n return this.data;\n }\n getAverageFrequency() {\n let value = 0;\n const data = this.getFrequencyData();\n for(let i = 0; i < data.length; i++)value += data[i];\n return value / data.length;\n }\n}\nclass $d5b33d7c30034067$export$dfe0af1ca1acb78a {\n constructor(binding, typeName, valueSize){\n this.binding = binding;\n this.valueSize = valueSize;\n let mixFunction, mixFunctionAdditive, setIdentity;\n // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n //\n // interpolators can use .buffer as their .result\n // the data then goes to 'incoming'\n //\n // 'accu0' and 'accu1' are used frame-interleaved for\n // the cumulative result and are compared to detect\n // changes\n //\n // 'orig' stores the original state of the property\n //\n // 'add' is used for additive cumulative results\n //\n // 'work' is optional and is only present for quaternion types. It is used\n // to store intermediate quaternion multiplication results\n switch(typeName){\n case \"quaternion\":\n mixFunction = this._slerp;\n mixFunctionAdditive = this._slerpAdditive;\n setIdentity = this._setAdditiveIdentityQuaternion;\n this.buffer = new Float64Array(valueSize * 6);\n this._workIndex = 5;\n break;\n case \"string\":\n case \"bool\":\n mixFunction = this._select;\n // Use the regular mix function and for additive on these types,\n // additive is not relevant for non-numeric types\n mixFunctionAdditive = this._select;\n setIdentity = this._setAdditiveIdentityOther;\n this.buffer = new Array(valueSize * 5);\n break;\n default:\n mixFunction = this._lerp;\n mixFunctionAdditive = this._lerpAdditive;\n setIdentity = this._setAdditiveIdentityNumeric;\n this.buffer = new Float64Array(valueSize * 5);\n }\n this._mixBufferRegion = mixFunction;\n this._mixBufferRegionAdditive = mixFunctionAdditive;\n this._setIdentity = setIdentity;\n this._origIndex = 3;\n this._addIndex = 4;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n this.useCount = 0;\n this.referenceCount = 0;\n }\n // accumulate data in the 'incoming' region into 'accu'\n accumulate(accuIndex, weight) {\n // note: happily accumulating nothing when weight = 0, the caller knows\n // the weight and shouldn't have made the call in the first place\n const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride;\n let currentWeight = this.cumulativeWeight;\n if (currentWeight === 0) {\n // accuN := incoming * weight\n for(let i = 0; i !== stride; ++i)buffer[offset + i] = buffer[i];\n currentWeight = weight;\n } else {\n // accuN := accuN + incoming * weight\n currentWeight += weight;\n const mix = weight / currentWeight;\n this._mixBufferRegion(buffer, offset, 0, mix, stride);\n }\n this.cumulativeWeight = currentWeight;\n }\n // accumulate data in the 'incoming' region into 'add'\n accumulateAdditive(weight) {\n const buffer = this.buffer, stride = this.valueSize, offset = stride * this._addIndex;\n if (this.cumulativeWeightAdditive === 0) // add = identity\n this._setIdentity();\n // add := add + incoming * weight\n this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);\n this.cumulativeWeightAdditive += weight;\n }\n // apply the state of 'accu' to the binding when accus differ\n apply(accuIndex) {\n const stride = this.valueSize, buffer = this.buffer, offset = accuIndex * stride + stride, weight = this.cumulativeWeight, weightAdditive = this.cumulativeWeightAdditive, binding = this.binding;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n if (weight < 1) {\n // accuN := accuN + original * ( 1 - cumulativeWeight )\n const originalValueOffset = stride * this._origIndex;\n this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n }\n if (weightAdditive > 0) // accuN := accuN + additive accuN\n this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n for(let i = stride, e = stride + stride; i !== e; ++i)if (buffer[i] !== buffer[i + stride]) {\n // value has changed -> update scene graph\n binding.setValue(buffer, offset);\n break;\n }\n }\n // remember the state of the bound property and copy it to both accus\n saveOriginalState() {\n const binding = this.binding;\n const buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * this._origIndex;\n binding.getValue(buffer, originalValueOffset);\n // accu[0..1] := orig -- initially detect changes against the original\n for(let i = stride, e = originalValueOffset; i !== e; ++i)buffer[i] = buffer[originalValueOffset + i % stride];\n // Add to identity for additive\n this._setIdentity();\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n }\n // apply the state previously taken via 'saveOriginalState' to the binding\n restoreOriginalState() {\n const originalValueOffset = this.valueSize * 3;\n this.binding.setValue(this.buffer, originalValueOffset);\n }\n _setAdditiveIdentityNumeric() {\n const startIndex = this._addIndex * this.valueSize;\n const endIndex = startIndex + this.valueSize;\n for(let i = startIndex; i < endIndex; i++)this.buffer[i] = 0;\n }\n _setAdditiveIdentityQuaternion() {\n this._setAdditiveIdentityNumeric();\n this.buffer[this._addIndex * this.valueSize + 3] = 1;\n }\n _setAdditiveIdentityOther() {\n const startIndex = this._origIndex * this.valueSize;\n const targetIndex = this._addIndex * this.valueSize;\n for(let i = 0; i < this.valueSize; i++)this.buffer[targetIndex + i] = this.buffer[startIndex + i];\n }\n // mix functions\n _select(buffer, dstOffset, srcOffset, t, stride) {\n if (t >= 0.5) for(let i = 0; i !== stride; ++i)buffer[dstOffset + i] = buffer[srcOffset + i];\n }\n _slerp(buffer, dstOffset, srcOffset, t) {\n $d5b33d7c30034067$export$23d6a54f0bbc85a3.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t);\n }\n _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n const workOffset = this._workIndex * stride;\n // Store result in intermediate buffer offset\n $d5b33d7c30034067$export$23d6a54f0bbc85a3.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset);\n // Slerp to the intermediate result\n $d5b33d7c30034067$export$23d6a54f0bbc85a3.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t);\n }\n _lerp(buffer, dstOffset, srcOffset, t, stride) {\n const s = 1 - t;\n for(let i = 0; i !== stride; ++i){\n const j = dstOffset + i;\n buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t;\n }\n }\n _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n for(let i = 0; i !== stride; ++i){\n const j = dstOffset + i;\n buffer[j] = buffer[j] + buffer[srcOffset + i] * t;\n }\n }\n}\n// Characters [].:/ are reserved for track binding syntax.\nconst $d5b33d7c30034067$var$_RESERVED_CHARS_RE = \"\\\\[\\\\]\\\\.:\\\\/\";\nconst $d5b33d7c30034067$var$_reservedRe = new RegExp(\"[\" + $d5b33d7c30034067$var$_RESERVED_CHARS_RE + \"]\", \"g\");\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst $d5b33d7c30034067$var$_wordChar = \"[^\" + $d5b33d7c30034067$var$_RESERVED_CHARS_RE + \"]\";\nconst $d5b33d7c30034067$var$_wordCharOrDot = \"[^\" + $d5b33d7c30034067$var$_RESERVED_CHARS_RE.replace(\"\\\\.\", \"\") + \"]\";\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst $d5b33d7c30034067$var$_directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace(\"WC\", $d5b33d7c30034067$var$_wordChar);\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst $d5b33d7c30034067$var$_nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace(\"WCOD\", $d5b33d7c30034067$var$_wordCharOrDot);\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst $d5b33d7c30034067$var$_objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace(\"WC\", $d5b33d7c30034067$var$_wordChar);\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst $d5b33d7c30034067$var$_propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace(\"WC\", $d5b33d7c30034067$var$_wordChar);\nconst $d5b33d7c30034067$var$_trackRe = new RegExp(\"^\" + $d5b33d7c30034067$var$_directoryRe + $d5b33d7c30034067$var$_nodeRe + $d5b33d7c30034067$var$_objectRe + $d5b33d7c30034067$var$_propertyRe + \"$\");\nconst $d5b33d7c30034067$var$_supportedObjectNames = [\n \"material\",\n \"materials\",\n \"bones\",\n \"map\"\n];\nclass $d5b33d7c30034067$var$Composite {\n constructor(targetGroup, path, optionalParsedPath){\n const parsedPath = optionalParsedPath || $d5b33d7c30034067$export$7bf70fcf9f891893.parseTrackName(path);\n this._targetGroup = targetGroup;\n this._bindings = targetGroup.subscribe_(path, parsedPath);\n }\n getValue(array, offset) {\n this.bind(); // bind all binding\n const firstValidIndex = this._targetGroup.nCachedObjects_, binding = this._bindings[firstValidIndex];\n // and only call .getValue on the first\n if (binding !== undefined) binding.getValue(array, offset);\n }\n setValue(array, offset) {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].setValue(array, offset);\n }\n bind() {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].bind();\n }\n unbind() {\n const bindings = this._bindings;\n for(let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i)bindings[i].unbind();\n }\n}\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass $d5b33d7c30034067$export$7bf70fcf9f891893 {\n constructor(rootNode, path, parsedPath){\n this.path = path;\n this.parsedPath = parsedPath || $d5b33d7c30034067$export$7bf70fcf9f891893.parseTrackName(path);\n this.node = $d5b33d7c30034067$export$7bf70fcf9f891893.findNode(rootNode, this.parsedPath.nodeName);\n this.rootNode = rootNode;\n // initial state of these methods that calls 'bind'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n static create(root, path, parsedPath) {\n if (!(root && root.isAnimationObjectGroup)) return new $d5b33d7c30034067$export$7bf70fcf9f891893(root, path, parsedPath);\n else return new $d5b33d7c30034067$export$7bf70fcf9f891893.Composite(root, path, parsedPath);\n }\n /**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */ static sanitizeNodeName(name) {\n return name.replace(/\\s/g, \"_\").replace($d5b33d7c30034067$var$_reservedRe, \"\");\n }\n static parseTrackName(trackName) {\n const matches = $d5b33d7c30034067$var$_trackRe.exec(trackName);\n if (matches === null) throw new Error(\"PropertyBinding: Cannot parse trackName: \" + trackName);\n const results = {\n // directoryName: matches[ 1 ], // (tschw) currently unused\n nodeName: matches[2],\n objectName: matches[3],\n objectIndex: matches[4],\n propertyName: matches[5],\n propertyIndex: matches[6]\n };\n const lastDot = results.nodeName && results.nodeName.lastIndexOf(\".\");\n if (lastDot !== undefined && lastDot !== -1) {\n const objectName = results.nodeName.substring(lastDot + 1);\n // Object names must be checked against an allowlist. Otherwise, there\n // is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n // 'bar' could be the objectName, or part of a nodeName (which can\n // include '.' characters).\n if ($d5b33d7c30034067$var$_supportedObjectNames.indexOf(objectName) !== -1) {\n results.nodeName = results.nodeName.substring(0, lastDot);\n results.objectName = objectName;\n }\n }\n if (results.propertyName === null || results.propertyName.length === 0) throw new Error(\"PropertyBinding: can not parse propertyName from trackName: \" + trackName);\n return results;\n }\n static findNode(root, nodeName) {\n if (nodeName === undefined || nodeName === \"\" || nodeName === \".\" || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) return root;\n // search into skeleton bones.\n if (root.skeleton) {\n const bone = root.skeleton.getBoneByName(nodeName);\n if (bone !== undefined) return bone;\n }\n // search into node subtree.\n if (root.children) {\n const searchNodeSubtree = function(children) {\n for(let i = 0; i < children.length; i++){\n const childNode = children[i];\n if (childNode.name === nodeName || childNode.uuid === nodeName) return childNode;\n const result = searchNodeSubtree(childNode.children);\n if (result) return result;\n }\n return null;\n };\n const subTreeNode = searchNodeSubtree(root.children);\n if (subTreeNode) return subTreeNode;\n }\n return null;\n }\n // these are used to \"bind\" a nonexistent property\n _getValue_unavailable() {}\n _setValue_unavailable() {}\n // Getters\n _getValue_direct(buffer, offset) {\n buffer[offset] = this.targetObject[this.propertyName];\n }\n _getValue_array(buffer, offset) {\n const source = this.resolvedProperty;\n for(let i = 0, n = source.length; i !== n; ++i)buffer[offset++] = source[i];\n }\n _getValue_arrayElement(buffer, offset) {\n buffer[offset] = this.resolvedProperty[this.propertyIndex];\n }\n _getValue_toArray(buffer, offset) {\n this.resolvedProperty.toArray(buffer, offset);\n }\n // Direct\n _setValue_direct(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n }\n _setValue_direct_setNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // EntireArray\n _setValue_array(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n }\n _setValue_array_setNeedsUpdate(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n this.targetObject.needsUpdate = true;\n }\n _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {\n const dest = this.resolvedProperty;\n for(let i = 0, n = dest.length; i !== n; ++i)dest[i] = buffer[offset++];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // ArrayElement\n _setValue_arrayElement(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n }\n _setValue_arrayElement_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n // HasToFromArray\n _setValue_fromArray(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n }\n _setValue_fromArray_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.needsUpdate = true;\n }\n _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n _getValue_unbound(targetArray, offset) {\n this.bind();\n this.getValue(targetArray, offset);\n }\n _setValue_unbound(sourceArray, offset) {\n this.bind();\n this.setValue(sourceArray, offset);\n }\n // create getter / setter pair for a property in the scene graph\n bind() {\n let targetObject = this.node;\n const parsedPath = this.parsedPath;\n const objectName = parsedPath.objectName;\n const propertyName = parsedPath.propertyName;\n let propertyIndex = parsedPath.propertyIndex;\n if (!targetObject) {\n targetObject = $d5b33d7c30034067$export$7bf70fcf9f891893.findNode(this.rootNode, parsedPath.nodeName);\n this.node = targetObject;\n }\n // set fail state so we can just 'return' on error\n this.getValue = this._getValue_unavailable;\n this.setValue = this._setValue_unavailable;\n // ensure there is a value node\n if (!targetObject) {\n console.warn(\"THREE.PropertyBinding: No target node found for track: \" + this.path + \".\");\n return;\n }\n if (objectName) {\n let objectIndex = parsedPath.objectIndex;\n // special cases were we need to reach deeper into the hierarchy to get the face materials....\n switch(objectName){\n case \"materials\":\n if (!targetObject.material) {\n console.error(\"THREE.PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!targetObject.material.materials) {\n console.error(\"THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\", this);\n return;\n }\n targetObject = targetObject.material.materials;\n break;\n case \"bones\":\n if (!targetObject.skeleton) {\n console.error(\"THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.\", this);\n return;\n }\n // potential future optimization: skip this if propertyIndex is already an integer\n // and convert the integer string to a true integer.\n targetObject = targetObject.skeleton.bones;\n // support resolving morphTarget names into indices.\n for(let i = 0; i < targetObject.length; i++)if (targetObject[i].name === objectIndex) {\n objectIndex = i;\n break;\n }\n break;\n case \"map\":\n if (\"map\" in targetObject) {\n targetObject = targetObject.map;\n break;\n }\n if (!targetObject.material) {\n console.error(\"THREE.PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!targetObject.material.map) {\n console.error(\"THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.\", this);\n return;\n }\n targetObject = targetObject.material.map;\n break;\n default:\n if (targetObject[objectName] === undefined) {\n console.error(\"THREE.PropertyBinding: Can not bind to objectName of node undefined.\", this);\n return;\n }\n targetObject = targetObject[objectName];\n }\n if (objectIndex !== undefined) {\n if (targetObject[objectIndex] === undefined) {\n console.error(\"THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\", this, targetObject);\n return;\n }\n targetObject = targetObject[objectIndex];\n }\n }\n // resolve property\n const nodeProperty = targetObject[propertyName];\n if (nodeProperty === undefined) {\n const nodeName = parsedPath.nodeName;\n console.error(\"THREE.PropertyBinding: Trying to update property for track: \" + nodeName + \".\" + propertyName + \" but it wasn't found.\", targetObject);\n return;\n }\n // determine versioning scheme\n let versioning = this.Versioning.None;\n this.targetObject = targetObject;\n if (targetObject.needsUpdate !== undefined) versioning = this.Versioning.NeedsUpdate;\n else if (targetObject.matrixWorldNeedsUpdate !== undefined) versioning = this.Versioning.MatrixWorldNeedsUpdate;\n // determine how the property gets bound\n let bindingType = this.BindingType.Direct;\n if (propertyIndex !== undefined) {\n // access a sub element of the property array (only primitives are supported right now)\n if (propertyName === \"morphTargetInfluences\") {\n // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n // support resolving morphTarget names into indices.\n if (!targetObject.geometry) {\n console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\", this);\n return;\n }\n if (!targetObject.geometry.morphAttributes) {\n console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\", this);\n return;\n }\n if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) propertyIndex = targetObject.morphTargetDictionary[propertyIndex];\n }\n bindingType = this.BindingType.ArrayElement;\n this.resolvedProperty = nodeProperty;\n this.propertyIndex = propertyIndex;\n } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) {\n // must use copy for Object3D.Euler/Quaternion\n bindingType = this.BindingType.HasFromToArray;\n this.resolvedProperty = nodeProperty;\n } else if (Array.isArray(nodeProperty)) {\n bindingType = this.BindingType.EntireArray;\n this.resolvedProperty = nodeProperty;\n } else this.propertyName = propertyName;\n // select getter / setter\n this.getValue = this.GetterByBindingType[bindingType];\n this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];\n }\n unbind() {\n this.node = null;\n // back to the prototype version of getValue / setValue\n // note: avoiding to mutate the shape of 'this' via 'delete'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n}\n$d5b33d7c30034067$export$7bf70fcf9f891893.Composite = $d5b33d7c30034067$var$Composite;\n$d5b33d7c30034067$export$7bf70fcf9f891893.prototype.BindingType = {\n Direct: 0,\n EntireArray: 1,\n ArrayElement: 2,\n HasFromToArray: 3\n};\n$d5b33d7c30034067$export$7bf70fcf9f891893.prototype.Versioning = {\n None: 0,\n NeedsUpdate: 1,\n MatrixWorldNeedsUpdate: 2\n};\n$d5b33d7c30034067$export$7bf70fcf9f891893.prototype.GetterByBindingType = [\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._getValue_direct,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._getValue_array,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._getValue_arrayElement,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._getValue_toArray\n];\n$d5b33d7c30034067$export$7bf70fcf9f891893.prototype.SetterByBindingTypeAndVersioning = [\n [\n // Direct\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_direct,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_direct_setNeedsUpdate,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_direct_setMatrixWorldNeedsUpdate\n ],\n [\n // EntireArray\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_array,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_array_setNeedsUpdate,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_array_setMatrixWorldNeedsUpdate\n ],\n [\n // ArrayElement\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_arrayElement,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_arrayElement_setNeedsUpdate,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate\n ],\n [\n // HasToFromArray\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_fromArray,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_fromArray_setNeedsUpdate,\n $d5b33d7c30034067$export$7bf70fcf9f891893.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate\n ]\n];\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */ class $d5b33d7c30034067$export$30619c2afd3f34db {\n constructor(){\n this.isAnimationObjectGroup = true;\n this.uuid = $d5b33d7c30034067$var$generateUUID();\n // cached objects followed by the active ones\n this._objects = Array.prototype.slice.call(arguments);\n this.nCachedObjects_ = 0; // threshold\n // note: read by PropertyBinding.Composite\n const indices = {};\n this._indicesByUUID = indices; // for bookkeeping\n for(let i = 0, n = arguments.length; i !== n; ++i)indices[arguments[i].uuid] = i;\n this._paths = []; // inside: string\n this._parsedPaths = []; // inside: { we don't care, here }\n this._bindings = []; // inside: Array< PropertyBinding >\n this._bindingsIndicesByPath = {}; // inside: indices in these arrays\n const scope = this;\n this.stats = {\n objects: {\n get total () {\n return scope._objects.length;\n },\n get inUse () {\n return this.total - scope.nCachedObjects_;\n }\n },\n get bindingsPerObject () {\n return scope._bindings.length;\n }\n };\n }\n add() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, nBindings = bindings.length;\n let knownObject = undefined, nObjects = objects.length, nCachedObjects = this.nCachedObjects_;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid;\n let index = indicesByUUID[uuid];\n if (index === undefined) {\n // unknown object -> add it to the ACTIVE region\n index = nObjects++;\n indicesByUUID[uuid] = index;\n objects.push(object);\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j)bindings[j].push(new $d5b33d7c30034067$export$7bf70fcf9f891893(object, paths[j], parsedPaths[j]));\n } else if (index < nCachedObjects) {\n knownObject = objects[index];\n // move existing object to the ACTIVE region\n const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex];\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n indicesByUUID[uuid] = firstActiveIndex;\n objects[firstActiveIndex] = object;\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex];\n let binding = bindingsForPath[index];\n bindingsForPath[index] = lastCached;\n if (binding === undefined) // since we do not bother to create new bindings\n // for objects that are cached, the binding may\n // or may not exist\n binding = new $d5b33d7c30034067$export$7bf70fcf9f891893(object, paths[j], parsedPaths[j]);\n bindingsForPath[firstActiveIndex] = binding;\n }\n } else if (objects[index] !== knownObject) console.error(\"THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.\");\n // else the object is already where we want it to be\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n remove() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;\n let nCachedObjects = this.nCachedObjects_;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid];\n if (index !== undefined && index >= nCachedObjects) {\n // move existing object into the CACHED region\n const lastCachedIndex = nCachedObjects++, firstActiveObject = objects[lastCachedIndex];\n indicesByUUID[firstActiveObject.uuid] = index;\n objects[index] = firstActiveObject;\n indicesByUUID[uuid] = lastCachedIndex;\n objects[lastCachedIndex] = object;\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], firstActive = bindingsForPath[lastCachedIndex], binding = bindingsForPath[index];\n bindingsForPath[index] = firstActive;\n bindingsForPath[lastCachedIndex] = binding;\n }\n }\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n // remove & forget\n uncache() {\n const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;\n let nCachedObjects = this.nCachedObjects_, nObjects = objects.length;\n for(let i = 0, n = arguments.length; i !== n; ++i){\n const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid];\n if (index !== undefined) {\n delete indicesByUUID[uuid];\n if (index < nCachedObjects) {\n // object is cached, shrink the CACHED region\n const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex];\n // last cached object takes this object's place\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n // last object goes to the activated slot and pop\n indicesByUUID[lastObject.uuid] = firstActiveIndex;\n objects[firstActiveIndex] = lastObject;\n objects.pop();\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex], last = bindingsForPath[lastIndex];\n bindingsForPath[index] = lastCached;\n bindingsForPath[firstActiveIndex] = last;\n bindingsForPath.pop();\n }\n } else {\n // object is active, just swap with the last and pop\n const lastIndex = --nObjects, lastObject = objects[lastIndex];\n if (lastIndex > 0) indicesByUUID[lastObject.uuid] = index;\n objects[index] = lastObject;\n objects.pop();\n // accounting is done, now do the same for all bindings\n for(let j = 0, m = nBindings; j !== m; ++j){\n const bindingsForPath = bindings[j];\n bindingsForPath[index] = bindingsForPath[lastIndex];\n bindingsForPath.pop();\n }\n } // cached or active\n } // if object is known\n } // for arguments\n this.nCachedObjects_ = nCachedObjects;\n }\n // Internal interface used by befriended PropertyBinding.Composite:\n subscribe_(path, parsedPath) {\n // returns an array of bindings for the given path that is changed\n // according to the contained objects in the group\n const indicesByPath = this._bindingsIndicesByPath;\n let index = indicesByPath[path];\n const bindings = this._bindings;\n if (index !== undefined) return bindings[index];\n const paths = this._paths, parsedPaths = this._parsedPaths, objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, bindingsForPath = new Array(nObjects);\n index = bindings.length;\n indicesByPath[path] = index;\n paths.push(path);\n parsedPaths.push(parsedPath);\n bindings.push(bindingsForPath);\n for(let i = nCachedObjects, n = objects.length; i !== n; ++i){\n const object = objects[i];\n bindingsForPath[i] = new $d5b33d7c30034067$export$7bf70fcf9f891893(object, path, parsedPath);\n }\n return bindingsForPath;\n }\n unsubscribe_(path) {\n // tells the group to forget about a property path and no longer\n // update the array previously obtained with 'subscribe_'\n const indicesByPath = this._bindingsIndicesByPath, index = indicesByPath[path];\n if (index !== undefined) {\n const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = path[lastBindingsIndex];\n indicesByPath[lastBindingsPath] = index;\n bindings[index] = lastBindings;\n bindings.pop();\n parsedPaths[index] = parsedPaths[lastBindingsIndex];\n parsedPaths.pop();\n paths[index] = paths[lastBindingsIndex];\n paths.pop();\n }\n }\n}\nclass $d5b33d7c30034067$export$6946940a69e799e {\n constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode){\n this._mixer = mixer;\n this._clip = clip;\n this._localRoot = localRoot;\n this.blendMode = blendMode;\n const tracks = clip.tracks, nTracks = tracks.length, interpolants = new Array(nTracks);\n const interpolantSettings = {\n endingStart: $d5b33d7c30034067$export$7f795934b84ab523,\n endingEnd: $d5b33d7c30034067$export$7f795934b84ab523\n };\n for(let i = 0; i !== nTracks; ++i){\n const interpolant = tracks[i].createInterpolant(null);\n interpolants[i] = interpolant;\n interpolant.settings = interpolantSettings;\n }\n this._interpolantSettings = interpolantSettings;\n this._interpolants = interpolants; // bound by the mixer\n // inside: PropertyMixer (managed by the mixer)\n this._propertyBindings = new Array(nTracks);\n this._cacheIndex = null; // for the memory manager\n this._byClipCacheIndex = null; // for the memory manager\n this._timeScaleInterpolant = null;\n this._weightInterpolant = null;\n this.loop = $d5b33d7c30034067$export$dfaf4422ce096e29;\n this._loopCount = -1;\n // global mixer time when the action is to be started\n // it's set back to 'null' upon start of the action\n this._startTime = null;\n // scaled local time of the action\n // gets clamped or wrapped to 0..clip.duration according to loop\n this.time = 0;\n this.timeScale = 1;\n this._effectiveTimeScale = 1;\n this.weight = 1;\n this._effectiveWeight = 1;\n this.repetitions = Infinity; // no. of repetitions when looping\n this.paused = false; // true -> zero effective time scale\n this.enabled = true; // false -> zero effective weight\n this.clampWhenFinished = false; // keep feeding the last frame?\n this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate\n this.zeroSlopeAtEnd = true; // clips for start, loop and end\n }\n // State & Scheduling\n play() {\n this._mixer._activateAction(this);\n return this;\n }\n stop() {\n this._mixer._deactivateAction(this);\n return this.reset();\n }\n reset() {\n this.paused = false;\n this.enabled = true;\n this.time = 0; // restart clip\n this._loopCount = -1; // forget previous loops\n this._startTime = null; // forget scheduling\n return this.stopFading().stopWarping();\n }\n isRunning() {\n return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);\n }\n // return true when play has been called\n isScheduled() {\n return this._mixer._isActiveAction(this);\n }\n startAt(time) {\n this._startTime = time;\n return this;\n }\n setLoop(mode, repetitions) {\n this.loop = mode;\n this.repetitions = repetitions;\n return this;\n }\n // Weight\n // set the weight stopping any scheduled fading\n // although .enabled = false yields an effective weight of zero, this\n // method does *not* change .enabled, because it would be confusing\n setEffectiveWeight(weight) {\n this.weight = weight;\n // note: same logic as when updated at runtime\n this._effectiveWeight = this.enabled ? weight : 0;\n return this.stopFading();\n }\n // return the weight considering fading and .enabled\n getEffectiveWeight() {\n return this._effectiveWeight;\n }\n fadeIn(duration) {\n return this._scheduleFading(duration, 0, 1);\n }\n fadeOut(duration) {\n return this._scheduleFading(duration, 1, 0);\n }\n crossFadeFrom(fadeOutAction, duration, warp) {\n fadeOutAction.fadeOut(duration);\n this.fadeIn(duration);\n if (warp) {\n const fadeInDuration = this._clip.duration, fadeOutDuration = fadeOutAction._clip.duration, startEndRatio = fadeOutDuration / fadeInDuration, endStartRatio = fadeInDuration / fadeOutDuration;\n fadeOutAction.warp(1.0, startEndRatio, duration);\n this.warp(endStartRatio, 1.0, duration);\n }\n return this;\n }\n crossFadeTo(fadeInAction, duration, warp) {\n return fadeInAction.crossFadeFrom(this, duration, warp);\n }\n stopFading() {\n const weightInterpolant = this._weightInterpolant;\n if (weightInterpolant !== null) {\n this._weightInterpolant = null;\n this._mixer._takeBackControlInterpolant(weightInterpolant);\n }\n return this;\n }\n // Time Scale Control\n // set the time scale stopping any scheduled warping\n // although .paused = true yields an effective time scale of zero, this\n // method does *not* change .paused, because it would be confusing\n setEffectiveTimeScale(timeScale) {\n this.timeScale = timeScale;\n this._effectiveTimeScale = this.paused ? 0 : timeScale;\n return this.stopWarping();\n }\n // return the time scale considering warping and .paused\n getEffectiveTimeScale() {\n return this._effectiveTimeScale;\n }\n setDuration(duration) {\n this.timeScale = this._clip.duration / duration;\n return this.stopWarping();\n }\n syncWith(action) {\n this.time = action.time;\n this.timeScale = action.timeScale;\n return this.stopWarping();\n }\n halt(duration) {\n return this.warp(this._effectiveTimeScale, 0, duration);\n }\n warp(startTimeScale, endTimeScale, duration) {\n const mixer = this._mixer, now = mixer.time, timeScale = this.timeScale;\n let interpolant = this._timeScaleInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._timeScaleInterpolant = interpolant;\n }\n const times = interpolant.parameterPositions, values = interpolant.sampleValues;\n times[0] = now;\n times[1] = now + duration;\n values[0] = startTimeScale / timeScale;\n values[1] = endTimeScale / timeScale;\n return this;\n }\n stopWarping() {\n const timeScaleInterpolant = this._timeScaleInterpolant;\n if (timeScaleInterpolant !== null) {\n this._timeScaleInterpolant = null;\n this._mixer._takeBackControlInterpolant(timeScaleInterpolant);\n }\n return this;\n }\n // Object Accessors\n getMixer() {\n return this._mixer;\n }\n getClip() {\n return this._clip;\n }\n getRoot() {\n return this._localRoot || this._mixer._root;\n }\n // Interna\n _update(time, deltaTime, timeDirection, accuIndex) {\n // called by the mixer\n if (!this.enabled) {\n // call ._updateWeight() to update ._effectiveWeight\n this._updateWeight(time);\n return;\n }\n const startTime = this._startTime;\n if (startTime !== null) {\n // check for scheduled start of action\n const timeRunning = (time - startTime) * timeDirection;\n if (timeRunning < 0 || timeDirection === 0) deltaTime = 0;\n else {\n this._startTime = null; // unschedule\n deltaTime = timeDirection * timeRunning;\n }\n }\n // apply time scale and advance time\n deltaTime *= this._updateTimeScale(time);\n const clipTime = this._updateTime(deltaTime);\n // note: _updateTime may disable the action resulting in\n // an effective weight of 0\n const weight = this._updateWeight(time);\n if (weight > 0) {\n const interpolants = this._interpolants;\n const propertyMixers = this._propertyBindings;\n switch(this.blendMode){\n case $d5b33d7c30034067$export$d875e029ef558d3:\n for(let j = 0, m = interpolants.length; j !== m; ++j){\n interpolants[j].evaluate(clipTime);\n propertyMixers[j].accumulateAdditive(weight);\n }\n break;\n case $d5b33d7c30034067$export$bcfbbdcf8de7f8cd:\n default:\n for(let j = 0, m = interpolants.length; j !== m; ++j){\n interpolants[j].evaluate(clipTime);\n propertyMixers[j].accumulate(accuIndex, weight);\n }\n }\n }\n }\n _updateWeight(time) {\n let weight = 0;\n if (this.enabled) {\n weight = this.weight;\n const interpolant = this._weightInterpolant;\n if (interpolant !== null) {\n const interpolantValue = interpolant.evaluate(time)[0];\n weight *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopFading();\n if (interpolantValue === 0) // faded out, disable\n this.enabled = false;\n }\n }\n }\n this._effectiveWeight = weight;\n return weight;\n }\n _updateTimeScale(time) {\n let timeScale = 0;\n if (!this.paused) {\n timeScale = this.timeScale;\n const interpolant = this._timeScaleInterpolant;\n if (interpolant !== null) {\n const interpolantValue = interpolant.evaluate(time)[0];\n timeScale *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopWarping();\n if (timeScale === 0) // motion has halted, pause\n this.paused = true;\n else // warp done - apply final time scale\n this.timeScale = timeScale;\n }\n }\n }\n this._effectiveTimeScale = timeScale;\n return timeScale;\n }\n _updateTime(deltaTime) {\n const duration = this._clip.duration;\n const loop = this.loop;\n let time = this.time + deltaTime;\n let loopCount = this._loopCount;\n const pingPong = loop === $d5b33d7c30034067$export$f8f6f2041b78e210;\n if (deltaTime === 0) {\n if (loopCount === -1) return time;\n return pingPong && (loopCount & 1) === 1 ? duration - time : time;\n }\n if (loop === $d5b33d7c30034067$export$d62fdc9d1b1cccad) {\n if (loopCount === -1) {\n // just started\n this._loopCount = 0;\n this._setEndings(true, true, false);\n }\n handle_stop: {\n if (time >= duration) time = duration;\n else if (time < 0) time = 0;\n else {\n this.time = time;\n break handle_stop;\n }\n if (this.clampWhenFinished) this.paused = true;\n else this.enabled = false;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"finished\",\n action: this,\n direction: deltaTime < 0 ? -1 : 1\n });\n }\n } else {\n if (loopCount === -1) {\n // just started\n if (deltaTime >= 0) {\n loopCount = 0;\n this._setEndings(true, this.repetitions === 0, pingPong);\n } else // when looping in reverse direction, the initial\n // transition through zero counts as a repetition,\n // so leave loopCount at -1\n this._setEndings(this.repetitions === 0, true, pingPong);\n }\n if (time >= duration || time < 0) {\n // wrap around\n const loopDelta = Math.floor(time / duration); // signed\n time -= duration * loopDelta;\n loopCount += Math.abs(loopDelta);\n const pending = this.repetitions - loopCount;\n if (pending <= 0) {\n // have to stop (switch state, clamp time, fire event)\n if (this.clampWhenFinished) this.paused = true;\n else this.enabled = false;\n time = deltaTime > 0 ? duration : 0;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"finished\",\n action: this,\n direction: deltaTime > 0 ? 1 : -1\n });\n } else {\n // keep running\n if (pending === 1) {\n // entering the last round\n const atStart = deltaTime < 0;\n this._setEndings(atStart, !atStart, pingPong);\n } else this._setEndings(false, false, pingPong);\n this._loopCount = loopCount;\n this.time = time;\n this._mixer.dispatchEvent({\n type: \"loop\",\n action: this,\n loopDelta: loopDelta\n });\n }\n } else this.time = time;\n if (pingPong && (loopCount & 1) === 1) // invert time for the \"pong round\"\n return duration - time;\n }\n return time;\n }\n _setEndings(atStart, atEnd, pingPong) {\n const settings = this._interpolantSettings;\n if (pingPong) {\n settings.endingStart = $d5b33d7c30034067$export$24a4ccb5099273b5;\n settings.endingEnd = $d5b33d7c30034067$export$24a4ccb5099273b5;\n } else {\n // assuming for LoopOnce atStart == atEnd == true\n if (atStart) settings.endingStart = this.zeroSlopeAtStart ? $d5b33d7c30034067$export$24a4ccb5099273b5 : $d5b33d7c30034067$export$7f795934b84ab523;\n else settings.endingStart = $d5b33d7c30034067$export$8e8c3ecdcd8e1fee;\n if (atEnd) settings.endingEnd = this.zeroSlopeAtEnd ? $d5b33d7c30034067$export$24a4ccb5099273b5 : $d5b33d7c30034067$export$7f795934b84ab523;\n else settings.endingEnd = $d5b33d7c30034067$export$8e8c3ecdcd8e1fee;\n }\n }\n _scheduleFading(duration, weightNow, weightThen) {\n const mixer = this._mixer, now = mixer.time;\n let interpolant = this._weightInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._weightInterpolant = interpolant;\n }\n const times = interpolant.parameterPositions, values = interpolant.sampleValues;\n times[0] = now;\n values[0] = weightNow;\n times[1] = now + duration;\n values[1] = weightThen;\n return this;\n }\n}\nconst $d5b33d7c30034067$var$_controlInterpolantsResultBuffer = new Float32Array(1);\nclass $d5b33d7c30034067$export$fbd77e5aefaa0102 extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(root){\n super();\n this._root = root;\n this._initMemoryManager();\n this._accuIndex = 0;\n this.time = 0;\n this.timeScale = 1.0;\n }\n _bindAction(action, prototypeAction) {\n const root = action._localRoot || this._root, tracks = action._clip.tracks, nTracks = tracks.length, bindings = action._propertyBindings, interpolants = action._interpolants, rootUuid = root.uuid, bindingsByRoot = this._bindingsByRootAndName;\n let bindingsByName = bindingsByRoot[rootUuid];\n if (bindingsByName === undefined) {\n bindingsByName = {};\n bindingsByRoot[rootUuid] = bindingsByName;\n }\n for(let i = 0; i !== nTracks; ++i){\n const track = tracks[i], trackName = track.name;\n let binding = bindingsByName[trackName];\n if (binding !== undefined) {\n ++binding.referenceCount;\n bindings[i] = binding;\n } else {\n binding = bindings[i];\n if (binding !== undefined) {\n // existing binding, make sure the cache knows\n if (binding._cacheIndex === null) {\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n }\n continue;\n }\n const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath;\n binding = new $d5b33d7c30034067$export$dfe0af1ca1acb78a($d5b33d7c30034067$export$7bf70fcf9f891893.create(root, trackName, path), track.ValueTypeName, track.getValueSize());\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n bindings[i] = binding;\n }\n interpolants[i].resultBuffer = binding.buffer;\n }\n }\n _activateAction(action) {\n if (!this._isActiveAction(action)) {\n if (action._cacheIndex === null) {\n // this action has been forgotten by the cache, but the user\n // appears to be still using it -> rebind\n const rootUuid = (action._localRoot || this._root).uuid, clipUuid = action._clip.uuid, actionsForClip = this._actionsByClip[clipUuid];\n this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]);\n this._addInactiveAction(action, clipUuid, rootUuid);\n }\n const bindings = action._propertyBindings;\n // increment reference counts / sort out state\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (binding.useCount++ === 0) {\n this._lendBinding(binding);\n binding.saveOriginalState();\n }\n }\n this._lendAction(action);\n }\n }\n _deactivateAction(action) {\n if (this._isActiveAction(action)) {\n const bindings = action._propertyBindings;\n // decrement reference counts / sort out state\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (--binding.useCount === 0) {\n binding.restoreOriginalState();\n this._takeBackBinding(binding);\n }\n }\n this._takeBackAction(action);\n }\n }\n // Memory manager\n _initMemoryManager() {\n this._actions = []; // 'nActiveActions' followed by inactive ones\n this._nActiveActions = 0;\n this._actionsByClip = {};\n // inside:\n // {\n // \tknownActions: Array< AnimationAction > - used as prototypes\n // \tactionByRoot: AnimationAction - lookup\n // }\n this._bindings = []; // 'nActiveBindings' followed by inactive ones\n this._nActiveBindings = 0;\n this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n this._controlInterpolants = []; // same game as above\n this._nActiveControlInterpolants = 0;\n const scope = this;\n this.stats = {\n actions: {\n get total () {\n return scope._actions.length;\n },\n get inUse () {\n return scope._nActiveActions;\n }\n },\n bindings: {\n get total () {\n return scope._bindings.length;\n },\n get inUse () {\n return scope._nActiveBindings;\n }\n },\n controlInterpolants: {\n get total () {\n return scope._controlInterpolants.length;\n },\n get inUse () {\n return scope._nActiveControlInterpolants;\n }\n }\n };\n }\n // Memory management for AnimationAction objects\n _isActiveAction(action) {\n const index = action._cacheIndex;\n return index !== null && index < this._nActiveActions;\n }\n _addInactiveAction(action, clipUuid, rootUuid) {\n const actions = this._actions, actionsByClip = this._actionsByClip;\n let actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip === undefined) {\n actionsForClip = {\n knownActions: [\n action\n ],\n actionByRoot: {}\n };\n action._byClipCacheIndex = 0;\n actionsByClip[clipUuid] = actionsForClip;\n } else {\n const knownActions = actionsForClip.knownActions;\n action._byClipCacheIndex = knownActions.length;\n knownActions.push(action);\n }\n action._cacheIndex = actions.length;\n actions.push(action);\n actionsForClip.actionByRoot[rootUuid] = action;\n }\n _removeInactiveAction(action) {\n const actions = this._actions, lastInactiveAction = actions[actions.length - 1], cacheIndex = action._cacheIndex;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n action._cacheIndex = null;\n const clipUuid = action._clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid], knownActionsForClip = actionsForClip.knownActions, lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], byClipCacheIndex = action._byClipCacheIndex;\n lastKnownAction._byClipCacheIndex = byClipCacheIndex;\n knownActionsForClip[byClipCacheIndex] = lastKnownAction;\n knownActionsForClip.pop();\n action._byClipCacheIndex = null;\n const actionByRoot = actionsForClip.actionByRoot, rootUuid = (action._localRoot || this._root).uuid;\n delete actionByRoot[rootUuid];\n if (knownActionsForClip.length === 0) delete actionsByClip[clipUuid];\n this._removeInactiveBindingsForAction(action);\n }\n _removeInactiveBindingsForAction(action) {\n const bindings = action._propertyBindings;\n for(let i = 0, n = bindings.length; i !== n; ++i){\n const binding = bindings[i];\n if (--binding.referenceCount === 0) this._removeInactiveBinding(binding);\n }\n }\n _lendAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions >| inactive actions ]\n // s a\n // <-swap->\n // a s\n const actions = this._actions, prevIndex = action._cacheIndex, lastActiveIndex = this._nActiveActions++, firstInactiveAction = actions[lastActiveIndex];\n action._cacheIndex = lastActiveIndex;\n actions[lastActiveIndex] = action;\n firstInactiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = firstInactiveAction;\n }\n _takeBackAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions |< inactive actions ]\n // a s\n // <-swap->\n // s a\n const actions = this._actions, prevIndex = action._cacheIndex, firstInactiveIndex = --this._nActiveActions, lastActiveAction = actions[firstInactiveIndex];\n action._cacheIndex = firstInactiveIndex;\n actions[firstInactiveIndex] = action;\n lastActiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = lastActiveAction;\n }\n // Memory management for PropertyMixer objects\n _addInactiveBinding(binding, rootUuid, trackName) {\n const bindingsByRoot = this._bindingsByRootAndName, bindings = this._bindings;\n let bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName === undefined) {\n bindingByName = {};\n bindingsByRoot[rootUuid] = bindingByName;\n }\n bindingByName[trackName] = binding;\n binding._cacheIndex = bindings.length;\n bindings.push(binding);\n }\n _removeInactiveBinding(binding) {\n const bindings = this._bindings, propBinding = binding.binding, rootUuid = propBinding.rootNode.uuid, trackName = propBinding.path, bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid], lastInactiveBinding = bindings[bindings.length - 1], cacheIndex = binding._cacheIndex;\n lastInactiveBinding._cacheIndex = cacheIndex;\n bindings[cacheIndex] = lastInactiveBinding;\n bindings.pop();\n delete bindingByName[trackName];\n if (Object.keys(bindingByName).length === 0) delete bindingsByRoot[rootUuid];\n }\n _lendBinding(binding) {\n const bindings = this._bindings, prevIndex = binding._cacheIndex, lastActiveIndex = this._nActiveBindings++, firstInactiveBinding = bindings[lastActiveIndex];\n binding._cacheIndex = lastActiveIndex;\n bindings[lastActiveIndex] = binding;\n firstInactiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = firstInactiveBinding;\n }\n _takeBackBinding(binding) {\n const bindings = this._bindings, prevIndex = binding._cacheIndex, firstInactiveIndex = --this._nActiveBindings, lastActiveBinding = bindings[firstInactiveIndex];\n binding._cacheIndex = firstInactiveIndex;\n bindings[firstInactiveIndex] = binding;\n lastActiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = lastActiveBinding;\n }\n // Memory management of Interpolants for weight and time scale\n _lendControlInterpolant() {\n const interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants++;\n let interpolant = interpolants[lastActiveIndex];\n if (interpolant === undefined) {\n interpolant = new $d5b33d7c30034067$export$a8e6009059f51e1a(new Float32Array(2), new Float32Array(2), 1, $d5b33d7c30034067$var$_controlInterpolantsResultBuffer);\n interpolant.__cacheIndex = lastActiveIndex;\n interpolants[lastActiveIndex] = interpolant;\n }\n return interpolant;\n }\n _takeBackControlInterpolant(interpolant) {\n const interpolants = this._controlInterpolants, prevIndex = interpolant.__cacheIndex, firstInactiveIndex = --this._nActiveControlInterpolants, lastActiveInterpolant = interpolants[firstInactiveIndex];\n interpolant.__cacheIndex = firstInactiveIndex;\n interpolants[firstInactiveIndex] = interpolant;\n lastActiveInterpolant.__cacheIndex = prevIndex;\n interpolants[prevIndex] = lastActiveInterpolant;\n }\n // return an action for a clip optionally using a custom root target\n // object (this method allocates a lot of dynamic memory in case a\n // previously unknown clip/root combination is specified)\n clipAction(clip, optionalRoot, blendMode) {\n const root = optionalRoot || this._root, rootUuid = root.uuid;\n let clipObject = typeof clip === \"string\" ? $d5b33d7c30034067$export$d942c706bf23829c.findByName(root, clip) : clip;\n const clipUuid = clipObject !== null ? clipObject.uuid : clip;\n const actionsForClip = this._actionsByClip[clipUuid];\n let prototypeAction = null;\n if (blendMode === undefined) {\n if (clipObject !== null) blendMode = clipObject.blendMode;\n else blendMode = $d5b33d7c30034067$export$bcfbbdcf8de7f8cd;\n }\n if (actionsForClip !== undefined) {\n const existingAction = actionsForClip.actionByRoot[rootUuid];\n if (existingAction !== undefined && existingAction.blendMode === blendMode) return existingAction;\n // we know the clip, so we don't have to parse all\n // the bindings again but can just copy\n prototypeAction = actionsForClip.knownActions[0];\n // also, take the clip from the prototype action\n if (clipObject === null) clipObject = prototypeAction._clip;\n }\n // clip must be known when specified via string\n if (clipObject === null) return null;\n // allocate all resources required to run it\n const newAction = new $d5b33d7c30034067$export$6946940a69e799e(this, clipObject, optionalRoot, blendMode);\n this._bindAction(newAction, prototypeAction);\n // and make the action known to the memory manager\n this._addInactiveAction(newAction, clipUuid, rootUuid);\n return newAction;\n }\n // get an existing action\n existingAction(clip, optionalRoot) {\n const root = optionalRoot || this._root, rootUuid = root.uuid, clipObject = typeof clip === \"string\" ? $d5b33d7c30034067$export$d942c706bf23829c.findByName(root, clip) : clip, clipUuid = clipObject ? clipObject.uuid : clip, actionsForClip = this._actionsByClip[clipUuid];\n if (actionsForClip !== undefined) return actionsForClip.actionByRoot[rootUuid] || null;\n return null;\n }\n // deactivates all previously scheduled actions\n stopAllAction() {\n const actions = this._actions, nActions = this._nActiveActions;\n for(let i = nActions - 1; i >= 0; --i)actions[i].stop();\n return this;\n }\n // advance the time and update apply the animation\n update(deltaTime) {\n deltaTime *= this.timeScale;\n const actions = this._actions, nActions = this._nActiveActions, time = this.time += deltaTime, timeDirection = Math.sign(deltaTime), accuIndex = this._accuIndex ^= 1;\n // run active actions\n for(let i = 0; i !== nActions; ++i){\n const action = actions[i];\n action._update(time, deltaTime, timeDirection, accuIndex);\n }\n // update scene graph\n const bindings = this._bindings, nBindings = this._nActiveBindings;\n for(let i = 0; i !== nBindings; ++i)bindings[i].apply(accuIndex);\n return this;\n }\n // Allows you to seek to a specific time in an animation.\n setTime(timeInSeconds) {\n this.time = 0; // Zero out time attribute for AnimationMixer object;\n for(let i = 0; i < this._actions.length; i++)this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n return this.update(timeInSeconds); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n }\n // return this mixer's root target object\n getRoot() {\n return this._root;\n }\n // free all resources specific to a particular clip\n uncacheClip(clip) {\n const actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip !== undefined) {\n // note: just calling _removeInactiveAction would mess up the\n // iteration state and also require updating the state we can\n // just throw away\n const actionsToRemove = actionsForClip.knownActions;\n for(let i = 0, n = actionsToRemove.length; i !== n; ++i){\n const action = actionsToRemove[i];\n this._deactivateAction(action);\n const cacheIndex = action._cacheIndex, lastInactiveAction = actions[actions.length - 1];\n action._cacheIndex = null;\n action._byClipCacheIndex = null;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n this._removeInactiveBindingsForAction(action);\n }\n delete actionsByClip[clipUuid];\n }\n }\n // free all resources specific to a particular root target object\n uncacheRoot(root) {\n const rootUuid = root.uuid, actionsByClip = this._actionsByClip;\n for(const clipUuid in actionsByClip){\n const actionByRoot = actionsByClip[clipUuid].actionByRoot, action = actionByRoot[rootUuid];\n if (action !== undefined) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n const bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName !== undefined) for(const trackName in bindingByName){\n const binding = bindingByName[trackName];\n binding.restoreOriginalState();\n this._removeInactiveBinding(binding);\n }\n }\n // remove a targeted clip from the cache\n uncacheAction(clip, optionalRoot) {\n const action = this.existingAction(clip, optionalRoot);\n if (action !== null) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n}\nclass $d5b33d7c30034067$export$2947cebfe91c02f8 {\n constructor(value){\n this.value = value;\n }\n clone() {\n return new $d5b33d7c30034067$export$2947cebfe91c02f8(this.value.clone === undefined ? this.value : this.value.clone());\n }\n}\nlet $d5b33d7c30034067$var$id = 0;\nclass $d5b33d7c30034067$export$c412d5ffe1f79209 extends $d5b33d7c30034067$export$ec8b666c5fe2c75a {\n constructor(){\n super();\n this.isUniformsGroup = true;\n Object.defineProperty(this, \"id\", {\n value: $d5b33d7c30034067$var$id++\n });\n this.name = \"\";\n this.usage = $d5b33d7c30034067$export$763e8360f4d7f77d;\n this.uniforms = [];\n }\n add(uniform) {\n this.uniforms.push(uniform);\n return this;\n }\n remove(uniform) {\n const index = this.uniforms.indexOf(uniform);\n if (index !== -1) this.uniforms.splice(index, 1);\n return this;\n }\n setName(name) {\n this.name = name;\n return this;\n }\n setUsage(value) {\n this.usage = value;\n return this;\n }\n dispose() {\n this.dispatchEvent({\n type: \"dispose\"\n });\n return this;\n }\n copy(source) {\n this.name = source.name;\n this.usage = source.usage;\n const uniformsSource = source.uniforms;\n this.uniforms.length = 0;\n for(let i = 0, l = uniformsSource.length; i < l; i++)this.uniforms.push(uniformsSource[i].clone());\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass $d5b33d7c30034067$export$25ec0e1af1389358 extends $d5b33d7c30034067$export$3d5cd879f108f53f {\n constructor(array, stride, meshPerAttribute = 1){\n super(array, stride);\n this.isInstancedInterleavedBuffer = true;\n this.meshPerAttribute = meshPerAttribute;\n }\n copy(source) {\n super.copy(source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n clone(data) {\n const ib = super.clone(data);\n ib.meshPerAttribute = this.meshPerAttribute;\n return ib;\n }\n toJSON(data) {\n const json = super.toJSON(data);\n json.isInstancedInterleavedBuffer = true;\n json.meshPerAttribute = this.meshPerAttribute;\n return json;\n }\n}\nclass $d5b33d7c30034067$export$6b7339ae8dbddf73 {\n constructor(buffer, type, itemSize, elementSize, count){\n this.isGLBufferAttribute = true;\n this.name = \"\";\n this.buffer = buffer;\n this.type = type;\n this.itemSize = itemSize;\n this.elementSize = elementSize;\n this.count = count;\n this.version = 0;\n }\n set needsUpdate(value) {\n if (value === true) this.version++;\n }\n setBuffer(buffer) {\n this.buffer = buffer;\n return this;\n }\n setType(type, elementSize) {\n this.type = type;\n this.elementSize = elementSize;\n return this;\n }\n setItemSize(itemSize) {\n this.itemSize = itemSize;\n return this;\n }\n setCount(count) {\n this.count = count;\n return this;\n }\n}\nclass $d5b33d7c30034067$export$8b7aaceff00bd2f {\n constructor(origin, direction, near = 0, far = Infinity){\n this.ray = new $d5b33d7c30034067$export$a186db52eed6d40e(origin, direction);\n // direction is assumed to be normalized (for accurate distance calculations)\n this.near = near;\n this.far = far;\n this.camera = null;\n this.layers = new $d5b33d7c30034067$export$89312ce47c0ca777();\n this.params = {\n Mesh: {},\n Line: {\n threshold: 1\n },\n LOD: {},\n Points: {\n threshold: 1\n },\n Sprite: {}\n };\n }\n set(origin, direction) {\n // direction is assumed to be normalized (for accurate distance calculations)\n this.ray.set(origin, direction);\n }\n setFromCamera(coords, camera) {\n if (camera.isPerspectiveCamera) {\n this.ray.origin.setFromMatrixPosition(camera.matrixWorld);\n this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize();\n this.camera = camera;\n } else if (camera.isOrthographicCamera) {\n this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera\n this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld);\n this.camera = camera;\n } else console.error(\"THREE.Raycaster: Unsupported camera type: \" + camera.type);\n }\n intersectObject(object, recursive = true, intersects = []) {\n $d5b33d7c30034067$var$intersectObject(object, this, intersects, recursive);\n intersects.sort($d5b33d7c30034067$var$ascSort);\n return intersects;\n }\n intersectObjects(objects, recursive = true, intersects = []) {\n for(let i = 0, l = objects.length; i < l; i++)$d5b33d7c30034067$var$intersectObject(objects[i], this, intersects, recursive);\n intersects.sort($d5b33d7c30034067$var$ascSort);\n return intersects;\n }\n}\nfunction $d5b33d7c30034067$var$ascSort(a, b) {\n return a.distance - b.distance;\n}\nfunction $d5b33d7c30034067$var$intersectObject(object, raycaster, intersects, recursive) {\n if (object.layers.test(raycaster.layers)) object.raycast(raycaster, intersects);\n if (recursive === true) {\n const children = object.children;\n for(let i = 0, l = children.length; i < l; i++)$d5b33d7c30034067$var$intersectObject(children[i], raycaster, intersects, true);\n }\n}\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */ class $d5b33d7c30034067$export$d712cd887b4a00f7 {\n constructor(radius = 1, phi = 0, theta = 0){\n this.radius = radius;\n this.phi = phi; // polar angle\n this.theta = theta; // azimuthal angle\n return this;\n }\n set(radius, phi, theta) {\n this.radius = radius;\n this.phi = phi;\n this.theta = theta;\n return this;\n }\n copy(other) {\n this.radius = other.radius;\n this.phi = other.phi;\n this.theta = other.theta;\n return this;\n }\n // restrict phi to be between EPS and PI-EPS\n makeSafe() {\n const EPS = 0.000001;\n this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi));\n return this;\n }\n setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + y * y + z * z);\n if (this.radius === 0) {\n this.theta = 0;\n this.phi = 0;\n } else {\n this.theta = Math.atan2(x, z);\n this.phi = Math.acos($d5b33d7c30034067$var$clamp(y / this.radius, -1, 1));\n }\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */ class $d5b33d7c30034067$export$287165bb2177f4fd {\n constructor(radius = 1, theta = 0, y = 0){\n this.radius = radius; // distance from the origin to a point in the x-z plane\n this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n this.y = y; // height above the x-z plane\n return this;\n }\n set(radius, theta, y) {\n this.radius = radius;\n this.theta = theta;\n this.y = y;\n return this;\n }\n copy(other) {\n this.radius = other.radius;\n this.theta = other.theta;\n this.y = other.y;\n return this;\n }\n setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + z * z);\n this.theta = Math.atan2(x, z);\n this.y = y;\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $d5b33d7c30034067$var$_vector$4 = /*@__PURE__*/ new $d5b33d7c30034067$export$c977b3e384af9ae1();\nclass $d5b33d7c30034067$export$60f553fa130f08b0 {\n constructor(min = new $d5b33d7c30034067$export$c977b3e384af9ae1(Infinity, Infinity), max = new $d5b33d7c30034067$export$c977b3e384af9ae1(-Infinity, -Infinity)){\n this.isBox2 = true;\n this.min = min;\n this.max = max;\n }\n set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n setFromPoints(points) {\n this.makeEmpty();\n for(let i = 0, il = points.length; i < il; i++)this.expandByPoint(points[i]);\n return this;\n }\n setFromCenterAndSize(center, size) {\n const halfSize = $d5b33d7c30034067$var$_vector$4.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n makeEmpty() {\n this.min.x = this.min.y = Infinity;\n this.max.x = this.max.y = -Infinity;\n return this;\n }\n isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n return this.max.x < this.min.x || this.max.y < this.min.y;\n }\n getCenter(target) {\n return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n getSize(target) {\n return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min);\n }\n expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true;\n }\n containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y;\n }\n getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));\n }\n intersectsBox(box) {\n // using 4 splitting planes to rule out intersections\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n }\n clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n distanceToPoint(point) {\n return this.clampPoint(point, $d5b33d7c30034067$var$_vector$4).distanceTo(point);\n }\n intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n}\nconst $d5b33d7c30034067$var$_startP = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_startEnd = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$e0ba6359f1954fd3 {\n constructor(start = new $d5b33d7c30034067$export$64b5c384219d3699(), end = new $d5b33d7c30034067$export$64b5c384219d3699()){\n this.start = start;\n this.end = end;\n }\n set(start, end) {\n this.start.copy(start);\n this.end.copy(end);\n return this;\n }\n copy(line) {\n this.start.copy(line.start);\n this.end.copy(line.end);\n return this;\n }\n getCenter(target) {\n return target.addVectors(this.start, this.end).multiplyScalar(0.5);\n }\n delta(target) {\n return target.subVectors(this.end, this.start);\n }\n distanceSq() {\n return this.start.distanceToSquared(this.end);\n }\n distance() {\n return this.start.distanceTo(this.end);\n }\n at(t, target) {\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n closestPointToPointParameter(point, clampToLine) {\n $d5b33d7c30034067$var$_startP.subVectors(point, this.start);\n $d5b33d7c30034067$var$_startEnd.subVectors(this.end, this.start);\n const startEnd2 = $d5b33d7c30034067$var$_startEnd.dot($d5b33d7c30034067$var$_startEnd);\n const startEnd_startP = $d5b33d7c30034067$var$_startEnd.dot($d5b33d7c30034067$var$_startP);\n let t = startEnd_startP / startEnd2;\n if (clampToLine) t = $d5b33d7c30034067$var$clamp(t, 0, 1);\n return t;\n }\n closestPointToPoint(point, clampToLine, target) {\n const t = this.closestPointToPointParameter(point, clampToLine);\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n applyMatrix4(matrix) {\n this.start.applyMatrix4(matrix);\n this.end.applyMatrix4(matrix);\n return this;\n }\n equals(line) {\n return line.start.equals(this.start) && line.end.equals(this.end);\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst $d5b33d7c30034067$var$_vector$3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$4b14638ffdd81e68 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(light, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"SpotLightHelper\";\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n const positions = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 1,\n 0,\n 0,\n 0,\n -1,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n -1,\n 1\n ];\n for(let i = 0, j = 1, l = 32; i < l; i++, j++){\n const p1 = i / l * Math.PI * 2;\n const p2 = j / l * Math.PI * 2;\n positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1);\n }\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(positions, 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n fog: false,\n toneMapped: false\n });\n this.cone = new $d5b33d7c30034067$export$ff1ed10fedfdd604(geometry, material);\n this.add(this.cone);\n this.update();\n }\n dispose() {\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n const coneLength = this.light.distance ? this.light.distance : 1000;\n const coneWidth = coneLength * Math.tan(this.light.angle);\n this.cone.scale.set(coneWidth, coneWidth, coneLength);\n $d5b33d7c30034067$var$_vector$3.setFromMatrixPosition(this.light.target.matrixWorld);\n this.cone.lookAt($d5b33d7c30034067$var$_vector$3);\n if (this.color !== undefined) this.cone.material.color.set(this.color);\n else this.cone.material.color.copy(this.light.color);\n }\n}\nconst $d5b33d7c30034067$var$_vector$2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_boneMatrix = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nconst $d5b33d7c30034067$var$_matrixWorldInv = /*@__PURE__*/ new $d5b33d7c30034067$export$2ae72fc923e5eb5();\nclass $d5b33d7c30034067$export$5277df3c9e732259 extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(object){\n const bones = $d5b33d7c30034067$var$getBoneList(object);\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n const vertices = [];\n const colors = [];\n const color1 = new $d5b33d7c30034067$export$892596cec99bc70e(0, 0, 1);\n const color2 = new $d5b33d7c30034067$export$892596cec99bc70e(0, 1, 0);\n for(let i = 0; i < bones.length; i++){\n const bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n vertices.push(0, 0, 0);\n vertices.push(0, 0, 0);\n colors.push(color1.r, color1.g, color1.b);\n colors.push(color2.r, color2.g, color2.b);\n }\n }\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$cbe7a62641830ebd(colors, 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n vertexColors: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n transparent: true\n });\n super(geometry, material);\n this.isSkeletonHelper = true;\n this.type = \"SkeletonHelper\";\n this.root = object;\n this.bones = bones;\n this.matrix = object.matrixWorld;\n this.matrixAutoUpdate = false;\n }\n updateMatrixWorld(force) {\n const bones = this.bones;\n const geometry = this.geometry;\n const position = geometry.getAttribute(\"position\");\n $d5b33d7c30034067$var$_matrixWorldInv.copy(this.root.matrixWorld).invert();\n for(let i = 0, j = 0; i < bones.length; i++){\n const bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n $d5b33d7c30034067$var$_boneMatrix.multiplyMatrices($d5b33d7c30034067$var$_matrixWorldInv, bone.matrixWorld);\n $d5b33d7c30034067$var$_vector$2.setFromMatrixPosition($d5b33d7c30034067$var$_boneMatrix);\n position.setXYZ(j, $d5b33d7c30034067$var$_vector$2.x, $d5b33d7c30034067$var$_vector$2.y, $d5b33d7c30034067$var$_vector$2.z);\n $d5b33d7c30034067$var$_boneMatrix.multiplyMatrices($d5b33d7c30034067$var$_matrixWorldInv, bone.parent.matrixWorld);\n $d5b33d7c30034067$var$_vector$2.setFromMatrixPosition($d5b33d7c30034067$var$_boneMatrix);\n position.setXYZ(j + 1, $d5b33d7c30034067$var$_vector$2.x, $d5b33d7c30034067$var$_vector$2.y, $d5b33d7c30034067$var$_vector$2.z);\n j += 2;\n }\n }\n geometry.getAttribute(\"position\").needsUpdate = true;\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nfunction $d5b33d7c30034067$var$getBoneList(object) {\n const boneList = [];\n if (object.isBone === true) boneList.push(object);\n for(let i = 0; i < object.children.length; i++)boneList.push.apply(boneList, $d5b33d7c30034067$var$getBoneList(object.children[i]));\n return boneList;\n}\nclass $d5b33d7c30034067$export$9a9291685b9e4023 extends $d5b33d7c30034067$export$e176487c05830cc5 {\n constructor(light, sphereSize, color){\n const geometry = new $d5b33d7c30034067$export$1b417fc3b307a251(sphereSize, 4, 2);\n const material = new $d5b33d7c30034067$export$55cbcc9b622fe1f5({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n super(geometry, material);\n this.light = light;\n this.color = color;\n this.type = \"PointLightHelper\";\n this.matrix = this.light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.update();\n /*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/ }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n if (this.color !== undefined) this.material.color.set(this.color);\n else this.material.color.copy(this.light.color);\n /*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/ }\n}\nconst $d5b33d7c30034067$var$_vector$1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_color1 = /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e();\nconst $d5b33d7c30034067$var$_color2 = /*@__PURE__*/ new $d5b33d7c30034067$export$892596cec99bc70e();\nclass $d5b33d7c30034067$export$8dca15f13f4f8172 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(light, size, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"HemisphereLightHelper\";\n const geometry = new $d5b33d7c30034067$export$1954e2b809fe361e(size);\n geometry.rotateY(Math.PI * 0.5);\n this.material = new $d5b33d7c30034067$export$55cbcc9b622fe1f5({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n if (this.color === undefined) this.material.vertexColors = true;\n const position = geometry.getAttribute(\"position\");\n const colors = new Float32Array(position.count * 3);\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$8dea267bd6bde117(colors, 3));\n this.add(new $d5b33d7c30034067$export$e176487c05830cc5(geometry, this.material));\n this.update();\n }\n dispose() {\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n update() {\n const mesh = this.children[0];\n if (this.color !== undefined) this.material.color.set(this.color);\n else {\n const colors = mesh.geometry.getAttribute(\"color\");\n $d5b33d7c30034067$var$_color1.copy(this.light.color);\n $d5b33d7c30034067$var$_color2.copy(this.light.groundColor);\n for(let i = 0, l = colors.count; i < l; i++){\n const color = i < l / 2 ? $d5b33d7c30034067$var$_color1 : $d5b33d7c30034067$var$_color2;\n colors.setXYZ(i, color.r, color.g, color.b);\n }\n colors.needsUpdate = true;\n }\n this.light.updateWorldMatrix(true, false);\n mesh.lookAt($d5b33d7c30034067$var$_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());\n }\n}\nclass $d5b33d7c30034067$export$3875d39926561055 extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888){\n color1 = new $d5b33d7c30034067$export$892596cec99bc70e(color1);\n color2 = new $d5b33d7c30034067$export$892596cec99bc70e(color2);\n const center = divisions / 2;\n const step = size / divisions;\n const halfSize = size / 2;\n const vertices = [], colors = [];\n for(let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step){\n vertices.push(-halfSize, 0, k, halfSize, 0, k);\n vertices.push(k, 0, -halfSize, k, 0, halfSize);\n const color = i === center ? color1 : color2;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n }\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$cbe7a62641830ebd(colors, 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"GridHelper\";\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $d5b33d7c30034067$export$361430a10f533cd3 extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888){\n color1 = new $d5b33d7c30034067$export$892596cec99bc70e(color1);\n color2 = new $d5b33d7c30034067$export$892596cec99bc70e(color2);\n const vertices = [];\n const colors = [];\n // create the sectors\n if (sectors > 1) for(let i = 0; i < sectors; i++){\n const v = i / sectors * (Math.PI * 2);\n const x = Math.sin(v) * radius;\n const z = Math.cos(v) * radius;\n vertices.push(0, 0, 0);\n vertices.push(x, 0, z);\n const color = i & 1 ? color1 : color2;\n colors.push(color.r, color.g, color.b);\n colors.push(color.r, color.g, color.b);\n }\n // create the rings\n for(let i = 0; i < rings; i++){\n const color = i & 1 ? color1 : color2;\n const r = radius - radius / rings * i;\n for(let j = 0; j < divisions; j++){\n // first vertex\n let v = j / divisions * (Math.PI * 2);\n let x = Math.sin(v) * r;\n let z = Math.cos(v) * r;\n vertices.push(x, 0, z);\n colors.push(color.r, color.g, color.b);\n // second vertex\n v = (j + 1) / divisions * (Math.PI * 2);\n x = Math.sin(v) * r;\n z = Math.cos(v) * r;\n vertices.push(x, 0, z);\n colors.push(color.r, color.g, color.b);\n }\n }\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$cbe7a62641830ebd(colors, 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"PolarGridHelper\";\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nconst $d5b33d7c30034067$var$_v1 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v2 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_v3 = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nclass $d5b33d7c30034067$export$f8e434dc14203e7d extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n constructor(light, size, color){\n super();\n this.light = light;\n this.matrix = light.matrixWorld;\n this.matrixAutoUpdate = false;\n this.color = color;\n this.type = \"DirectionalLightHelper\";\n if (size === undefined) size = 1;\n let geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd([\n -size,\n size,\n 0,\n size,\n size,\n 0,\n size,\n -size,\n 0,\n -size,\n -size,\n 0,\n -size,\n size,\n 0\n ], 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n fog: false,\n toneMapped: false\n });\n this.lightPlane = new $d5b33d7c30034067$export$17d680238e50603e(geometry, material);\n this.add(this.lightPlane);\n geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd([\n 0,\n 0,\n 0,\n 0,\n 0,\n 1\n ], 3));\n this.targetLine = new $d5b33d7c30034067$export$17d680238e50603e(geometry, material);\n this.add(this.targetLine);\n this.update();\n }\n dispose() {\n this.lightPlane.geometry.dispose();\n this.lightPlane.material.dispose();\n this.targetLine.geometry.dispose();\n this.targetLine.material.dispose();\n }\n update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n $d5b33d7c30034067$var$_v1.setFromMatrixPosition(this.light.matrixWorld);\n $d5b33d7c30034067$var$_v2.setFromMatrixPosition(this.light.target.matrixWorld);\n $d5b33d7c30034067$var$_v3.subVectors($d5b33d7c30034067$var$_v2, $d5b33d7c30034067$var$_v1);\n this.lightPlane.lookAt($d5b33d7c30034067$var$_v2);\n if (this.color !== undefined) {\n this.lightPlane.material.color.set(this.color);\n this.targetLine.material.color.set(this.color);\n } else {\n this.lightPlane.material.color.copy(this.light.color);\n this.targetLine.material.color.copy(this.light.color);\n }\n this.targetLine.lookAt($d5b33d7c30034067$var$_v2);\n this.targetLine.scale.z = $d5b33d7c30034067$var$_v3.length();\n }\n}\nconst $d5b33d7c30034067$var$_vector = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nconst $d5b33d7c30034067$var$_camera = /*@__PURE__*/ new $d5b33d7c30034067$export$79f141de891a5fed();\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */ class $d5b33d7c30034067$export$ed8e93f853cd795 extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(camera){\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n color: 0xffffff,\n vertexColors: true,\n toneMapped: false\n });\n const vertices = [];\n const colors = [];\n const pointMap = {};\n // near\n addLine(\"n1\", \"n2\");\n addLine(\"n2\", \"n4\");\n addLine(\"n4\", \"n3\");\n addLine(\"n3\", \"n1\");\n // far\n addLine(\"f1\", \"f2\");\n addLine(\"f2\", \"f4\");\n addLine(\"f4\", \"f3\");\n addLine(\"f3\", \"f1\");\n // sides\n addLine(\"n1\", \"f1\");\n addLine(\"n2\", \"f2\");\n addLine(\"n3\", \"f3\");\n addLine(\"n4\", \"f4\");\n // cone\n addLine(\"p\", \"n1\");\n addLine(\"p\", \"n2\");\n addLine(\"p\", \"n3\");\n addLine(\"p\", \"n4\");\n // up\n addLine(\"u1\", \"u2\");\n addLine(\"u2\", \"u3\");\n addLine(\"u3\", \"u1\");\n // target\n addLine(\"c\", \"t\");\n addLine(\"p\", \"c\");\n // cross\n addLine(\"cn1\", \"cn2\");\n addLine(\"cn3\", \"cn4\");\n addLine(\"cf1\", \"cf2\");\n addLine(\"cf3\", \"cf4\");\n function addLine(a, b) {\n addPoint(a);\n addPoint(b);\n }\n function addPoint(id) {\n vertices.push(0, 0, 0);\n colors.push(0, 0, 0);\n if (pointMap[id] === undefined) pointMap[id] = [];\n pointMap[id].push(vertices.length / 3 - 1);\n }\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$cbe7a62641830ebd(colors, 3));\n super(geometry, material);\n this.type = \"CameraHelper\";\n this.camera = camera;\n if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix();\n this.matrix = camera.matrixWorld;\n this.matrixAutoUpdate = false;\n this.pointMap = pointMap;\n this.update();\n // colors\n const colorFrustum = new $d5b33d7c30034067$export$892596cec99bc70e(0xffaa00);\n const colorCone = new $d5b33d7c30034067$export$892596cec99bc70e(0xff0000);\n const colorUp = new $d5b33d7c30034067$export$892596cec99bc70e(0x00aaff);\n const colorTarget = new $d5b33d7c30034067$export$892596cec99bc70e(0xffffff);\n const colorCross = new $d5b33d7c30034067$export$892596cec99bc70e(0x333333);\n this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross);\n }\n setColors(frustum, cone, up, target, cross) {\n const geometry = this.geometry;\n const colorAttribute = geometry.getAttribute(\"color\");\n // near\n colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); // n1, n2\n colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); // n2, n4\n colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); // n4, n3\n colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); // n3, n1\n // far\n colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); // f1, f2\n colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); // f2, f4\n colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); // f4, f3\n colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); // f3, f1\n // sides\n colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); // n1, f1\n colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); // n2, f2\n colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); // n3, f3\n colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); // n4, f4\n // cone\n colorAttribute.setXYZ(24, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); // p, n1\n colorAttribute.setXYZ(26, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); // p, n2\n colorAttribute.setXYZ(28, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); // p, n3\n colorAttribute.setXYZ(30, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); // p, n4\n // up\n colorAttribute.setXYZ(32, up.r, up.g, up.b);\n colorAttribute.setXYZ(33, up.r, up.g, up.b); // u1, u2\n colorAttribute.setXYZ(34, up.r, up.g, up.b);\n colorAttribute.setXYZ(35, up.r, up.g, up.b); // u2, u3\n colorAttribute.setXYZ(36, up.r, up.g, up.b);\n colorAttribute.setXYZ(37, up.r, up.g, up.b); // u3, u1\n // target\n colorAttribute.setXYZ(38, target.r, target.g, target.b);\n colorAttribute.setXYZ(39, target.r, target.g, target.b); // c, t\n colorAttribute.setXYZ(40, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); // p, c\n // cross\n colorAttribute.setXYZ(42, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); // cn1, cn2\n colorAttribute.setXYZ(44, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); // cn3, cn4\n colorAttribute.setXYZ(46, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); // cf1, cf2\n colorAttribute.setXYZ(48, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); // cf3, cf4\n colorAttribute.needsUpdate = true;\n }\n update() {\n const geometry = this.geometry;\n const pointMap = this.pointMap;\n const w = 1, h = 1;\n // we need just camera projection matrix inverse\n // world matrix must be identity\n $d5b33d7c30034067$var$_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);\n // center / target\n $d5b33d7c30034067$var$setPoint(\"c\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, 0, -1);\n $d5b33d7c30034067$var$setPoint(\"t\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, 0, 1);\n // near\n $d5b33d7c30034067$var$setPoint(\"n1\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, -h, -1);\n $d5b33d7c30034067$var$setPoint(\"n2\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, -h, -1);\n $d5b33d7c30034067$var$setPoint(\"n3\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, h, -1);\n $d5b33d7c30034067$var$setPoint(\"n4\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, h, -1);\n // far\n $d5b33d7c30034067$var$setPoint(\"f1\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, -h, 1);\n $d5b33d7c30034067$var$setPoint(\"f2\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, -h, 1);\n $d5b33d7c30034067$var$setPoint(\"f3\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, h, 1);\n $d5b33d7c30034067$var$setPoint(\"f4\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, h, 1);\n // up\n $d5b33d7c30034067$var$setPoint(\"u1\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w * 0.7, h * 1.1, -1);\n $d5b33d7c30034067$var$setPoint(\"u2\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w * 0.7, h * 1.1, -1);\n $d5b33d7c30034067$var$setPoint(\"u3\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, h * 2, -1);\n // cross\n $d5b33d7c30034067$var$setPoint(\"cf1\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, 0, 1);\n $d5b33d7c30034067$var$setPoint(\"cf2\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, 0, 1);\n $d5b33d7c30034067$var$setPoint(\"cf3\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, -h, 1);\n $d5b33d7c30034067$var$setPoint(\"cf4\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, h, 1);\n $d5b33d7c30034067$var$setPoint(\"cn1\", pointMap, geometry, $d5b33d7c30034067$var$_camera, -w, 0, -1);\n $d5b33d7c30034067$var$setPoint(\"cn2\", pointMap, geometry, $d5b33d7c30034067$var$_camera, w, 0, -1);\n $d5b33d7c30034067$var$setPoint(\"cn3\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, -h, -1);\n $d5b33d7c30034067$var$setPoint(\"cn4\", pointMap, geometry, $d5b33d7c30034067$var$_camera, 0, h, -1);\n geometry.getAttribute(\"position\").needsUpdate = true;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nfunction $d5b33d7c30034067$var$setPoint(point, pointMap, geometry, camera, x, y, z) {\n $d5b33d7c30034067$var$_vector.set(x, y, z).unproject(camera);\n const points = pointMap[point];\n if (points !== undefined) {\n const position = geometry.getAttribute(\"position\");\n for(let i = 0, l = points.length; i < l; i++)position.setXYZ(points[i], $d5b33d7c30034067$var$_vector.x, $d5b33d7c30034067$var$_vector.y, $d5b33d7c30034067$var$_vector.z);\n }\n}\nconst $d5b33d7c30034067$var$_box = /*@__PURE__*/ new $d5b33d7c30034067$export$6f7d5a9418ab2aa3();\nclass $d5b33d7c30034067$export$38a664cc862a6a9d extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(object, color = 0xffff00){\n const indices = new Uint16Array([\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 0,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 4,\n 0,\n 4,\n 1,\n 5,\n 2,\n 6,\n 3,\n 7\n ]);\n const positions = new Float32Array(24);\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setIndex(new $d5b33d7c30034067$export$8dea267bd6bde117(indices, 1));\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$8dea267bd6bde117(positions, 3));\n super(geometry, new $d5b33d7c30034067$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.object = object;\n this.type = \"BoxHelper\";\n this.matrixAutoUpdate = false;\n this.update();\n }\n update(object) {\n if (object !== undefined) console.warn(\"THREE.BoxHelper: .update() has no longer arguments.\");\n if (this.object !== undefined) $d5b33d7c30034067$var$_box.setFromObject(this.object);\n if ($d5b33d7c30034067$var$_box.isEmpty()) return;\n const min = $d5b33d7c30034067$var$_box.min;\n const max = $d5b33d7c30034067$var$_box.max;\n /*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/ const position = this.geometry.attributes.position;\n const array = position.array;\n array[0] = max.x;\n array[1] = max.y;\n array[2] = max.z;\n array[3] = min.x;\n array[4] = max.y;\n array[5] = max.z;\n array[6] = min.x;\n array[7] = min.y;\n array[8] = max.z;\n array[9] = max.x;\n array[10] = min.y;\n array[11] = max.z;\n array[12] = max.x;\n array[13] = max.y;\n array[14] = min.z;\n array[15] = min.x;\n array[16] = max.y;\n array[17] = min.z;\n array[18] = min.x;\n array[19] = min.y;\n array[20] = min.z;\n array[21] = max.x;\n array[22] = min.y;\n array[23] = min.z;\n position.needsUpdate = true;\n this.geometry.computeBoundingSphere();\n }\n setFromObject(object) {\n this.object = object;\n this.update();\n return this;\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.object = source.object;\n return this;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $d5b33d7c30034067$export$ce39f4bb96c9a290 extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(box, color = 0xffff00){\n const indices = new Uint16Array([\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 0,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 4,\n 0,\n 4,\n 1,\n 5,\n 2,\n 6,\n 3,\n 7\n ]);\n const positions = [\n 1,\n 1,\n 1,\n -1,\n 1,\n 1,\n -1,\n -1,\n 1,\n 1,\n -1,\n 1,\n 1,\n 1,\n -1,\n -1,\n 1,\n -1,\n -1,\n -1,\n -1,\n 1,\n -1,\n -1\n ];\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setIndex(new $d5b33d7c30034067$export$8dea267bd6bde117(indices, 1));\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(positions, 3));\n super(geometry, new $d5b33d7c30034067$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.box = box;\n this.type = \"Box3Helper\";\n this.geometry.computeBoundingSphere();\n }\n updateMatrixWorld(force) {\n const box = this.box;\n if (box.isEmpty()) return;\n box.getCenter(this.position);\n box.getSize(this.scale);\n this.scale.multiplyScalar(0.5);\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $d5b33d7c30034067$export$a34fe8156c66e5d7 extends $d5b33d7c30034067$export$17d680238e50603e {\n constructor(plane, size = 1, hex = 0xffff00){\n const color = hex;\n const positions = [\n 1,\n -1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n 1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n -1,\n 0,\n 1,\n 1,\n 0\n ];\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(positions, 3));\n geometry.computeBoundingSphere();\n super(geometry, new $d5b33d7c30034067$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.type = \"PlaneHelper\";\n this.plane = plane;\n this.size = size;\n const positions2 = [\n 1,\n 1,\n 0,\n -1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n 1,\n 0,\n -1,\n -1,\n 0,\n 1,\n -1,\n 0\n ];\n const geometry2 = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry2.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(positions2, 3));\n geometry2.computeBoundingSphere();\n this.add(new $d5b33d7c30034067$export$e176487c05830cc5(geometry2, new $d5b33d7c30034067$export$55cbcc9b622fe1f5({\n color: color,\n opacity: 0.2,\n transparent: true,\n depthWrite: false,\n toneMapped: false\n })));\n }\n updateMatrixWorld(force) {\n this.position.set(0, 0, 0);\n this.scale.set(0.5 * this.size, 0.5 * this.size, 1);\n this.lookAt(this.plane.normal);\n this.translateZ(-this.plane.constant);\n super.updateMatrixWorld(force);\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n}\nconst $d5b33d7c30034067$var$_axis = /*@__PURE__*/ new $d5b33d7c30034067$export$64b5c384219d3699();\nlet $d5b33d7c30034067$var$_lineGeometry, $d5b33d7c30034067$var$_coneGeometry;\nclass $d5b33d7c30034067$export$a3008e7bd8d2cbe7 extends $d5b33d7c30034067$export$e4dd07dff30cc924 {\n // dir is assumed to be normalized\n constructor(dir = new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 1), origin = new $d5b33d7c30034067$export$64b5c384219d3699(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2){\n super();\n this.type = \"ArrowHelper\";\n if ($d5b33d7c30034067$var$_lineGeometry === undefined) {\n $d5b33d7c30034067$var$_lineGeometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n $d5b33d7c30034067$var$_lineGeometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd([\n 0,\n 0,\n 0,\n 0,\n 1,\n 0\n ], 3));\n $d5b33d7c30034067$var$_coneGeometry = new $d5b33d7c30034067$export$68f745719dbe5198(0, 0.5, 1, 5, 1);\n $d5b33d7c30034067$var$_coneGeometry.translate(0, -0.5, 0);\n }\n this.position.copy(origin);\n this.line = new $d5b33d7c30034067$export$17d680238e50603e($d5b33d7c30034067$var$_lineGeometry, new $d5b33d7c30034067$export$fbaaa33907730a0c({\n color: color,\n toneMapped: false\n }));\n this.line.matrixAutoUpdate = false;\n this.add(this.line);\n this.cone = new $d5b33d7c30034067$export$e176487c05830cc5($d5b33d7c30034067$var$_coneGeometry, new $d5b33d7c30034067$export$55cbcc9b622fe1f5({\n color: color,\n toneMapped: false\n }));\n this.cone.matrixAutoUpdate = false;\n this.add(this.cone);\n this.setDirection(dir);\n this.setLength(length, headLength, headWidth);\n }\n setDirection(dir) {\n // dir is assumed to be normalized\n if (dir.y > 0.99999) this.quaternion.set(0, 0, 0, 1);\n else if (dir.y < -0.99999) this.quaternion.set(1, 0, 0, 0);\n else {\n $d5b33d7c30034067$var$_axis.set(dir.z, 0, -dir.x).normalize();\n const radians = Math.acos(dir.y);\n this.quaternion.setFromAxisAngle($d5b33d7c30034067$var$_axis, radians);\n }\n }\n setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) {\n this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458\n this.line.updateMatrix();\n this.cone.scale.set(headWidth, headLength, headWidth);\n this.cone.position.y = length;\n this.cone.updateMatrix();\n }\n setColor(color) {\n this.line.material.color.set(color);\n this.cone.material.color.set(color);\n }\n copy(source) {\n super.copy(source, false);\n this.line.copy(source.line);\n this.cone.copy(source.cone);\n return this;\n }\n dispose() {\n this.line.geometry.dispose();\n this.line.material.dispose();\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n}\nclass $d5b33d7c30034067$export$6c8303f35b8578fd extends $d5b33d7c30034067$export$ff1ed10fedfdd604 {\n constructor(size = 1){\n const vertices = [\n 0,\n 0,\n 0,\n size,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n size,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n size\n ];\n const colors = [\n 1,\n 0,\n 0,\n 1,\n 0.6,\n 0,\n 0,\n 1,\n 0,\n 0.6,\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0.6,\n 1\n ];\n const geometry = new $d5b33d7c30034067$export$b7be63a67df8959();\n geometry.setAttribute(\"position\", new $d5b33d7c30034067$export$cbe7a62641830ebd(vertices, 3));\n geometry.setAttribute(\"color\", new $d5b33d7c30034067$export$cbe7a62641830ebd(colors, 3));\n const material = new $d5b33d7c30034067$export$fbaaa33907730a0c({\n vertexColors: true,\n toneMapped: false\n });\n super(geometry, material);\n this.type = \"AxesHelper\";\n }\n setColors(xAxisColor, yAxisColor, zAxisColor) {\n const color = new $d5b33d7c30034067$export$892596cec99bc70e();\n const array = this.geometry.attributes.color.array;\n color.set(xAxisColor);\n color.toArray(array, 0);\n color.toArray(array, 3);\n color.set(yAxisColor);\n color.toArray(array, 6);\n color.toArray(array, 9);\n color.set(zAxisColor);\n color.toArray(array, 12);\n color.toArray(array, 15);\n this.geometry.attributes.color.needsUpdate = true;\n return this;\n }\n dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n}\nclass $d5b33d7c30034067$export$148534a3c727230b {\n constructor(){\n this.type = \"ShapePath\";\n this.color = new $d5b33d7c30034067$export$892596cec99bc70e();\n this.subPaths = [];\n this.currentPath = null;\n }\n moveTo(x, y) {\n this.currentPath = new $d5b33d7c30034067$export$4b2950bdac9b6ee9();\n this.subPaths.push(this.currentPath);\n this.currentPath.moveTo(x, y);\n return this;\n }\n lineTo(x, y) {\n this.currentPath.lineTo(x, y);\n return this;\n }\n quadraticCurveTo(aCPx, aCPy, aX, aY) {\n this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY);\n return this;\n }\n bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY);\n return this;\n }\n splineThru(pts) {\n this.currentPath.splineThru(pts);\n return this;\n }\n toShapes(isCCW) {\n function toShapesNoHoles(inSubpaths) {\n const shapes = [];\n for(let i = 0, l = inSubpaths.length; i < l; i++){\n const tmpPath = inSubpaths[i];\n const tmpShape = new $d5b33d7c30034067$export$6428a7f2611ef1fa();\n tmpShape.curves = tmpPath.curves;\n shapes.push(tmpShape);\n }\n return shapes;\n }\n function isPointInsidePolygon(inPt, inPolygon) {\n const polyLen = inPolygon.length;\n // inPt on polygon contour => immediate success or\n // toggling of inside/outside at every single! intersection point of an edge\n // with the horizontal line through inPt, left of inPt\n // not counting lowerY endpoints of edges and whole edges on that line\n let inside = false;\n for(let p = polyLen - 1, q = 0; q < polyLen; p = q++){\n let edgeLowPt = inPolygon[p];\n let edgeHighPt = inPolygon[q];\n let edgeDx = edgeHighPt.x - edgeLowPt.x;\n let edgeDy = edgeHighPt.y - edgeLowPt.y;\n if (Math.abs(edgeDy) > Number.EPSILON) {\n // not parallel\n if (edgeDy < 0) {\n edgeLowPt = inPolygon[q];\n edgeDx = -edgeDx;\n edgeHighPt = inPolygon[p];\n edgeDy = -edgeDy;\n }\n if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue;\n if (inPt.y === edgeLowPt.y) {\n if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ?\n // continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n } else {\n const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);\n if (perpEdge === 0) return true; // inPt is on contour ?\n if (perpEdge < 0) continue;\n inside = !inside; // true intersection left of inPt\n }\n } else {\n // parallel or collinear\n if (inPt.y !== edgeLowPt.y) continue; // parallel\n // edge lies on the same horizontal line as inPt\n if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour !\n // continue;\n }\n }\n return inside;\n }\n const isClockWise = $d5b33d7c30034067$export$96bdf6d9c66d7ba8.isClockWise;\n const subPaths = this.subPaths;\n if (subPaths.length === 0) return [];\n let solid, tmpPath, tmpShape;\n const shapes = [];\n if (subPaths.length === 1) {\n tmpPath = subPaths[0];\n tmpShape = new $d5b33d7c30034067$export$6428a7f2611ef1fa();\n tmpShape.curves = tmpPath.curves;\n shapes.push(tmpShape);\n return shapes;\n }\n let holesFirst = !isClockWise(subPaths[0].getPoints());\n holesFirst = isCCW ? !holesFirst : holesFirst;\n // console.log(\"Holes first\", holesFirst);\n const betterShapeHoles = [];\n const newShapes = [];\n let newShapeHoles = [];\n let mainIdx = 0;\n let tmpPoints;\n newShapes[mainIdx] = undefined;\n newShapeHoles[mainIdx] = [];\n for(let i = 0, l = subPaths.length; i < l; i++){\n tmpPath = subPaths[i];\n tmpPoints = tmpPath.getPoints();\n solid = isClockWise(tmpPoints);\n solid = isCCW ? !solid : solid;\n if (solid) {\n if (!holesFirst && newShapes[mainIdx]) mainIdx++;\n newShapes[mainIdx] = {\n s: new $d5b33d7c30034067$export$6428a7f2611ef1fa(),\n p: tmpPoints\n };\n newShapes[mainIdx].s.curves = tmpPath.curves;\n if (holesFirst) mainIdx++;\n newShapeHoles[mainIdx] = [];\n //console.log('cw', i);\n } else newShapeHoles[mainIdx].push({\n h: tmpPath,\n p: tmpPoints[0]\n });\n }\n // only Holes? -> probably all Shapes with wrong orientation\n if (!newShapes[0]) return toShapesNoHoles(subPaths);\n if (newShapes.length > 1) {\n let ambiguous = false;\n let toChange = 0;\n for(let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++)betterShapeHoles[sIdx] = [];\n for(let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++){\n const sho = newShapeHoles[sIdx];\n for(let hIdx = 0; hIdx < sho.length; hIdx++){\n const ho = sho[hIdx];\n let hole_unassigned = true;\n for(let s2Idx = 0; s2Idx < newShapes.length; s2Idx++)if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) {\n if (sIdx !== s2Idx) toChange++;\n if (hole_unassigned) {\n hole_unassigned = false;\n betterShapeHoles[s2Idx].push(ho);\n } else ambiguous = true;\n }\n if (hole_unassigned) betterShapeHoles[sIdx].push(ho);\n }\n }\n if (toChange > 0 && ambiguous === false) newShapeHoles = betterShapeHoles;\n }\n let tmpHoles;\n for(let i = 0, il = newShapes.length; i < il; i++){\n tmpShape = newShapes[i].s;\n shapes.push(tmpShape);\n tmpHoles = newShapeHoles[i];\n for(let j = 0, jl = tmpHoles.length; j < jl; j++)tmpShape.holes.push(tmpHoles[j].h);\n }\n //console.log(\"shape\", shapes);\n return shapes;\n }\n}\nif (typeof __THREE_DEVTOOLS__ !== \"undefined\") __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"register\", {\n detail: {\n revision: $d5b33d7c30034067$export$3545e07a80636437\n }\n}));\nif (typeof window !== \"undefined\") {\n if (window.__THREE__) console.warn(\"WARNING: Multiple instances of Three.js being imported.\");\n else window.__THREE__ = $d5b33d7c30034067$export$3545e07a80636437;\n}\n\n});\n\nparcelRequire.register(\"5Rd1x\", function(module, exports) {\n\n$parcel$export(module.exports, \"OrbitControls\", () => $443c013b983d0324$export$8ff7788029dfdf52);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\nconst $443c013b983d0324$var$_changeEvent = {\n type: \"change\"\n};\nconst $443c013b983d0324$var$_startEvent = {\n type: \"start\"\n};\nconst $443c013b983d0324$var$_endEvent = {\n type: \"end\"\n};\nconst $443c013b983d0324$var$_ray = new (0, $ilwiq.Ray)();\nconst $443c013b983d0324$var$_plane = new (0, $ilwiq.Plane)();\nconst $443c013b983d0324$var$TILT_LIMIT = Math.cos(70 * (0, $ilwiq.MathUtils).DEG2RAD);\nclass $443c013b983d0324$export$8ff7788029dfdf52 extends (0, $ilwiq.EventDispatcher) {\n constructor(object, domElement){\n super();\n this.object = object;\n this.domElement = domElement;\n this.domElement.style.touchAction = \"none\"; // disable touch scroll\n // Set to false to disable this control\n this.enabled = true;\n // \"target\" sets the location of focus, where the object orbits around\n this.target = new (0, $ilwiq.Vector3)();\n // How far you can dolly in and out ( PerspectiveCamera only )\n this.minDistance = 0;\n this.maxDistance = Infinity;\n // How far you can zoom in and out ( OrthographicCamera only )\n this.minZoom = 0;\n this.maxZoom = Infinity;\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n this.minAzimuthAngle = -Infinity; // radians\n this.maxAzimuthAngle = Infinity; // radians\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n this.enableDamping = false;\n this.dampingFactor = 0.05;\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n this.enableZoom = true;\n this.zoomSpeed = 1.0;\n // Set to false to disable rotating\n this.enableRotate = true;\n this.rotateSpeed = 1.0;\n // Set to false to disable panning\n this.enablePan = true;\n this.panSpeed = 1.0;\n this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n this.keyPanSpeed = 7.0; // pixels moved per arrow key push\n this.zoomToCursor = false;\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n // The four arrow keys\n this.keys = {\n LEFT: \"ArrowLeft\",\n UP: \"ArrowUp\",\n RIGHT: \"ArrowRight\",\n BOTTOM: \"ArrowDown\"\n };\n // Mouse buttons\n this.mouseButtons = {\n LEFT: (0, $ilwiq.MOUSE).ROTATE,\n MIDDLE: (0, $ilwiq.MOUSE).DOLLY,\n RIGHT: (0, $ilwiq.MOUSE).PAN\n };\n // Touch fingers\n this.touches = {\n ONE: (0, $ilwiq.TOUCH).ROTATE,\n TWO: (0, $ilwiq.TOUCH).DOLLY_PAN\n };\n // for reset\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n // the target DOM element for key events\n this._domElementKeyEvents = null;\n //\n // public methods\n //\n this.getPolarAngle = function() {\n return spherical.phi;\n };\n this.getAzimuthalAngle = function() {\n return spherical.theta;\n };\n this.getDistance = function() {\n return this.object.position.distanceTo(this.target);\n };\n this.listenToKeyEvents = function(domElement) {\n domElement.addEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = domElement;\n };\n this.stopListenToKeyEvents = function() {\n this._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = null;\n };\n this.saveState = function() {\n scope.target0.copy(scope.target);\n scope.position0.copy(scope.object.position);\n scope.zoom0 = scope.object.zoom;\n };\n this.reset = function() {\n scope.target.copy(scope.target0);\n scope.object.position.copy(scope.position0);\n scope.object.zoom = scope.zoom0;\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent($443c013b983d0324$var$_changeEvent);\n scope.update();\n state = STATE.NONE;\n };\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = function() {\n const offset = new (0, $ilwiq.Vector3)();\n // so camera.up is the orbit axis\n const quat = new (0, $ilwiq.Quaternion)().setFromUnitVectors(object.up, new (0, $ilwiq.Vector3)(0, 1, 0));\n const quatInverse = quat.clone().invert();\n const lastPosition = new (0, $ilwiq.Vector3)();\n const lastQuaternion = new (0, $ilwiq.Quaternion)();\n const lastTargetPosition = new (0, $ilwiq.Vector3)();\n const twoPI = 2 * Math.PI;\n return function update() {\n const position = scope.object.position;\n offset.copy(position).sub(scope.target);\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat);\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset);\n if (scope.autoRotate && state === STATE.NONE) rotateLeft(getAutoRotationAngle());\n if (scope.enableDamping) {\n spherical.theta += sphericalDelta.theta * scope.dampingFactor;\n spherical.phi += sphericalDelta.phi * scope.dampingFactor;\n } else {\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n }\n // restrict theta to be between desired limits\n let min = scope.minAzimuthAngle;\n let max = scope.maxAzimuthAngle;\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI;\n else if (min > Math.PI) min -= twoPI;\n if (max < -Math.PI) max += twoPI;\n else if (max > Math.PI) max -= twoPI;\n if (min <= max) spherical.theta = Math.max(min, Math.min(max, spherical.theta));\n else spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);\n }\n // restrict phi to be between desired limits\n spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));\n spherical.makeSafe();\n // move target to panned location\n if (scope.enableDamping === true) scope.target.addScaledVector(panOffset, scope.dampingFactor);\n else scope.target.add(panOffset);\n // adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera\n // we adjust zoom later in these cases\n if (scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera) spherical.radius = clampDistance(spherical.radius);\n else spherical.radius = clampDistance(spherical.radius * scale);\n offset.setFromSpherical(spherical);\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse);\n position.copy(scope.target).add(offset);\n scope.object.lookAt(scope.target);\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor;\n sphericalDelta.phi *= 1 - scope.dampingFactor;\n panOffset.multiplyScalar(1 - scope.dampingFactor);\n } else {\n sphericalDelta.set(0, 0, 0);\n panOffset.set(0, 0, 0);\n }\n // adjust camera position\n let zoomChanged = false;\n if (scope.zoomToCursor && performCursorZoom) {\n let newRadius = null;\n if (scope.object.isPerspectiveCamera) {\n // move the camera down the pointer ray\n // this method avoids floating point error\n const prevRadius = offset.length();\n newRadius = clampDistance(prevRadius * scale);\n const radiusDelta = prevRadius - newRadius;\n scope.object.position.addScaledVector(dollyDirection, radiusDelta);\n scope.object.updateMatrixWorld();\n } else if (scope.object.isOrthographicCamera) {\n // adjust the ortho camera position based on zoom changes\n const mouseBefore = new (0, $ilwiq.Vector3)(mouse.x, mouse.y, 0);\n mouseBefore.unproject(scope.object);\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n const mouseAfter = new (0, $ilwiq.Vector3)(mouse.x, mouse.y, 0);\n mouseAfter.unproject(scope.object);\n scope.object.position.sub(mouseAfter).add(mouseBefore);\n scope.object.updateMatrixWorld();\n newRadius = offset.length();\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.\");\n scope.zoomToCursor = false;\n }\n // handle the placement of the target\n if (newRadius !== null) {\n if (this.screenSpacePanning) // position the orbit target in front of the new camera position\n scope.target.set(0, 0, -1).transformDirection(scope.object.matrix).multiplyScalar(newRadius).add(scope.object.position);\n else {\n // get the ray and translation plane to compute target\n $443c013b983d0324$var$_ray.origin.copy(scope.object.position);\n $443c013b983d0324$var$_ray.direction.set(0, 0, -1).transformDirection(scope.object.matrix);\n // if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid\n // extremely large values\n if (Math.abs(scope.object.up.dot($443c013b983d0324$var$_ray.direction)) < $443c013b983d0324$var$TILT_LIMIT) object.lookAt(scope.target);\n else {\n $443c013b983d0324$var$_plane.setFromNormalAndCoplanarPoint(scope.object.up, scope.target);\n $443c013b983d0324$var$_ray.intersectPlane($443c013b983d0324$var$_plane, scope.target);\n }\n }\n }\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n }\n scale = 1;\n performCursorZoom = false;\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS || lastTargetPosition.distanceToSquared(scope.target) > 0) {\n scope.dispatchEvent($443c013b983d0324$var$_changeEvent);\n lastPosition.copy(scope.object.position);\n lastQuaternion.copy(scope.object.quaternion);\n lastTargetPosition.copy(scope.target);\n zoomChanged = false;\n return true;\n }\n return false;\n };\n }();\n this.dispose = function() {\n scope.domElement.removeEventListener(\"contextmenu\", onContextMenu);\n scope.domElement.removeEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.removeEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.removeEventListener(\"wheel\", onMouseWheel);\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n scope._domElementKeyEvents = null;\n }\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n };\n //\n // internals\n //\n const scope = this;\n const STATE = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_PAN: 4,\n TOUCH_DOLLY_PAN: 5,\n TOUCH_DOLLY_ROTATE: 6\n };\n let state = STATE.NONE;\n const EPS = 0.000001;\n // current position in spherical coordinates\n const spherical = new (0, $ilwiq.Spherical)();\n const sphericalDelta = new (0, $ilwiq.Spherical)();\n let scale = 1;\n const panOffset = new (0, $ilwiq.Vector3)();\n const rotateStart = new (0, $ilwiq.Vector2)();\n const rotateEnd = new (0, $ilwiq.Vector2)();\n const rotateDelta = new (0, $ilwiq.Vector2)();\n const panStart = new (0, $ilwiq.Vector2)();\n const panEnd = new (0, $ilwiq.Vector2)();\n const panDelta = new (0, $ilwiq.Vector2)();\n const dollyStart = new (0, $ilwiq.Vector2)();\n const dollyEnd = new (0, $ilwiq.Vector2)();\n const dollyDelta = new (0, $ilwiq.Vector2)();\n const dollyDirection = new (0, $ilwiq.Vector3)();\n const mouse = new (0, $ilwiq.Vector2)();\n let performCursorZoom = false;\n const pointers = [];\n const pointerPositions = {};\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n function rotateLeft(angle) {\n sphericalDelta.theta -= angle;\n }\n function rotateUp(angle) {\n sphericalDelta.phi -= angle;\n }\n const panLeft = function() {\n const v = new (0, $ilwiq.Vector3)();\n return function panLeft(distance, objectMatrix) {\n v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix\n v.multiplyScalar(-distance);\n panOffset.add(v);\n };\n }();\n const panUp = function() {\n const v = new (0, $ilwiq.Vector3)();\n return function panUp(distance, objectMatrix) {\n if (scope.screenSpacePanning === true) v.setFromMatrixColumn(objectMatrix, 1);\n else {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.crossVectors(scope.object.up, v);\n }\n v.multiplyScalar(distance);\n panOffset.add(v);\n };\n }();\n // deltaX and deltaY are in pixels; right and down are positive\n const pan = function() {\n const offset = new (0, $ilwiq.Vector3)();\n return function pan(deltaX, deltaY) {\n const element = scope.domElement;\n if (scope.object.isPerspectiveCamera) {\n // perspective\n const position = scope.object.position;\n offset.copy(position).sub(scope.target);\n let targetDistance = offset.length();\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n // we use only clientHeight here so aspect ratio does not distort speed\n panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n } else if (scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);\n panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);\n } else {\n // camera neither orthographic nor perspective\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.\");\n scope.enablePan = false;\n }\n };\n }();\n function dollyOut(dollyScale) {\n if (scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera) scale /= dollyScale;\n else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n function dollyIn(dollyScale) {\n if (scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera) scale *= dollyScale;\n else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n function updateMouseParameters(event) {\n if (!scope.zoomToCursor) return;\n performCursorZoom = true;\n const rect = scope.domElement.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const w = rect.width;\n const h = rect.height;\n mouse.x = x / w * 2 - 1;\n mouse.y = -(y / h) * 2 + 1;\n dollyDirection.set(mouse.x, mouse.y, 1).unproject(object).sub(object.position).normalize();\n }\n function clampDistance(dist) {\n return Math.max(scope.minDistance, Math.min(scope.maxDistance, dist));\n }\n //\n // event callbacks - update the object state\n //\n function handleMouseDownRotate(event) {\n rotateStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownDolly(event) {\n updateMouseParameters(event);\n dollyStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownPan(event) {\n panStart.set(event.clientX, event.clientY);\n }\n function handleMouseMoveRotate(event) {\n rotateEnd.set(event.clientX, event.clientY);\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n const element = scope.domElement;\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n rotateStart.copy(rotateEnd);\n scope.update();\n }\n function handleMouseMoveDolly(event) {\n dollyEnd.set(event.clientX, event.clientY);\n dollyDelta.subVectors(dollyEnd, dollyStart);\n if (dollyDelta.y > 0) dollyOut(getZoomScale());\n else if (dollyDelta.y < 0) dollyIn(getZoomScale());\n dollyStart.copy(dollyEnd);\n scope.update();\n }\n function handleMouseMovePan(event) {\n panEnd.set(event.clientX, event.clientY);\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n scope.update();\n }\n function handleMouseWheel(event) {\n updateMouseParameters(event);\n if (event.deltaY < 0) dollyIn(getZoomScale());\n else if (event.deltaY > 0) dollyOut(getZoomScale());\n scope.update();\n }\n function handleKeyDown(event) {\n let needsUpdate = false;\n switch(event.code){\n case scope.keys.UP:\n if (event.ctrlKey || event.metaKey || event.shiftKey) rotateUp(2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n else pan(0, scope.keyPanSpeed);\n needsUpdate = true;\n break;\n case scope.keys.BOTTOM:\n if (event.ctrlKey || event.metaKey || event.shiftKey) rotateUp(-2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n else pan(0, -scope.keyPanSpeed);\n needsUpdate = true;\n break;\n case scope.keys.LEFT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) rotateLeft(2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n else pan(scope.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n case scope.keys.RIGHT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) rotateLeft(-2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n else pan(-scope.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n }\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault();\n scope.update();\n }\n }\n function handleTouchStartRotate() {\n if (pointers.length === 1) rotateStart.set(pointers[0].pageX, pointers[0].pageY);\n else {\n const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n rotateStart.set(x, y);\n }\n }\n function handleTouchStartPan() {\n if (pointers.length === 1) panStart.set(pointers[0].pageX, pointers[0].pageY);\n else {\n const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n panStart.set(x, y);\n }\n }\n function handleTouchStartDolly() {\n const dx = pointers[0].pageX - pointers[1].pageX;\n const dy = pointers[0].pageY - pointers[1].pageY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n dollyStart.set(0, distance);\n }\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly();\n if (scope.enablePan) handleTouchStartPan();\n }\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly();\n if (scope.enableRotate) handleTouchStartRotate();\n }\n function handleTouchMoveRotate(event) {\n if (pointers.length == 1) rotateEnd.set(event.pageX, event.pageY);\n else {\n const position = getSecondPointerPosition(event);\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n rotateEnd.set(x, y);\n }\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n const element = scope.domElement;\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n rotateStart.copy(rotateEnd);\n }\n function handleTouchMovePan(event) {\n if (pointers.length === 1) panEnd.set(event.pageX, event.pageY);\n else {\n const position = getSecondPointerPosition(event);\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n panEnd.set(x, y);\n }\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n }\n function handleTouchMoveDolly(event) {\n const position = getSecondPointerPosition(event);\n const dx = event.pageX - position.x;\n const dy = event.pageY - position.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n dollyEnd.set(0, distance);\n dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));\n dollyOut(dollyDelta.y);\n dollyStart.copy(dollyEnd);\n }\n function handleTouchMoveDollyPan(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n if (scope.enablePan) handleTouchMovePan(event);\n }\n function handleTouchMoveDollyRotate(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n if (scope.enableRotate) handleTouchMoveRotate(event);\n }\n //\n // event handlers - FSM: listen for events and reset state\n //\n function onPointerDown(event) {\n if (scope.enabled === false) return;\n if (pointers.length === 0) {\n scope.domElement.setPointerCapture(event.pointerId);\n scope.domElement.addEventListener(\"pointermove\", onPointerMove);\n scope.domElement.addEventListener(\"pointerup\", onPointerUp);\n }\n //\n addPointer(event);\n if (event.pointerType === \"touch\") onTouchStart(event);\n else onMouseDown(event);\n }\n function onPointerMove(event) {\n if (scope.enabled === false) return;\n if (event.pointerType === \"touch\") onTouchMove(event);\n else onMouseMove(event);\n }\n function onPointerUp(event) {\n removePointer(event);\n if (pointers.length === 0) {\n scope.domElement.releasePointerCapture(event.pointerId);\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n }\n scope.dispatchEvent($443c013b983d0324$var$_endEvent);\n state = STATE.NONE;\n }\n function onMouseDown(event) {\n let mouseAction;\n switch(event.button){\n case 0:\n mouseAction = scope.mouseButtons.LEFT;\n break;\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE;\n break;\n case 2:\n mouseAction = scope.mouseButtons.RIGHT;\n break;\n default:\n mouseAction = -1;\n }\n switch(mouseAction){\n case (0, $ilwiq.MOUSE).DOLLY:\n if (scope.enableZoom === false) return;\n handleMouseDownDolly(event);\n state = STATE.DOLLY;\n break;\n case (0, $ilwiq.MOUSE).ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n } else {\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n }\n break;\n case (0, $ilwiq.MOUSE).PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n } else {\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n }\n break;\n default:\n state = STATE.NONE;\n }\n if (state !== STATE.NONE) scope.dispatchEvent($443c013b983d0324$var$_startEvent);\n }\n function onMouseMove(event) {\n switch(state){\n case STATE.ROTATE:\n if (scope.enableRotate === false) return;\n handleMouseMoveRotate(event);\n break;\n case STATE.DOLLY:\n if (scope.enableZoom === false) return;\n handleMouseMoveDolly(event);\n break;\n case STATE.PAN:\n if (scope.enablePan === false) return;\n handleMouseMovePan(event);\n break;\n }\n }\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n event.preventDefault();\n scope.dispatchEvent($443c013b983d0324$var$_startEvent);\n handleMouseWheel(event);\n scope.dispatchEvent($443c013b983d0324$var$_endEvent);\n }\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enablePan === false) return;\n handleKeyDown(event);\n }\n function onTouchStart(event) {\n trackPointer(event);\n switch(pointers.length){\n case 1:\n switch(scope.touches.ONE){\n case (0, $ilwiq.TOUCH).ROTATE:\n if (scope.enableRotate === false) return;\n handleTouchStartRotate();\n state = STATE.TOUCH_ROTATE;\n break;\n case (0, $ilwiq.TOUCH).PAN:\n if (scope.enablePan === false) return;\n handleTouchStartPan();\n state = STATE.TOUCH_PAN;\n break;\n default:\n state = STATE.NONE;\n }\n break;\n case 2:\n switch(scope.touches.TWO){\n case (0, $ilwiq.TOUCH).DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n handleTouchStartDollyPan();\n state = STATE.TOUCH_DOLLY_PAN;\n break;\n case (0, $ilwiq.TOUCH).DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n handleTouchStartDollyRotate();\n state = STATE.TOUCH_DOLLY_ROTATE;\n break;\n default:\n state = STATE.NONE;\n }\n break;\n default:\n state = STATE.NONE;\n }\n if (state !== STATE.NONE) scope.dispatchEvent($443c013b983d0324$var$_startEvent);\n }\n function onTouchMove(event) {\n trackPointer(event);\n switch(state){\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return;\n handleTouchMoveRotate(event);\n scope.update();\n break;\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return;\n handleTouchMovePan(event);\n scope.update();\n break;\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n handleTouchMoveDollyPan(event);\n scope.update();\n break;\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n handleTouchMoveDollyRotate(event);\n scope.update();\n break;\n default:\n state = STATE.NONE;\n }\n }\n function onContextMenu(event) {\n if (scope.enabled === false) return;\n event.preventDefault();\n }\n function addPointer(event) {\n pointers.push(event);\n }\n function removePointer(event) {\n delete pointerPositions[event.pointerId];\n for(let i = 0; i < pointers.length; i++)if (pointers[i].pointerId == event.pointerId) {\n pointers.splice(i, 1);\n return;\n }\n }\n function trackPointer(event) {\n let position = pointerPositions[event.pointerId];\n if (position === undefined) {\n position = new (0, $ilwiq.Vector2)();\n pointerPositions[event.pointerId] = position;\n }\n position.set(event.pageX, event.pageY);\n }\n function getSecondPointerPosition(event) {\n const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0];\n return pointerPositions[pointer.pointerId];\n }\n //\n scope.domElement.addEventListener(\"contextmenu\", onContextMenu);\n scope.domElement.addEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.addEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.addEventListener(\"wheel\", onMouseWheel, {\n passive: false\n });\n // force an update at start\n this.update();\n }\n}\n\n});\n\nparcelRequire.register(\"7ePFa\", function(module, exports) {\n\n$parcel$export(module.exports, \"mergeGeometries\", () => $5451ea62abbe5f68$export$f06f69b3bf41d25c);\n$parcel$export(module.exports, \"toTrianglesDrawMode\", () => $5451ea62abbe5f68$export$5492ca6e5c0c7aa0);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nfunction $5451ea62abbe5f68$export$676e3e70c930f774(geometry, MikkTSpace, negateSign = true) {\n if (!MikkTSpace || !MikkTSpace.isReady) throw new Error(\"BufferGeometryUtils: Initialized MikkTSpace library required.\");\n if (!geometry.hasAttribute(\"position\") || !geometry.hasAttribute(\"normal\") || !geometry.hasAttribute(\"uv\")) throw new Error('BufferGeometryUtils: Tangents require \"position\", \"normal\", and \"uv\" attributes.');\n function getAttributeArray(attribute) {\n if (attribute.normalized || attribute.isInterleavedBufferAttribute) {\n const dstArray = new Float32Array(attribute.count * attribute.itemSize);\n for(let i = 0, j = 0; i < attribute.count; i++){\n dstArray[j++] = attribute.getX(i);\n dstArray[j++] = attribute.getY(i);\n if (attribute.itemSize > 2) dstArray[j++] = attribute.getZ(i);\n }\n return dstArray;\n }\n if (attribute.array instanceof Float32Array) return attribute.array;\n return new Float32Array(attribute.array);\n }\n // MikkTSpace algorithm requires non-indexed input.\n const _geometry = geometry.index ? geometry.toNonIndexed() : geometry;\n // Compute vertex tangents.\n const tangents = MikkTSpace.generateTangents(getAttributeArray(_geometry.attributes.position), getAttributeArray(_geometry.attributes.normal), getAttributeArray(_geometry.attributes.uv));\n // Texture coordinate convention of glTF differs from the apparent\n // default of the MikkTSpace library; .w component must be flipped.\n if (negateSign) for(let i = 3; i < tangents.length; i += 4)tangents[i] *= -1;\n //\n _geometry.setAttribute(\"tangent\", new (0, $ilwiq.BufferAttribute)(tangents, 4));\n if (geometry !== _geometry) geometry.copy(_geometry);\n return geometry;\n}\n/**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */ function $5451ea62abbe5f68$export$f06f69b3bf41d25c(geometries, useGroups = false) {\n const isIndexed = geometries[0].index !== null;\n const attributesUsed = new Set(Object.keys(geometries[0].attributes));\n const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes));\n const attributes = {};\n const morphAttributes = {};\n const morphTargetsRelative = geometries[0].morphTargetsRelative;\n const mergedGeometry = new (0, $ilwiq.BufferGeometry)();\n let offset = 0;\n for(let i = 0; i < geometries.length; ++i){\n const geometry = geometries[i];\n let attributesCount = 0;\n // ensure that all geometries are indexed, or none\n if (isIndexed !== (geometry.index !== null)) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + \". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.\");\n return null;\n }\n // gather attributes, exit early if they're different\n for(const name in geometry.attributes){\n if (!attributesUsed.has(name)) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + '. All geometries must have compatible attributes; make sure \"' + name + '\" attribute exists among all geometries, or in none of them.');\n return null;\n }\n if (attributes[name] === undefined) attributes[name] = [];\n attributes[name].push(geometry.attributes[name]);\n attributesCount++;\n }\n // ensure geometries have the same number of attributes\n if (attributesCount !== attributesUsed.size) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + \". Make sure all geometries have the same number of attributes.\");\n return null;\n }\n // gather morph attributes, exit early if they're different\n if (morphTargetsRelative !== geometry.morphTargetsRelative) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + \". .morphTargetsRelative must be consistent throughout all geometries.\");\n return null;\n }\n for(const name in geometry.morphAttributes){\n if (!morphAttributesUsed.has(name)) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + \". .morphAttributes must be consistent throughout all geometries.\");\n return null;\n }\n if (morphAttributes[name] === undefined) morphAttributes[name] = [];\n morphAttributes[name].push(geometry.morphAttributes[name]);\n }\n if (useGroups) {\n let count;\n if (isIndexed) count = geometry.index.count;\n else if (geometry.attributes.position !== undefined) count = geometry.attributes.position.count;\n else {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index \" + i + \". The geometry must have either an index or a position attribute\");\n return null;\n }\n mergedGeometry.addGroup(offset, count, i);\n offset += count;\n }\n }\n // merge indices\n if (isIndexed) {\n let indexOffset = 0;\n const mergedIndex = [];\n for(let i = 0; i < geometries.length; ++i){\n const index = geometries[i].index;\n for(let j = 0; j < index.count; ++j)mergedIndex.push(index.getX(j) + indexOffset);\n indexOffset += geometries[i].attributes.position.count;\n }\n mergedGeometry.setIndex(mergedIndex);\n }\n // merge attributes\n for(const name in attributes){\n const mergedAttribute = $5451ea62abbe5f68$export$9f98db6234c4bd78(attributes[name]);\n if (!mergedAttribute) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the \" + name + \" attribute.\");\n return null;\n }\n mergedGeometry.setAttribute(name, mergedAttribute);\n }\n // merge morph attributes\n for(const name in morphAttributes){\n const numMorphTargets = morphAttributes[name][0].length;\n if (numMorphTargets === 0) break;\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n mergedGeometry.morphAttributes[name] = [];\n for(let i = 0; i < numMorphTargets; ++i){\n const morphAttributesToMerge = [];\n for(let j = 0; j < morphAttributes[name].length; ++j)morphAttributesToMerge.push(morphAttributes[name][j][i]);\n const mergedMorphAttribute = $5451ea62abbe5f68$export$9f98db6234c4bd78(morphAttributesToMerge);\n if (!mergedMorphAttribute) {\n console.error(\"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the \" + name + \" morphAttribute.\");\n return null;\n }\n mergedGeometry.morphAttributes[name].push(mergedMorphAttribute);\n }\n }\n return mergedGeometry;\n}\n/**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */ function $5451ea62abbe5f68$export$9f98db6234c4bd78(attributes) {\n let TypedArray;\n let itemSize;\n let normalized;\n let gpuType = -1;\n let arrayLength = 0;\n for(let i = 0; i < attributes.length; ++i){\n const attribute = attributes[i];\n if (attribute.isInterleavedBufferAttribute) {\n console.error(\"THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported.\");\n return null;\n }\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error(\"THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.\");\n return null;\n }\n if (itemSize === undefined) itemSize = attribute.itemSize;\n if (itemSize !== attribute.itemSize) {\n console.error(\"THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.\");\n return null;\n }\n if (normalized === undefined) normalized = attribute.normalized;\n if (normalized !== attribute.normalized) {\n console.error(\"THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.\");\n return null;\n }\n if (gpuType === -1) gpuType = attribute.gpuType;\n if (gpuType !== attribute.gpuType) {\n console.error(\"THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.\");\n return null;\n }\n arrayLength += attribute.array.length;\n }\n const array = new TypedArray(arrayLength);\n let offset = 0;\n for(let i = 0; i < attributes.length; ++i){\n array.set(attributes[i].array, offset);\n offset += attributes[i].array.length;\n }\n const result = new (0, $ilwiq.BufferAttribute)(array, itemSize, normalized);\n if (gpuType !== undefined) result.gpuType = gpuType;\n return result;\n}\nfunction $5451ea62abbe5f68$export$4848639a9adff548(attribute) {\n if (attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute) return $5451ea62abbe5f68$export$4b7aa2f2134b7e19(attribute);\n if (attribute.isInstancedBufferAttribute) return new (0, $ilwiq.InstancedBufferAttribute)().copy(attribute);\n return new (0, $ilwiq.BufferAttribute)().copy(attribute);\n}\n/**\n * @param {Array} attributes\n * @return {Array}\n */ function $5451ea62abbe5f68$export$308f9509e428a845(attributes) {\n // Interleaves the provided attributes into an InterleavedBuffer and returns\n // a set of InterleavedBufferAttributes for each attribute\n let TypedArray;\n let arrayLength = 0;\n let stride = 0;\n // calculate the length and type of the interleavedBuffer\n for(let i = 0, l = attributes.length; i < l; ++i){\n const attribute = attributes[i];\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error(\"AttributeBuffers of different types cannot be interleaved\");\n return null;\n }\n arrayLength += attribute.array.length;\n stride += attribute.itemSize;\n }\n // Create the set of buffer attributes\n const interleavedBuffer = new (0, $ilwiq.InterleavedBuffer)(new TypedArray(arrayLength), stride);\n let offset = 0;\n const res = [];\n const getters = [\n \"getX\",\n \"getY\",\n \"getZ\",\n \"getW\"\n ];\n const setters = [\n \"setX\",\n \"setY\",\n \"setZ\",\n \"setW\"\n ];\n for(let j = 0, l = attributes.length; j < l; j++){\n const attribute = attributes[j];\n const itemSize = attribute.itemSize;\n const count = attribute.count;\n const iba = new (0, $ilwiq.InterleavedBufferAttribute)(interleavedBuffer, itemSize, offset, attribute.normalized);\n res.push(iba);\n offset += itemSize;\n // Move the data for each attribute into the new interleavedBuffer\n // at the appropriate offset\n for(let c = 0; c < count; c++)for(let k = 0; k < itemSize; k++)iba[setters[k]](c, attribute[getters[k]](c));\n }\n return res;\n}\nfunction $5451ea62abbe5f68$export$4b7aa2f2134b7e19(attribute) {\n const cons = attribute.data.array.constructor;\n const count = attribute.count;\n const itemSize = attribute.itemSize;\n const normalized = attribute.normalized;\n const array = new cons(count * itemSize);\n let newAttribute;\n if (attribute.isInstancedInterleavedBufferAttribute) newAttribute = new (0, $ilwiq.InstancedBufferAttribute)(array, itemSize, normalized, attribute.meshPerAttribute);\n else newAttribute = new (0, $ilwiq.BufferAttribute)(array, itemSize, normalized);\n for(let i = 0; i < count; i++){\n newAttribute.setX(i, attribute.getX(i));\n if (itemSize >= 2) newAttribute.setY(i, attribute.getY(i));\n if (itemSize >= 3) newAttribute.setZ(i, attribute.getZ(i));\n if (itemSize >= 4) newAttribute.setW(i, attribute.getW(i));\n }\n return newAttribute;\n}\nfunction $5451ea62abbe5f68$export$e7413b17bfaaa80b(geometry) {\n const attributes = geometry.attributes;\n const morphTargets = geometry.morphTargets;\n const attrMap = new Map();\n for(const key in attributes){\n const attr = attributes[key];\n if (attr.isInterleavedBufferAttribute) {\n if (!attrMap.has(attr)) attrMap.set(attr, $5451ea62abbe5f68$export$4b7aa2f2134b7e19(attr));\n attributes[key] = attrMap.get(attr);\n }\n }\n for(const key in morphTargets){\n const attr = morphTargets[key];\n if (attr.isInterleavedBufferAttribute) {\n if (!attrMap.has(attr)) attrMap.set(attr, $5451ea62abbe5f68$export$4b7aa2f2134b7e19(attr));\n morphTargets[key] = attrMap.get(attr);\n }\n }\n}\n/**\n * @param {Array} geometry\n * @return {number}\n */ function $5451ea62abbe5f68$export$35bee7999e19754d(geometry) {\n // Return the estimated memory used by this geometry in bytes\n // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account\n // for InterleavedBufferAttributes.\n let mem = 0;\n for(const name in geometry.attributes){\n const attr = geometry.getAttribute(name);\n mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n }\n const indices = geometry.getIndex();\n mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n return mem;\n}\n/**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry}\n */ function $5451ea62abbe5f68$export$e36bb98c4c944f9(geometry, tolerance = 1e-4) {\n tolerance = Math.max(tolerance, Number.EPSILON);\n // Generate an index buffer if the geometry doesn't have one, or optimize it\n // if it's already available.\n const hashToIndex = {};\n const indices = geometry.getIndex();\n const positions = geometry.getAttribute(\"position\");\n const vertexCount = indices ? indices.count : positions.count;\n // next value for triangle indices\n let nextIndex = 0;\n // attributes and new attribute arrays\n const attributeNames = Object.keys(geometry.attributes);\n const tmpAttributes = {};\n const tmpMorphAttributes = {};\n const newIndices = [];\n const getters = [\n \"getX\",\n \"getY\",\n \"getZ\",\n \"getW\"\n ];\n const setters = [\n \"setX\",\n \"setY\",\n \"setZ\",\n \"setW\"\n ];\n // Initialize the arrays, allocating space conservatively. Extra\n // space will be trimmed in the last step.\n for(let i = 0, l = attributeNames.length; i < l; i++){\n const name = attributeNames[i];\n const attr = geometry.attributes[name];\n tmpAttributes[name] = new (0, $ilwiq.BufferAttribute)(new attr.array.constructor(attr.count * attr.itemSize), attr.itemSize, attr.normalized);\n const morphAttr = geometry.morphAttributes[name];\n if (morphAttr) tmpMorphAttributes[name] = new (0, $ilwiq.BufferAttribute)(new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize), morphAttr.itemSize, morphAttr.normalized);\n }\n // convert the error tolerance to an amount of decimal places to truncate to\n const decimalShift = Math.log10(1 / tolerance);\n const shiftMultiplier = Math.pow(10, decimalShift);\n for(let i = 0; i < vertexCount; i++){\n const index = indices ? indices.getX(i) : i;\n // Generate a hash for the vertex attributes at the current index 'i'\n let hash = \"\";\n for(let j = 0, l = attributeNames.length; j < l; j++){\n const name = attributeNames[j];\n const attribute = geometry.getAttribute(name);\n const itemSize = attribute.itemSize;\n for(let k = 0; k < itemSize; k++)// double tilde truncates the decimal value\n hash += `${~~(attribute[getters[k]](index) * shiftMultiplier)},`;\n }\n // Add another reference to the vertex if it's already\n // used by another index\n if (hash in hashToIndex) newIndices.push(hashToIndex[hash]);\n else {\n // copy data to the new index in the temporary attributes\n for(let j = 0, l = attributeNames.length; j < l; j++){\n const name = attributeNames[j];\n const attribute = geometry.getAttribute(name);\n const morphAttr = geometry.morphAttributes[name];\n const itemSize = attribute.itemSize;\n const newarray = tmpAttributes[name];\n const newMorphArrays = tmpMorphAttributes[name];\n for(let k = 0; k < itemSize; k++){\n const getterFunc = getters[k];\n const setterFunc = setters[k];\n newarray[setterFunc](nextIndex, attribute[getterFunc](index));\n if (morphAttr) for(let m = 0, ml = morphAttr.length; m < ml; m++)newMorphArrays[m][setterFunc](nextIndex, morphAttr[m][getterFunc](index));\n }\n }\n hashToIndex[hash] = nextIndex;\n newIndices.push(nextIndex);\n nextIndex++;\n }\n }\n // generate result BufferGeometry\n const result = geometry.clone();\n for(const name in geometry.attributes){\n const tmpAttribute = tmpAttributes[name];\n result.setAttribute(name, new (0, $ilwiq.BufferAttribute)(tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), tmpAttribute.itemSize, tmpAttribute.normalized));\n if (!(name in tmpMorphAttributes)) continue;\n for(let j = 0; j < tmpMorphAttributes[name].length; j++){\n const tmpMorphAttribute = tmpMorphAttributes[name][j];\n result.morphAttributes[name][j] = new (0, $ilwiq.BufferAttribute)(tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), tmpMorphAttribute.itemSize, tmpMorphAttribute.normalized);\n }\n }\n // indices\n result.setIndex(newIndices);\n return result;\n}\n/**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry}\n */ function $5451ea62abbe5f68$export$5492ca6e5c0c7aa0(geometry, drawMode) {\n if (drawMode === (0, $ilwiq.TrianglesDrawMode)) {\n console.warn(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.\");\n return geometry;\n }\n if (drawMode === (0, $ilwiq.TriangleFanDrawMode) || drawMode === (0, $ilwiq.TriangleStripDrawMode)) {\n let index = geometry.getIndex();\n // generate index if not present\n if (index === null) {\n const indices = [];\n const position = geometry.getAttribute(\"position\");\n if (position !== undefined) {\n for(let i = 0; i < position.count; i++)indices.push(i);\n geometry.setIndex(indices);\n index = geometry.getIndex();\n } else {\n console.error(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.\");\n return geometry;\n }\n }\n //\n const numberOfTriangles = index.count - 2;\n const newIndices = [];\n if (drawMode === (0, $ilwiq.TriangleFanDrawMode)) // gl.TRIANGLE_FAN\n for(let i = 1; i <= numberOfTriangles; i++){\n newIndices.push(index.getX(0));\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n }\n else {\n // gl.TRIANGLE_STRIP\n for(let i = 0; i < numberOfTriangles; i++)if (i % 2 === 0) {\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i + 2));\n } else {\n newIndices.push(index.getX(i + 2));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i));\n }\n }\n if (newIndices.length / 3 !== numberOfTriangles) console.error(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.\");\n // build final geometry\n const newGeometry = geometry.clone();\n newGeometry.setIndex(newIndices);\n newGeometry.clearGroups();\n return newGeometry;\n } else {\n console.error(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:\", drawMode);\n return geometry;\n }\n}\n/**\n * Calculates the morphed attributes of a morphed/skinned BufferGeometry.\n * Helpful for Raytracing or Decals.\n * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.\n * @return {Object} An Object with original position/normal attributes and morphed ones.\n */ function $5451ea62abbe5f68$export$29e54e2e4ab904e7(object) {\n const _vA = new (0, $ilwiq.Vector3)();\n const _vB = new (0, $ilwiq.Vector3)();\n const _vC = new (0, $ilwiq.Vector3)();\n const _tempA = new (0, $ilwiq.Vector3)();\n const _tempB = new (0, $ilwiq.Vector3)();\n const _tempC = new (0, $ilwiq.Vector3)();\n const _morphA = new (0, $ilwiq.Vector3)();\n const _morphB = new (0, $ilwiq.Vector3)();\n const _morphC = new (0, $ilwiq.Vector3)();\n function _calculateMorphedAttributeData(object, attribute, morphAttribute, morphTargetsRelative, a, b, c, modifiedAttributeArray) {\n _vA.fromBufferAttribute(attribute, a);\n _vB.fromBufferAttribute(attribute, b);\n _vC.fromBufferAttribute(attribute, c);\n const morphInfluences = object.morphTargetInfluences;\n if (morphAttribute && morphInfluences) {\n _morphA.set(0, 0, 0);\n _morphB.set(0, 0, 0);\n _morphC.set(0, 0, 0);\n for(let i = 0, il = morphAttribute.length; i < il; i++){\n const influence = morphInfluences[i];\n const morph = morphAttribute[i];\n if (influence === 0) continue;\n _tempA.fromBufferAttribute(morph, a);\n _tempB.fromBufferAttribute(morph, b);\n _tempC.fromBufferAttribute(morph, c);\n if (morphTargetsRelative) {\n _morphA.addScaledVector(_tempA, influence);\n _morphB.addScaledVector(_tempB, influence);\n _morphC.addScaledVector(_tempC, influence);\n } else {\n _morphA.addScaledVector(_tempA.sub(_vA), influence);\n _morphB.addScaledVector(_tempB.sub(_vB), influence);\n _morphC.addScaledVector(_tempC.sub(_vC), influence);\n }\n }\n _vA.add(_morphA);\n _vB.add(_morphB);\n _vC.add(_morphC);\n }\n if (object.isSkinnedMesh) {\n object.applyBoneTransform(a, _vA);\n object.applyBoneTransform(b, _vB);\n object.applyBoneTransform(c, _vC);\n }\n modifiedAttributeArray[a * 3 + 0] = _vA.x;\n modifiedAttributeArray[a * 3 + 1] = _vA.y;\n modifiedAttributeArray[a * 3 + 2] = _vA.z;\n modifiedAttributeArray[b * 3 + 0] = _vB.x;\n modifiedAttributeArray[b * 3 + 1] = _vB.y;\n modifiedAttributeArray[b * 3 + 2] = _vB.z;\n modifiedAttributeArray[c * 3 + 0] = _vC.x;\n modifiedAttributeArray[c * 3 + 1] = _vC.y;\n modifiedAttributeArray[c * 3 + 2] = _vC.z;\n }\n const geometry = object.geometry;\n const material = object.material;\n let a, b, c;\n const index = geometry.index;\n const positionAttribute = geometry.attributes.position;\n const morphPosition = geometry.morphAttributes.position;\n const morphTargetsRelative = geometry.morphTargetsRelative;\n const normalAttribute = geometry.attributes.normal;\n const morphNormal = geometry.morphAttributes.position;\n const groups = geometry.groups;\n const drawRange = geometry.drawRange;\n let i, j, il, jl;\n let group;\n let start, end;\n const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize);\n const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize);\n if (index !== null) {\n // indexed buffer geometry\n if (Array.isArray(material)) for(i = 0, il = groups.length; i < il; i++){\n group = groups[i];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for(j = start, jl = end; j < jl; j += 3){\n a = index.getX(j);\n b = index.getX(j + 1);\n c = index.getX(j + 2);\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n else {\n start = Math.max(0, drawRange.start);\n end = Math.min(index.count, drawRange.start + drawRange.count);\n for(i = start, il = end; i < il; i += 3){\n a = index.getX(i);\n b = index.getX(i + 1);\n c = index.getX(i + 2);\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n } else {\n // non-indexed buffer geometry\n if (Array.isArray(material)) for(i = 0, il = groups.length; i < il; i++){\n group = groups[i];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for(j = start, jl = end; j < jl; j += 3){\n a = j;\n b = j + 1;\n c = j + 2;\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n else {\n start = Math.max(0, drawRange.start);\n end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for(i = start, il = end; i < il; i += 3){\n a = i;\n b = i + 1;\n c = i + 2;\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n }\n const morphedPositionAttribute = new (0, $ilwiq.Float32BufferAttribute)(modifiedPosition, 3);\n const morphedNormalAttribute = new (0, $ilwiq.Float32BufferAttribute)(modifiedNormal, 3);\n return {\n positionAttribute: positionAttribute,\n normalAttribute: normalAttribute,\n morphedPositionAttribute: morphedPositionAttribute,\n morphedNormalAttribute: morphedNormalAttribute\n };\n}\nfunction $5451ea62abbe5f68$export$8babbf41197098b1(geometry) {\n if (geometry.groups.length === 0) {\n console.warn(\"THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge.\");\n return geometry;\n }\n let groups = geometry.groups;\n // sort groups by material index\n groups = groups.sort((a, b)=>{\n if (a.materialIndex !== b.materialIndex) return a.materialIndex - b.materialIndex;\n return a.start - b.start;\n });\n // create index for non-indexed geometries\n if (geometry.getIndex() === null) {\n const positionAttribute = geometry.getAttribute(\"position\");\n const indices = [];\n for(let i = 0; i < positionAttribute.count; i += 3)indices.push(i, i + 1, i + 2);\n geometry.setIndex(indices);\n }\n // sort index\n const index = geometry.getIndex();\n const newIndices = [];\n for(let i = 0; i < groups.length; i++){\n const group = groups[i];\n const groupStart = group.start;\n const groupLength = groupStart + group.count;\n for(let j = groupStart; j < groupLength; j++)newIndices.push(index.getX(j));\n }\n geometry.dispose(); // Required to force buffer recreation\n geometry.setIndex(newIndices);\n // update groups indices\n let start = 0;\n for(let i = 0; i < groups.length; i++){\n const group = groups[i];\n group.start = start;\n start += group.count;\n }\n // merge groups\n let currentGroup = groups[0];\n geometry.groups = [\n currentGroup\n ];\n for(let i = 1; i < groups.length; i++){\n const group = groups[i];\n if (currentGroup.materialIndex === group.materialIndex) currentGroup.count += group.count;\n else {\n currentGroup = group;\n geometry.groups.push(currentGroup);\n }\n }\n return geometry;\n}\n/**\n * Modifies the supplied geometry if it is non-indexed, otherwise creates a new,\n * non-indexed geometry. Returns the geometry with smooth normals everywhere except\n * faces that meet at an angle greater than the crease angle.\n *\n * @param {BufferGeometry} geometry\n * @param {number} [creaseAngle]\n * @return {BufferGeometry}\n */ function $5451ea62abbe5f68$export$b525764477fc001f(geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {\n const creaseDot = Math.cos(creaseAngle);\n const hashMultiplier = (1 + 1e-10) * 1e2;\n // reusable vectors\n const verts = [\n new (0, $ilwiq.Vector3)(),\n new (0, $ilwiq.Vector3)(),\n new (0, $ilwiq.Vector3)()\n ];\n const tempVec1 = new (0, $ilwiq.Vector3)();\n const tempVec2 = new (0, $ilwiq.Vector3)();\n const tempNorm = new (0, $ilwiq.Vector3)();\n const tempNorm2 = new (0, $ilwiq.Vector3)();\n // hashes a vector\n function hashVertex(v) {\n const x = ~~(v.x * hashMultiplier);\n const y = ~~(v.y * hashMultiplier);\n const z = ~~(v.z * hashMultiplier);\n return `${x},${y},${z}`;\n }\n // BufferGeometry.toNonIndexed() warns if the geometry is non-indexed\n // and returns the original geometry\n const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;\n const posAttr = resultGeometry.attributes.position;\n const vertexMap = {};\n // find all the normals shared by commonly located vertices\n for(let i = 0, l = posAttr.count / 3; i < l; i++){\n const i3 = 3 * i;\n const a = verts[0].fromBufferAttribute(posAttr, i3 + 0);\n const b = verts[1].fromBufferAttribute(posAttr, i3 + 1);\n const c = verts[2].fromBufferAttribute(posAttr, i3 + 2);\n tempVec1.subVectors(c, b);\n tempVec2.subVectors(a, b);\n // add the normal to the map for all vertices\n const normal = new (0, $ilwiq.Vector3)().crossVectors(tempVec1, tempVec2).normalize();\n for(let n = 0; n < 3; n++){\n const vert = verts[n];\n const hash = hashVertex(vert);\n if (!(hash in vertexMap)) vertexMap[hash] = [];\n vertexMap[hash].push(normal);\n }\n }\n // average normals from all vertices that share a common location if they are within the\n // provided crease threshold\n const normalArray = new Float32Array(posAttr.count * 3);\n const normAttr = new (0, $ilwiq.BufferAttribute)(normalArray, 3, false);\n for(let i = 0, l = posAttr.count / 3; i < l; i++){\n // get the face normal for this vertex\n const i3 = 3 * i;\n const a = verts[0].fromBufferAttribute(posAttr, i3 + 0);\n const b = verts[1].fromBufferAttribute(posAttr, i3 + 1);\n const c = verts[2].fromBufferAttribute(posAttr, i3 + 2);\n tempVec1.subVectors(c, b);\n tempVec2.subVectors(a, b);\n tempNorm.crossVectors(tempVec1, tempVec2).normalize();\n // average all normals that meet the threshold and set the normal value\n for(let n = 0; n < 3; n++){\n const vert = verts[n];\n const hash = hashVertex(vert);\n const otherNormals = vertexMap[hash];\n tempNorm2.set(0, 0, 0);\n for(let k = 0, lk = otherNormals.length; k < lk; k++){\n const otherNorm = otherNormals[k];\n if (tempNorm.dot(otherNorm) > creaseDot) tempNorm2.add(otherNorm);\n }\n tempNorm2.normalize();\n normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z);\n }\n }\n resultGeometry.setAttribute(\"normal\", normAttr);\n return resultGeometry;\n}\nfunction $5451ea62abbe5f68$export$728c051ccdf8a702(geometries, useGroups = false) {\n console.warn(\"THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries().\"); // @deprecated, r151\n return $5451ea62abbe5f68$export$f06f69b3bf41d25c(geometries, useGroups);\n}\nfunction $5451ea62abbe5f68$export$c4eef4c1c9d34ea9(attributes) {\n console.warn(\"THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().\"); // @deprecated, r151\n return $5451ea62abbe5f68$export$9f98db6234c4bd78(attributes);\n}\n\n});\n\nparcelRequire.register(\"4CEV9\", function(module, exports) {\n$parcel$export(module.exports, \"ProjectionGenerator\", () => (parcelRequire(\"kTiqx\")).ProjectionGenerator);\n$parcel$export(module.exports, \"OUTPUT_BOTH\", () => (parcelRequire(\"l7uOa\")).OUTPUT_BOTH);\n$parcel$export(module.exports, \"SilhouetteGenerator\", () => (parcelRequire(\"l7uOa\")).SilhouetteGenerator);\nparcelRequire(\"kTiqx\");\nparcelRequire(\"l7uOa\");\n\n});\nparcelRequire.register(\"kTiqx\", function(module, exports) {\n\n$parcel$export(module.exports, \"ProjectionGenerator\", () => $03ecc30c21a1bb08$export$4776387f3c0e5209);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $6KVZ3 = parcelRequire(\"6KVZ3\");\n\nvar $bJKwC = parcelRequire(\"bJKwC\");\n\nvar $fNPnQ = parcelRequire(\"fNPnQ\");\n\nvar $33ViW = parcelRequire(\"33ViW\");\n\nvar $itkSV = parcelRequire(\"itkSV\");\n\nvar $64zt3 = parcelRequire(\"64zt3\");\n\nvar $iQQnd = parcelRequire(\"iQQnd\");\n\nvar $5zNJG = parcelRequire(\"5zNJG\");\n// these shared variables are not used across \"yield\" boundaries in the\n// generator so there's no risk of overwriting another tasks data\nconst $03ecc30c21a1bb08$var$DIST_THRESHOLD = 1e-10;\nconst $03ecc30c21a1bb08$var$UP_VECTOR = /* @__PURE__ */ new (0, $ilwiq.Vector3)(0, 1, 0);\nconst $03ecc30c21a1bb08$var$_beneathLine = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nconst $03ecc30c21a1bb08$var$_ray = /* @__PURE__ */ new (0, $ilwiq.Ray)();\nconst $03ecc30c21a1bb08$var$_vec = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $03ecc30c21a1bb08$var$_overlapLine = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nclass $03ecc30c21a1bb08$var$EdgeSet {\n constructor(){\n this.edges = [];\n }\n getLineGeometry(y = 0) {\n const edges = this.edges;\n const edgeArray = new Float32Array(edges.length * 6);\n let c = 0;\n for(let i = 0, l = edges.length; i < l; i++){\n const line = edges[i];\n edgeArray[c++] = line[0];\n edgeArray[c++] = y;\n edgeArray[c++] = line[2];\n edgeArray[c++] = line[3];\n edgeArray[c++] = y;\n edgeArray[c++] = line[5];\n }\n const edgeGeom = new (0, $ilwiq.BufferGeometry)();\n const edgeBuffer = new (0, $ilwiq.BufferAttribute)(edgeArray, 3, true);\n edgeGeom.setAttribute(\"position\", edgeBuffer);\n return edgeGeom;\n }\n}\nclass $03ecc30c21a1bb08$export$4776387f3c0e5209 {\n constructor(){\n this.sortEdges = true;\n this.iterationTime = 30;\n this.angleThreshold = 50;\n this.includeIntersectionEdges = true;\n }\n generateAsync(geometry, options = {}) {\n return new Promise((resolve, reject)=>{\n const { signal: signal } = options;\n const task = this.generate(geometry, options);\n run();\n function run() {\n if (signal && signal.aborted) reject(new Error(\"ProjectionGenerator: Process aborted via AbortSignal.\"));\n const result = task.next();\n if (result.done) resolve(result.value);\n else requestAnimationFrame(run);\n }\n });\n }\n *generate(bvh, options = {}) {\n const { onProgress: onProgress } = options;\n const { sortEdges: sortEdges, iterationTime: iterationTime, angleThreshold: angleThreshold, includeIntersectionEdges: includeIntersectionEdges } = this;\n if (bvh instanceof (0, $ilwiq.BufferGeometry)) bvh = new (0, $6KVZ3.MeshBVH)(bvh, {\n maxLeafTris: 1\n });\n const geometry = bvh.geometry;\n let edges = (0, $fNPnQ.generateEdges)(geometry, $03ecc30c21a1bb08$var$UP_VECTOR, angleThreshold);\n if (includeIntersectionEdges) {\n const results = yield* (0, $5zNJG.generateIntersectionEdges)(bvh, iterationTime);\n edges = edges.concat(results);\n }\n if (sortEdges) edges.sort((a, b)=>{\n return Math.min(a.start.y, a.end.y) - Math.min(b.start.y, b.end.y);\n });\n yield;\n // trim the candidate edges\n const finalEdges = new $03ecc30c21a1bb08$var$EdgeSet();\n let time = performance.now();\n for(let i = 0, l = edges.length; i < l; i++){\n const line = edges[i];\n if ((0, $bJKwC.isYProjectedLineDegenerate)(line)) continue;\n const lowestLineY = Math.min(line.start.y, line.end.y);\n const highestLineY = Math.max(line.start.y, line.end.y);\n const hiddenOverlaps = [];\n bvh.shapecast({\n intersectsBounds: (box)=>{\n // expand the bounding box to the bottom height of the line\n box.min.y = Math.min(lowestLineY - 1e-6, box.min.y);\n // get the line as a ray\n const { origin: origin, direction: direction } = $03ecc30c21a1bb08$var$_ray;\n origin.copy(line.start);\n line.delta(direction).normalize();\n // if the ray is inside the box then we intersect it\n if (box.containsPoint(origin)) return true;\n // check if the line segment intersects the box\n if ($03ecc30c21a1bb08$var$_ray.intersectBox(box, $03ecc30c21a1bb08$var$_vec)) return origin.distanceToSquared($03ecc30c21a1bb08$var$_vec) < line.distanceSq();\n return false;\n },\n intersectsTriangle: (tri)=>{\n // skip the triangle if the triangle is completely below the line\n const highestTriangleY = Math.max(tri.a.y, tri.b.y, tri.c.y);\n if (highestTriangleY <= lowestLineY) return false;\n // if the projected triangle is just a line then don't check it\n if ((0, $bJKwC.isYProjectedTriangleDegenerate)(tri)) return false;\n // if this line lies on a triangle edge then don't check for visual overlaps\n // with this triangle\n if ((0, $bJKwC.isLineTriangleEdge)(tri, line)) return false;\n // Retrieve the portion of line that is below the plane - and skip the triangle if none\n // of it is\n const lowestTriangleY = Math.min(tri.a.y, tri.b.y, tri.c.y);\n if (highestLineY < lowestTriangleY) $03ecc30c21a1bb08$var$_beneathLine.copy(line);\n else if (!(0, $itkSV.trimToBeneathTriPlane)(tri, line, $03ecc30c21a1bb08$var$_beneathLine)) return false;\n if ($03ecc30c21a1bb08$var$_beneathLine.distance() < $03ecc30c21a1bb08$var$DIST_THRESHOLD) return false;\n // compress the edge overlaps so we can easily tell if the whole edge is hidden already\n // and exit early\n if ((0, $64zt3.getProjectedLineOverlap)($03ecc30c21a1bb08$var$_beneathLine, tri, $03ecc30c21a1bb08$var$_overlapLine) && (0, $iQQnd.appendOverlapRange)(line, $03ecc30c21a1bb08$var$_overlapLine, hiddenOverlaps)) (0, $33ViW.compressEdgeOverlaps)(hiddenOverlaps);\n // if we're hiding the edge entirely now then skip further checks\n if (hiddenOverlaps.length !== 0) {\n const [d0, d1] = hiddenOverlaps[hiddenOverlaps.length - 1];\n return d0 === 0.0 && d1 === 1.0;\n }\n return false;\n }\n });\n // convert the overlap points to proper lines\n (0, $33ViW.overlapsToLines)(line, hiddenOverlaps, finalEdges.edges);\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n if (onProgress) {\n const progress = i / edges.length;\n onProgress(progress, finalEdges);\n }\n yield;\n time = performance.now();\n }\n }\n return finalEdges.getLineGeometry(0);\n }\n}\n\n});\nparcelRequire.register(\"6KVZ3\", function(module, exports) {\n\n$parcel$export(module.exports, \"MeshBVH\", () => $4eb4044e12c26831$export$9d614b3bc2c4eacf);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $alNGj = parcelRequire(\"alNGj\");\n\nvar $knbvI = parcelRequire(\"knbvI\");\n\nvar $lenTA = parcelRequire(\"lenTA\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $7EZfU = parcelRequire(\"7EZfU\");\n\nvar $8hs00 = parcelRequire(\"8hs00\");\n\nvar $8VlEg = parcelRequire(\"8VlEg\");\n\nvar $9Kyri = parcelRequire(\"9Kyri\");\n\nvar $ayHng = parcelRequire(\"ayHng\");\n\nvar $laUNa = parcelRequire(\"laUNa\");\n\nvar $1SnJR = parcelRequire(\"1SnJR\");\n\nvar $dhXUU = parcelRequire(\"dhXUU\");\n\nvar $dnRHH = parcelRequire(\"dnRHH\");\n\nvar $7AkHD = parcelRequire(\"7AkHD\");\n\nvar $gDpfV = parcelRequire(\"gDpfV\");\n\nvar $iERXt = parcelRequire(\"iERXt\");\n\nvar $kNP8c = parcelRequire(\"kNP8c\");\n\nvar $ZxvHI = parcelRequire(\"ZxvHI\");\n\nvar $bD1WL = parcelRequire(\"bD1WL\");\n\nvar $gUrAj = parcelRequire(\"gUrAj\");\n\nvar $86OmO = parcelRequire(\"86OmO\");\n\nvar $cSOJe = parcelRequire(\"cSOJe\");\nconst $4eb4044e12c26831$var$obb = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $4eb4044e12c26831$var$tempBox = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nclass $4eb4044e12c26831$export$9d614b3bc2c4eacf {\n static serialize(bvh, options = {}) {\n options = {\n cloneBuffers: true,\n ...options\n };\n const geometry = bvh.geometry;\n const rootData = bvh._roots;\n const indirectBuffer = bvh._indirectBuffer;\n const indexAttribute = geometry.getIndex();\n let result;\n if (options.cloneBuffers) result = {\n roots: rootData.map((root)=>root.slice()),\n index: indexAttribute.array.slice(),\n indirectBuffer: indirectBuffer ? indirectBuffer.slice() : null\n };\n else result = {\n roots: rootData,\n index: indexAttribute.array,\n indirectBuffer: indirectBuffer\n };\n return result;\n }\n static deserialize(data, geometry, options = {}) {\n options = {\n setIndex: true,\n indirect: Boolean(data.indirectBuffer),\n ...options\n };\n const { index: index, roots: roots, indirectBuffer: indirectBuffer } = data;\n const bvh = new $4eb4044e12c26831$export$9d614b3bc2c4eacf(geometry, {\n ...options,\n [(0, $alNGj.SKIP_GENERATION)]: true\n });\n bvh._roots = roots;\n bvh._indirectBuffer = indirectBuffer || null;\n if (options.setIndex) {\n const indexAttribute = geometry.getIndex();\n if (indexAttribute === null) {\n const newIndex = new (0, $ilwiq.BufferAttribute)(data.index, 1, false);\n geometry.setIndex(newIndex);\n } else if (indexAttribute.array !== index) {\n indexAttribute.array.set(index);\n indexAttribute.needsUpdate = true;\n }\n }\n return bvh;\n }\n get indirect() {\n return !!this._indirectBuffer;\n }\n constructor(geometry, options = {}){\n if (!geometry.isBufferGeometry) throw new Error(\"MeshBVH: Only BufferGeometries are supported.\");\n else if (geometry.index && geometry.index.isInterleavedBufferAttribute) throw new Error(\"MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.\");\n // default options\n options = Object.assign({\n strategy: (0, $alNGj.CENTER),\n maxDepth: 40,\n maxLeafTris: 10,\n verbose: true,\n useSharedArrayBuffer: false,\n setBoundingBox: true,\n onProgress: null,\n indirect: false,\n // undocumented options\n // Whether to skip generating the tree. Used for deserialization.\n [(0, $alNGj.SKIP_GENERATION)]: false\n }, options);\n if (options.useSharedArrayBuffer && !(0, $cSOJe.isSharedArrayBufferSupported)()) throw new Error(\"MeshBVH: SharedArrayBuffer is not available.\");\n // retain references to the geometry so we can use them it without having to\n // take a geometry reference in every function.\n this.geometry = geometry;\n this._roots = null;\n this._indirectBuffer = null;\n if (!options[0, $alNGj.SKIP_GENERATION]) {\n (0, $knbvI.buildPackedTree)(this, options);\n if (!geometry.boundingBox && options.setBoundingBox) geometry.boundingBox = this.getBoundingBox(new (0, $ilwiq.Box3)());\n }\n const { _indirectBuffer: _indirectBuffer } = this;\n this.resolveTriangleIndex = options.indirect ? (i)=>_indirectBuffer[i] : (i)=>i;\n }\n refit(nodeIndices = null) {\n const refitFunc = this.indirect ? (0, $iERXt.refit_indirect) : (0, $ayHng.refit);\n return refitFunc(this, nodeIndices);\n }\n traverse(callback, rootIndex = 0) {\n const buffer = this._roots[rootIndex];\n const uint32Array = new Uint32Array(buffer);\n const uint16Array = new Uint16Array(buffer);\n _traverse(0);\n function _traverse(node32Index, depth = 0) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $alNGj.IS_LEAFNODE_FLAG);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n callback(depth, isLeaf, new Float32Array(buffer, node32Index * 4, 6), offset, count);\n } else {\n // TODO: use node functions here\n const left = node32Index + (0, $alNGj.BYTES_PER_NODE) / 4;\n const right = uint32Array[node32Index + 6];\n const splitAxis = uint32Array[node32Index + 7];\n const stopTraversal = callback(depth, isLeaf, new Float32Array(buffer, node32Index * 4, 6), splitAxis);\n if (!stopTraversal) {\n _traverse(left, depth + 1);\n _traverse(right, depth + 1);\n }\n }\n }\n }\n /* Core Cast Functions */ raycast(ray, materialOrSide = (0, $ilwiq.FrontSide)) {\n const roots = this._roots;\n const geometry = this.geometry;\n const intersects = [];\n const isMaterial = materialOrSide.isMaterial;\n const isArrayMaterial = Array.isArray(materialOrSide);\n const groups = geometry.groups;\n const side = isMaterial ? materialOrSide.side : materialOrSide;\n const raycastFunc = this.indirect ? (0, $kNP8c.raycast_indirect) : (0, $laUNa.raycast);\n for(let i = 0, l = roots.length; i < l; i++){\n const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;\n const startCount = intersects.length;\n raycastFunc(this, i, materialSide, ray, intersects);\n if (isArrayMaterial) {\n const materialIndex = groups[i].materialIndex;\n for(let j = startCount, jl = intersects.length; j < jl; j++)intersects[j].face.materialIndex = materialIndex;\n }\n }\n return intersects;\n }\n raycastFirst(ray, materialOrSide = (0, $ilwiq.FrontSide)) {\n const roots = this._roots;\n const geometry = this.geometry;\n const isMaterial = materialOrSide.isMaterial;\n const isArrayMaterial = Array.isArray(materialOrSide);\n let closestResult = null;\n const groups = geometry.groups;\n const side = isMaterial ? materialOrSide.side : materialOrSide;\n const raycastFirstFunc = this.indirect ? (0, $ZxvHI.raycastFirst_indirect) : (0, $1SnJR.raycastFirst);\n for(let i = 0, l = roots.length; i < l; i++){\n const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;\n const result = raycastFirstFunc(this, i, materialSide, ray);\n if (result != null && (closestResult == null || result.distance < closestResult.distance)) {\n closestResult = result;\n if (isArrayMaterial) result.face.materialIndex = groups[i].materialIndex;\n }\n }\n return closestResult;\n }\n intersectsGeometry(otherGeometry, geomToMesh) {\n let result = false;\n const roots = this._roots;\n const intersectsGeometryFunc = this.indirect ? (0, $bD1WL.intersectsGeometry_indirect) : (0, $dhXUU.intersectsGeometry);\n for(let i = 0, l = roots.length; i < l; i++){\n result = intersectsGeometryFunc(this, i, otherGeometry, geomToMesh);\n if (result) break;\n }\n return result;\n }\n shapecast(callbacks) {\n const triangle = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n const iterateFunc = this.indirect ? (0, $gDpfV.iterateOverTriangles_indirect) : (0, $9Kyri.iterateOverTriangles);\n let { boundsTraverseOrder: boundsTraverseOrder, intersectsBounds: intersectsBounds, intersectsRange: intersectsRange, intersectsTriangle: intersectsTriangle } = callbacks;\n // wrap the intersectsRange function\n if (intersectsRange && intersectsTriangle) {\n const originalIntersectsRange = intersectsRange;\n intersectsRange = (offset, count, contained, depth, nodeIndex)=>{\n if (!originalIntersectsRange(offset, count, contained, depth, nodeIndex)) return iterateFunc(offset, count, this, intersectsTriangle, contained, depth, triangle);\n return true;\n };\n } else if (!intersectsRange) {\n if (intersectsTriangle) intersectsRange = (offset, count, contained, depth)=>{\n return iterateFunc(offset, count, this, intersectsTriangle, contained, depth, triangle);\n };\n else intersectsRange = (offset, count, contained)=>{\n return contained;\n };\n }\n // run shapecast\n let result = false;\n let byteOffset = 0;\n const roots = this._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n const root = roots[i];\n result = (0, $8hs00.shapecast)(this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);\n if (result) break;\n byteOffset += root.byteLength;\n }\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle);\n return result;\n }\n bvhcast(otherBvh, matrixToLocal, callbacks) {\n const bvhcastFunc = this.indirect ? (0, $86OmO.bvhcast_indirect) : (0, $7AkHD.bvhcast);\n return bvhcastFunc(this, otherBvh, matrixToLocal, callbacks);\n }\n /* Derived Cast Functions */ intersectsBox(box, boxToMesh) {\n $4eb4044e12c26831$var$obb.set(box.min, box.max, boxToMesh);\n $4eb4044e12c26831$var$obb.needsUpdate = true;\n return this.shapecast({\n intersectsBounds: (box)=>$4eb4044e12c26831$var$obb.intersectsBox(box),\n intersectsTriangle: (tri)=>$4eb4044e12c26831$var$obb.intersectsTriangle(tri)\n });\n }\n intersectsSphere(sphere) {\n return this.shapecast({\n intersectsBounds: (box)=>sphere.intersectsBox(box),\n intersectsTriangle: (tri)=>tri.intersectsSphere(sphere)\n });\n }\n closestPointToGeometry(otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n const closestPointToGeometryFunc = this.indirect ? (0, $gUrAj.closestPointToGeometry_indirect) : (0, $dnRHH.closestPointToGeometry);\n return closestPointToGeometryFunc(this, otherGeometry, geometryToBvh, target1, target2, minThreshold, maxThreshold);\n }\n closestPointToPoint(point, target = {}, minThreshold = 0, maxThreshold = Infinity) {\n return (0, $8VlEg.closestPointToPoint)(this, point, target, minThreshold, maxThreshold);\n }\n getBoundingBox(target) {\n target.makeEmpty();\n const roots = this._roots;\n roots.forEach((buffer)=>{\n (0, $eADNI.arrayToBox)(0, new Float32Array(buffer), $4eb4044e12c26831$var$tempBox);\n target.union($4eb4044e12c26831$var$tempBox);\n });\n return target;\n }\n}\n\n});\nparcelRequire.register(\"alNGj\", function(module, exports) {\n\n$parcel$export(module.exports, \"CENTER\", () => $78926744db4a8a3e$export$91c2158bc24c63d4);\n$parcel$export(module.exports, \"AVERAGE\", () => $78926744db4a8a3e$export$d3bfe4097a2a8542);\n$parcel$export(module.exports, \"SAH\", () => $78926744db4a8a3e$export$2b2cc3fb4f03d723);\n$parcel$export(module.exports, \"CONTAINED\", () => $78926744db4a8a3e$export$82ad94f0a038b67a);\n$parcel$export(module.exports, \"TRIANGLE_INTERSECT_COST\", () => $78926744db4a8a3e$export$22e1995328fd3cd9);\n$parcel$export(module.exports, \"TRAVERSAL_COST\", () => $78926744db4a8a3e$export$f4b101accf1b23d1);\n$parcel$export(module.exports, \"BYTES_PER_NODE\", () => $78926744db4a8a3e$export$a08e7d18fbc53be5);\n$parcel$export(module.exports, \"IS_LEAFNODE_FLAG\", () => $78926744db4a8a3e$export$661fddb62bfe0e42);\n$parcel$export(module.exports, \"FLOAT32_EPSILON\", () => $78926744db4a8a3e$export$859129fb5c8f4dc1);\n$parcel$export(module.exports, \"SKIP_GENERATION\", () => $78926744db4a8a3e$export$abef70518a11a6ba);\n// Split strategy constants\nconst $78926744db4a8a3e$export$91c2158bc24c63d4 = 0;\nconst $78926744db4a8a3e$export$d3bfe4097a2a8542 = 1;\nconst $78926744db4a8a3e$export$2b2cc3fb4f03d723 = 2;\nconst $78926744db4a8a3e$export$34b5498ca69d033 = 0;\nconst $78926744db4a8a3e$export$a26e00882057cd76 = 1;\nconst $78926744db4a8a3e$export$82ad94f0a038b67a = 2;\nconst $78926744db4a8a3e$export$22e1995328fd3cd9 = 1.25;\nconst $78926744db4a8a3e$export$f4b101accf1b23d1 = 1;\nconst $78926744db4a8a3e$export$a08e7d18fbc53be5 = 32;\nconst $78926744db4a8a3e$export$661fddb62bfe0e42 = 0xFFFF;\nconst $78926744db4a8a3e$export$859129fb5c8f4dc1 = Math.pow(2, -24);\nconst $78926744db4a8a3e$export$abef70518a11a6ba = Symbol(\"SKIP_GENERATION\");\n\n});\n\nparcelRequire.register(\"knbvI\", function(module, exports) {\n\n$parcel$export(module.exports, \"buildPackedTree\", () => $ed4ee2639a9fd94e$export$e63bca57f220b8e3);\n\nvar $5Gkg5 = parcelRequire(\"5Gkg5\");\n\nvar $6zZ33 = parcelRequire(\"6zZ33\");\n\nvar $4rNvL = parcelRequire(\"4rNvL\");\n\nvar $O2f62 = parcelRequire(\"O2f62\");\n\nvar $alNGj = parcelRequire(\"alNGj\");\n\nvar $8aRzr = parcelRequire(\"8aRzr\");\n\nvar $fe03E = parcelRequire(\"fe03E\");\nfunction $ed4ee2639a9fd94e$var$generateIndirectBuffer(geometry, useSharedArrayBuffer) {\n const triCount = (geometry.index ? geometry.index.count : geometry.attributes.position.count) / 3;\n const useUint32 = triCount > 2 ** 16;\n const byteCount = useUint32 ? 4 : 2;\n const buffer = useSharedArrayBuffer ? new SharedArrayBuffer(triCount * byteCount) : new ArrayBuffer(triCount * byteCount);\n const indirectBuffer = useUint32 ? new Uint32Array(buffer) : new Uint16Array(buffer);\n for(let i = 0, l = indirectBuffer.length; i < l; i++)indirectBuffer[i] = i;\n return indirectBuffer;\n}\nfunction $ed4ee2639a9fd94e$var$buildTree(bvh, options) {\n // Compute the full bounds of the geometry at the same time as triangle bounds because\n // we'll need it for the root bounds in the case with no groups and it should be fast here.\n // We can't use the geometry bounding box if it's available because it may be out of date.\n const geometry = bvh.geometry;\n const indexArray = geometry.index ? geometry.index.array : null;\n const maxDepth = options.maxDepth;\n const verbose = options.verbose;\n const maxLeafTris = options.maxLeafTris;\n const strategy = options.strategy;\n const onProgress = options.onProgress;\n const totalTriangles = (0, $5Gkg5.getTriCount)(geometry);\n const indirectBuffer = bvh._indirectBuffer;\n let reachedMaxDepth = false;\n const fullBounds = new Float32Array(6);\n const cacheCentroidBoundingData = new Float32Array(6);\n const triangleBounds = (0, $6zZ33.computeTriangleBounds)(geometry, fullBounds);\n const partionFunc = options.indirect ? (0, $fe03E.partition_indirect) : (0, $8aRzr.partition);\n const roots = [];\n const ranges = options.indirect ? (0, $5Gkg5.getFullGeometryRange)(geometry) : (0, $5Gkg5.getRootIndexRanges)(geometry);\n if (ranges.length === 1) {\n const range = ranges[0];\n const root = new (0, $O2f62.MeshBVHNode)();\n root.boundingData = fullBounds;\n (0, $6zZ33.getCentroidBounds)(triangleBounds, range.offset, range.count, cacheCentroidBoundingData);\n splitNode(root, range.offset, range.count, cacheCentroidBoundingData);\n roots.push(root);\n } else for (let range of ranges){\n const root = new (0, $O2f62.MeshBVHNode)();\n root.boundingData = new Float32Array(6);\n (0, $6zZ33.getBounds)(triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData);\n splitNode(root, range.offset, range.count, cacheCentroidBoundingData);\n roots.push(root);\n }\n return roots;\n function triggerProgress(trianglesProcessed) {\n if (onProgress) onProgress(trianglesProcessed / totalTriangles);\n }\n // either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\n // recording the offset and count of its triangles and writing them into the reordered geometry index.\n function splitNode(node, offset, count, centroidBoundingData = null, depth = 0) {\n if (!reachedMaxDepth && depth >= maxDepth) {\n reachedMaxDepth = true;\n if (verbose) {\n console.warn(`MeshBVH: Max depth of ${maxDepth} reached when generating BVH. Consider increasing maxDepth.`);\n console.warn(geometry);\n }\n }\n // early out if we've met our capacity\n if (count <= maxLeafTris || depth >= maxDepth) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n return node;\n }\n // Find where to split the volume\n const split = (0, $4rNvL.getOptimalSplit)(node.boundingData, centroidBoundingData, triangleBounds, offset, count, strategy);\n if (split.axis === -1) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n return node;\n }\n const splitOffset = partionFunc(indirectBuffer, indexArray, triangleBounds, offset, count, split);\n // create the two new child nodes\n if (splitOffset === offset || splitOffset === offset + count) {\n triggerProgress(offset + count);\n node.offset = offset;\n node.count = count;\n } else {\n node.splitAxis = split.axis;\n // create the left child and compute its bounding box\n const left = new (0, $O2f62.MeshBVHNode)();\n const lstart = offset;\n const lcount = splitOffset - offset;\n node.left = left;\n left.boundingData = new Float32Array(6);\n (0, $6zZ33.getBounds)(triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData);\n splitNode(left, lstart, lcount, cacheCentroidBoundingData, depth + 1);\n // repeat for right\n const right = new (0, $O2f62.MeshBVHNode)();\n const rstart = splitOffset;\n const rcount = count - lcount;\n node.right = right;\n right.boundingData = new Float32Array(6);\n (0, $6zZ33.getBounds)(triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData);\n splitNode(right, rstart, rcount, cacheCentroidBoundingData, depth + 1);\n }\n return node;\n }\n}\nfunction $ed4ee2639a9fd94e$export$e63bca57f220b8e3(bvh, options) {\n const geometry = bvh.geometry;\n if (options.indirect) {\n bvh._indirectBuffer = $ed4ee2639a9fd94e$var$generateIndirectBuffer(geometry, options.useSharedArrayBuffer);\n if ((0, $5Gkg5.hasGroupGaps)(geometry) && !options.verbose) console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the \"indirect\" option. BVH may incorrectly report intersections on unrendered portions of the geometry.');\n }\n if (!bvh._indirectBuffer) (0, $5Gkg5.ensureIndex)(geometry, options);\n // boundingData \t\t\t\t: 6 float32\n // right / offset \t\t\t\t: 1 uint32\n // splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\n const roots = $ed4ee2639a9fd94e$var$buildTree(bvh, options);\n let float32Array;\n let uint32Array;\n let uint16Array;\n const packedRoots = [];\n const BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n for(let i = 0; i < roots.length; i++){\n const root = roots[i];\n let nodeCount = countNodes(root);\n const buffer = new BufferConstructor((0, $alNGj.BYTES_PER_NODE) * nodeCount);\n float32Array = new Float32Array(buffer);\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n populateBuffer(0, root);\n packedRoots.push(buffer);\n }\n bvh._roots = packedRoots;\n return;\n function countNodes(node) {\n if (node.count) return 1;\n else return 1 + countNodes(node.left) + countNodes(node.right);\n }\n function populateBuffer(byteOffset, node) {\n const stride4Offset = byteOffset / 4;\n const stride2Offset = byteOffset / 2;\n const isLeaf = !!node.count;\n const boundingData = node.boundingData;\n for(let i = 0; i < 6; i++)float32Array[stride4Offset + i] = boundingData[i];\n if (isLeaf) {\n const offset = node.offset;\n const count = node.count;\n uint32Array[stride4Offset + 6] = offset;\n uint16Array[stride2Offset + 14] = count;\n uint16Array[stride2Offset + 15] = (0, $alNGj.IS_LEAFNODE_FLAG);\n return byteOffset + (0, $alNGj.BYTES_PER_NODE);\n } else {\n const left = node.left;\n const right = node.right;\n const splitAxis = node.splitAxis;\n let nextUnusedPointer;\n nextUnusedPointer = populateBuffer(byteOffset + (0, $alNGj.BYTES_PER_NODE), left);\n if (nextUnusedPointer / 4 > Math.pow(2, 32)) throw new Error(\"MeshBVH: Cannot store child pointer greater than 32 bits.\");\n uint32Array[stride4Offset + 6] = nextUnusedPointer / 4;\n nextUnusedPointer = populateBuffer(nextUnusedPointer, right);\n uint32Array[stride4Offset + 7] = splitAxis;\n return nextUnusedPointer;\n }\n }\n}\n\n});\nparcelRequire.register(\"5Gkg5\", function(module, exports) {\n\n$parcel$export(module.exports, \"getTriCount\", () => $423096e95cd96e19$export$c56c51fae37b2d63);\n$parcel$export(module.exports, \"ensureIndex\", () => $423096e95cd96e19$export$90fd303420808ebb);\n$parcel$export(module.exports, \"getFullGeometryRange\", () => $423096e95cd96e19$export$8c9d42783264c26e);\n$parcel$export(module.exports, \"getRootIndexRanges\", () => $423096e95cd96e19$export$fd7a16c461f5043c);\n$parcel$export(module.exports, \"hasGroupGaps\", () => $423096e95cd96e19$export$d3cf4eabab21775d);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nfunction $423096e95cd96e19$export$bb010cc24ecaa644(geo) {\n return geo.index ? geo.index.count : geo.attributes.position.count;\n}\nfunction $423096e95cd96e19$export$c56c51fae37b2d63(geo) {\n return $423096e95cd96e19$export$bb010cc24ecaa644(geo) / 3;\n}\nfunction $423096e95cd96e19$export$62808f0201824da2(vertexCount, BufferConstructor = ArrayBuffer) {\n if (vertexCount > 65535) return new Uint32Array(new BufferConstructor(4 * vertexCount));\n else return new Uint16Array(new BufferConstructor(2 * vertexCount));\n}\nfunction $423096e95cd96e19$export$90fd303420808ebb(geo, options) {\n if (!geo.index) {\n const vertexCount = geo.attributes.position.count;\n const BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n const index = $423096e95cd96e19$export$62808f0201824da2(vertexCount, BufferConstructor);\n geo.setIndex(new (0, $ilwiq.BufferAttribute)(index, 1));\n for(let i = 0; i < vertexCount; i++)index[i] = i;\n }\n}\nfunction $423096e95cd96e19$export$8c9d42783264c26e(geo) {\n const triCount = $423096e95cd96e19$export$c56c51fae37b2d63(geo);\n const drawRange = geo.drawRange;\n const start = drawRange.start / 3;\n const end = (drawRange.start + drawRange.count) / 3;\n const offset = Math.max(0, start);\n const count = Math.min(triCount, end) - offset;\n return [\n {\n offset: Math.floor(offset),\n count: Math.floor(count)\n }\n ];\n}\nfunction $423096e95cd96e19$export$fd7a16c461f5043c(geo) {\n if (!geo.groups || !geo.groups.length) return $423096e95cd96e19$export$8c9d42783264c26e(geo);\n const ranges = [];\n const rangeBoundaries = new Set();\n const drawRange = geo.drawRange;\n const drawRangeStart = drawRange.start / 3;\n const drawRangeEnd = (drawRange.start + drawRange.count) / 3;\n for (const group of geo.groups){\n const groupStart = group.start / 3;\n const groupEnd = (group.start + group.count) / 3;\n rangeBoundaries.add(Math.max(drawRangeStart, groupStart));\n rangeBoundaries.add(Math.min(drawRangeEnd, groupEnd));\n }\n // note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\n const sortedBoundaries = Array.from(rangeBoundaries.values()).sort((a, b)=>a - b);\n for(let i = 0; i < sortedBoundaries.length - 1; i++){\n const start = sortedBoundaries[i];\n const end = sortedBoundaries[i + 1];\n ranges.push({\n offset: Math.floor(start),\n count: Math.floor(end - start)\n });\n }\n return ranges;\n}\nfunction $423096e95cd96e19$export$d3cf4eabab21775d(geometry) {\n if (geometry.groups.length === 0) return false;\n const vertexCount = $423096e95cd96e19$export$c56c51fae37b2d63(geometry);\n const groups = $423096e95cd96e19$export$fd7a16c461f5043c(geometry).sort((a, b)=>a.offset - b.offset);\n const finalGroup = groups[groups.length - 1];\n finalGroup.count = Math.min(vertexCount - finalGroup.offset, finalGroup.count);\n let total = 0;\n groups.forEach(({ count: count })=>total += count);\n return vertexCount !== total;\n}\n\n});\n\nparcelRequire.register(\"6zZ33\", function(module, exports) {\n\n$parcel$export(module.exports, \"getBounds\", () => $4ca55de292e93eb1$export$becd1e645219fa23);\n$parcel$export(module.exports, \"getCentroidBounds\", () => $4ca55de292e93eb1$export$8eb05c58dc5aa2de);\n$parcel$export(module.exports, \"computeTriangleBounds\", () => $4ca55de292e93eb1$export$b3cc4d5d5179e78c);\n\nvar $alNGj = parcelRequire(\"alNGj\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $5Gkg5 = parcelRequire(\"5Gkg5\");\nfunction $4ca55de292e93eb1$export$becd1e645219fa23(triangleBounds, offset, count, target, centroidTarget = null) {\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n let cminx = Infinity;\n let cminy = Infinity;\n let cminz = Infinity;\n let cmaxx = -Infinity;\n let cmaxy = -Infinity;\n let cmaxz = -Infinity;\n const includeCentroid = centroidTarget !== null;\n for(let i = offset * 6, end = (offset + count) * 6; i < end; i += 6){\n const cx = triangleBounds[i + 0];\n const hx = triangleBounds[i + 1];\n const lx = cx - hx;\n const rx = cx + hx;\n if (lx < minx) minx = lx;\n if (rx > maxx) maxx = rx;\n if (includeCentroid && cx < cminx) cminx = cx;\n if (includeCentroid && cx > cmaxx) cmaxx = cx;\n const cy = triangleBounds[i + 2];\n const hy = triangleBounds[i + 3];\n const ly = cy - hy;\n const ry = cy + hy;\n if (ly < miny) miny = ly;\n if (ry > maxy) maxy = ry;\n if (includeCentroid && cy < cminy) cminy = cy;\n if (includeCentroid && cy > cmaxy) cmaxy = cy;\n const cz = triangleBounds[i + 4];\n const hz = triangleBounds[i + 5];\n const lz = cz - hz;\n const rz = cz + hz;\n if (lz < minz) minz = lz;\n if (rz > maxz) maxz = rz;\n if (includeCentroid && cz < cminz) cminz = cz;\n if (includeCentroid && cz > cmaxz) cmaxz = cz;\n }\n target[0] = minx;\n target[1] = miny;\n target[2] = minz;\n target[3] = maxx;\n target[4] = maxy;\n target[5] = maxz;\n if (includeCentroid) {\n centroidTarget[0] = cminx;\n centroidTarget[1] = cminy;\n centroidTarget[2] = cminz;\n centroidTarget[3] = cmaxx;\n centroidTarget[4] = cmaxy;\n centroidTarget[5] = cmaxz;\n }\n}\nfunction $4ca55de292e93eb1$export$8eb05c58dc5aa2de(triangleBounds, offset, count, centroidTarget) {\n let cminx = Infinity;\n let cminy = Infinity;\n let cminz = Infinity;\n let cmaxx = -Infinity;\n let cmaxy = -Infinity;\n let cmaxz = -Infinity;\n for(let i = offset * 6, end = (offset + count) * 6; i < end; i += 6){\n const cx = triangleBounds[i + 0];\n if (cx < cminx) cminx = cx;\n if (cx > cmaxx) cmaxx = cx;\n const cy = triangleBounds[i + 2];\n if (cy < cminy) cminy = cy;\n if (cy > cmaxy) cmaxy = cy;\n const cz = triangleBounds[i + 4];\n if (cz < cminz) cminz = cz;\n if (cz > cmaxz) cmaxz = cz;\n }\n centroidTarget[0] = cminx;\n centroidTarget[1] = cminy;\n centroidTarget[2] = cminz;\n centroidTarget[3] = cmaxx;\n centroidTarget[4] = cmaxy;\n centroidTarget[5] = cmaxz;\n}\nfunction $4ca55de292e93eb1$export$b3cc4d5d5179e78c(geo, fullBounds) {\n // clear the bounds to empty\n (0, $eADNI.makeEmptyBounds)(fullBounds);\n const posAttr = geo.attributes.position;\n const index = geo.index ? geo.index.array : null;\n const triCount = (0, $5Gkg5.getTriCount)(geo);\n const triangleBounds = new Float32Array(triCount * 6);\n const normalized = posAttr.normalized;\n // used for non-normalized positions\n const posArr = posAttr.array;\n // support for an interleaved position buffer\n const bufferOffset = posAttr.offset || 0;\n let stride = 3;\n if (posAttr.isInterleavedBufferAttribute) stride = posAttr.data.stride;\n // used for normalized positions\n const getters = [\n \"getX\",\n \"getY\",\n \"getZ\"\n ];\n for(let tri = 0; tri < triCount; tri++){\n const tri3 = tri * 3;\n const tri6 = tri * 6;\n let ai = tri3 + 0;\n let bi = tri3 + 1;\n let ci = tri3 + 2;\n if (index) {\n ai = index[ai];\n bi = index[bi];\n ci = index[ci];\n }\n // we add the stride and offset here since we access the array directly\n // below for the sake of performance\n if (!normalized) {\n ai = ai * stride + bufferOffset;\n bi = bi * stride + bufferOffset;\n ci = ci * stride + bufferOffset;\n }\n for(let el = 0; el < 3; el++){\n let a, b, c;\n if (normalized) {\n a = posAttr[getters[el]](ai);\n b = posAttr[getters[el]](bi);\n c = posAttr[getters[el]](ci);\n } else {\n a = posArr[ai + el];\n b = posArr[bi + el];\n c = posArr[ci + el];\n }\n let min = a;\n if (b < min) min = b;\n if (c < min) min = c;\n let max = a;\n if (b > max) max = b;\n if (c > max) max = c;\n // Increase the bounds size by float32 epsilon to avoid precision errors when\n // converting to 32 bit float. Scale the epsilon by the size of the numbers being\n // worked with.\n const halfExtents = (max - min) / 2;\n const el2 = el * 2;\n triangleBounds[tri6 + el2 + 0] = min + halfExtents;\n triangleBounds[tri6 + el2 + 1] = halfExtents + (Math.abs(min) + halfExtents) * (0, $alNGj.FLOAT32_EPSILON);\n if (min < fullBounds[el]) fullBounds[el] = min;\n if (max > fullBounds[el + 3]) fullBounds[el + 3] = max;\n }\n }\n return triangleBounds;\n}\n\n});\nparcelRequire.register(\"eADNI\", function(module, exports) {\n\n$parcel$export(module.exports, \"arrayToBox\", () => $a9f34d1ac25848aa$export$40b9a5e446bf11e0);\n$parcel$export(module.exports, \"makeEmptyBounds\", () => $a9f34d1ac25848aa$export$8737d658f04762d3);\n$parcel$export(module.exports, \"getLongestEdgeIndex\", () => $a9f34d1ac25848aa$export$dcdc414399b99746);\n$parcel$export(module.exports, \"copyBounds\", () => $a9f34d1ac25848aa$export$14b050a767b4a3a7);\n$parcel$export(module.exports, \"unionBounds\", () => $a9f34d1ac25848aa$export$a8a7063dce01a911);\n$parcel$export(module.exports, \"expandByTriangleBounds\", () => $a9f34d1ac25848aa$export$c989e53c4b24c2f5);\n$parcel$export(module.exports, \"computeSurfaceArea\", () => $a9f34d1ac25848aa$export$dbf4320364dc239e);\nfunction $a9f34d1ac25848aa$export$40b9a5e446bf11e0(nodeIndex32, array, target) {\n target.min.x = array[nodeIndex32];\n target.min.y = array[nodeIndex32 + 1];\n target.min.z = array[nodeIndex32 + 2];\n target.max.x = array[nodeIndex32 + 3];\n target.max.y = array[nodeIndex32 + 4];\n target.max.z = array[nodeIndex32 + 5];\n return target;\n}\nfunction $a9f34d1ac25848aa$export$8737d658f04762d3(target) {\n target[0] = target[1] = target[2] = Infinity;\n target[3] = target[4] = target[5] = -Infinity;\n}\nfunction $a9f34d1ac25848aa$export$dcdc414399b99746(bounds) {\n let splitDimIdx = -1;\n let splitDist = -Infinity;\n for(let i = 0; i < 3; i++){\n const dist = bounds[i + 3] - bounds[i];\n if (dist > splitDist) {\n splitDist = dist;\n splitDimIdx = i;\n }\n }\n return splitDimIdx;\n}\nfunction $a9f34d1ac25848aa$export$14b050a767b4a3a7(source, target) {\n target.set(source);\n}\nfunction $a9f34d1ac25848aa$export$a8a7063dce01a911(a, b, target) {\n let aVal, bVal;\n for(let d = 0; d < 3; d++){\n const d3 = d + 3;\n // set the minimum values\n aVal = a[d];\n bVal = b[d];\n target[d] = aVal < bVal ? aVal : bVal;\n // set the max values\n aVal = a[d3];\n bVal = b[d3];\n target[d3] = aVal > bVal ? aVal : bVal;\n }\n}\nfunction $a9f34d1ac25848aa$export$c989e53c4b24c2f5(startIndex, triangleBounds, bounds) {\n for(let d = 0; d < 3; d++){\n const tCenter = triangleBounds[startIndex + 2 * d];\n const tHalf = triangleBounds[startIndex + 2 * d + 1];\n const tMin = tCenter - tHalf;\n const tMax = tCenter + tHalf;\n if (tMin < bounds[d]) bounds[d] = tMin;\n if (tMax > bounds[d + 3]) bounds[d + 3] = tMax;\n }\n}\nfunction $a9f34d1ac25848aa$export$dbf4320364dc239e(bounds) {\n const d0 = bounds[3] - bounds[0];\n const d1 = bounds[4] - bounds[1];\n const d2 = bounds[5] - bounds[2];\n return 2 * (d0 * d1 + d1 * d2 + d2 * d0);\n}\n\n});\n\n\nparcelRequire.register(\"4rNvL\", function(module, exports) {\n\n$parcel$export(module.exports, \"getOptimalSplit\", () => $33d016ef2ae8a9ff$export$9e40712018083c80);\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $alNGj = parcelRequire(\"alNGj\");\nconst $33d016ef2ae8a9ff$var$BIN_COUNT = 32;\nconst $33d016ef2ae8a9ff$var$binsSort = (a, b)=>a.candidate - b.candidate;\nconst $33d016ef2ae8a9ff$var$sahBins = new Array($33d016ef2ae8a9ff$var$BIN_COUNT).fill().map(()=>{\n return {\n count: 0,\n bounds: new Float32Array(6),\n rightCacheBounds: new Float32Array(6),\n leftCacheBounds: new Float32Array(6),\n candidate: 0\n };\n});\nconst $33d016ef2ae8a9ff$var$leftBounds = new Float32Array(6);\nfunction $33d016ef2ae8a9ff$export$9e40712018083c80(nodeBoundingData, centroidBoundingData, triangleBounds, offset, count, strategy) {\n let axis = -1;\n let pos = 0;\n // Center\n if (strategy === (0, $alNGj.CENTER)) {\n axis = (0, $eADNI.getLongestEdgeIndex)(centroidBoundingData);\n if (axis !== -1) pos = (centroidBoundingData[axis] + centroidBoundingData[axis + 3]) / 2;\n } else if (strategy === (0, $alNGj.AVERAGE)) {\n axis = (0, $eADNI.getLongestEdgeIndex)(nodeBoundingData);\n if (axis !== -1) pos = $33d016ef2ae8a9ff$var$getAverage(triangleBounds, offset, count, axis);\n } else if (strategy === (0, $alNGj.SAH)) {\n const rootSurfaceArea = (0, $eADNI.computeSurfaceArea)(nodeBoundingData);\n let bestCost = (0, $alNGj.TRIANGLE_INTERSECT_COST) * count;\n // iterate over all axes\n const cStart = offset * 6;\n const cEnd = (offset + count) * 6;\n for(let a = 0; a < 3; a++){\n const axisLeft = centroidBoundingData[a];\n const axisRight = centroidBoundingData[a + 3];\n const axisLength = axisRight - axisLeft;\n const binWidth = axisLength / $33d016ef2ae8a9ff$var$BIN_COUNT;\n // If we have fewer triangles than we're planning to split then just check all\n // the triangle positions because it will be faster.\n if (count < $33d016ef2ae8a9ff$var$BIN_COUNT / 4) {\n // initialize the bin candidates\n const truncatedBins = [\n ...$33d016ef2ae8a9ff$var$sahBins\n ];\n truncatedBins.length = count;\n // set the candidates\n let b = 0;\n for(let c = cStart; c < cEnd; c += 6, b++){\n const bin = truncatedBins[b];\n bin.candidate = triangleBounds[c + 2 * a];\n bin.count = 0;\n const { bounds: bounds, leftCacheBounds: leftCacheBounds, rightCacheBounds: rightCacheBounds } = bin;\n for(let d = 0; d < 3; d++){\n rightCacheBounds[d] = Infinity;\n rightCacheBounds[d + 3] = -Infinity;\n leftCacheBounds[d] = Infinity;\n leftCacheBounds[d + 3] = -Infinity;\n bounds[d] = Infinity;\n bounds[d + 3] = -Infinity;\n }\n (0, $eADNI.expandByTriangleBounds)(c, triangleBounds, bounds);\n }\n truncatedBins.sort($33d016ef2ae8a9ff$var$binsSort);\n // remove redundant splits\n let splitCount = count;\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n while(bi + 1 < splitCount && truncatedBins[bi + 1].candidate === bin.candidate){\n truncatedBins.splice(bi + 1, 1);\n splitCount--;\n }\n }\n // find the appropriate bin for each triangle and expand the bounds.\n for(let c = cStart; c < cEnd; c += 6){\n const center = triangleBounds[c + 2 * a];\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n if (center >= bin.candidate) (0, $eADNI.expandByTriangleBounds)(c, triangleBounds, bin.rightCacheBounds);\n else {\n (0, $eADNI.expandByTriangleBounds)(c, triangleBounds, bin.leftCacheBounds);\n bin.count++;\n }\n }\n }\n // expand all the bounds\n for(let bi = 0; bi < splitCount; bi++){\n const bin = truncatedBins[bi];\n const leftCount = bin.count;\n const rightCount = count - bin.count;\n // check the cost of this split\n const leftBounds = bin.leftCacheBounds;\n const rightBounds = bin.rightCacheBounds;\n let leftProb = 0;\n if (leftCount !== 0) leftProb = (0, $eADNI.computeSurfaceArea)(leftBounds) / rootSurfaceArea;\n let rightProb = 0;\n if (rightCount !== 0) rightProb = (0, $eADNI.computeSurfaceArea)(rightBounds) / rootSurfaceArea;\n const cost = (0, $alNGj.TRAVERSAL_COST) + (0, $alNGj.TRIANGLE_INTERSECT_COST) * (leftProb * leftCount + rightProb * rightCount);\n if (cost < bestCost) {\n axis = a;\n bestCost = cost;\n pos = bin.candidate;\n }\n }\n } else {\n // reset the bins\n for(let i = 0; i < $33d016ef2ae8a9ff$var$BIN_COUNT; i++){\n const bin = $33d016ef2ae8a9ff$var$sahBins[i];\n bin.count = 0;\n bin.candidate = axisLeft + binWidth + i * binWidth;\n const bounds = bin.bounds;\n for(let d = 0; d < 3; d++){\n bounds[d] = Infinity;\n bounds[d + 3] = -Infinity;\n }\n }\n // iterate over all center positions\n for(let c = cStart; c < cEnd; c += 6){\n const triCenter = triangleBounds[c + 2 * a];\n const relativeCenter = triCenter - axisLeft;\n // in the partition function if the centroid lies on the split plane then it is\n // considered to be on the right side of the split\n let binIndex = ~~(relativeCenter / binWidth);\n if (binIndex >= $33d016ef2ae8a9ff$var$BIN_COUNT) binIndex = $33d016ef2ae8a9ff$var$BIN_COUNT - 1;\n const bin = $33d016ef2ae8a9ff$var$sahBins[binIndex];\n bin.count++;\n (0, $eADNI.expandByTriangleBounds)(c, triangleBounds, bin.bounds);\n }\n // cache the unioned bounds from right to left so we don't have to regenerate them each time\n const lastBin = $33d016ef2ae8a9ff$var$sahBins[$33d016ef2ae8a9ff$var$BIN_COUNT - 1];\n (0, $eADNI.copyBounds)(lastBin.bounds, lastBin.rightCacheBounds);\n for(let i = $33d016ef2ae8a9ff$var$BIN_COUNT - 2; i >= 0; i--){\n const bin = $33d016ef2ae8a9ff$var$sahBins[i];\n const nextBin = $33d016ef2ae8a9ff$var$sahBins[i + 1];\n (0, $eADNI.unionBounds)(bin.bounds, nextBin.rightCacheBounds, bin.rightCacheBounds);\n }\n let leftCount = 0;\n for(let i = 0; i < $33d016ef2ae8a9ff$var$BIN_COUNT - 1; i++){\n const bin = $33d016ef2ae8a9ff$var$sahBins[i];\n const binCount = bin.count;\n const bounds = bin.bounds;\n const nextBin = $33d016ef2ae8a9ff$var$sahBins[i + 1];\n const rightBounds = nextBin.rightCacheBounds;\n // don't do anything with the bounds if the new bounds have no triangles\n if (binCount !== 0) {\n if (leftCount === 0) (0, $eADNI.copyBounds)(bounds, $33d016ef2ae8a9ff$var$leftBounds);\n else (0, $eADNI.unionBounds)(bounds, $33d016ef2ae8a9ff$var$leftBounds, $33d016ef2ae8a9ff$var$leftBounds);\n }\n leftCount += binCount;\n // check the cost of this split\n let leftProb = 0;\n let rightProb = 0;\n if (leftCount !== 0) leftProb = (0, $eADNI.computeSurfaceArea)($33d016ef2ae8a9ff$var$leftBounds) / rootSurfaceArea;\n const rightCount = count - leftCount;\n if (rightCount !== 0) rightProb = (0, $eADNI.computeSurfaceArea)(rightBounds) / rootSurfaceArea;\n const cost = (0, $alNGj.TRAVERSAL_COST) + (0, $alNGj.TRIANGLE_INTERSECT_COST) * (leftProb * leftCount + rightProb * rightCount);\n if (cost < bestCost) {\n axis = a;\n bestCost = cost;\n pos = bin.candidate;\n }\n }\n }\n }\n } else console.warn(`MeshBVH: Invalid build strategy value ${strategy} used.`);\n return {\n axis: axis,\n pos: pos\n };\n}\n// returns the average coordinate on the specified axis of the all the provided triangles\nfunction $33d016ef2ae8a9ff$var$getAverage(triangleBounds, offset, count, axis) {\n let avg = 0;\n for(let i = offset, end = offset + count; i < end; i++)avg += triangleBounds[i * 6 + axis * 2];\n return avg / count;\n}\n\n});\n\nparcelRequire.register(\"O2f62\", function(module, exports) {\n\n$parcel$export(module.exports, \"MeshBVHNode\", () => $096668f03fbb5645$export$6f473cc5f89b0a1c);\nclass $096668f03fbb5645$export$6f473cc5f89b0a1c {\n constructor(){\n // internal nodes have boundingData, left, right, and splitAxis\n // leaf nodes have offset and count (referring to primitives in the mesh geometry)\n }\n}\n\n});\n\nparcelRequire.register(\"8aRzr\", function(module, exports) {\n\n$parcel$export(module.exports, \"partition\", () => $5f38cfeb5f7666c7$export$b29f828819edca8d);\n/********************************************************/ /* This file is generated from \"sortUtils.template.js\". */ /********************************************************/ // reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction $5f38cfeb5f7666c7$export$b29f828819edca8d(indirectBuffer, index, triangleBounds, offset, count, split) {\n let left = offset;\n let right = offset + count - 1;\n const pos = split.pos;\n const axisOffset = split.axis * 2;\n // hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n while(true){\n while(left <= right && triangleBounds[left * 6 + axisOffset] < pos)left++;\n // if a triangle center lies on the partition plane it is considered to be on the right side\n while(left <= right && triangleBounds[right * 6 + axisOffset] >= pos)right--;\n if (left < right) {\n // we need to swap all of the information associated with the triangles at index\n // left and right; that's the verts in the geometry index, the bounds,\n // and perhaps the SAH planes\n for(let i = 0; i < 3; i++){\n let t0 = index[left * 3 + i];\n index[left * 3 + i] = index[right * 3 + i];\n index[right * 3 + i] = t0;\n }\n // swap bounds\n for(let i = 0; i < 6; i++){\n let tb = triangleBounds[left * 6 + i];\n triangleBounds[left * 6 + i] = triangleBounds[right * 6 + i];\n triangleBounds[right * 6 + i] = tb;\n }\n left++;\n right--;\n } else return left;\n }\n}\n\n});\n\nparcelRequire.register(\"fe03E\", function(module, exports) {\n\n$parcel$export(module.exports, \"partition_indirect\", () => $b1583556301b54a3$export$7cee363d477551d0);\n/********************************************************/ /* This file is generated from \"sortUtils.template.js\". */ /********************************************************/ // reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction $b1583556301b54a3$export$7cee363d477551d0(indirectBuffer, index, triangleBounds, offset, count, split) {\n let left = offset;\n let right = offset + count - 1;\n const pos = split.pos;\n const axisOffset = split.axis * 2;\n // hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n while(true){\n while(left <= right && triangleBounds[left * 6 + axisOffset] < pos)left++;\n // if a triangle center lies on the partition plane it is considered to be on the right side\n while(left <= right && triangleBounds[right * 6 + axisOffset] >= pos)right--;\n if (left < right) {\n // we need to swap all of the information associated with the triangles at index\n // left and right; that's the verts in the geometry index, the bounds,\n // and perhaps the SAH planes\n let t = indirectBuffer[left];\n indirectBuffer[left] = indirectBuffer[right];\n indirectBuffer[right] = t;\n // swap bounds\n for(let i = 0; i < 6; i++){\n let tb = triangleBounds[left * 6 + i];\n triangleBounds[left * 6 + i] = triangleBounds[right * 6 + i];\n triangleBounds[right * 6 + i] = tb;\n }\n left++;\n right--;\n } else return left;\n }\n}\n\n});\n\n\nparcelRequire.register(\"lenTA\", function(module, exports) {\n\n$parcel$export(module.exports, \"OrientedBox\", () => $f74d70f31e44d1f9$export$4ccecd8ac6ee0e58);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $2OKGW = parcelRequire(\"2OKGW\");\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\n\nvar $f56Km = parcelRequire(\"f56Km\");\nclass $f74d70f31e44d1f9$export$4ccecd8ac6ee0e58 {\n constructor(min, max, matrix){\n this.isOrientedBox = true;\n this.min = new (0, $ilwiq.Vector3)();\n this.max = new (0, $ilwiq.Vector3)();\n this.matrix = new (0, $ilwiq.Matrix4)();\n this.invMatrix = new (0, $ilwiq.Matrix4)();\n this.points = new Array(8).fill().map(()=>new (0, $ilwiq.Vector3)());\n this.satAxes = new Array(3).fill().map(()=>new (0, $ilwiq.Vector3)());\n this.satBounds = new Array(3).fill().map(()=>new (0, $2OKGW.SeparatingAxisBounds)());\n this.alignedSatBounds = new Array(3).fill().map(()=>new (0, $2OKGW.SeparatingAxisBounds)());\n this.needsUpdate = false;\n if (min) this.min.copy(min);\n if (max) this.max.copy(max);\n if (matrix) this.matrix.copy(matrix);\n }\n set(min, max, matrix) {\n this.min.copy(min);\n this.max.copy(max);\n this.matrix.copy(matrix);\n this.needsUpdate = true;\n }\n copy(other) {\n this.min.copy(other.min);\n this.max.copy(other.max);\n this.matrix.copy(other.matrix);\n this.needsUpdate = true;\n }\n}\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.update = function() {\n return function update() {\n const matrix = this.matrix;\n const min = this.min;\n const max = this.max;\n const points = this.points;\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n const i = 1 * x | 2 * y | 4 * z;\n const v = points[i];\n v.x = x ? max.x : min.x;\n v.y = y ? max.y : min.y;\n v.z = z ? max.z : min.z;\n v.applyMatrix4(matrix);\n }\n }\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n const minVec = points[0];\n for(let i = 0; i < 3; i++){\n const axis = satAxes[i];\n const sb = satBounds[i];\n const index = 1 << i;\n const pi = points[index];\n axis.subVectors(minVec, pi);\n sb.setFromPoints(axis, points);\n }\n const alignedSatBounds = this.alignedSatBounds;\n alignedSatBounds[0].setFromPointsField(points, \"x\");\n alignedSatBounds[1].setFromPointsField(points, \"y\");\n alignedSatBounds[2].setFromPointsField(points, \"z\");\n this.invMatrix.copy(this.matrix).invert();\n this.needsUpdate = false;\n };\n}();\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.intersectsBox = function() {\n const aabbBounds = new (0, $2OKGW.SeparatingAxisBounds)();\n return function intersectsBox(box) {\n // TODO: should this be doing SAT against the AABB?\n if (this.needsUpdate) this.update();\n const min = box.min;\n const max = box.max;\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n const alignedSatBounds = this.alignedSatBounds;\n aabbBounds.min = min.x;\n aabbBounds.max = max.x;\n if (alignedSatBounds[0].isSeparated(aabbBounds)) return false;\n aabbBounds.min = min.y;\n aabbBounds.max = max.y;\n if (alignedSatBounds[1].isSeparated(aabbBounds)) return false;\n aabbBounds.min = min.z;\n aabbBounds.max = max.z;\n if (alignedSatBounds[2].isSeparated(aabbBounds)) return false;\n for(let i = 0; i < 3; i++){\n const axis = satAxes[i];\n const sb = satBounds[i];\n aabbBounds.setFromBox(axis, box);\n if (sb.isSeparated(aabbBounds)) return false;\n }\n return true;\n };\n}();\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.intersectsTriangle = function() {\n const saTri = new (0, $8VYkb.ExtendedTriangle)();\n const pointsArr = new Array(3);\n const cachedSatBounds = new (0, $2OKGW.SeparatingAxisBounds)();\n const cachedSatBounds2 = new (0, $2OKGW.SeparatingAxisBounds)();\n const cachedAxis = new (0, $ilwiq.Vector3)();\n return function intersectsTriangle(triangle) {\n if (this.needsUpdate) this.update();\n if (!triangle.isExtendedTriangle) {\n saTri.copy(triangle);\n saTri.update();\n triangle = saTri;\n } else if (triangle.needsUpdate) triangle.update();\n const satBounds = this.satBounds;\n const satAxes = this.satAxes;\n pointsArr[0] = triangle.a;\n pointsArr[1] = triangle.b;\n pointsArr[2] = triangle.c;\n for(let i = 0; i < 3; i++){\n const sb = satBounds[i];\n const sa = satAxes[i];\n cachedSatBounds.setFromPoints(sa, pointsArr);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n const triSatBounds = triangle.satBounds;\n const triSatAxes = triangle.satAxes;\n const points = this.points;\n for(let i = 0; i < 3; i++){\n const sb = triSatBounds[i];\n const sa = triSatAxes[i];\n cachedSatBounds.setFromPoints(sa, points);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n // check crossed axes\n for(let i = 0; i < 3; i++){\n const sa1 = satAxes[i];\n for(let i2 = 0; i2 < 4; i2++){\n const sa2 = triSatAxes[i2];\n cachedAxis.crossVectors(sa1, sa2);\n cachedSatBounds.setFromPoints(cachedAxis, pointsArr);\n cachedSatBounds2.setFromPoints(cachedAxis, points);\n if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;\n }\n }\n return true;\n };\n}();\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.closestPointToPoint = function() {\n return function closestPointToPoint(point, target1) {\n if (this.needsUpdate) this.update();\n target1.copy(point).applyMatrix4(this.invMatrix).clamp(this.min, this.max).applyMatrix4(this.matrix);\n return target1;\n };\n}();\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.distanceToPoint = function() {\n const target = new (0, $ilwiq.Vector3)();\n return function distanceToPoint(point) {\n this.closestPointToPoint(point, target);\n return point.distanceTo(target);\n };\n}();\n$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58.prototype.distanceToBox = function() {\n const xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n ];\n const segments1 = new Array(12).fill().map(()=>new (0, $ilwiq.Line3)());\n const segments2 = new Array(12).fill().map(()=>new (0, $ilwiq.Line3)());\n const point1 = new (0, $ilwiq.Vector3)();\n const point2 = new (0, $ilwiq.Vector3)();\n // early out if we find a value below threshold\n return function distanceToBox(box, threshold = 0, target1 = null, target2 = null) {\n if (this.needsUpdate) this.update();\n if (this.intersectsBox(box)) {\n if (target1 || target2) {\n box.getCenter(point2);\n this.closestPointToPoint(point2, point1);\n box.closestPointToPoint(point1, point2);\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n }\n return 0;\n }\n const threshold2 = threshold * threshold;\n const min = box.min;\n const max = box.max;\n const points = this.points;\n // iterate over every edge and compare distances\n let closestDistanceSq = Infinity;\n // check over all these points\n for(let i = 0; i < 8; i++){\n const p = points[i];\n point2.copy(p).clamp(min, max);\n const dist = p.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(p);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n // generate and check all line segment distances\n let count = 0;\n for(let i = 0; i < 3; i++){\n for(let i1 = 0; i1 <= 1; i1++)for(let i2 = 0; i2 <= 1; i2++){\n const nextIndex = (i + 1) % 3;\n const nextIndex2 = (i + 2) % 3;\n // get obb line segments\n const index = i1 << nextIndex | i2 << nextIndex2;\n const index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n const p1 = points[index];\n const p2 = points[index2];\n const line1 = segments1[count];\n line1.set(p1, p2);\n // get aabb line segments\n const f1 = xyzFields[i];\n const f2 = xyzFields[nextIndex];\n const f3 = xyzFields[nextIndex2];\n const line2 = segments2[count];\n const start = line2.start;\n const end = line2.end;\n start[f1] = min[f1];\n start[f2] = i1 ? min[f2] : max[f2];\n start[f3] = i2 ? min[f3] : max[f2];\n end[f1] = max[f1];\n end[f2] = i1 ? min[f2] : max[f2];\n end[f3] = i2 ? min[f3] : max[f2];\n count++;\n }\n }\n // check all the other boxes point\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n point2.x = x ? max.x : min.x;\n point2.y = y ? max.y : min.y;\n point2.z = z ? max.z : min.z;\n this.closestPointToPoint(point2, point1);\n const dist = point2.distanceToSquared(point1);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n }\n for(let i = 0; i < 12; i++){\n const l1 = segments1[i];\n for(let i2 = 0; i2 < 12; i2++){\n const l2 = segments2[i2];\n (0, $f56Km.closestPointsSegmentToSegment)(l1, l2, point1, point2);\n const dist = point1.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n if (dist < threshold2) return Math.sqrt(dist);\n }\n }\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n\n});\nparcelRequire.register(\"2OKGW\", function(module, exports) {\n\n$parcel$export(module.exports, \"SeparatingAxisBounds\", () => $20d478469c10be0c$export$f758e41ecdcd8e69);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nclass $20d478469c10be0c$export$f758e41ecdcd8e69 {\n constructor(){\n this.min = Infinity;\n this.max = -Infinity;\n }\n setFromPointsField(points, field) {\n let min = Infinity;\n let max = -Infinity;\n for(let i = 0, l = points.length; i < l; i++){\n const p = points[i];\n const val = p[field];\n min = val < min ? val : min;\n max = val > max ? val : max;\n }\n this.min = min;\n this.max = max;\n }\n setFromPoints(axis, points) {\n let min = Infinity;\n let max = -Infinity;\n for(let i = 0, l = points.length; i < l; i++){\n const p = points[i];\n const val = axis.dot(p);\n min = val < min ? val : min;\n max = val > max ? val : max;\n }\n this.min = min;\n this.max = max;\n }\n isSeparated(other) {\n return this.min > other.max || other.min > this.max;\n }\n}\n$20d478469c10be0c$export$f758e41ecdcd8e69.prototype.setFromBox = function() {\n const p = new (0, $ilwiq.Vector3)();\n return function setFromBox(axis, box) {\n const boxMin = box.min;\n const boxMax = box.max;\n let min = Infinity;\n let max = -Infinity;\n for(let x = 0; x <= 1; x++){\n for(let y = 0; y <= 1; y++)for(let z = 0; z <= 1; z++){\n p.x = boxMin.x * x + boxMax.x * (1 - x);\n p.y = boxMin.y * y + boxMax.y * (1 - y);\n p.z = boxMin.z * z + boxMax.z * (1 - z);\n const val = axis.dot(p);\n min = Math.min(val, min);\n max = Math.max(val, max);\n }\n }\n this.min = min;\n this.max = max;\n };\n}();\nconst $20d478469c10be0c$export$e086b7be1b4d1d36 = function() {\n const cacheSatBounds = new $20d478469c10be0c$export$f758e41ecdcd8e69();\n return function areIntersecting(shape1, shape2) {\n const points1 = shape1.points;\n const satAxes1 = shape1.satAxes;\n const satBounds1 = shape1.satBounds;\n const points2 = shape2.points;\n const satAxes2 = shape2.satAxes;\n const satBounds2 = shape2.satBounds;\n // check axes of the first shape\n for(let i = 0; i < 3; i++){\n const sb = satBounds1[i];\n const sa = satAxes1[i];\n cacheSatBounds.setFromPoints(sa, points2);\n if (sb.isSeparated(cacheSatBounds)) return false;\n }\n // check axes of the second shape\n for(let i = 0; i < 3; i++){\n const sb = satBounds2[i];\n const sa = satAxes2[i];\n cacheSatBounds.setFromPoints(sa, points1);\n if (sb.isSeparated(cacheSatBounds)) return false;\n }\n };\n}();\n\n});\n\nparcelRequire.register(\"8VYkb\", function(module, exports) {\n\n$parcel$export(module.exports, \"ExtendedTriangle\", () => $681270c6f2e9ebff$export$a37f7ec1c23dfacf);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $2OKGW = parcelRequire(\"2OKGW\");\n\nvar $f56Km = parcelRequire(\"f56Km\");\nconst $681270c6f2e9ebff$var$ZERO_EPSILON = 1e-15;\nfunction $681270c6f2e9ebff$var$isNearZero(value) {\n return Math.abs(value) < $681270c6f2e9ebff$var$ZERO_EPSILON;\n}\nclass $681270c6f2e9ebff$export$a37f7ec1c23dfacf extends (0, $ilwiq.Triangle) {\n constructor(...args){\n super(...args);\n this.isExtendedTriangle = true;\n this.satAxes = new Array(4).fill().map(()=>new (0, $ilwiq.Vector3)());\n this.satBounds = new Array(4).fill().map(()=>new (0, $2OKGW.SeparatingAxisBounds)());\n this.points = [\n this.a,\n this.b,\n this.c\n ];\n this.sphere = new (0, $ilwiq.Sphere)();\n this.plane = new (0, $ilwiq.Plane)();\n this.needsUpdate = true;\n }\n intersectsSphere(sphere) {\n return (0, $f56Km.sphereIntersectTriangle)(sphere, this);\n }\n update() {\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const points = this.points;\n const satAxes = this.satAxes;\n const satBounds = this.satBounds;\n const axis0 = satAxes[0];\n const sab0 = satBounds[0];\n this.getNormal(axis0);\n sab0.setFromPoints(axis0, points);\n const axis1 = satAxes[1];\n const sab1 = satBounds[1];\n axis1.subVectors(a, b);\n sab1.setFromPoints(axis1, points);\n const axis2 = satAxes[2];\n const sab2 = satBounds[2];\n axis2.subVectors(b, c);\n sab2.setFromPoints(axis2, points);\n const axis3 = satAxes[3];\n const sab3 = satBounds[3];\n axis3.subVectors(c, a);\n sab3.setFromPoints(axis3, points);\n this.sphere.setFromPoints(this.points);\n this.plane.setFromNormalAndCoplanarPoint(axis0, a);\n this.needsUpdate = false;\n }\n}\n$681270c6f2e9ebff$export$a37f7ec1c23dfacf.prototype.closestPointToSegment = function() {\n const point1 = new (0, $ilwiq.Vector3)();\n const point2 = new (0, $ilwiq.Vector3)();\n const edge = new (0, $ilwiq.Line3)();\n return function distanceToSegment(segment, target1 = null, target2 = null) {\n const { start: start, end: end } = segment;\n const points = this.points;\n let distSq;\n let closestDistanceSq = Infinity;\n // check the triangle edges\n for(let i = 0; i < 3; i++){\n const nexti = (i + 1) % 3;\n edge.start.copy(points[i]);\n edge.end.copy(points[nexti]);\n (0, $f56Km.closestPointsSegmentToSegment)(edge, segment, point1, point2);\n distSq = point1.distanceToSquared(point2);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(point2);\n }\n }\n // check end points\n this.closestPointToPoint(start, point1);\n distSq = start.distanceToSquared(point1);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(start);\n }\n this.closestPointToPoint(end, point1);\n distSq = end.distanceToSquared(point1);\n if (distSq < closestDistanceSq) {\n closestDistanceSq = distSq;\n if (target1) target1.copy(point1);\n if (target2) target2.copy(end);\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n$681270c6f2e9ebff$export$a37f7ec1c23dfacf.prototype.intersectsTriangle = function() {\n const saTri2 = new $681270c6f2e9ebff$export$a37f7ec1c23dfacf();\n const arr1 = new Array(3);\n const arr2 = new Array(3);\n const cachedSatBounds = new (0, $2OKGW.SeparatingAxisBounds)();\n const cachedSatBounds2 = new (0, $2OKGW.SeparatingAxisBounds)();\n const cachedAxis = new (0, $ilwiq.Vector3)();\n const dir = new (0, $ilwiq.Vector3)();\n const dir1 = new (0, $ilwiq.Vector3)();\n const dir2 = new (0, $ilwiq.Vector3)();\n const tempDir = new (0, $ilwiq.Vector3)();\n const edge = new (0, $ilwiq.Line3)();\n const edge1 = new (0, $ilwiq.Line3)();\n const edge2 = new (0, $ilwiq.Line3)();\n const tempPoint = new (0, $ilwiq.Vector3)();\n function triIntersectPlane(tri, plane, targetEdge) {\n // find the edge that intersects the other triangle plane\n const points = tri.points;\n let count = 0;\n let startPointIntersection = -1;\n for(let i = 0; i < 3; i++){\n const { start: start, end: end } = edge;\n start.copy(points[i]);\n end.copy(points[(i + 1) % 3]);\n edge.delta(dir);\n const startIntersects = $681270c6f2e9ebff$var$isNearZero(plane.distanceToPoint(start));\n if ($681270c6f2e9ebff$var$isNearZero(plane.normal.dot(dir)) && startIntersects) {\n // if the edge lies on the plane then take the line\n targetEdge.copy(edge);\n count = 2;\n break;\n }\n // check if the start point is near the plane because \"intersectLine\" is not robust to that case\n const doesIntersect = plane.intersectLine(edge, tempPoint);\n if (!doesIntersect && startIntersects) tempPoint.copy(start);\n // ignore the end point\n if ((doesIntersect || startIntersects) && !$681270c6f2e9ebff$var$isNearZero(tempPoint.distanceTo(end))) {\n if (count <= 1) {\n // assign to the start or end point and save which index was snapped to\n // the start point if necessary\n const point = count === 1 ? targetEdge.start : targetEdge.end;\n point.copy(tempPoint);\n if (startIntersects) startPointIntersection = count;\n } else if (count >= 2) {\n // if we're here that means that there must have been one point that had\n // snapped to the start point so replace it here\n const point = startPointIntersection === 1 ? targetEdge.start : targetEdge.end;\n point.copy(tempPoint);\n count = 2;\n break;\n }\n count++;\n if (count === 2 && startPointIntersection === -1) break;\n }\n }\n return count;\n }\n // TODO: If the triangles are coplanar and intersecting the target is nonsensical. It should at least\n // be a line contained by both triangles if not a different special case somehow represented in the return result.\n return function intersectsTriangle(other, target = null, suppressLog = false) {\n if (this.needsUpdate) this.update();\n if (!other.isExtendedTriangle) {\n saTri2.copy(other);\n saTri2.update();\n other = saTri2;\n } else if (other.needsUpdate) other.update();\n const plane1 = this.plane;\n const plane2 = other.plane;\n if (Math.abs(plane1.normal.dot(plane2.normal)) > 1.0 - 1e-10) {\n // perform separating axis intersection test only for coplanar triangles\n const satBounds1 = this.satBounds;\n const satAxes1 = this.satAxes;\n arr2[0] = other.a;\n arr2[1] = other.b;\n arr2[2] = other.c;\n for(let i = 0; i < 4; i++){\n const sb = satBounds1[i];\n const sa = satAxes1[i];\n cachedSatBounds.setFromPoints(sa, arr2);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n const satBounds2 = other.satBounds;\n const satAxes2 = other.satAxes;\n arr1[0] = this.a;\n arr1[1] = this.b;\n arr1[2] = this.c;\n for(let i = 0; i < 4; i++){\n const sb = satBounds2[i];\n const sa = satAxes2[i];\n cachedSatBounds.setFromPoints(sa, arr1);\n if (sb.isSeparated(cachedSatBounds)) return false;\n }\n // check crossed axes\n for(let i = 0; i < 4; i++){\n const sa1 = satAxes1[i];\n for(let i2 = 0; i2 < 4; i2++){\n const sa2 = satAxes2[i2];\n cachedAxis.crossVectors(sa1, sa2);\n cachedSatBounds.setFromPoints(cachedAxis, arr1);\n cachedSatBounds2.setFromPoints(cachedAxis, arr2);\n if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;\n }\n }\n if (target) {\n // TODO find two points that intersect on the edges and make that the result\n if (!suppressLog) console.warn(\"ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.\");\n target.start.set(0, 0, 0);\n target.end.set(0, 0, 0);\n }\n return true;\n } else {\n // find the edge that intersects the other triangle plane\n const count1 = triIntersectPlane(this, plane2, edge1);\n if (count1 === 1 && other.containsPoint(edge1.end)) {\n if (target) {\n target.start.copy(edge1.end);\n target.end.copy(edge1.end);\n }\n return true;\n } else if (count1 !== 2) return false;\n // find the other triangles edge that intersects this plane\n const count2 = triIntersectPlane(other, plane1, edge2);\n if (count2 === 1 && this.containsPoint(edge2.end)) {\n if (target) {\n target.start.copy(edge2.end);\n target.end.copy(edge2.end);\n }\n return true;\n } else if (count2 !== 2) return false;\n // find swap the second edge so both lines are running the same direction\n edge1.delta(dir1);\n edge2.delta(dir2);\n if (dir1.dot(dir2) < 0) {\n let tmp = edge2.start;\n edge2.start = edge2.end;\n edge2.end = tmp;\n }\n // check if the edges are overlapping\n const s1 = edge1.start.dot(dir1);\n const e1 = edge1.end.dot(dir1);\n const s2 = edge2.start.dot(dir1);\n const e2 = edge2.end.dot(dir1);\n const separated1 = e1 < s2;\n const separated2 = s1 < e2;\n if (s1 !== e2 && s2 !== e1 && separated1 === separated2) return false;\n // assign the target output\n if (target) {\n tempDir.subVectors(edge1.start, edge2.start);\n if (tempDir.dot(dir1) > 0) target.start.copy(edge1.start);\n else target.start.copy(edge2.start);\n tempDir.subVectors(edge1.end, edge2.end);\n if (tempDir.dot(dir1) < 0) target.end.copy(edge1.end);\n else target.end.copy(edge2.end);\n }\n return true;\n }\n };\n}();\n$681270c6f2e9ebff$export$a37f7ec1c23dfacf.prototype.distanceToPoint = function() {\n const target = new (0, $ilwiq.Vector3)();\n return function distanceToPoint(point) {\n this.closestPointToPoint(point, target);\n return point.distanceTo(target);\n };\n}();\n$681270c6f2e9ebff$export$a37f7ec1c23dfacf.prototype.distanceToTriangle = function() {\n const point = new (0, $ilwiq.Vector3)();\n const point2 = new (0, $ilwiq.Vector3)();\n const cornerFields = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const line1 = new (0, $ilwiq.Line3)();\n const line2 = new (0, $ilwiq.Line3)();\n return function distanceToTriangle(other, target1 = null, target2 = null) {\n const lineTarget = target1 || target2 ? line1 : null;\n if (this.intersectsTriangle(other, lineTarget)) {\n if (target1 || target2) {\n if (target1) lineTarget.getCenter(target1);\n if (target2) lineTarget.getCenter(target2);\n }\n return 0;\n }\n let closestDistanceSq = Infinity;\n // check all point distances\n for(let i = 0; i < 3; i++){\n let dist;\n const field = cornerFields[i];\n const otherVec = other[field];\n this.closestPointToPoint(otherVec, point);\n dist = otherVec.distanceToSquared(point);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point);\n if (target2) target2.copy(otherVec);\n }\n const thisVec = this[field];\n other.closestPointToPoint(thisVec, point);\n dist = thisVec.distanceToSquared(point);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(thisVec);\n if (target2) target2.copy(point);\n }\n }\n for(let i = 0; i < 3; i++){\n const f11 = cornerFields[i];\n const f12 = cornerFields[(i + 1) % 3];\n line1.set(this[f11], this[f12]);\n for(let i2 = 0; i2 < 3; i2++){\n const f21 = cornerFields[i2];\n const f22 = cornerFields[(i2 + 1) % 3];\n line2.set(other[f21], other[f22]);\n (0, $f56Km.closestPointsSegmentToSegment)(line1, line2, point, point2);\n const dist = point.distanceToSquared(point2);\n if (dist < closestDistanceSq) {\n closestDistanceSq = dist;\n if (target1) target1.copy(point);\n if (target2) target2.copy(point2);\n }\n }\n }\n return Math.sqrt(closestDistanceSq);\n };\n}();\n\n});\nparcelRequire.register(\"f56Km\", function(module, exports) {\n\n$parcel$export(module.exports, \"closestPointsSegmentToSegment\", () => $afac8e64b68760a8$export$b09f296caca7547a);\n$parcel$export(module.exports, \"sphereIntersectTriangle\", () => $afac8e64b68760a8$export$eed3a6606b3adc41);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $afac8e64b68760a8$export$479eef7c8f1b846c = function() {\n // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n const dir1 = new (0, $ilwiq.Vector3)();\n const dir2 = new (0, $ilwiq.Vector3)();\n const v02 = new (0, $ilwiq.Vector3)();\n return function closestPointLineToLine(l1, l2, result) {\n const v0 = l1.start;\n const v10 = dir1;\n const v2 = l2.start;\n const v32 = dir2;\n v02.subVectors(v0, v2);\n dir1.subVectors(l1.end, l1.start);\n dir2.subVectors(l2.end, l2.start);\n // float d0232 = v02.Dot(v32);\n const d0232 = v02.dot(v32);\n // float d3210 = v32.Dot(v10);\n const d3210 = v32.dot(v10);\n // float d3232 = v32.Dot(v32);\n const d3232 = v32.dot(v32);\n // float d0210 = v02.Dot(v10);\n const d0210 = v02.dot(v10);\n // float d1010 = v10.Dot(v10);\n const d1010 = v10.dot(v10);\n // float denom = d1010*d3232 - d3210*d3210;\n const denom = d1010 * d3232 - d3210 * d3210;\n let d, d2;\n if (denom !== 0) d = (d0232 * d3210 - d0210 * d3232) / denom;\n else d = 0;\n d2 = (d0232 + d * d3210) / d3232;\n result.x = d;\n result.y = d2;\n };\n}();\nconst $afac8e64b68760a8$export$b09f296caca7547a = function() {\n // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n const paramResult = new (0, $ilwiq.Vector2)();\n const temp1 = new (0, $ilwiq.Vector3)();\n const temp2 = new (0, $ilwiq.Vector3)();\n return function closestPointsSegmentToSegment(l1, l2, target1, target2) {\n $afac8e64b68760a8$export$479eef7c8f1b846c(l1, l2, paramResult);\n let d = paramResult.x;\n let d2 = paramResult.y;\n if (d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1) {\n l1.at(d, target1);\n l2.at(d2, target2);\n return;\n } else if (d >= 0 && d <= 1) {\n // Only d2 is out of bounds.\n if (d2 < 0) l2.at(0, target2);\n else l2.at(1, target2);\n l1.closestPointToPoint(target2, true, target1);\n return;\n } else if (d2 >= 0 && d2 <= 1) {\n // Only d is out of bounds.\n if (d < 0) l1.at(0, target1);\n else l1.at(1, target1);\n l2.closestPointToPoint(target1, true, target2);\n return;\n } else {\n // Both u and u2 are out of bounds.\n let p;\n if (d < 0) p = l1.start;\n else p = l1.end;\n let p2;\n if (d2 < 0) p2 = l2.start;\n else p2 = l2.end;\n const closestPoint = temp1;\n const closestPoint2 = temp2;\n l1.closestPointToPoint(p2, true, temp1);\n l2.closestPointToPoint(p, true, temp2);\n if (closestPoint.distanceToSquared(p2) <= closestPoint2.distanceToSquared(p)) {\n target1.copy(closestPoint);\n target2.copy(p2);\n return;\n } else {\n target1.copy(p);\n target2.copy(closestPoint2);\n return;\n }\n }\n };\n}();\nconst $afac8e64b68760a8$export$eed3a6606b3adc41 = function() {\n // https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n const closestPointTemp = new (0, $ilwiq.Vector3)();\n const projectedPointTemp = new (0, $ilwiq.Vector3)();\n const planeTemp = new (0, $ilwiq.Plane)();\n const lineTemp = new (0, $ilwiq.Line3)();\n return function sphereIntersectTriangle(sphere, triangle) {\n const { radius: radius, center: center } = sphere;\n const { a: a, b: b, c: c } = triangle;\n // phase 1\n lineTemp.start = a;\n lineTemp.end = b;\n const closestPoint1 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint1.distanceTo(center) <= radius) return true;\n lineTemp.start = a;\n lineTemp.end = c;\n const closestPoint2 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint2.distanceTo(center) <= radius) return true;\n lineTemp.start = b;\n lineTemp.end = c;\n const closestPoint3 = lineTemp.closestPointToPoint(center, true, closestPointTemp);\n if (closestPoint3.distanceTo(center) <= radius) return true;\n // phase 2\n const plane = triangle.getPlane(planeTemp);\n const dp = Math.abs(plane.distanceToPoint(center));\n if (dp <= radius) {\n const pp = plane.projectPoint(center, projectedPointTemp);\n const cp = triangle.containsPoint(pp);\n if (cp) return true;\n }\n return false;\n };\n}();\n\n});\n\n\n\nparcelRequire.register(\"7EZfU\", function(module, exports) {\n\n$parcel$export(module.exports, \"ExtendedTrianglePool\", () => $593bc8ef8d1a55fc$export$2622f4315304edad);\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\n\nvar $1l8b2 = parcelRequire(\"1l8b2\");\nclass $593bc8ef8d1a55fc$var$ExtendedTrianglePoolBase extends (0, $1l8b2.PrimitivePool) {\n constructor(){\n super(()=>new (0, $8VYkb.ExtendedTriangle)());\n }\n}\nconst $593bc8ef8d1a55fc$export$2622f4315304edad = /* @__PURE__ */ new $593bc8ef8d1a55fc$var$ExtendedTrianglePoolBase();\n\n});\nparcelRequire.register(\"1l8b2\", function(module, exports) {\n\n$parcel$export(module.exports, \"PrimitivePool\", () => $0f9e1864656e7fae$export$bf300c504651112a);\nclass $0f9e1864656e7fae$export$bf300c504651112a {\n constructor(getNewPrimitive){\n this._getNewPrimitive = getNewPrimitive;\n this._primitives = [];\n }\n getPrimitive() {\n const primitives = this._primitives;\n if (primitives.length === 0) return this._getNewPrimitive();\n else return primitives.pop();\n }\n releasePrimitive(primitive) {\n this._primitives.push(primitive);\n }\n}\n\n});\n\n\nparcelRequire.register(\"8hs00\", function(module, exports) {\n\n$parcel$export(module.exports, \"shapecast\", () => $6075a1513b66f4c0$export$963c78622ed2c172);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $alNGj = parcelRequire(\"alNGj\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $1l8b2 = parcelRequire(\"1l8b2\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\nlet $6075a1513b66f4c0$var$_box1, $6075a1513b66f4c0$var$_box2;\nconst $6075a1513b66f4c0$var$boxStack = [];\nconst $6075a1513b66f4c0$var$boxPool = /* @__PURE__ */ new (0, $1l8b2.PrimitivePool)(()=>new (0, $ilwiq.Box3)());\nfunction $6075a1513b66f4c0$export$963c78622ed2c172(bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset) {\n // setup\n $6075a1513b66f4c0$var$_box1 = $6075a1513b66f4c0$var$boxPool.getPrimitive();\n $6075a1513b66f4c0$var$_box2 = $6075a1513b66f4c0$var$boxPool.getPrimitive();\n $6075a1513b66f4c0$var$boxStack.push($6075a1513b66f4c0$var$_box1, $6075a1513b66f4c0$var$_box2);\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n const result = $6075a1513b66f4c0$var$shapecastTraverse(0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);\n // cleanup\n (0, $xqrrD.BufferStack).clearBuffer();\n $6075a1513b66f4c0$var$boxPool.releasePrimitive($6075a1513b66f4c0$var$_box1);\n $6075a1513b66f4c0$var$boxPool.releasePrimitive($6075a1513b66f4c0$var$_box2);\n $6075a1513b66f4c0$var$boxStack.pop();\n $6075a1513b66f4c0$var$boxStack.pop();\n const length = $6075a1513b66f4c0$var$boxStack.length;\n if (length > 0) {\n $6075a1513b66f4c0$var$_box2 = $6075a1513b66f4c0$var$boxStack[length - 1];\n $6075a1513b66f4c0$var$_box1 = $6075a1513b66f4c0$var$boxStack[length - 2];\n }\n return result;\n}\nfunction $6075a1513b66f4c0$var$shapecastTraverse(nodeIndex32, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc = null, nodeIndexByteOffset = 0, depth = 0) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(nodeIndex32), float32Array, $6075a1513b66f4c0$var$_box1);\n return intersectsRangeFunc(offset, count, false, depth, nodeIndexByteOffset + nodeIndex32, $6075a1513b66f4c0$var$_box1);\n } else {\n const left = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n const right = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n let c1 = left;\n let c2 = right;\n let score1, score2;\n let box1, box2;\n if (nodeScoreFunc) {\n box1 = $6075a1513b66f4c0$var$_box1;\n box2 = $6075a1513b66f4c0$var$_box2;\n // bounding data is not offset\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(c1), float32Array, box1);\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(c2), float32Array, box2);\n score1 = nodeScoreFunc(box1);\n score2 = nodeScoreFunc(box2);\n if (score2 < score1) {\n c1 = right;\n c2 = left;\n const temp = score1;\n score1 = score2;\n score2 = temp;\n box1 = box2;\n // box2 is always set before use below\n }\n }\n // Check box 1 intersection\n if (!box1) {\n box1 = $6075a1513b66f4c0$var$_box1;\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(c1), float32Array, box1);\n }\n const isC1Leaf = (0, $8x2iv.IS_LEAF)(c1 * 2, uint16Array);\n const c1Intersection = intersectsBoundsFunc(box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1);\n let c1StopTraversal;\n if (c1Intersection === (0, $alNGj.CONTAINED)) {\n const offset = getLeftOffset(c1);\n const end = getRightEndOffset(c1);\n const count = end - offset;\n c1StopTraversal = intersectsRangeFunc(offset, count, true, depth + 1, nodeIndexByteOffset + c1, box1);\n } else c1StopTraversal = c1Intersection && $6075a1513b66f4c0$var$shapecastTraverse(c1, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, nodeIndexByteOffset, depth + 1);\n if (c1StopTraversal) return true;\n // Check box 2 intersection\n // cached box2 will have been overwritten by previous traversal\n box2 = $6075a1513b66f4c0$var$_box2;\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(c2), float32Array, box2);\n const isC2Leaf = (0, $8x2iv.IS_LEAF)(c2 * 2, uint16Array);\n const c2Intersection = intersectsBoundsFunc(box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2);\n let c2StopTraversal;\n if (c2Intersection === (0, $alNGj.CONTAINED)) {\n const offset = getLeftOffset(c2);\n const end = getRightEndOffset(c2);\n const count = end - offset;\n c2StopTraversal = intersectsRangeFunc(offset, count, true, depth + 1, nodeIndexByteOffset + c2, box2);\n } else c2StopTraversal = c2Intersection && $6075a1513b66f4c0$var$shapecastTraverse(c2, geometry, intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, nodeIndexByteOffset, depth + 1);\n if (c2StopTraversal) return true;\n return false;\n // Define these inside the function so it has access to the local variables needed\n // when converting to the buffer equivalents\n function getLeftOffset(nodeIndex32) {\n const { uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n // traverse until we find a leaf\n while(!(0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array)){\n nodeIndex32 = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n nodeIndex16 = nodeIndex32 * 2;\n }\n return (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n }\n function getRightEndOffset(nodeIndex32) {\n const { uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n // traverse until we find a leaf\n while(!(0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array)){\n // adjust offset to point to the right node\n nodeIndex32 = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n nodeIndex16 = nodeIndex32 * 2;\n }\n // return the end offset of the triangle range\n return (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array) + (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n }\n }\n}\n\n});\nparcelRequire.register(\"8x2iv\", function(module, exports) {\n\n$parcel$export(module.exports, \"IS_LEAF\", () => $6363300ccf15b961$export$bc7cbaf27fbe938e);\n$parcel$export(module.exports, \"OFFSET\", () => $6363300ccf15b961$export$3231e969238304f3);\n$parcel$export(module.exports, \"COUNT\", () => $6363300ccf15b961$export$d61684373eacdf61);\n$parcel$export(module.exports, \"LEFT_NODE\", () => $6363300ccf15b961$export$7a68bc00425859d);\n$parcel$export(module.exports, \"RIGHT_NODE\", () => $6363300ccf15b961$export$4f44f52d9f75fa31);\n$parcel$export(module.exports, \"SPLIT_AXIS\", () => $6363300ccf15b961$export$b43717b3ca95505);\n$parcel$export(module.exports, \"BOUNDING_DATA_INDEX\", () => $6363300ccf15b961$export$b5b7e27a1440579d);\nfunction $6363300ccf15b961$export$bc7cbaf27fbe938e(n16, uint16Array) {\n return uint16Array[n16 + 15] === 0xFFFF;\n}\nfunction $6363300ccf15b961$export$3231e969238304f3(n32, uint32Array) {\n return uint32Array[n32 + 6];\n}\nfunction $6363300ccf15b961$export$d61684373eacdf61(n16, uint16Array) {\n return uint16Array[n16 + 14];\n}\nfunction $6363300ccf15b961$export$7a68bc00425859d(n32) {\n return n32 + 8;\n}\nfunction $6363300ccf15b961$export$4f44f52d9f75fa31(n32, uint32Array) {\n return uint32Array[n32 + 6];\n}\nfunction $6363300ccf15b961$export$b43717b3ca95505(n32, uint32Array) {\n return uint32Array[n32 + 7];\n}\nfunction $6363300ccf15b961$export$b5b7e27a1440579d(n32) {\n return n32;\n}\n\n});\n\nparcelRequire.register(\"xqrrD\", function(module, exports) {\n\n$parcel$export(module.exports, \"BufferStack\", () => $064797f1cfb48450$export$7451c73ce907854f);\nclass $064797f1cfb48450$var$_BufferStack {\n constructor(){\n this.float32Array = null;\n this.uint16Array = null;\n this.uint32Array = null;\n const stack = [];\n let prevBuffer = null;\n this.setBuffer = (buffer)=>{\n if (prevBuffer) stack.push(prevBuffer);\n prevBuffer = buffer;\n this.float32Array = new Float32Array(buffer);\n this.uint16Array = new Uint16Array(buffer);\n this.uint32Array = new Uint32Array(buffer);\n };\n this.clearBuffer = ()=>{\n prevBuffer = null;\n this.float32Array = null;\n this.uint16Array = null;\n this.uint32Array = null;\n if (stack.length !== 0) this.setBuffer(stack.pop());\n };\n }\n}\nconst $064797f1cfb48450$export$7451c73ce907854f = new $064797f1cfb48450$var$_BufferStack();\n\n});\n\n\nparcelRequire.register(\"8VlEg\", function(module, exports) {\n\n$parcel$export(module.exports, \"closestPointToPoint\", () => $67f4708097c33efc$export$96ec44700e587d99);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $67f4708097c33efc$var$temp = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $67f4708097c33efc$var$temp1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $67f4708097c33efc$export$96ec44700e587d99(bvh, point, target = {}, minThreshold = 0, maxThreshold = Infinity) {\n // early out if under minThreshold\n // skip checking if over maxThreshold\n // set minThreshold = maxThreshold to quickly check if a point is within a threshold\n // returns Infinity if no value found\n const minThresholdSq = minThreshold * minThreshold;\n const maxThresholdSq = maxThreshold * maxThreshold;\n let closestDistanceSq = Infinity;\n let closestDistanceTriIndex = null;\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n $67f4708097c33efc$var$temp.copy(point).clamp(box.min, box.max);\n return $67f4708097c33efc$var$temp.distanceToSquared(point);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistanceSq && score < maxThresholdSq;\n },\n intersectsTriangle: (tri, triIndex)=>{\n tri.closestPointToPoint(point, $67f4708097c33efc$var$temp);\n const distSq = point.distanceToSquared($67f4708097c33efc$var$temp);\n if (distSq < closestDistanceSq) {\n $67f4708097c33efc$var$temp1.copy($67f4708097c33efc$var$temp);\n closestDistanceSq = distSq;\n closestDistanceTriIndex = triIndex;\n }\n if (distSq < minThresholdSq) return true;\n else return false;\n }\n });\n if (closestDistanceSq === Infinity) return null;\n const closestDistance = Math.sqrt(closestDistanceSq);\n if (!target.point) target.point = $67f4708097c33efc$var$temp1.clone();\n else target.point.copy($67f4708097c33efc$var$temp1);\n target.distance = closestDistance, target.faceIndex = closestDistanceTriIndex;\n return target;\n}\n\n});\n\nparcelRequire.register(\"9Kyri\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectTris\", () => $01d4f4206273ed95$export$6f0a8fc5d2775a51);\n$parcel$export(module.exports, \"intersectClosestTri\", () => $01d4f4206273ed95$export$4331f2604b0bca4);\n$parcel$export(module.exports, \"iterateOverTriangles\", () => $01d4f4206273ed95$export$be1391b7aa79c0f6);\n\nvar $7pS02 = parcelRequire(\"7pS02\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n/*************************************************************/ /* This file is generated from \"iterationUtils.template.js\". */ /*************************************************************/ /* eslint-disable indent */ function $01d4f4206273ed95$export$6f0a8fc5d2775a51(bvh, side, ray, offset, count, intersections) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n for(let i = offset, end = offset + count; i < end; i++)(0, $7pS02.intersectTri)(geometry, side, ray, i, intersections);\n}\nfunction $01d4f4206273ed95$export$4331f2604b0bca4(bvh, side, ray, offset, count) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n let dist = Infinity;\n let res = null;\n for(let i = offset, end = offset + count; i < end; i++){\n let intersection;\n intersection = (0, $7pS02.intersectTri)(geometry, side, ray, i);\n if (intersection && intersection.distance < dist) {\n res = intersection;\n dist = intersection.distance;\n }\n }\n return res;\n}\nfunction $01d4f4206273ed95$export$be1391b7aa79c0f6(offset, count, bvh, intersectsTriangleFunc, contained, depth, triangle) {\n const { geometry: geometry } = bvh;\n const { index: index } = geometry;\n const pos = geometry.attributes.position;\n for(let i = offset, l = count + offset; i < l; i++){\n let tri;\n tri = i;\n (0, $dRxiJ.setTriangle)(triangle, tri * 3, index, pos);\n triangle.needsUpdate = true;\n if (intersectsTriangleFunc(triangle, tri, contained, depth)) return true;\n }\n return false;\n}\n\n});\nparcelRequire.register(\"7pS02\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectTri\", () => $5664c169f49816c4$export$1a557053019a130b);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n// Ripped and modified From THREE.js Mesh raycast\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\nconst $5664c169f49816c4$var$_vA = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_vB = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_vC = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_uvA = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nconst $5664c169f49816c4$var$_uvB = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nconst $5664c169f49816c4$var$_uvC = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nconst $5664c169f49816c4$var$_normalA = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_normalB = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_normalC = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $5664c169f49816c4$var$_intersectionPoint = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $5664c169f49816c4$var$checkIntersection(ray, pA, pB, pC, point, side) {\n let intersect;\n if (side === (0, $ilwiq.BackSide)) intersect = ray.intersectTriangle(pC, pB, pA, true, point);\n else intersect = ray.intersectTriangle(pA, pB, pC, side !== (0, $ilwiq.DoubleSide), point);\n if (intersect === null) return null;\n const distance = ray.origin.distanceTo(point);\n return {\n distance: distance,\n point: point.clone()\n };\n}\nfunction $5664c169f49816c4$var$checkBufferGeometryIntersection(ray, position, normal, uv, uv1, a, b, c, side) {\n $5664c169f49816c4$var$_vA.fromBufferAttribute(position, a);\n $5664c169f49816c4$var$_vB.fromBufferAttribute(position, b);\n $5664c169f49816c4$var$_vC.fromBufferAttribute(position, c);\n const intersection = $5664c169f49816c4$var$checkIntersection(ray, $5664c169f49816c4$var$_vA, $5664c169f49816c4$var$_vB, $5664c169f49816c4$var$_vC, $5664c169f49816c4$var$_intersectionPoint, side);\n if (intersection) {\n if (uv) {\n $5664c169f49816c4$var$_uvA.fromBufferAttribute(uv, a);\n $5664c169f49816c4$var$_uvB.fromBufferAttribute(uv, b);\n $5664c169f49816c4$var$_uvC.fromBufferAttribute(uv, c);\n intersection.uv = (0, $ilwiq.Triangle).getInterpolation($5664c169f49816c4$var$_intersectionPoint, $5664c169f49816c4$var$_vA, $5664c169f49816c4$var$_vB, $5664c169f49816c4$var$_vC, $5664c169f49816c4$var$_uvA, $5664c169f49816c4$var$_uvB, $5664c169f49816c4$var$_uvC, new (0, $ilwiq.Vector2)());\n }\n if (uv1) {\n $5664c169f49816c4$var$_uvA.fromBufferAttribute(uv1, a);\n $5664c169f49816c4$var$_uvB.fromBufferAttribute(uv1, b);\n $5664c169f49816c4$var$_uvC.fromBufferAttribute(uv1, c);\n intersection.uv1 = (0, $ilwiq.Triangle).getInterpolation($5664c169f49816c4$var$_intersectionPoint, $5664c169f49816c4$var$_vA, $5664c169f49816c4$var$_vB, $5664c169f49816c4$var$_vC, $5664c169f49816c4$var$_uvA, $5664c169f49816c4$var$_uvB, $5664c169f49816c4$var$_uvC, new (0, $ilwiq.Vector2)());\n }\n if (normal) {\n $5664c169f49816c4$var$_normalA.fromBufferAttribute(normal, a);\n $5664c169f49816c4$var$_normalB.fromBufferAttribute(normal, b);\n $5664c169f49816c4$var$_normalC.fromBufferAttribute(normal, c);\n intersection.normal = (0, $ilwiq.Triangle).getInterpolation($5664c169f49816c4$var$_intersectionPoint, $5664c169f49816c4$var$_vA, $5664c169f49816c4$var$_vB, $5664c169f49816c4$var$_vC, $5664c169f49816c4$var$_normalA, $5664c169f49816c4$var$_normalB, $5664c169f49816c4$var$_normalC, new (0, $ilwiq.Vector3)());\n if (intersection.normal.dot(ray.direction) > 0) intersection.normal.multiplyScalar(-1);\n }\n const face = {\n a: a,\n b: b,\n c: c,\n normal: new (0, $ilwiq.Vector3)(),\n materialIndex: 0\n };\n (0, $ilwiq.Triangle).getNormal($5664c169f49816c4$var$_vA, $5664c169f49816c4$var$_vB, $5664c169f49816c4$var$_vC, face.normal);\n intersection.face = face;\n intersection.faceIndex = a;\n }\n return intersection;\n}\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\nfunction $5664c169f49816c4$export$1a557053019a130b(geo, side, ray, tri, intersections) {\n const triOffset = tri * 3;\n let a = triOffset + 0;\n let b = triOffset + 1;\n let c = triOffset + 2;\n const index = geo.index;\n if (geo.index) {\n a = index.getX(a);\n b = index.getX(b);\n c = index.getX(c);\n }\n const { position: position, normal: normal, uv: uv, uv1: uv1 } = geo.attributes;\n const intersection = $5664c169f49816c4$var$checkBufferGeometryIntersection(ray, position, normal, uv, uv1, a, b, c, side);\n if (intersection) {\n intersection.faceIndex = tri;\n if (intersections) intersections.push(intersection);\n return intersection;\n }\n return null;\n}\n\n});\n\nparcelRequire.register(\"dRxiJ\", function(module, exports) {\n\n$parcel$export(module.exports, \"setTriangle\", () => $a17a0e7ef0b826e6$export$32f7fa781964ae30);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nfunction $a17a0e7ef0b826e6$export$32f7fa781964ae30(tri, i, index, pos) {\n const ta = tri.a;\n const tb = tri.b;\n const tc = tri.c;\n let i0 = i;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n ta.x = pos.getX(i0);\n ta.y = pos.getY(i0);\n ta.z = pos.getZ(i0);\n tb.x = pos.getX(i1);\n tb.y = pos.getY(i1);\n tb.z = pos.getZ(i1);\n tc.x = pos.getX(i2);\n tc.y = pos.getY(i2);\n tc.z = pos.getZ(i2);\n}\nconst $a17a0e7ef0b826e6$var$tempV1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $a17a0e7ef0b826e6$var$tempV2 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $a17a0e7ef0b826e6$var$tempV3 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $a17a0e7ef0b826e6$var$tempUV1 = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nconst $a17a0e7ef0b826e6$var$tempUV2 = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nconst $a17a0e7ef0b826e6$var$tempUV3 = /* @__PURE__ */ new (0, $ilwiq.Vector2)();\nfunction $a17a0e7ef0b826e6$export$d3cf03f2575167ef(point, geometry, triangleIndex, target) {\n const indices = geometry.getIndex().array;\n const positions = geometry.getAttribute(\"position\");\n const uvs = geometry.getAttribute(\"uv\");\n const a = indices[triangleIndex * 3];\n const b = indices[triangleIndex * 3 + 1];\n const c = indices[triangleIndex * 3 + 2];\n $a17a0e7ef0b826e6$var$tempV1.fromBufferAttribute(positions, a);\n $a17a0e7ef0b826e6$var$tempV2.fromBufferAttribute(positions, b);\n $a17a0e7ef0b826e6$var$tempV3.fromBufferAttribute(positions, c);\n // find the associated material index\n let materialIndex = 0;\n const groups = geometry.groups;\n const firstVertexIndex = triangleIndex * 3;\n for(let i = 0, l = groups.length; i < l; i++){\n const group = groups[i];\n const { start: start, count: count } = group;\n if (firstVertexIndex >= start && firstVertexIndex < start + count) {\n materialIndex = group.materialIndex;\n break;\n }\n }\n // extract uvs\n let uv = null;\n if (uvs) {\n $a17a0e7ef0b826e6$var$tempUV1.fromBufferAttribute(uvs, a);\n $a17a0e7ef0b826e6$var$tempUV2.fromBufferAttribute(uvs, b);\n $a17a0e7ef0b826e6$var$tempUV3.fromBufferAttribute(uvs, c);\n if (target && target.uv) uv = target.uv;\n else uv = new (0, $ilwiq.Vector2)();\n (0, $ilwiq.Triangle).getInterpolation(point, $a17a0e7ef0b826e6$var$tempV1, $a17a0e7ef0b826e6$var$tempV2, $a17a0e7ef0b826e6$var$tempV3, $a17a0e7ef0b826e6$var$tempUV1, $a17a0e7ef0b826e6$var$tempUV2, $a17a0e7ef0b826e6$var$tempUV3, uv);\n }\n // adjust the provided target or create a new one\n if (target) {\n if (!target.face) target.face = {};\n target.face.a = a;\n target.face.b = b;\n target.face.c = c;\n target.face.materialIndex = materialIndex;\n if (!target.face.normal) target.face.normal = new (0, $ilwiq.Vector3)();\n (0, $ilwiq.Triangle).getNormal($a17a0e7ef0b826e6$var$tempV1, $a17a0e7ef0b826e6$var$tempV2, $a17a0e7ef0b826e6$var$tempV3, target.face.normal);\n if (uv) target.uv = uv;\n return target;\n } else return {\n face: {\n a: a,\n b: b,\n c: c,\n materialIndex: materialIndex,\n normal: (0, $ilwiq.Triangle).getNormal($a17a0e7ef0b826e6$var$tempV1, $a17a0e7ef0b826e6$var$tempV2, $a17a0e7ef0b826e6$var$tempV3, new (0, $ilwiq.Vector3)())\n },\n uv: uv\n };\n}\n\n});\n\n\nparcelRequire.register(\"ayHng\", function(module, exports) {\n\n$parcel$export(module.exports, \"refit\", () => $7afeb992771d32d5$export$8eb1eda96b2e6d7a);\n\nvar $alNGj = parcelRequire(\"alNGj\");\n/****************************************************/ /* This file is generated from \"refit.template.js\". */ /****************************************************/ function $7afeb992771d32d5$export$8eb1eda96b2e6d7a(bvh, nodeIndices = null) {\n if (nodeIndices && Array.isArray(nodeIndices)) nodeIndices = new Set(nodeIndices);\n const geometry = bvh.geometry;\n const indexArr = geometry.index ? geometry.index.array : null;\n const posAttr = geometry.attributes.position;\n let buffer, uint32Array, uint16Array, float32Array;\n let byteOffset = 0;\n const roots = bvh._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n buffer = roots[i];\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n float32Array = new Float32Array(buffer);\n _traverse(0, byteOffset);\n byteOffset += buffer.byteLength;\n }\n function _traverse(node32Index, byteOffset, force = false) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $alNGj.IS_LEAFNODE_FLAG);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n for(let i = 3 * offset, l = 3 * (offset + count); i < l; i++){\n let index = indexArr[i];\n const x = posAttr.getX(index);\n const y = posAttr.getY(index);\n const z = posAttr.getZ(index);\n if (x < minx) minx = x;\n if (x > maxx) maxx = x;\n if (y < miny) miny = y;\n if (y > maxy) maxy = y;\n if (z < minz) minz = z;\n if (z > maxz) maxz = z;\n }\n if (float32Array[node32Index + 0] !== minx || float32Array[node32Index + 1] !== miny || float32Array[node32Index + 2] !== minz || float32Array[node32Index + 3] !== maxx || float32Array[node32Index + 4] !== maxy || float32Array[node32Index + 5] !== maxz) {\n float32Array[node32Index + 0] = minx;\n float32Array[node32Index + 1] = miny;\n float32Array[node32Index + 2] = minz;\n float32Array[node32Index + 3] = maxx;\n float32Array[node32Index + 4] = maxy;\n float32Array[node32Index + 5] = maxz;\n return true;\n } else return false;\n } else {\n const left = node32Index + 8;\n const right = uint32Array[node32Index + 6];\n // the identifying node indices provided by the shapecast function include offsets of all\n // root buffers to guarantee they're unique between roots so offset left and right indices here.\n const offsetLeft = left + byteOffset;\n const offsetRight = right + byteOffset;\n let forceChildren = force;\n let includesLeft = false;\n let includesRight = false;\n if (nodeIndices) // if we see that neither the left or right child are included in the set that need to be updated\n // then we assume that all children need to be updated.\n {\n if (!forceChildren) {\n includesLeft = nodeIndices.has(offsetLeft);\n includesRight = nodeIndices.has(offsetRight);\n forceChildren = !includesLeft && !includesRight;\n }\n } else {\n includesLeft = true;\n includesRight = true;\n }\n const traverseLeft = forceChildren || includesLeft;\n const traverseRight = forceChildren || includesRight;\n let leftChange = false;\n if (traverseLeft) leftChange = _traverse(left, byteOffset, forceChildren);\n let rightChange = false;\n if (traverseRight) rightChange = _traverse(right, byteOffset, forceChildren);\n const didChange = leftChange || rightChange;\n if (didChange) for(let i = 0; i < 3; i++){\n const lefti = left + i;\n const righti = right + i;\n const minLeftValue = float32Array[lefti];\n const maxLeftValue = float32Array[lefti + 3];\n const minRightValue = float32Array[righti];\n const maxRightValue = float32Array[righti + 3];\n float32Array[node32Index + i] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n float32Array[node32Index + i + 3] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n }\n return didChange;\n }\n }\n}\n\n});\n\nparcelRequire.register(\"laUNa\", function(module, exports) {\n\n$parcel$export(module.exports, \"raycast\", () => $f6a695dbb681b4c5$export$630e89aab3ddc1d6);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $d4vta = parcelRequire(\"d4vta\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n\nvar $9Kyri = parcelRequire(\"9Kyri\");\n\n/******************************************************/ /* This file is generated from \"raycast.template.js\". */ /******************************************************/ const $f6a695dbb681b4c5$var$_boxIntersection = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $f6a695dbb681b4c5$export$630e89aab3ddc1d6(bvh, root, side, ray, intersects) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n $f6a695dbb681b4c5$var$_raycast(0, bvh, side, ray, intersects);\n (0, $xqrrD.BufferStack).clearBuffer();\n}\nfunction $f6a695dbb681b4c5$var$_raycast(nodeIndex32, bvh, side, ray, intersects) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n const nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n (0, $9Kyri.intersectTris)(bvh, side, ray, offset, count, intersects);\n } else {\n const leftIndex = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n if ((0, $d4vta.intersectRay)(leftIndex, float32Array, ray, $f6a695dbb681b4c5$var$_boxIntersection)) $f6a695dbb681b4c5$var$_raycast(leftIndex, bvh, side, ray, intersects);\n const rightIndex = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n if ((0, $d4vta.intersectRay)(rightIndex, float32Array, ray, $f6a695dbb681b4c5$var$_boxIntersection)) $f6a695dbb681b4c5$var$_raycast(rightIndex, bvh, side, ray, intersects);\n }\n}\n\n});\nparcelRequire.register(\"d4vta\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectRay\", () => $98440f459aa220f3$export$d5a069a08bb68982);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\nconst $98440f459aa220f3$var$_boundingBox = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nfunction $98440f459aa220f3$export$d5a069a08bb68982(nodeIndex32, array, ray, target) {\n (0, $eADNI.arrayToBox)(nodeIndex32, array, $98440f459aa220f3$var$_boundingBox);\n return ray.intersectBox($98440f459aa220f3$var$_boundingBox, target);\n}\n\n});\n\n\nparcelRequire.register(\"1SnJR\", function(module, exports) {\n\n$parcel$export(module.exports, \"raycastFirst\", () => $15dd3f9915d1b1ff$export$1fa457bc72ef1a2a);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n\nvar $d4vta = parcelRequire(\"d4vta\");\n\nvar $9Kyri = parcelRequire(\"9Kyri\");\n\n/***********************************************************/ /* This file is generated from \"raycastFirst.template.js\". */ /***********************************************************/ const $15dd3f9915d1b1ff$var$_boxIntersection = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $15dd3f9915d1b1ff$var$_xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n];\nfunction $15dd3f9915d1b1ff$export$1fa457bc72ef1a2a(bvh, root, side, ray) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n const result = $15dd3f9915d1b1ff$var$_raycastFirst(0, bvh, side, ray);\n (0, $xqrrD.BufferStack).clearBuffer();\n return result;\n}\nfunction $15dd3f9915d1b1ff$var$_raycastFirst(nodeIndex32, bvh, side, ray) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n return (0, $9Kyri.intersectClosestTri)(bvh, side, ray, offset, count);\n } else {\n // consider the position of the split plane with respect to the oncoming ray; whichever direction\n // the ray is coming from, look for an intersection among that side of the tree first\n const splitAxis = (0, $8x2iv.SPLIT_AXIS)(nodeIndex32, uint32Array);\n const xyzAxis = $15dd3f9915d1b1ff$var$_xyzFields[splitAxis];\n const rayDir = ray.direction[xyzAxis];\n const leftToRight = rayDir >= 0;\n // c1 is the child to check first\n let c1, c2;\n if (leftToRight) {\n c1 = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n c2 = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n } else {\n c1 = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n c2 = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n }\n const c1Intersection = (0, $d4vta.intersectRay)(c1, float32Array, ray, $15dd3f9915d1b1ff$var$_boxIntersection);\n const c1Result = c1Intersection ? $15dd3f9915d1b1ff$var$_raycastFirst(c1, bvh, side, ray) : null;\n // if we got an intersection in the first node and it's closer than the second node's bounding\n // box, we don't need to consider the second node because it couldn't possibly be a better result\n if (c1Result) {\n // check if the point is within the second bounds\n // \"point\" is in the local frame of the bvh\n const point = c1Result.point[xyzAxis];\n const isOutside = leftToRight ? point <= float32Array[c2 + splitAxis] : point >= float32Array[c2 + splitAxis + 3]; // max bounding data\n if (isOutside) return c1Result;\n }\n // either there was no intersection in the first node, or there could still be a closer\n // intersection in the second, so check the second node and then take the better of the two\n const c2Intersection = (0, $d4vta.intersectRay)(c2, float32Array, ray, $15dd3f9915d1b1ff$var$_boxIntersection);\n const c2Result = c2Intersection ? $15dd3f9915d1b1ff$var$_raycastFirst(c2, bvh, side, ray) : null;\n if (c1Result && c2Result) return c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n else return c1Result || c2Result || null;\n }\n}\n\n});\n\nparcelRequire.register(\"dhXUU\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectsGeometry\", () => $9acb57256233c065$export$b2f96b0abaf94e0a);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $lenTA = parcelRequire(\"lenTA\");\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n/*****************************************************************/ /* This file is generated from \"intersectsGeometry.template.js\". */ /*****************************************************************/ /* eslint-disable indent */ const $9acb57256233c065$var$boundingBox = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nconst $9acb57256233c065$var$triangle = /* @__PURE__ */ new (0, $8VYkb.ExtendedTriangle)();\nconst $9acb57256233c065$var$triangle2 = /* @__PURE__ */ new (0, $8VYkb.ExtendedTriangle)();\nconst $9acb57256233c065$var$invertedMat = /* @__PURE__ */ new (0, $ilwiq.Matrix4)();\nconst $9acb57256233c065$var$obb = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $9acb57256233c065$var$obb2 = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nfunction $9acb57256233c065$export$b2f96b0abaf94e0a(bvh, root, otherGeometry, geometryToBvh) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n const result = $9acb57256233c065$var$_intersectsGeometry(0, bvh, otherGeometry, geometryToBvh);\n (0, $xqrrD.BufferStack).clearBuffer();\n return result;\n}\nfunction $9acb57256233c065$var$_intersectsGeometry(nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n if (cachedObb === null) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $9acb57256233c065$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n cachedObb = $9acb57256233c065$var$obb;\n }\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const thisGeometry = bvh.geometry;\n const thisIndex = thisGeometry.index;\n const thisPos = thisGeometry.attributes.position;\n const index = otherGeometry.index;\n const pos = otherGeometry.attributes.position;\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n // get the inverse of the geometry matrix so we can transform our triangles into the\n // geometry space we're trying to test. We assume there are fewer triangles being checked\n // here.\n $9acb57256233c065$var$invertedMat.copy(geometryToBvh).invert();\n if (otherGeometry.boundsTree) {\n // if there's a bounds tree\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(nodeIndex32), float32Array, $9acb57256233c065$var$obb2);\n $9acb57256233c065$var$obb2.matrix.copy($9acb57256233c065$var$invertedMat);\n $9acb57256233c065$var$obb2.needsUpdate = true;\n // TODO: use a triangle iteration function here\n const res = otherGeometry.boundsTree.shapecast({\n intersectsBounds: (box)=>$9acb57256233c065$var$obb2.intersectsBox(box),\n intersectsTriangle: (tri)=>{\n tri.a.applyMatrix4(geometryToBvh);\n tri.b.applyMatrix4(geometryToBvh);\n tri.c.applyMatrix4(geometryToBvh);\n tri.needsUpdate = true;\n for(let i = offset * 3, l = (count + offset) * 3; i < l; i += 3){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $dRxiJ.setTriangle)($9acb57256233c065$var$triangle2, i, thisIndex, thisPos);\n $9acb57256233c065$var$triangle2.needsUpdate = true;\n if (tri.intersectsTriangle($9acb57256233c065$var$triangle2)) return true;\n }\n return false;\n }\n });\n return res;\n } else // if we're just dealing with raw geometry\n for(let i = offset * 3, l = (count + offset) * 3; i < l; i += 3){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $dRxiJ.setTriangle)($9acb57256233c065$var$triangle, i, thisIndex, thisPos);\n $9acb57256233c065$var$triangle.a.applyMatrix4($9acb57256233c065$var$invertedMat);\n $9acb57256233c065$var$triangle.b.applyMatrix4($9acb57256233c065$var$invertedMat);\n $9acb57256233c065$var$triangle.c.applyMatrix4($9acb57256233c065$var$invertedMat);\n $9acb57256233c065$var$triangle.needsUpdate = true;\n for(let i2 = 0, l2 = index.count; i2 < l2; i2 += 3){\n (0, $dRxiJ.setTriangle)($9acb57256233c065$var$triangle2, i2, index, pos);\n $9acb57256233c065$var$triangle2.needsUpdate = true;\n if ($9acb57256233c065$var$triangle.intersectsTriangle($9acb57256233c065$var$triangle2)) return true;\n }\n }\n } else {\n const left = nodeIndex32 + 8;\n const right = uint32Array[nodeIndex32 + 6];\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(left), float32Array, $9acb57256233c065$var$boundingBox);\n const leftIntersection = cachedObb.intersectsBox($9acb57256233c065$var$boundingBox) && $9acb57256233c065$var$_intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (leftIntersection) return true;\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(right), float32Array, $9acb57256233c065$var$boundingBox);\n const rightIntersection = cachedObb.intersectsBox($9acb57256233c065$var$boundingBox) && $9acb57256233c065$var$_intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (rightIntersection) return true;\n return false;\n }\n}\n\n});\n\nparcelRequire.register(\"dnRHH\", function(module, exports) {\n\n$parcel$export(module.exports, \"closestPointToGeometry\", () => $9be714d2e19cc068$export$5912902c175a555e);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $lenTA = parcelRequire(\"lenTA\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $5Gkg5 = parcelRequire(\"5Gkg5\");\n\nvar $7EZfU = parcelRequire(\"7EZfU\");\n/*********************************************************************/ /* This file is generated from \"closestPointToGeometry.template.js\". */ /*********************************************************************/ const $9be714d2e19cc068$var$tempMatrix = /* @__PURE__ */ new (0, $ilwiq.Matrix4)();\nconst $9be714d2e19cc068$var$obb = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $9be714d2e19cc068$var$obb2 = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $9be714d2e19cc068$var$temp1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $9be714d2e19cc068$var$temp2 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $9be714d2e19cc068$var$temp3 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $9be714d2e19cc068$var$temp4 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $9be714d2e19cc068$export$5912902c175a555e(bvh, otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $9be714d2e19cc068$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n $9be714d2e19cc068$var$obb.needsUpdate = true;\n const geometry = bvh.geometry;\n const pos = geometry.attributes.position;\n const index = geometry.index;\n const otherPos = otherGeometry.attributes.position;\n const otherIndex = otherGeometry.index;\n const triangle = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n const triangle2 = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n let tempTarget1 = $9be714d2e19cc068$var$temp1;\n let tempTargetDest1 = $9be714d2e19cc068$var$temp2;\n let tempTarget2 = null;\n let tempTargetDest2 = null;\n if (target2) {\n tempTarget2 = $9be714d2e19cc068$var$temp3;\n tempTargetDest2 = $9be714d2e19cc068$var$temp4;\n }\n let closestDistance = Infinity;\n let closestDistanceTriIndex = null;\n let closestDistanceOtherTriIndex = null;\n $9be714d2e19cc068$var$tempMatrix.copy(geometryToBvh).invert();\n $9be714d2e19cc068$var$obb2.matrix.copy($9be714d2e19cc068$var$tempMatrix);\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $9be714d2e19cc068$var$obb.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n if (score < closestDistance && score < maxThreshold) {\n // if we know the triangles of this bounds will be intersected next then\n // save the bounds to use during triangle checks.\n if (isLeaf) {\n $9be714d2e19cc068$var$obb2.min.copy(box.min);\n $9be714d2e19cc068$var$obb2.max.copy(box.max);\n $9be714d2e19cc068$var$obb2.needsUpdate = true;\n }\n return true;\n }\n return false;\n },\n intersectsRange: (offset, count)=>{\n if (otherGeometry.boundsTree) {\n // if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n // the closest bounds in the other geometry to check.\n const otherBvh = otherGeometry.boundsTree;\n return otherBvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $9be714d2e19cc068$var$obb2.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistance && score < maxThreshold;\n },\n intersectsRange: (otherOffset, otherCount)=>{\n for(let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2++){\n (0, $dRxiJ.setTriangle)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n (0, $dRxiJ.setTriangle)(triangle, 3 * i, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n });\n } else {\n // If no bounds tree then we'll just check every triangle.\n const triCount = (0, $5Gkg5.getTriCount)(otherGeometry);\n for(let i2 = 0, l2 = triCount; i2 < l2; i2++){\n (0, $dRxiJ.setTriangle)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n (0, $dRxiJ.setTriangle)(triangle, 3 * i, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n }\n });\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle);\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle2);\n if (closestDistance === Infinity) return null;\n if (!target1.point) target1.point = tempTargetDest1.clone();\n else target1.point.copy(tempTargetDest1);\n target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;\n if (target2) {\n if (!target2.point) target2.point = tempTargetDest2.clone();\n else target2.point.copy(tempTargetDest2);\n target2.point.applyMatrix4($9be714d2e19cc068$var$tempMatrix);\n tempTargetDest1.applyMatrix4($9be714d2e19cc068$var$tempMatrix);\n target2.distance = tempTargetDest1.sub(target2.point).length();\n target2.faceIndex = closestDistanceOtherTriIndex;\n }\n return target1;\n}\n\n});\n\nparcelRequire.register(\"7AkHD\", function(module, exports) {\n\n$parcel$export(module.exports, \"bvhcast\", () => $585bf4558c86be92$export$a2253c6980b92559);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $7EZfU = parcelRequire(\"7EZfU\");\n/******************************************************/ /* This file is generated from \"bvhcast.template.js\". */ /******************************************************/ const $585bf4558c86be92$var$tempMatrix = new (0, $ilwiq.Matrix4)();\nconst $585bf4558c86be92$var$aabb = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nconst $585bf4558c86be92$var$aabb2 = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nfunction $585bf4558c86be92$export$a2253c6980b92559(bvh, otherBvh, matrixToLocal, callbacks) {\n // BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n // than an approach that walks down the tree (see bvhcast.js file for more info).\n let { intersectsRanges: intersectsRanges, intersectsTriangles: intersectsTriangles } = callbacks;\n const indexAttr = bvh.geometry.index;\n const positionAttr = bvh.geometry.attributes.position;\n const otherIndexAttr = otherBvh.geometry.index;\n const otherPositionAttr = otherBvh.geometry.attributes.position;\n $585bf4558c86be92$var$tempMatrix.copy(matrixToLocal).invert();\n const triangle = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n const triangle2 = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n if (intersectsTriangles) {\n const iterateOverDoubleTriangles = (offset1, count1, offset2, count2, depth1, index1, depth2, index2)=>{\n for(let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2++){\n (0, $dRxiJ.setTriangle)(triangle2, i2 * 3, otherIndexAttr, otherPositionAttr);\n triangle2.a.applyMatrix4(matrixToLocal);\n triangle2.b.applyMatrix4(matrixToLocal);\n triangle2.c.applyMatrix4(matrixToLocal);\n triangle2.needsUpdate = true;\n for(let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1++){\n (0, $dRxiJ.setTriangle)(triangle, i1 * 3, indexAttr, positionAttr);\n triangle.needsUpdate = true;\n if (intersectsTriangles(triangle, triangle2, i1, i2, depth1, index1, depth2, index2)) return true;\n }\n }\n return false;\n };\n if (intersectsRanges) {\n const originalIntersectsRanges = intersectsRanges;\n intersectsRanges = function(offset1, count1, offset2, count2, depth1, index1, depth2, index2) {\n if (!originalIntersectsRanges(offset1, count1, offset2, count2, depth1, index1, depth2, index2)) return iterateOverDoubleTriangles(offset1, count1, offset2, count2, depth1, index1, depth2, index2);\n return true;\n };\n } else intersectsRanges = iterateOverDoubleTriangles;\n }\n otherBvh.getBoundingBox($585bf4558c86be92$var$aabb2);\n $585bf4558c86be92$var$aabb2.applyMatrix4(matrixToLocal);\n const result = bvh.shapecast({\n intersectsBounds: (box)=>$585bf4558c86be92$var$aabb2.intersectsBox(box),\n intersectsRange: (offset1, count1, contained, depth1, nodeIndex1, box)=>{\n $585bf4558c86be92$var$aabb.copy(box);\n $585bf4558c86be92$var$aabb.applyMatrix4($585bf4558c86be92$var$tempMatrix);\n return otherBvh.shapecast({\n intersectsBounds: (box)=>$585bf4558c86be92$var$aabb.intersectsBox(box),\n intersectsRange: (offset2, count2, contained, depth2, nodeIndex2)=>{\n return intersectsRanges(offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2);\n }\n });\n }\n });\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle);\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle2);\n return result;\n}\n\n});\n\nparcelRequire.register(\"gDpfV\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectTris_indirect\", () => $c1c3e12524864241$export$7e7412b9f4f11a5c);\n$parcel$export(module.exports, \"intersectClosestTri_indirect\", () => $c1c3e12524864241$export$dddff414156655a1);\n$parcel$export(module.exports, \"iterateOverTriangles_indirect\", () => $c1c3e12524864241$export$dae1f8efdced590b);\n\nvar $7pS02 = parcelRequire(\"7pS02\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n/*************************************************************/ /* This file is generated from \"iterationUtils.template.js\". */ /*************************************************************/ /* eslint-disable indent */ function $c1c3e12524864241$export$7e7412b9f4f11a5c(bvh, side, ray, offset, count, intersections) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n for(let i = offset, end = offset + count; i < end; i++){\n let vi = _indirectBuffer ? _indirectBuffer[i] : i;\n (0, $7pS02.intersectTri)(geometry, side, ray, vi, intersections);\n }\n}\nfunction $c1c3e12524864241$export$dddff414156655a1(bvh, side, ray, offset, count) {\n const { geometry: geometry, _indirectBuffer: _indirectBuffer } = bvh;\n let dist = Infinity;\n let res = null;\n for(let i = offset, end = offset + count; i < end; i++){\n let intersection;\n intersection = (0, $7pS02.intersectTri)(geometry, side, ray, _indirectBuffer ? _indirectBuffer[i] : i);\n if (intersection && intersection.distance < dist) {\n res = intersection;\n dist = intersection.distance;\n }\n }\n return res;\n}\nfunction $c1c3e12524864241$export$dae1f8efdced590b(offset, count, bvh, intersectsTriangleFunc, contained, depth, triangle) {\n const { geometry: geometry } = bvh;\n const { index: index } = geometry;\n const pos = geometry.attributes.position;\n for(let i = offset, l = count + offset; i < l; i++){\n let tri;\n tri = bvh.resolveTriangleIndex(i);\n (0, $dRxiJ.setTriangle)(triangle, tri * 3, index, pos);\n triangle.needsUpdate = true;\n if (intersectsTriangleFunc(triangle, tri, contained, depth)) return true;\n }\n return false;\n}\n\n});\n\nparcelRequire.register(\"iERXt\", function(module, exports) {\n\n$parcel$export(module.exports, \"refit_indirect\", () => $d955d16ddee6d2e4$export$40f4af49b81ca898);\n\nvar $alNGj = parcelRequire(\"alNGj\");\n/****************************************************/ /* This file is generated from \"refit.template.js\". */ /****************************************************/ function $d955d16ddee6d2e4$export$40f4af49b81ca898(bvh, nodeIndices = null) {\n if (nodeIndices && Array.isArray(nodeIndices)) nodeIndices = new Set(nodeIndices);\n const geometry = bvh.geometry;\n const indexArr = geometry.index ? geometry.index.array : null;\n const posAttr = geometry.attributes.position;\n let buffer, uint32Array, uint16Array, float32Array;\n let byteOffset = 0;\n const roots = bvh._roots;\n for(let i = 0, l = roots.length; i < l; i++){\n buffer = roots[i];\n uint32Array = new Uint32Array(buffer);\n uint16Array = new Uint16Array(buffer);\n float32Array = new Float32Array(buffer);\n _traverse(0, byteOffset);\n byteOffset += buffer.byteLength;\n }\n function _traverse(node32Index, byteOffset, force = false) {\n const node16Index = node32Index * 2;\n const isLeaf = uint16Array[node16Index + 15] === (0, $alNGj.IS_LEAFNODE_FLAG);\n if (isLeaf) {\n const offset = uint32Array[node32Index + 6];\n const count = uint16Array[node16Index + 14];\n let minx = Infinity;\n let miny = Infinity;\n let minz = Infinity;\n let maxx = -Infinity;\n let maxy = -Infinity;\n let maxz = -Infinity;\n for(let i = offset, l = offset + count; i < l; i++){\n const t = 3 * bvh.resolveTriangleIndex(i);\n for(let j = 0; j < 3; j++){\n let index = t + j;\n index = indexArr ? indexArr[index] : index;\n const x = posAttr.getX(index);\n const y = posAttr.getY(index);\n const z = posAttr.getZ(index);\n if (x < minx) minx = x;\n if (x > maxx) maxx = x;\n if (y < miny) miny = y;\n if (y > maxy) maxy = y;\n if (z < minz) minz = z;\n if (z > maxz) maxz = z;\n }\n }\n if (float32Array[node32Index + 0] !== minx || float32Array[node32Index + 1] !== miny || float32Array[node32Index + 2] !== minz || float32Array[node32Index + 3] !== maxx || float32Array[node32Index + 4] !== maxy || float32Array[node32Index + 5] !== maxz) {\n float32Array[node32Index + 0] = minx;\n float32Array[node32Index + 1] = miny;\n float32Array[node32Index + 2] = minz;\n float32Array[node32Index + 3] = maxx;\n float32Array[node32Index + 4] = maxy;\n float32Array[node32Index + 5] = maxz;\n return true;\n } else return false;\n } else {\n const left = node32Index + 8;\n const right = uint32Array[node32Index + 6];\n // the identifying node indices provided by the shapecast function include offsets of all\n // root buffers to guarantee they're unique between roots so offset left and right indices here.\n const offsetLeft = left + byteOffset;\n const offsetRight = right + byteOffset;\n let forceChildren = force;\n let includesLeft = false;\n let includesRight = false;\n if (nodeIndices) // if we see that neither the left or right child are included in the set that need to be updated\n // then we assume that all children need to be updated.\n {\n if (!forceChildren) {\n includesLeft = nodeIndices.has(offsetLeft);\n includesRight = nodeIndices.has(offsetRight);\n forceChildren = !includesLeft && !includesRight;\n }\n } else {\n includesLeft = true;\n includesRight = true;\n }\n const traverseLeft = forceChildren || includesLeft;\n const traverseRight = forceChildren || includesRight;\n let leftChange = false;\n if (traverseLeft) leftChange = _traverse(left, byteOffset, forceChildren);\n let rightChange = false;\n if (traverseRight) rightChange = _traverse(right, byteOffset, forceChildren);\n const didChange = leftChange || rightChange;\n if (didChange) for(let i = 0; i < 3; i++){\n const lefti = left + i;\n const righti = right + i;\n const minLeftValue = float32Array[lefti];\n const maxLeftValue = float32Array[lefti + 3];\n const minRightValue = float32Array[righti];\n const maxRightValue = float32Array[righti + 3];\n float32Array[node32Index + i] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n float32Array[node32Index + i + 3] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n }\n return didChange;\n }\n }\n}\n\n});\n\nparcelRequire.register(\"kNP8c\", function(module, exports) {\n\n$parcel$export(module.exports, \"raycast_indirect\", () => $f2500bdd73784d92$export$1999205ebe856279);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $d4vta = parcelRequire(\"d4vta\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n\n\nvar $gDpfV = parcelRequire(\"gDpfV\");\n/******************************************************/ /* This file is generated from \"raycast.template.js\". */ /******************************************************/ const $f2500bdd73784d92$var$_boxIntersection = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $f2500bdd73784d92$export$1999205ebe856279(bvh, root, side, ray, intersects) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n $f2500bdd73784d92$var$_raycast(0, bvh, side, ray, intersects);\n (0, $xqrrD.BufferStack).clearBuffer();\n}\nfunction $f2500bdd73784d92$var$_raycast(nodeIndex32, bvh, side, ray, intersects) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n const nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n (0, $gDpfV.intersectTris_indirect)(bvh, side, ray, offset, count, intersects);\n } else {\n const leftIndex = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n if ((0, $d4vta.intersectRay)(leftIndex, float32Array, ray, $f2500bdd73784d92$var$_boxIntersection)) $f2500bdd73784d92$var$_raycast(leftIndex, bvh, side, ray, intersects);\n const rightIndex = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n if ((0, $d4vta.intersectRay)(rightIndex, float32Array, ray, $f2500bdd73784d92$var$_boxIntersection)) $f2500bdd73784d92$var$_raycast(rightIndex, bvh, side, ray, intersects);\n }\n}\n\n});\n\nparcelRequire.register(\"ZxvHI\", function(module, exports) {\n\n$parcel$export(module.exports, \"raycastFirst_indirect\", () => $0b8fb114025d9d97$export$44e48d4cf2fe0609);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n\nvar $d4vta = parcelRequire(\"d4vta\");\n\n\nvar $gDpfV = parcelRequire(\"gDpfV\");\n/***********************************************************/ /* This file is generated from \"raycastFirst.template.js\". */ /***********************************************************/ const $0b8fb114025d9d97$var$_boxIntersection = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $0b8fb114025d9d97$var$_xyzFields = [\n \"x\",\n \"y\",\n \"z\"\n];\nfunction $0b8fb114025d9d97$export$44e48d4cf2fe0609(bvh, root, side, ray) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n const result = $0b8fb114025d9d97$var$_raycastFirst(0, bvh, side, ray);\n (0, $xqrrD.BufferStack).clearBuffer();\n return result;\n}\nfunction $0b8fb114025d9d97$var$_raycastFirst(nodeIndex32, bvh, side, ray) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n return (0, $gDpfV.intersectClosestTri_indirect)(bvh, side, ray, offset, count);\n } else {\n // consider the position of the split plane with respect to the oncoming ray; whichever direction\n // the ray is coming from, look for an intersection among that side of the tree first\n const splitAxis = (0, $8x2iv.SPLIT_AXIS)(nodeIndex32, uint32Array);\n const xyzAxis = $0b8fb114025d9d97$var$_xyzFields[splitAxis];\n const rayDir = ray.direction[xyzAxis];\n const leftToRight = rayDir >= 0;\n // c1 is the child to check first\n let c1, c2;\n if (leftToRight) {\n c1 = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n c2 = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n } else {\n c1 = (0, $8x2iv.RIGHT_NODE)(nodeIndex32, uint32Array);\n c2 = (0, $8x2iv.LEFT_NODE)(nodeIndex32);\n }\n const c1Intersection = (0, $d4vta.intersectRay)(c1, float32Array, ray, $0b8fb114025d9d97$var$_boxIntersection);\n const c1Result = c1Intersection ? $0b8fb114025d9d97$var$_raycastFirst(c1, bvh, side, ray) : null;\n // if we got an intersection in the first node and it's closer than the second node's bounding\n // box, we don't need to consider the second node because it couldn't possibly be a better result\n if (c1Result) {\n // check if the point is within the second bounds\n // \"point\" is in the local frame of the bvh\n const point = c1Result.point[xyzAxis];\n const isOutside = leftToRight ? point <= float32Array[c2 + splitAxis] : point >= float32Array[c2 + splitAxis + 3]; // max bounding data\n if (isOutside) return c1Result;\n }\n // either there was no intersection in the first node, or there could still be a closer\n // intersection in the second, so check the second node and then take the better of the two\n const c2Intersection = (0, $d4vta.intersectRay)(c2, float32Array, ray, $0b8fb114025d9d97$var$_boxIntersection);\n const c2Result = c2Intersection ? $0b8fb114025d9d97$var$_raycastFirst(c2, bvh, side, ray) : null;\n if (c1Result && c2Result) return c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n else return c1Result || c2Result || null;\n }\n}\n\n});\n\nparcelRequire.register(\"bD1WL\", function(module, exports) {\n\n$parcel$export(module.exports, \"intersectsGeometry_indirect\", () => $8774d8cede10b4d0$export$80dca0df80ee0084);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $lenTA = parcelRequire(\"lenTA\");\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $eADNI = parcelRequire(\"eADNI\");\n\nvar $8x2iv = parcelRequire(\"8x2iv\");\n\nvar $xqrrD = parcelRequire(\"xqrrD\");\n/*****************************************************************/ /* This file is generated from \"intersectsGeometry.template.js\". */ /*****************************************************************/ /* eslint-disable indent */ const $8774d8cede10b4d0$var$boundingBox = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nconst $8774d8cede10b4d0$var$triangle = /* @__PURE__ */ new (0, $8VYkb.ExtendedTriangle)();\nconst $8774d8cede10b4d0$var$triangle2 = /* @__PURE__ */ new (0, $8VYkb.ExtendedTriangle)();\nconst $8774d8cede10b4d0$var$invertedMat = /* @__PURE__ */ new (0, $ilwiq.Matrix4)();\nconst $8774d8cede10b4d0$var$obb = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $8774d8cede10b4d0$var$obb2 = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nfunction $8774d8cede10b4d0$export$80dca0df80ee0084(bvh, root, otherGeometry, geometryToBvh) {\n (0, $xqrrD.BufferStack).setBuffer(bvh._roots[root]);\n const result = $8774d8cede10b4d0$var$_intersectsGeometry(0, bvh, otherGeometry, geometryToBvh);\n (0, $xqrrD.BufferStack).clearBuffer();\n return result;\n}\nfunction $8774d8cede10b4d0$var$_intersectsGeometry(nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null) {\n const { float32Array: float32Array, uint16Array: uint16Array, uint32Array: uint32Array } = (0, $xqrrD.BufferStack);\n let nodeIndex16 = nodeIndex32 * 2;\n if (cachedObb === null) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $8774d8cede10b4d0$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n cachedObb = $8774d8cede10b4d0$var$obb;\n }\n const isLeaf = (0, $8x2iv.IS_LEAF)(nodeIndex16, uint16Array);\n if (isLeaf) {\n const thisGeometry = bvh.geometry;\n const thisIndex = thisGeometry.index;\n const thisPos = thisGeometry.attributes.position;\n const index = otherGeometry.index;\n const pos = otherGeometry.attributes.position;\n const offset = (0, $8x2iv.OFFSET)(nodeIndex32, uint32Array);\n const count = (0, $8x2iv.COUNT)(nodeIndex16, uint16Array);\n // get the inverse of the geometry matrix so we can transform our triangles into the\n // geometry space we're trying to test. We assume there are fewer triangles being checked\n // here.\n $8774d8cede10b4d0$var$invertedMat.copy(geometryToBvh).invert();\n if (otherGeometry.boundsTree) {\n // if there's a bounds tree\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(nodeIndex32), float32Array, $8774d8cede10b4d0$var$obb2);\n $8774d8cede10b4d0$var$obb2.matrix.copy($8774d8cede10b4d0$var$invertedMat);\n $8774d8cede10b4d0$var$obb2.needsUpdate = true;\n // TODO: use a triangle iteration function here\n const res = otherGeometry.boundsTree.shapecast({\n intersectsBounds: (box)=>$8774d8cede10b4d0$var$obb2.intersectsBox(box),\n intersectsTriangle: (tri)=>{\n tri.a.applyMatrix4(geometryToBvh);\n tri.b.applyMatrix4(geometryToBvh);\n tri.c.applyMatrix4(geometryToBvh);\n tri.needsUpdate = true;\n for(let i = offset, l = count + offset; i < l; i++){\n // this triangle needs to be transformed into the current BVH coordinate frame\n (0, $dRxiJ.setTriangle)($8774d8cede10b4d0$var$triangle2, 3 * bvh.resolveTriangleIndex(i), thisIndex, thisPos);\n $8774d8cede10b4d0$var$triangle2.needsUpdate = true;\n if (tri.intersectsTriangle($8774d8cede10b4d0$var$triangle2)) return true;\n }\n return false;\n }\n });\n return res;\n } else // if we're just dealing with raw geometry\n for(let i = offset, l = count + offset; i < l; i++){\n // this triangle needs to be transformed into the current BVH coordinate frame\n const ti = bvh.resolveTriangleIndex(i);\n (0, $dRxiJ.setTriangle)($8774d8cede10b4d0$var$triangle, 3 * ti, thisIndex, thisPos);\n $8774d8cede10b4d0$var$triangle.a.applyMatrix4($8774d8cede10b4d0$var$invertedMat);\n $8774d8cede10b4d0$var$triangle.b.applyMatrix4($8774d8cede10b4d0$var$invertedMat);\n $8774d8cede10b4d0$var$triangle.c.applyMatrix4($8774d8cede10b4d0$var$invertedMat);\n $8774d8cede10b4d0$var$triangle.needsUpdate = true;\n for(let i2 = 0, l2 = index.count; i2 < l2; i2 += 3){\n (0, $dRxiJ.setTriangle)($8774d8cede10b4d0$var$triangle2, i2, index, pos);\n $8774d8cede10b4d0$var$triangle2.needsUpdate = true;\n if ($8774d8cede10b4d0$var$triangle.intersectsTriangle($8774d8cede10b4d0$var$triangle2)) return true;\n }\n }\n } else {\n const left = nodeIndex32 + 8;\n const right = uint32Array[nodeIndex32 + 6];\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(left), float32Array, $8774d8cede10b4d0$var$boundingBox);\n const leftIntersection = cachedObb.intersectsBox($8774d8cede10b4d0$var$boundingBox) && $8774d8cede10b4d0$var$_intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (leftIntersection) return true;\n (0, $eADNI.arrayToBox)((0, $8x2iv.BOUNDING_DATA_INDEX)(right), float32Array, $8774d8cede10b4d0$var$boundingBox);\n const rightIntersection = cachedObb.intersectsBox($8774d8cede10b4d0$var$boundingBox) && $8774d8cede10b4d0$var$_intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);\n if (rightIntersection) return true;\n return false;\n }\n}\n\n});\n\nparcelRequire.register(\"gUrAj\", function(module, exports) {\n\n$parcel$export(module.exports, \"closestPointToGeometry_indirect\", () => $c4f746093678aa23$export$334b669407b5ec06);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $lenTA = parcelRequire(\"lenTA\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $5Gkg5 = parcelRequire(\"5Gkg5\");\n\nvar $7EZfU = parcelRequire(\"7EZfU\");\n/*********************************************************************/ /* This file is generated from \"closestPointToGeometry.template.js\". */ /*********************************************************************/ const $c4f746093678aa23$var$tempMatrix = /* @__PURE__ */ new (0, $ilwiq.Matrix4)();\nconst $c4f746093678aa23$var$obb = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $c4f746093678aa23$var$obb2 = /* @__PURE__ */ new (0, $lenTA.OrientedBox)();\nconst $c4f746093678aa23$var$temp1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $c4f746093678aa23$var$temp2 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $c4f746093678aa23$var$temp3 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $c4f746093678aa23$var$temp4 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $c4f746093678aa23$export$334b669407b5ec06(bvh, otherGeometry, geometryToBvh, target1 = {}, target2 = {}, minThreshold = 0, maxThreshold = Infinity) {\n if (!otherGeometry.boundingBox) otherGeometry.computeBoundingBox();\n $c4f746093678aa23$var$obb.set(otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh);\n $c4f746093678aa23$var$obb.needsUpdate = true;\n const geometry = bvh.geometry;\n const pos = geometry.attributes.position;\n const index = geometry.index;\n const otherPos = otherGeometry.attributes.position;\n const otherIndex = otherGeometry.index;\n const triangle = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n const triangle2 = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n let tempTarget1 = $c4f746093678aa23$var$temp1;\n let tempTargetDest1 = $c4f746093678aa23$var$temp2;\n let tempTarget2 = null;\n let tempTargetDest2 = null;\n if (target2) {\n tempTarget2 = $c4f746093678aa23$var$temp3;\n tempTargetDest2 = $c4f746093678aa23$var$temp4;\n }\n let closestDistance = Infinity;\n let closestDistanceTriIndex = null;\n let closestDistanceOtherTriIndex = null;\n $c4f746093678aa23$var$tempMatrix.copy(geometryToBvh).invert();\n $c4f746093678aa23$var$obb2.matrix.copy($c4f746093678aa23$var$tempMatrix);\n bvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $c4f746093678aa23$var$obb.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n if (score < closestDistance && score < maxThreshold) {\n // if we know the triangles of this bounds will be intersected next then\n // save the bounds to use during triangle checks.\n if (isLeaf) {\n $c4f746093678aa23$var$obb2.min.copy(box.min);\n $c4f746093678aa23$var$obb2.max.copy(box.max);\n $c4f746093678aa23$var$obb2.needsUpdate = true;\n }\n return true;\n }\n return false;\n },\n intersectsRange: (offset, count)=>{\n if (otherGeometry.boundsTree) {\n // if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n // the closest bounds in the other geometry to check.\n const otherBvh = otherGeometry.boundsTree;\n return otherBvh.shapecast({\n boundsTraverseOrder: (box)=>{\n return $c4f746093678aa23$var$obb2.distanceToBox(box);\n },\n intersectsBounds: (box, isLeaf, score)=>{\n return score < closestDistance && score < maxThreshold;\n },\n intersectsRange: (otherOffset, otherCount)=>{\n for(let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2++){\n const ti2 = otherBvh.resolveTriangleIndex(i2);\n (0, $dRxiJ.setTriangle)(triangle2, 3 * ti2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n const ti = bvh.resolveTriangleIndex(i);\n (0, $dRxiJ.setTriangle)(triangle, 3 * ti, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n });\n } else {\n // If no bounds tree then we'll just check every triangle.\n const triCount = (0, $5Gkg5.getTriCount)(otherGeometry);\n for(let i2 = 0, l2 = triCount; i2 < l2; i2++){\n (0, $dRxiJ.setTriangle)(triangle2, 3 * i2, otherIndex, otherPos);\n triangle2.a.applyMatrix4(geometryToBvh);\n triangle2.b.applyMatrix4(geometryToBvh);\n triangle2.c.applyMatrix4(geometryToBvh);\n triangle2.needsUpdate = true;\n for(let i = offset, l = offset + count; i < l; i++){\n const ti = bvh.resolveTriangleIndex(i);\n (0, $dRxiJ.setTriangle)(triangle, 3 * ti, index, pos);\n triangle.needsUpdate = true;\n const dist = triangle.distanceToTriangle(triangle2, tempTarget1, tempTarget2);\n if (dist < closestDistance) {\n tempTargetDest1.copy(tempTarget1);\n if (tempTargetDest2) tempTargetDest2.copy(tempTarget2);\n closestDistance = dist;\n closestDistanceTriIndex = i;\n closestDistanceOtherTriIndex = i2;\n }\n // stop traversal if we find a point that's under the given threshold\n if (dist < minThreshold) return true;\n }\n }\n }\n }\n });\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle);\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle2);\n if (closestDistance === Infinity) return null;\n if (!target1.point) target1.point = tempTargetDest1.clone();\n else target1.point.copy(tempTargetDest1);\n target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;\n if (target2) {\n if (!target2.point) target2.point = tempTargetDest2.clone();\n else target2.point.copy(tempTargetDest2);\n target2.point.applyMatrix4($c4f746093678aa23$var$tempMatrix);\n tempTargetDest1.applyMatrix4($c4f746093678aa23$var$tempMatrix);\n target2.distance = tempTargetDest1.sub(target2.point).length();\n target2.faceIndex = closestDistanceOtherTriIndex;\n }\n return target1;\n}\n\n});\n\nparcelRequire.register(\"86OmO\", function(module, exports) {\n\n$parcel$export(module.exports, \"bvhcast_indirect\", () => $5e75f41ad0049e3c$export$4e2970292710be2c);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $dRxiJ = parcelRequire(\"dRxiJ\");\n\nvar $7EZfU = parcelRequire(\"7EZfU\");\n/******************************************************/ /* This file is generated from \"bvhcast.template.js\". */ /******************************************************/ const $5e75f41ad0049e3c$var$tempMatrix = new (0, $ilwiq.Matrix4)();\nconst $5e75f41ad0049e3c$var$aabb = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nconst $5e75f41ad0049e3c$var$aabb2 = /* @__PURE__ */ new (0, $ilwiq.Box3)();\nfunction $5e75f41ad0049e3c$export$4e2970292710be2c(bvh, otherBvh, matrixToLocal, callbacks) {\n // BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n // than an approach that walks down the tree (see bvhcast.js file for more info).\n let { intersectsRanges: intersectsRanges, intersectsTriangles: intersectsTriangles } = callbacks;\n const indexAttr = bvh.geometry.index;\n const positionAttr = bvh.geometry.attributes.position;\n const otherIndexAttr = otherBvh.geometry.index;\n const otherPositionAttr = otherBvh.geometry.attributes.position;\n $5e75f41ad0049e3c$var$tempMatrix.copy(matrixToLocal).invert();\n const triangle = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n const triangle2 = (0, $7EZfU.ExtendedTrianglePool).getPrimitive();\n if (intersectsTriangles) {\n const iterateOverDoubleTriangles = (offset1, count1, offset2, count2, depth1, index1, depth2, index2)=>{\n for(let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2++){\n const ti2 = otherBvh.resolveTriangleIndex(i2);\n (0, $dRxiJ.setTriangle)(triangle2, ti2 * 3, otherIndexAttr, otherPositionAttr);\n triangle2.a.applyMatrix4(matrixToLocal);\n triangle2.b.applyMatrix4(matrixToLocal);\n triangle2.c.applyMatrix4(matrixToLocal);\n triangle2.needsUpdate = true;\n for(let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1++){\n const ti1 = bvh.resolveTriangleIndex(i1);\n (0, $dRxiJ.setTriangle)(triangle, ti1 * 3, indexAttr, positionAttr);\n triangle.needsUpdate = true;\n if (intersectsTriangles(triangle, triangle2, i1, i2, depth1, index1, depth2, index2)) return true;\n }\n }\n return false;\n };\n if (intersectsRanges) {\n const originalIntersectsRanges = intersectsRanges;\n intersectsRanges = function(offset1, count1, offset2, count2, depth1, index1, depth2, index2) {\n if (!originalIntersectsRanges(offset1, count1, offset2, count2, depth1, index1, depth2, index2)) return iterateOverDoubleTriangles(offset1, count1, offset2, count2, depth1, index1, depth2, index2);\n return true;\n };\n } else intersectsRanges = iterateOverDoubleTriangles;\n }\n otherBvh.getBoundingBox($5e75f41ad0049e3c$var$aabb2);\n $5e75f41ad0049e3c$var$aabb2.applyMatrix4(matrixToLocal);\n const result = bvh.shapecast({\n intersectsBounds: (box)=>$5e75f41ad0049e3c$var$aabb2.intersectsBox(box),\n intersectsRange: (offset1, count1, contained, depth1, nodeIndex1, box)=>{\n $5e75f41ad0049e3c$var$aabb.copy(box);\n $5e75f41ad0049e3c$var$aabb.applyMatrix4($5e75f41ad0049e3c$var$tempMatrix);\n return otherBvh.shapecast({\n intersectsBounds: (box)=>$5e75f41ad0049e3c$var$aabb.intersectsBox(box),\n intersectsRange: (offset2, count2, contained, depth2, nodeIndex2)=>{\n return intersectsRanges(offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2);\n }\n });\n }\n });\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle);\n (0, $7EZfU.ExtendedTrianglePool).releasePrimitive(triangle2);\n return result;\n}\n\n});\n\nparcelRequire.register(\"cSOJe\", function(module, exports) {\n\n$parcel$export(module.exports, \"isSharedArrayBufferSupported\", () => $9611e0cfae405faf$export$9c28fa8114adc339);\nfunction $9611e0cfae405faf$export$9c28fa8114adc339() {\n return typeof SharedArrayBuffer !== \"undefined\";\n}\n\n});\n\n\nparcelRequire.register(\"bJKwC\", function(module, exports) {\n\n$parcel$export(module.exports, \"isYProjectedLineDegenerate\", () => $88b7fc9acd2941fb$export$cec4aea73fa71fc5);\n$parcel$export(module.exports, \"isYProjectedTriangleDegenerate\", () => $88b7fc9acd2941fb$export$97cada60b6f00a63);\n$parcel$export(module.exports, \"isLineTriangleEdge\", () => $88b7fc9acd2941fb$export$6ce1ecae0cd1cc55);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $88b7fc9acd2941fb$var$EPSILON = 1e-16;\nconst $88b7fc9acd2941fb$var$UP_VECTOR = /* @__PURE__ */ new (0, $ilwiq.Vector3)(0, 1, 0);\nconst $88b7fc9acd2941fb$var$_dir = new (0, $ilwiq.Vector3)();\nfunction $88b7fc9acd2941fb$export$cec4aea73fa71fc5(line) {\n line.delta($88b7fc9acd2941fb$var$_dir).normalize();\n return Math.abs($88b7fc9acd2941fb$var$_dir.dot($88b7fc9acd2941fb$var$UP_VECTOR)) >= 1.0 - $88b7fc9acd2941fb$var$EPSILON;\n}\nfunction $88b7fc9acd2941fb$export$97cada60b6f00a63(tri) {\n if (tri.needsUpdate) tri.update();\n return Math.abs(tri.plane.normal.dot($88b7fc9acd2941fb$var$UP_VECTOR)) <= $88b7fc9acd2941fb$var$EPSILON;\n}\nfunction $88b7fc9acd2941fb$export$6ce1ecae0cd1cc55(tri, line) {\n // if this is the same line as on the triangle\n const { start: start, end: end } = line;\n const triPoints = tri.points;\n let startMatches = false;\n let endMatches = false;\n for(let i = 0; i < 3; i++){\n const tp = triPoints[i];\n if (!startMatches && start.distanceToSquared(tp) <= $88b7fc9acd2941fb$var$EPSILON) startMatches = true;\n if (!endMatches && end.distanceToSquared(tp) <= $88b7fc9acd2941fb$var$EPSILON) endMatches = true;\n if (startMatches && endMatches) return true;\n }\n return startMatches && endMatches;\n}\n\n});\n\nparcelRequire.register(\"fNPnQ\", function(module, exports) {\n\n$parcel$export(module.exports, \"generateEdges\", () => $b8134a58754c7ea3$export$b2d7c053833d1662);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n// Modified version of js EdgesGeometry logic to handle silhouette edges\nconst $b8134a58754c7ea3$var$EPSILON = 1e-16;\nconst $b8134a58754c7ea3$var$UP_VECTOR = /* @__PURE__ */ new (0, $ilwiq.Vector3)(0, 1, 0);\nconst $b8134a58754c7ea3$var$_v0 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $b8134a58754c7ea3$var$_v1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $b8134a58754c7ea3$var$_normal = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $b8134a58754c7ea3$var$_triangle = /* @__PURE__ */ new (0, $ilwiq.Triangle)();\nfunction $b8134a58754c7ea3$export$b2d7c053833d1662(geometry, projectionDir = $b8134a58754c7ea3$var$UP_VECTOR, thresholdAngle = 1) {\n const edges = [];\n const precisionPoints = 4;\n const precision = Math.pow(10, precisionPoints);\n const thresholdDot = Math.cos((0, $ilwiq.MathUtils).DEG2RAD * thresholdAngle);\n const indexAttr = geometry.getIndex();\n const positionAttr = geometry.getAttribute(\"position\");\n const indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n const indexArr = [\n 0,\n 0,\n 0\n ];\n const vertKeys = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const hashes = new Array(3);\n const edgeData = {};\n for(let i = 0; i < indexCount; i += 3){\n if (indexAttr) {\n indexArr[0] = indexAttr.getX(i);\n indexArr[1] = indexAttr.getX(i + 1);\n indexArr[2] = indexAttr.getX(i + 2);\n } else {\n indexArr[0] = i;\n indexArr[1] = i + 1;\n indexArr[2] = i + 2;\n }\n const { a: a, b: b, c: c } = $b8134a58754c7ea3$var$_triangle;\n a.fromBufferAttribute(positionAttr, indexArr[0]);\n b.fromBufferAttribute(positionAttr, indexArr[1]);\n c.fromBufferAttribute(positionAttr, indexArr[2]);\n $b8134a58754c7ea3$var$_triangle.getNormal($b8134a58754c7ea3$var$_normal);\n // create hashes for the edge from the vertices\n hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;\n hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;\n hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`;\n // skip degenerate triangles\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) continue;\n // iterate over every edge\n for(let j = 0; j < 3; j++){\n // get the first and next vertex making up the edge\n const jNext = (j + 1) % 3;\n const vecHash0 = hashes[j];\n const vecHash1 = hashes[jNext];\n const v0 = $b8134a58754c7ea3$var$_triangle[vertKeys[j]];\n const v1 = $b8134a58754c7ea3$var$_triangle[vertKeys[jNext]];\n const hash = `${vecHash0}_${vecHash1}`;\n const reverseHash = `${vecHash1}_${vecHash0}`;\n if (reverseHash in edgeData && edgeData[reverseHash]) {\n // if we found a sibling edge add it into the vertex array if\n // it meets the angle threshold and delete the edge from the map.\n const otherNormal = edgeData[reverseHash].normal;\n const meetsThreshold = $b8134a58754c7ea3$var$_normal.dot(otherNormal) <= thresholdDot;\n // get the dot product relative to the projection angle and\n // add an epsilon for nearly vertical triangles\n let normDot = projectionDir.dot($b8134a58754c7ea3$var$_normal);\n normDot = Math.abs(normDot) < $b8134a58754c7ea3$var$EPSILON ? 0 : normDot;\n let otherDot = projectionDir.dot(otherNormal);\n otherDot = Math.abs(otherDot) < $b8134a58754c7ea3$var$EPSILON ? 0 : otherDot;\n const projectionThreshold = Math.sign(normDot) !== Math.sign(otherDot);\n if (meetsThreshold || projectionThreshold) {\n const line = new (0, $ilwiq.Line3)();\n line.start.copy(v0);\n line.end.copy(v1);\n edges.push(line);\n }\n edgeData[reverseHash] = null;\n } else if (!(hash in edgeData)) // if we've already got an edge here then skip adding a new one\n edgeData[hash] = {\n index0: indexArr[j],\n index1: indexArr[jNext],\n normal: $b8134a58754c7ea3$var$_normal.clone()\n };\n }\n }\n // iterate over all remaining, unmatched edges and add them to the vertex array\n for(const key in edgeData)if (edgeData[key]) {\n const { index0: index0, index1: index1 } = edgeData[key];\n $b8134a58754c7ea3$var$_v0.fromBufferAttribute(positionAttr, index0);\n $b8134a58754c7ea3$var$_v1.fromBufferAttribute(positionAttr, index1);\n const line = new (0, $ilwiq.Line3)();\n line.start.copy($b8134a58754c7ea3$var$_v0);\n line.end.copy($b8134a58754c7ea3$var$_v1);\n edges.push(line);\n }\n return edges;\n}\n\n});\n\nparcelRequire.register(\"33ViW\", function(module, exports) {\n\n$parcel$export(module.exports, \"compressEdgeOverlaps\", () => $23ae1a62f6ba3037$export$84bed164e326c2f0);\n$parcel$export(module.exports, \"overlapsToLines\", () => $23ae1a62f6ba3037$export$fbbde8a5b23b7b65);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $23ae1a62f6ba3037$var$_line = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nfunction $23ae1a62f6ba3037$export$84bed164e326c2f0(overlaps) {\n overlaps.sort((a, b)=>{\n return a[0] - b[0];\n });\n for(let i = 1; i < overlaps.length; i++){\n const overlap = overlaps[i];\n const prevOverlap = overlaps[i - 1];\n if (prevOverlap[1] >= overlap[0]) {\n prevOverlap[1] = Math.max(prevOverlap[1], overlap[1]);\n overlaps.splice(i, 1);\n i--;\n }\n }\n}\nfunction $23ae1a62f6ba3037$export$fbbde8a5b23b7b65(line, overlaps, target = []) {\n $23ae1a62f6ba3037$export$84bed164e326c2f0(overlaps);\n const invOverlaps = [\n [\n 0,\n 1\n ]\n ];\n for(let i = 0, l = overlaps.length; i < l; i++){\n const invOverlap = invOverlaps[i];\n const overlap = overlaps[i];\n invOverlap[1] = overlap[0];\n invOverlaps.push(new Float32Array([\n overlap[1],\n 1\n ]));\n }\n for(let i = 0, l = invOverlaps.length; i < l; i++){\n const { start: start, end: end } = line;\n $23ae1a62f6ba3037$var$_line.start.lerpVectors(start, end, invOverlaps[i][0]);\n $23ae1a62f6ba3037$var$_line.end.lerpVectors(start, end, invOverlaps[i][1]);\n target.push(new Float32Array([\n $23ae1a62f6ba3037$var$_line.start.x,\n $23ae1a62f6ba3037$var$_line.start.y,\n $23ae1a62f6ba3037$var$_line.start.z,\n $23ae1a62f6ba3037$var$_line.end.x,\n $23ae1a62f6ba3037$var$_line.end.y,\n $23ae1a62f6ba3037$var$_line.end.z\n ]));\n }\n return target;\n}\n\n});\n\nparcelRequire.register(\"itkSV\", function(module, exports) {\n\n$parcel$export(module.exports, \"trimToBeneathTriPlane\", () => $d72b22c0d316ba07$export$3240a8dc8bb0ce4c);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $bJKwC = parcelRequire(\"bJKwC\");\nconst $d72b22c0d316ba07$var$EPSILON = 1e-16;\nconst $d72b22c0d316ba07$var$UP_VECTOR = /* @__PURE__ */ new (0, $ilwiq.Vector3)(0, 1, 0);\nconst $d72b22c0d316ba07$var$_plane = /* @__PURE__ */ new (0, $ilwiq.Plane)();\nconst $d72b22c0d316ba07$var$_planeHit = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $d72b22c0d316ba07$var$_lineDirection = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $d72b22c0d316ba07$export$3240a8dc8bb0ce4c(tri, line, lineTarget) {\n // if the triangle is insignificant then skip it\n if ((0, $bJKwC.isYProjectedTriangleDegenerate)(tri)) return false;\n // update triangle if needed\n if (tri.needsUpdate) tri.update();\n // if the plane is not facing up then flip the direction\n $d72b22c0d316ba07$var$_plane.copy(tri.plane);\n if ($d72b22c0d316ba07$var$_plane.normal.dot($d72b22c0d316ba07$var$UP_VECTOR) < 0) {\n $d72b22c0d316ba07$var$_plane.normal.multiplyScalar(-1);\n $d72b22c0d316ba07$var$_plane.constant *= -1;\n }\n const startDist = $d72b22c0d316ba07$var$_plane.distanceToPoint(line.start);\n const endDist = $d72b22c0d316ba07$var$_plane.distanceToPoint(line.end);\n const isStartOnPlane = Math.abs(startDist) < $d72b22c0d316ba07$var$EPSILON;\n const isEndOnPlane = Math.abs(endDist) < $d72b22c0d316ba07$var$EPSILON;\n const isStartBelow = startDist < 0;\n const isEndBelow = endDist < 0;\n // if the line and plane are coplanar then return that we can't trim\n line.delta($d72b22c0d316ba07$var$_lineDirection).normalize();\n if (Math.abs($d72b22c0d316ba07$var$_plane.normal.dot($d72b22c0d316ba07$var$_lineDirection)) < $d72b22c0d316ba07$var$EPSILON) {\n if (isStartOnPlane || !isStartBelow) return false;\n else {\n lineTarget.copy(line);\n return true;\n }\n }\n // find the point that's below the plane. If both points are below the plane\n // then we assume we're dealing with floating point error\n if (isStartBelow && isEndBelow) {\n // if the whole line is below then just copy that\n lineTarget.copy(line);\n return true;\n } else if (!isStartBelow && !isEndBelow) // if it's wholly above then skip it\n return false;\n else {\n let didHit = $d72b22c0d316ba07$var$_plane.intersectLine(line, $d72b22c0d316ba07$var$_planeHit);\n if (!didHit) {\n if (isStartOnPlane) {\n $d72b22c0d316ba07$var$_planeHit.copy(line.start);\n didHit = true;\n }\n if (isEndOnPlane) {\n $d72b22c0d316ba07$var$_planeHit.copy(line.end);\n didHit = true;\n }\n }\n if (didHit) {\n if (isStartBelow) {\n lineTarget.start.copy(line.start);\n lineTarget.end.copy($d72b22c0d316ba07$var$_planeHit);\n return true;\n } else if (isEndBelow) {\n lineTarget.end.copy(line.end);\n lineTarget.start.copy($d72b22c0d316ba07$var$_planeHit);\n return true;\n }\n }\n }\n return false;\n}\n\n});\n\nparcelRequire.register(\"64zt3\", function(module, exports) {\n\n$parcel$export(module.exports, \"getProjectedLineOverlap\", () => $46bea0e9f6f7cdfa$export$87b006ababf09c4d);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\nconst $46bea0e9f6f7cdfa$var$AREA_EPSILON = 1e-16;\nconst $46bea0e9f6f7cdfa$var$DIST_EPSILON = 1e-16;\nconst $46bea0e9f6f7cdfa$var$_orthoPlane = /* @__PURE__ */ new (0, $ilwiq.Plane)();\nconst $46bea0e9f6f7cdfa$var$_edgeLine = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nconst $46bea0e9f6f7cdfa$var$_point = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $46bea0e9f6f7cdfa$var$_vec = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $46bea0e9f6f7cdfa$var$_tri = /* @__PURE__ */ new (0, $8VYkb.ExtendedTriangle)();\nconst $46bea0e9f6f7cdfa$var$_line = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nconst $46bea0e9f6f7cdfa$var$_triLine = /* @__PURE__ */ new (0, $ilwiq.Line3)();\nconst $46bea0e9f6f7cdfa$var$_dir = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $46bea0e9f6f7cdfa$var$_triDir = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $46bea0e9f6f7cdfa$export$87b006ababf09c4d(line, triangle, lineTarget = new (0, $ilwiq.Line3)()) {\n // flatten the shapes\n $46bea0e9f6f7cdfa$var$_tri.copy(triangle);\n $46bea0e9f6f7cdfa$var$_tri.a.y = 0;\n $46bea0e9f6f7cdfa$var$_tri.b.y = 0;\n $46bea0e9f6f7cdfa$var$_tri.c.y = 0;\n $46bea0e9f6f7cdfa$var$_tri.update();\n $46bea0e9f6f7cdfa$var$_line.copy(line);\n $46bea0e9f6f7cdfa$var$_line.start.y = 0;\n $46bea0e9f6f7cdfa$var$_line.end.y = 0;\n // if the triangle is degenerate then return no overlap\n if ($46bea0e9f6f7cdfa$var$_tri.getArea() <= $46bea0e9f6f7cdfa$var$AREA_EPSILON) return null;\n $46bea0e9f6f7cdfa$var$_line.delta($46bea0e9f6f7cdfa$var$_dir).normalize();\n $46bea0e9f6f7cdfa$var$_dir.cross($46bea0e9f6f7cdfa$var$_tri.plane.normal).normalize();\n $46bea0e9f6f7cdfa$var$_orthoPlane.setFromNormalAndCoplanarPoint($46bea0e9f6f7cdfa$var$_dir, $46bea0e9f6f7cdfa$var$_line.start);\n // find the line of intersection of the triangle along the plane if it exists\n let intersectCount = 0;\n const { points: points } = $46bea0e9f6f7cdfa$var$_tri;\n for(let i = 0; i < 3; i++){\n const p1 = points[i];\n const p2 = points[(i + 1) % 3];\n $46bea0e9f6f7cdfa$var$_edgeLine.start.copy(p1);\n $46bea0e9f6f7cdfa$var$_edgeLine.end.copy(p2);\n const startIntersects = Math.abs($46bea0e9f6f7cdfa$var$_orthoPlane.distanceToPoint($46bea0e9f6f7cdfa$var$_edgeLine.start)) < $46bea0e9f6f7cdfa$var$DIST_EPSILON;\n const endIntersects = Math.abs($46bea0e9f6f7cdfa$var$_orthoPlane.distanceToPoint($46bea0e9f6f7cdfa$var$_edgeLine.end)) < $46bea0e9f6f7cdfa$var$DIST_EPSILON;\n const edgeIntersects = $46bea0e9f6f7cdfa$var$_orthoPlane.intersectLine($46bea0e9f6f7cdfa$var$_edgeLine, $46bea0e9f6f7cdfa$var$_point);\n if (edgeIntersects && !endIntersects || startIntersects) {\n if (startIntersects && !edgeIntersects) $46bea0e9f6f7cdfa$var$_point.copy($46bea0e9f6f7cdfa$var$_edgeLine.start);\n if (intersectCount === 0) $46bea0e9f6f7cdfa$var$_triLine.start.copy($46bea0e9f6f7cdfa$var$_point);\n else $46bea0e9f6f7cdfa$var$_triLine.end.copy($46bea0e9f6f7cdfa$var$_point);\n intersectCount++;\n if (intersectCount === 2) break;\n }\n }\n if (intersectCount === 2) {\n // find the intersect line if any\n $46bea0e9f6f7cdfa$var$_line.delta($46bea0e9f6f7cdfa$var$_dir).normalize();\n $46bea0e9f6f7cdfa$var$_triLine.delta($46bea0e9f6f7cdfa$var$_triDir).normalize();\n // swap edges so they're facing in the same direction\n if ($46bea0e9f6f7cdfa$var$_dir.dot($46bea0e9f6f7cdfa$var$_triDir) < 0) {\n let tmp = $46bea0e9f6f7cdfa$var$_triLine.start;\n $46bea0e9f6f7cdfa$var$_triLine.start = $46bea0e9f6f7cdfa$var$_triLine.end;\n $46bea0e9f6f7cdfa$var$_triLine.end = tmp;\n }\n // check if the edges are overlapping\n const s1 = 0;\n const e1 = $46bea0e9f6f7cdfa$var$_vec.subVectors($46bea0e9f6f7cdfa$var$_line.end, $46bea0e9f6f7cdfa$var$_line.start).dot($46bea0e9f6f7cdfa$var$_dir);\n const s2 = $46bea0e9f6f7cdfa$var$_vec.subVectors($46bea0e9f6f7cdfa$var$_triLine.start, $46bea0e9f6f7cdfa$var$_line.start).dot($46bea0e9f6f7cdfa$var$_dir);\n const e2 = $46bea0e9f6f7cdfa$var$_vec.subVectors($46bea0e9f6f7cdfa$var$_triLine.end, $46bea0e9f6f7cdfa$var$_line.start).dot($46bea0e9f6f7cdfa$var$_dir);\n const separated1 = e1 <= s2;\n const separated2 = e2 <= s1;\n if (separated1 || separated2) return null;\n line.at(Math.max(s1, s2) / $46bea0e9f6f7cdfa$var$_line.distance(), lineTarget.start);\n line.at(Math.min(e1, e2) / $46bea0e9f6f7cdfa$var$_line.distance(), lineTarget.end);\n return lineTarget;\n }\n return null;\n}\n\n});\n\nparcelRequire.register(\"iQQnd\", function(module, exports) {\n\n$parcel$export(module.exports, \"appendOverlapRange\", () => $db95b59be4665d0e$export$23512680614f2620);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nconst $db95b59be4665d0e$var$DIST_EPSILON = 1e-16;\nconst $db95b59be4665d0e$var$_dir = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $db95b59be4665d0e$var$_v0 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $db95b59be4665d0e$var$_v1 = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $db95b59be4665d0e$export$23512680614f2620(line, overlapLine, overlapsTarget) {\n line.delta($db95b59be4665d0e$var$_dir);\n $db95b59be4665d0e$var$_v0.subVectors(overlapLine.start, line.start);\n $db95b59be4665d0e$var$_v1.subVectors(overlapLine.end, line.start);\n const length = $db95b59be4665d0e$var$_dir.length();\n let d0 = $db95b59be4665d0e$var$_v0.length() / length;\n let d1 = $db95b59be4665d0e$var$_v1.length() / length;\n d0 = Math.min(Math.max(d0, 0), 1);\n d1 = Math.min(Math.max(d1, 0), 1);\n if (!(Math.abs(d0 - d1) <= $db95b59be4665d0e$var$DIST_EPSILON)) {\n overlapsTarget.push(new Float32Array([\n d0,\n d1\n ]));\n return true;\n }\n return false;\n}\n\n});\n\nparcelRequire.register(\"5zNJG\", function(module, exports) {\n\n$parcel$export(module.exports, \"generateIntersectionEdges\", () => $40f6cd1fbf8b2094$export$983ba676a1dedbe3);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $8VYkb = parcelRequire(\"8VYkb\");\n\nvar $bJKwC = parcelRequire(\"bJKwC\");\nconst $40f6cd1fbf8b2094$var$OFFSET_EPSILON = 1e-6;\nconst $40f6cd1fbf8b2094$var$_tri = new (0, $8VYkb.ExtendedTriangle)();\nconst $40f6cd1fbf8b2094$var$_line = new (0, $ilwiq.Line3)();\nfunction* $40f6cd1fbf8b2094$export$983ba676a1dedbe3(bvh, iterationTime = 30) {\n const edges = [];\n const geometry = bvh.geometry;\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const vertCount = index ? index.count : posAttr;\n let time = performance.now();\n for(let i = 0; i < vertCount; i += 3){\n let i0 = i + 0;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n const { a: a, b: b, c: c } = $40f6cd1fbf8b2094$var$_tri;\n a.fromBufferAttribute(posAttr, i0);\n b.fromBufferAttribute(posAttr, i1);\n c.fromBufferAttribute(posAttr, i2);\n $40f6cd1fbf8b2094$var$_tri.needsUpdate = true;\n $40f6cd1fbf8b2094$var$_tri.update();\n bvh.shapecast({\n intersectsBounds: (box)=>{\n return box.intersectsTriangle($40f6cd1fbf8b2094$var$_tri);\n },\n intersectsTriangle: (tri2)=>{\n if ($40f6cd1fbf8b2094$var$_tri.equals(tri2)) return false;\n if (tri2.needsUpdate) tri2.update();\n if (Math.abs($40f6cd1fbf8b2094$var$_tri.plane.normal.dot(tri2.plane.normal)) > 1 - 1e-6) return false;\n if ($40f6cd1fbf8b2094$var$_tri.intersectsTriangle(tri2, $40f6cd1fbf8b2094$var$_line, true) && !(0, $bJKwC.isLineTriangleEdge)($40f6cd1fbf8b2094$var$_tri, $40f6cd1fbf8b2094$var$_line) && !(0, $bJKwC.isLineTriangleEdge)(tri2, $40f6cd1fbf8b2094$var$_line)) {\n $40f6cd1fbf8b2094$var$_line.start.y += $40f6cd1fbf8b2094$var$OFFSET_EPSILON;\n $40f6cd1fbf8b2094$var$_line.end.y += $40f6cd1fbf8b2094$var$OFFSET_EPSILON;\n edges.push($40f6cd1fbf8b2094$var$_line.clone());\n }\n }\n });\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n yield;\n time = performance.now();\n }\n }\n return edges;\n}\n\n});\n\n\nparcelRequire.register(\"l7uOa\", function(module, exports) {\n\n$parcel$export(module.exports, \"OUTPUT_BOTH\", () => $f602264c1435a2aa$export$d2881bb52ea2a3ff);\n$parcel$export(module.exports, \"SilhouetteGenerator\", () => $f602264c1435a2aa$export$8f233aafe78e44af);\n\nvar $4Yai1 = parcelRequire(\"4Yai1\");\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $9bB8r = parcelRequire(\"9bB8r\");\n\nvar $e5S3P = parcelRequire(\"e5S3P\");\n\nvar $2lMur = parcelRequire(\"2lMur\");\n\nvar $ahD9r = parcelRequire(\"ahD9r\");\nconst $f602264c1435a2aa$var$AREA_EPSILON = 1e-8;\nconst $f602264c1435a2aa$var$UP_VECTOR = /* @__PURE__ */ new (0, $ilwiq.Vector3)(0, 1, 0);\nconst $f602264c1435a2aa$var$_tri = /* @__PURE__ */ new (0, $ilwiq.Triangle)();\nconst $f602264c1435a2aa$var$_normal = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $f602264c1435a2aa$var$_center = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nconst $f602264c1435a2aa$var$_vec = /* @__PURE__ */ new (0, $ilwiq.Vector3)();\nfunction $f602264c1435a2aa$var$convertPathToGeometry(path, scale) {\n const vector2s = path.map((points)=>{\n return points.flatMap((v)=>new (0, $ilwiq.Vector2)(v.x / scale, v.y / scale));\n });\n const holesShapes = vector2s.filter((p)=>(0, $ilwiq.ShapeUtils).isClockWise(p)).map((p)=>new (0, $ilwiq.Shape)(p));\n const solidShapes = vector2s.filter((p)=>!(0, $ilwiq.ShapeUtils).isClockWise(p)).map((p)=>{\n const shape = new (0, $ilwiq.Shape)(p);\n shape.holes = holesShapes;\n return shape;\n });\n // flip the triangles so they're facing in the right direction\n const result = new (0, $ilwiq.ShapeGeometry)(solidShapes).rotateX(Math.PI / 2);\n result.index.array.reverse();\n return result;\n}\nfunction $f602264c1435a2aa$var$convertPathToLineSegments(path, scale) {\n const arr = [];\n path.forEach((points)=>{\n for(let i = 0, l = points.length; i < l; i++){\n const i1 = (i + 1) % points.length;\n const p0 = points[i];\n const p1 = points[i1];\n arr.push(new (0, $ilwiq.Vector3)(p0.x / scale, 0, p0.y / scale), new (0, $ilwiq.Vector3)(p1.x / scale, 0, p1.y / scale));\n }\n });\n const result = new (0, $ilwiq.BufferGeometry)();\n result.setFromPoints(arr);\n return result;\n}\nconst $f602264c1435a2aa$export$1d778cb9e99a63d0 = 0;\nconst $f602264c1435a2aa$export$b1968b297e0facc4 = 1;\nconst $f602264c1435a2aa$export$d2881bb52ea2a3ff = 2;\nclass $f602264c1435a2aa$export$8f233aafe78e44af {\n constructor(){\n this.iterationTime = 30;\n this.intScalar = 1e9;\n this.doubleSided = false;\n this.sortTriangles = false;\n this.output = $f602264c1435a2aa$export$1d778cb9e99a63d0;\n }\n generateAsync(geometry, options = {}) {\n return new Promise((resolve, reject)=>{\n const { signal: signal } = options;\n const task = this.generate(geometry, options);\n run();\n function run() {\n if (signal && signal.aborted) reject(new Error(\"SilhouetteGenerator: Process aborted via AbortSignal.\"));\n const result = task.next();\n if (result.done) resolve(result.value);\n else requestAnimationFrame(run);\n }\n });\n }\n *generate(geometry, options = {}) {\n const { iterationTime: iterationTime, intScalar: intScalar, doubleSided: doubleSided, output: output, sortTriangles: sortTriangles } = this;\n const { onProgress: onProgress } = options;\n const power = Math.log10(intScalar);\n const extendMultiplier = Math.pow(10, -(power - 2));\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const triCount = (0, $ahD9r.getTriCount)(geometry);\n let overallPath = null;\n const triList = sortTriangles ? (0, $2lMur.getSizeSortedTriList)(geometry) : new Array(triCount).fill().map((v, i)=>i);\n const handle = {\n getGeometry () {\n if (output === $f602264c1435a2aa$export$1d778cb9e99a63d0) return $f602264c1435a2aa$var$convertPathToGeometry(overallPath, intScalar);\n else if (output === $f602264c1435a2aa$export$b1968b297e0facc4) return $f602264c1435a2aa$var$convertPathToLineSegments(overallPath, intScalar);\n else return [\n $f602264c1435a2aa$var$convertPathToGeometry(overallPath, intScalar),\n $f602264c1435a2aa$var$convertPathToLineSegments(overallPath, intScalar)\n ];\n }\n };\n let time = performance.now();\n for(let ti = 0; ti < triCount; ti++){\n const i = triList[ti] * 3;\n let i0 = i + 0;\n let i1 = i + 1;\n let i2 = i + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n // get the triangle\n const { a: a, b: b, c: c } = $f602264c1435a2aa$var$_tri;\n a.fromBufferAttribute(posAttr, i0);\n b.fromBufferAttribute(posAttr, i1);\n c.fromBufferAttribute(posAttr, i2);\n if (!doubleSided) {\n $f602264c1435a2aa$var$_tri.getNormal($f602264c1435a2aa$var$_normal);\n if ($f602264c1435a2aa$var$_normal.dot($f602264c1435a2aa$var$UP_VECTOR) < 0) continue;\n }\n // flatten the triangle\n a.y = 0;\n b.y = 0;\n c.y = 0;\n if ($f602264c1435a2aa$var$_tri.getArea() < $f602264c1435a2aa$var$AREA_EPSILON) continue;\n // expand the triangle by a small degree to ensure overlap\n $f602264c1435a2aa$var$_center.copy(a).add(b).add(c).multiplyScalar(1 / 3);\n $f602264c1435a2aa$var$_vec.subVectors(a, $f602264c1435a2aa$var$_center).normalize();\n a.addScaledVector($f602264c1435a2aa$var$_vec, extendMultiplier);\n $f602264c1435a2aa$var$_vec.subVectors(b, $f602264c1435a2aa$var$_center).normalize();\n b.addScaledVector($f602264c1435a2aa$var$_vec, extendMultiplier);\n $f602264c1435a2aa$var$_vec.subVectors(c, $f602264c1435a2aa$var$_center).normalize();\n c.addScaledVector($f602264c1435a2aa$var$_vec, extendMultiplier);\n // create the path\n const path = new (0, $4Yai1.Path64)();\n path.push((0, $4Yai1.Clipper).makePath([\n a.x * intScalar,\n a.z * intScalar,\n b.x * intScalar,\n b.z * intScalar,\n c.x * intScalar,\n c.z * intScalar\n ]));\n a.multiplyScalar(intScalar);\n b.multiplyScalar(intScalar);\n c.multiplyScalar(intScalar);\n if (overallPath && (0, $e5S3P.triangleIsInsidePaths)($f602264c1435a2aa$var$_tri, overallPath)) continue;\n // perform union\n if (overallPath === null) overallPath = path;\n else {\n overallPath = (0, $4Yai1.Clipper).Union(overallPath, path, (0, $4Yai1.FillRule).NonZero);\n overallPath.forEach((path)=>(0, $9bB8r.compressPoints)(path));\n }\n const delta = performance.now() - time;\n if (delta > iterationTime) {\n if (onProgress) {\n const progress = ti / triCount;\n onProgress(progress, handle);\n }\n yield;\n time = performance.now();\n }\n }\n return handle.getGeometry();\n }\n}\n\n});\nparcelRequire.register(\"4Yai1\", function(module, exports) {\n\n$parcel$export(module.exports, \"Clipper\", () => $e6b3dc1fa027c309$export$47d6d5d06ccbc908);\n$parcel$export(module.exports, \"FillRule\", () => $e6b3dc1fa027c309$export$f26b42c94e8a4f95);\n$parcel$export(module.exports, \"Path64\", () => $e6b3dc1fa027c309$export$b12670b10302a8b7);\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $e6b3dc1fa027c309$export$d7b4df78e16216b1 {\n static minkowskiInternal(pattern, path, isSum, isClosed) {\n const delta = isClosed ? 0 : 1;\n const patLen = pattern.length;\n const pathLen = path.length;\n const tmp = [];\n for (const pathPt of path){\n const path2 = [];\n if (isSum) for (const basePt of pattern)path2.push({\n x: pathPt.x + basePt.x,\n y: pathPt.y + basePt.y\n });\n else for (const basePt of pattern)path2.push({\n x: pathPt.x - basePt.x,\n y: pathPt.y - basePt.y\n });\n tmp.push(path2);\n }\n const result = [];\n let g = isClosed ? pathLen - 1 : 0;\n let h = patLen - 1;\n for(let i = delta; i < pathLen; i++){\n for(let j = 0; j < patLen; j++){\n const quad = [\n tmp[g][h],\n tmp[i][h],\n tmp[i][j],\n tmp[g][j]\n ];\n if (!$e6b3dc1fa027c309$export$47d6d5d06ccbc908.isPositive(quad)) result.push($e6b3dc1fa027c309$export$47d6d5d06ccbc908.reversePath(quad));\n else result.push(quad);\n h = j;\n }\n g = i;\n }\n return result;\n }\n static sum(pattern, path, isClosed) {\n return $e6b3dc1fa027c309$export$47d6d5d06ccbc908.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.NonZero);\n }\n static diff(pattern, path, isClosed) {\n return $e6b3dc1fa027c309$export$47d6d5d06ccbc908.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.NonZero);\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nvar $e6b3dc1fa027c309$export$738d8b3921c27063;\n(function(JoinType) {\n JoinType[JoinType[\"Square\"] = 0] = \"Square\";\n JoinType[JoinType[\"Round\"] = 1] = \"Round\";\n JoinType[JoinType[\"Miter\"] = 2] = \"Miter\";\n})($e6b3dc1fa027c309$export$738d8b3921c27063 || ($e6b3dc1fa027c309$export$738d8b3921c27063 = {}));\nvar $e6b3dc1fa027c309$export$38f58f6965412d86;\n(function(EndType) {\n EndType[EndType[\"Polygon\"] = 0] = \"Polygon\";\n EndType[EndType[\"Joined\"] = 1] = \"Joined\";\n EndType[EndType[\"Butt\"] = 2] = \"Butt\";\n EndType[EndType[\"Square\"] = 3] = \"Square\";\n EndType[EndType[\"Round\"] = 4] = \"Round\";\n})($e6b3dc1fa027c309$export$38f58f6965412d86 || ($e6b3dc1fa027c309$export$38f58f6965412d86 = {}));\nclass $e6b3dc1fa027c309$var$Group {\n constructor(paths, joinType, endType = $e6b3dc1fa027c309$export$38f58f6965412d86.Polygon){\n this.inPaths = [\n ...paths\n ]; // creates a shallow copy of paths\n this.joinType = joinType;\n this.endType = endType;\n this.outPath = [];\n this.outPaths = [];\n this.pathsReversed = false;\n }\n}\nclass $e6b3dc1fa027c309$export$f7b22d527d83f4ad {\n constructor(xOrPt, yOrScale){\n if (typeof xOrPt === \"number\" && typeof yOrScale === \"number\") {\n this.x = xOrPt;\n this.y = yOrScale;\n } else if (xOrPt instanceof $e6b3dc1fa027c309$export$f7b22d527d83f4ad) {\n if (yOrScale !== undefined) {\n this.x = xOrPt.x * yOrScale;\n this.y = xOrPt.y * yOrScale;\n } else {\n this.x = xOrPt.x;\n this.y = xOrPt.y;\n }\n } else {\n this.x = xOrPt.x * (yOrScale || 1);\n this.y = xOrPt.y * (yOrScale || 1);\n }\n }\n toString(precision = 2) {\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\n }\n static equals(lhs, rhs) {\n return $e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(lhs.x - rhs.x) && $e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(lhs.y - rhs.y);\n }\n static notEquals(lhs, rhs) {\n return !$e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(lhs.x - rhs.x) || !$e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(lhs.y - rhs.y);\n }\n equals(obj) {\n if (obj instanceof $e6b3dc1fa027c309$export$f7b22d527d83f4ad) return $e6b3dc1fa027c309$export$f7b22d527d83f4ad.equals(this, obj);\n return false;\n }\n negate() {\n this.x = -this.x;\n this.y = -this.y;\n }\n}\nclass $e6b3dc1fa027c309$export$8cbc02e4273c0b24 {\n constructor(miterLimit = 2.0, arcTolerance = 0.0, preserveCollinear = false, reverseSolution = false){\n this._groupList = [];\n this._normals = [];\n this._solution = [];\n this.MiterLimit = miterLimit;\n this.ArcTolerance = arcTolerance;\n this.MergeGroups = true;\n this.PreserveCollinear = preserveCollinear;\n this.ReverseSolution = reverseSolution;\n }\n clear() {\n this._groupList = [];\n }\n addPath(path, joinType, endType) {\n if (path.length === 0) return;\n const pp = [\n path\n ];\n this.addPaths(pp, joinType, endType);\n }\n addPaths(paths, joinType, endType) {\n if (paths.length === 0) return;\n this._groupList.push(new $e6b3dc1fa027c309$var$Group(paths, joinType, endType));\n }\n executeInternal(delta) {\n this._solution = [];\n if (this._groupList.length === 0) return;\n if (Math.abs(delta) < 0.5) {\n for (const group of this._groupList)for (const path of group.inPaths)this._solution.push(path);\n } else {\n this._delta = delta;\n this._mitLimSqr = this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit);\n for (const group of this._groupList)this.doGroupOffset(group);\n }\n }\n sqr(value) {\n return value * value;\n }\n execute(delta, solution) {\n solution.length = 0;\n this.executeInternal(delta);\n if (this._groupList.length === 0) return;\n // clean up self-intersections ...\n const c = new $e6b3dc1fa027c309$export$389255fe4ace408b();\n c.preserveCollinear = this.PreserveCollinear;\n // the solution should retain the orientation of the input\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\n c.addSubjectPaths(this._solution);\n if (this._groupList[0].pathsReversed) c.execute($e6b3dc1fa027c309$export$9e3ecdefb2438757.Union, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative, solution);\n else c.execute($e6b3dc1fa027c309$export$9e3ecdefb2438757.Union, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive, solution);\n }\n executePolytree(delta, polytree) {\n polytree.clear();\n this.executeInternal(delta);\n if (this._groupList.length === 0) return;\n // clean up self-intersections ...\n const c = new $e6b3dc1fa027c309$export$389255fe4ace408b();\n c.preserveCollinear = this.PreserveCollinear;\n // the solution should retain the orientation of the input\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\n c.addSubjectPaths(this._solution);\n if (this._groupList[0].pathsReversed) c.executePolyTree($e6b3dc1fa027c309$export$9e3ecdefb2438757.Union, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative, polytree);\n else c.executePolyTree($e6b3dc1fa027c309$export$9e3ecdefb2438757.Union, $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive, polytree);\n }\n static getUnitNormal(pt1, pt2) {\n let dx = pt2.x - pt1.x;\n let dy = pt2.y - pt1.y;\n if (dx === 0 && dy === 0) return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(0, 0);\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\n dx *= f;\n dy *= f;\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(dy, -dx);\n }\n executeCallback(deltaCallback, solution) {\n this.DeltaCallback = deltaCallback;\n this.execute(1.0, solution);\n }\n static getBoundsAndLowestPolyIdx(paths) {\n const rec = new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(false); // ie invalid rect\n let lpX = Number.MIN_SAFE_INTEGER;\n let index = -1;\n for(let i = 0; i < paths.length; i++)for (const pt of paths[i]){\n if (pt.y >= rec.bottom) {\n if (pt.y > rec.bottom || pt.x < lpX) {\n index = i;\n lpX = pt.x;\n rec.bottom = pt.y;\n }\n } else if (pt.y < rec.top) rec.top = pt.y;\n if (pt.x > rec.right) rec.right = pt.x;\n else if (pt.x < rec.left) rec.left = pt.x;\n }\n return {\n index: index,\n rec: rec\n };\n }\n static translatePoint(pt, dx, dy) {\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pt.x + dx, pt.y + dy);\n }\n static reflectPoint(pt, pivot) {\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\n }\n static almostZero(value, epsilon = 0.001) {\n return Math.abs(value) < epsilon;\n }\n static hypotenuse(x, y) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n }\n static normalizeVector(vec) {\n const h = this.hypotenuse(vec.x, vec.y);\n if (this.almostZero(h)) return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(0, 0);\n const inverseHypot = 1 / h;\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(vec.x * inverseHypot, vec.y * inverseHypot);\n }\n static getAvgUnitVector(vec1, vec2) {\n return this.normalizeVector(new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(vec1.x + vec2.x, vec1.y + vec2.y));\n }\n static intersectPoint(pt1a, pt1b, pt2a, pt2b) {\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(pt1a.x - pt1b.x)) {\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(pt2a.x - pt2b.x)) return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(0, 0);\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\n const b2 = pt2a.y - m2 * pt2a.x;\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pt1a.x, m2 * pt1a.x + b2);\n }\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(pt2a.x - pt2b.x)) {\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\n const b1 = pt1a.y - m1 * pt1a.x;\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pt2a.x, m1 * pt2a.x + b1);\n } else {\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\n const b1 = pt1a.y - m1 * pt1a.x;\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\n const b2 = pt2a.y - m2 * pt2a.x;\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(m1 - m2)) return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(0, 0);\n const x = (b2 - b1) / (m1 - m2);\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(x, m1 * x + b1);\n }\n }\n getPerpendic(pt, norm) {\n return new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\n }\n getPerpendicD(pt, norm) {\n return new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\n }\n doSquare(group, path, j, k) {\n let vec;\n if (j === k) vec = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(this._normals[j].y, -this._normals[j].x);\n else vec = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.getAvgUnitVector(new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(-this._normals[k].y, this._normals[k].x), new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(this._normals[j].y, -this._normals[j].x));\n const absDelta = Math.abs(this._groupDelta);\n // now offset the original vertex delta units along unit vector\n let ptQ = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(path[j].x, path[j].y);\n ptQ = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\n // get perpendicular vertices\n const pt1 = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\n const pt2 = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\n // get 2 vertices along one edge offset\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\n if (j === k) {\n const pt4 = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\n const pt = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.intersectPoint(pt1, pt2, pt3, pt4);\n //get the second intersect point through reflection\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f($e6b3dc1fa027c309$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).x, $e6b3dc1fa027c309$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).y));\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x, pt.y));\n } else {\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\n const pt = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.intersectPoint(pt1, pt2, pt3, pt4);\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x, pt.y));\n //get the second intersect point through reflection\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f($e6b3dc1fa027c309$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).x, $e6b3dc1fa027c309$export$8cbc02e4273c0b24.reflectPoint(pt, ptQ).y));\n }\n }\n doMiter(group, path, j, k, cosA) {\n const q = this._groupDelta / (cosA + 1);\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(path[j].x + (this._normals[k].x + this._normals[j].x) * q, path[j].y + (this._normals[k].y + this._normals[j].y) * q));\n }\n doRound(group, path, j, k, angle) {\n if (typeof this.DeltaCallback !== \"undefined\") {\n const absDelta = Math.abs(this._groupDelta);\n const arcTol = this.ArcTolerance > 0.01 ? this.ArcTolerance : Math.log10(2 + absDelta) * $e6b3dc1fa027c309$export$9bad362b29d84293.defaultArcTolerance;\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\n this._stepSin = Math.sin(2 * Math.PI / stepsPer360);\n this._stepCos = Math.cos(2 * Math.PI / stepsPer360);\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\n }\n const pt = path[j];\n let offsetVec = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\n if (j === k) offsetVec.negate();\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x + offsetVec.x, pt.y + offsetVec.y));\n if (angle > -Math.PI + 0.01) {\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\n for(let i = 1; i < steps; i++){\n offsetVec = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(offsetVec.x * this._stepCos - this._stepSin * offsetVec.y, offsetVec.x * this._stepSin + offsetVec.y * this._stepCos);\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x + offsetVec.x, pt.y + offsetVec.y));\n }\n }\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\n }\n buildNormals(path) {\n const cnt = path.length;\n this._normals = [];\n this._normals.length = cnt;\n for(let i = 0; i < cnt - 1; i++)this._normals.push($e6b3dc1fa027c309$export$8cbc02e4273c0b24.getUnitNormal(path[i], path[i + 1]));\n this._normals.push($e6b3dc1fa027c309$export$8cbc02e4273c0b24.getUnitNormal(path[cnt - 1], path[0]));\n }\n crossProduct(vec1, vec2) {\n return vec1.y * vec2.x - vec2.y * vec1.x;\n }\n dotProduct(vec1, vec2) {\n return vec1.x * vec2.x + vec1.y * vec2.y;\n }\n offsetPoint(group, path, j, k) {\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\n if (sinA > 1.0) cosA = 1.0;\n else if (sinA < -1) cosA = -1;\n if (typeof this.DeltaCallback !== \"undefined\") {\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\n if (group.pathsReversed) this._groupDelta = -this._groupDelta;\n }\n if (Math.abs(this._groupDelta) < $e6b3dc1fa027c309$export$8cbc02e4273c0b24.Tolerance) {\n group.outPath.push(path[j]);\n return;\n }\n if (cosA > 0.999) this.doMiter(group, path, j, k, cosA);\n else if (cosA > -0.99 && sinA * this._groupDelta < 0) {\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\n group.outPath.push(path[j]);\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\n } else if (this._joinType === $e6b3dc1fa027c309$export$738d8b3921c27063.Miter) {\n if (cosA > this._mitLimSqr - 1) this.doMiter(group, path, j, k, cosA);\n else this.doSquare(group, path, j, k);\n } else if (cosA > 0.99 || this._joinType === $e6b3dc1fa027c309$export$738d8b3921c27063.Square) this.doSquare(group, path, j, k);\n else this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\n k = j;\n }\n offsetPolygon(group, path) {\n const area = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.area(path);\n if (area < 0 !== this._groupDelta < 0) {\n const rect = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.getBounds(path);\n if (Math.abs(this._groupDelta) * 2 > rect.width) return;\n }\n group.outPath = [];\n const cnt = path.length;\n const prev = cnt - 1;\n for(let i = 0; i < cnt; i++)this.offsetPoint(group, path, i, prev);\n group.outPaths.push(group.outPath);\n }\n offsetOpenJoined(group, path) {\n this.offsetPolygon(group, path);\n path = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.reversePath(path);\n this.buildNormals(path);\n this.offsetPolygon(group, path);\n }\n offsetOpenPath(group, path) {\n group.outPath = [];\n const highI = path.length - 1;\n if (typeof this.DeltaCallback !== \"undefined\") this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\n if (Math.abs(this._groupDelta) < $e6b3dc1fa027c309$export$8cbc02e4273c0b24.Tolerance) group.outPath.push(path[0]);\n else switch(this._endType){\n case $e6b3dc1fa027c309$export$38f58f6965412d86.Butt:\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(path[0].x - this._normals[0].x * this._groupDelta, path[0].y - this._normals[0].y * this._groupDelta));\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\n break;\n case $e6b3dc1fa027c309$export$38f58f6965412d86.Round:\n this.doRound(group, path, 0, 0, Math.PI);\n break;\n default:\n this.doSquare(group, path, 0, 0);\n break;\n }\n for(let i = 1, k = 0; i < highI; i++)this.offsetPoint(group, path, i, k);\n for(let i = highI; i > 0; i--)this._normals[i] = new $e6b3dc1fa027c309$export$f7b22d527d83f4ad(-this._normals[i - 1].x, -this._normals[i - 1].y);\n this._normals[0] = this._normals[highI];\n if (typeof this.DeltaCallback !== \"undefined\") this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\n if (Math.abs(this._groupDelta) < $e6b3dc1fa027c309$export$8cbc02e4273c0b24.Tolerance) group.outPath.push(path[highI]);\n else switch(this._endType){\n case $e6b3dc1fa027c309$export$38f58f6965412d86.Butt:\n group.outPath.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(path[highI].x - this._normals[highI].x * this._groupDelta, path[highI].y - this._normals[highI].y * this._groupDelta));\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\n break;\n case $e6b3dc1fa027c309$export$38f58f6965412d86.Round:\n this.doRound(group, path, highI, highI, Math.PI);\n break;\n default:\n this.doSquare(group, path, highI, highI);\n break;\n }\n for(let i = highI, k = 0; i > 0; i--)this.offsetPoint(group, path, i, k);\n group.outPaths.push(group.outPath);\n }\n doGroupOffset(group) {\n if (group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Polygon) {\n const { index: index } = $e6b3dc1fa027c309$export$8cbc02e4273c0b24.getBoundsAndLowestPolyIdx(group.inPaths);\n if (index < 0) return;\n const area = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.area(group.inPaths[index]);\n group.pathsReversed = area < 0;\n if (group.pathsReversed) this._groupDelta = -this._delta;\n else this._groupDelta = this._delta;\n } else {\n group.pathsReversed = false;\n this._groupDelta = Math.abs(this._delta) * 0.5;\n }\n const absDelta = Math.abs(this._groupDelta);\n this._joinType = group.joinType;\n this._endType = group.endType;\n if (!this.DeltaCallback && (group.joinType == $e6b3dc1fa027c309$export$738d8b3921c27063.Round || group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Round)) {\n const arcTol = this.ArcTolerance > 0.01 ? this.ArcTolerance : Math.log10(2 + absDelta) * $e6b3dc1fa027c309$export$9bad362b29d84293.defaultArcTolerance;\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\n this._stepSin = Math.sin(2 * Math.PI / stepsPer360);\n this._stepCos = Math.cos(2 * Math.PI / stepsPer360);\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\n }\n const isJoined = group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Joined || group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Polygon;\n for (const p of group.inPaths){\n const path = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.stripDuplicates(p, isJoined);\n const cnt = path.length;\n if (cnt === 0 || cnt < 3 && this._endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Polygon) continue;\n if (cnt == 1) {\n group.outPath = [];\n if (group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Round) {\n const r = absDelta;\n group.outPath = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.ellipse(path[0], r, r);\n } else {\n const d = Math.ceil(this._groupDelta);\n const r = new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\n group.outPath = r.asPath();\n }\n group.outPaths.push(group.outPath);\n } else {\n if (cnt == 2 && group.endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Joined) {\n if (group.joinType == $e6b3dc1fa027c309$export$738d8b3921c27063.Round) this._endType = $e6b3dc1fa027c309$export$38f58f6965412d86.Round;\n else this._endType = $e6b3dc1fa027c309$export$38f58f6965412d86.Square;\n }\n this.buildNormals(path);\n if (this._endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Polygon) this.offsetPolygon(group, path);\n else if (this._endType == $e6b3dc1fa027c309$export$38f58f6965412d86.Joined) this.offsetOpenJoined(group, path);\n else this.offsetOpenPath(group, path);\n }\n }\n this._solution.push(...group.outPaths);\n group.outPaths = [];\n }\n}\n$e6b3dc1fa027c309$export$8cbc02e4273c0b24.Tolerance = 1.0E-12;\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $e6b3dc1fa027c309$export$a6dea2fac1e0b407 {\n constructor(pt){\n this.pt = pt;\n this.ownerIdx = 0;\n }\n}\nvar $e6b3dc1fa027c309$var$Location;\n(function(Location) {\n Location[Location[\"left\"] = 0] = \"left\";\n Location[Location[\"top\"] = 1] = \"top\";\n Location[Location[\"right\"] = 2] = \"right\";\n Location[Location[\"bottom\"] = 3] = \"bottom\";\n Location[Location[\"inside\"] = 4] = \"inside\";\n})($e6b3dc1fa027c309$var$Location || ($e6b3dc1fa027c309$var$Location = {}));\nclass $e6b3dc1fa027c309$export$ada4127871f05d7b {\n constructor(rect){\n this.currIdx = -1;\n this.rect = rect;\n this.mp = rect.midPoint();\n this.rectPath = rect.asPath();\n this.results = [];\n this.edges = Array(8).fill(undefined).map(()=>[]);\n }\n add(pt, startingNewPath = false) {\n let currIdx = this.results.length;\n let result;\n if (currIdx === 0 || startingNewPath) {\n result = new $e6b3dc1fa027c309$export$a6dea2fac1e0b407(pt);\n this.results.push(result);\n result.ownerIdx = currIdx;\n result.prev = result;\n result.next = result;\n } else {\n currIdx--;\n const prevOp = this.results[currIdx];\n if (prevOp.pt === pt) return prevOp;\n result = new $e6b3dc1fa027c309$export$a6dea2fac1e0b407(pt);\n result.ownerIdx = currIdx;\n result.next = prevOp.next;\n prevOp.next.prev = result;\n prevOp.next = result;\n result.prev = prevOp;\n this.results[currIdx] = result;\n }\n return result;\n }\n static path1ContainsPath2(path1, path2) {\n let ioCount = 0;\n for (const pt of path2){\n const pip = $e6b3dc1fa027c309$export$9bad362b29d84293.pointInPolygon(pt, path1);\n switch(pip){\n case $e6b3dc1fa027c309$export$20896d302a4e5029.IsInside:\n ioCount--;\n break;\n case $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside:\n ioCount++;\n break;\n }\n if (Math.abs(ioCount) > 1) break;\n }\n return ioCount <= 0;\n }\n static isClockwise(prev, curr, prevPt, currPt, rectMidPoint) {\n if (this.areOpposites(prev, curr)) return $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(prevPt, rectMidPoint, currPt) < 0;\n else return this.headingClockwise(prev, curr);\n }\n static areOpposites(prev, curr) {\n return Math.abs(prev - curr) === 2;\n }\n static headingClockwise(prev, curr) {\n return (prev + 1) % 4 === curr;\n }\n static getAdjacentLocation(loc, isClockwise) {\n const delta = isClockwise ? 1 : 3;\n return (loc + delta) % 4;\n }\n static unlinkOp(op) {\n if (op.next === op) return undefined;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return op.next;\n }\n static unlinkOpBack(op) {\n if (op.next === op) return undefined;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return op.prev;\n }\n static getEdgesForPt(pt, rec) {\n let result = 0;\n if (pt.x === rec.left) result = 1;\n else if (pt.x === rec.right) result = 4;\n if (pt.y === rec.top) result += 2;\n else if (pt.y === rec.bottom) result += 8;\n return result;\n }\n static isHeadingClockwise(pt1, pt2, edgeIdx) {\n switch(edgeIdx){\n case 0:\n return pt2.y < pt1.y;\n case 1:\n return pt2.x > pt1.x;\n case 2:\n return pt2.y > pt1.y;\n default:\n return pt2.x < pt1.x;\n }\n }\n static hasHorzOverlap(left1, right1, left2, right2) {\n return left1.x < right2.x && right1.x > left2.x;\n }\n static hasVertOverlap(top1, bottom1, top2, bottom2) {\n return top1.y < bottom2.y && bottom1.y > top2.y;\n }\n static addToEdge(edge, op) {\n if (op.edge) return;\n op.edge = edge;\n edge.push(op);\n }\n static uncoupleEdge(op) {\n if (!op.edge) return;\n for(let i = 0; i < op.edge.length; i++){\n const op2 = op.edge[i];\n if (op2 === op) {\n op.edge[i] = undefined;\n break;\n }\n }\n op.edge = undefined;\n }\n static setNewOwner(op, newIdx) {\n op.ownerIdx = newIdx;\n let op2 = op.next;\n while(op2 !== op){\n op2.ownerIdx = newIdx;\n op2 = op2.next;\n }\n }\n addCorner(prev, curr) {\n if ($e6b3dc1fa027c309$export$ada4127871f05d7b.headingClockwise(prev, curr)) this.add(this.rectPath[prev]);\n else this.add(this.rectPath[curr]);\n }\n addCornerByRef(loc, isClockwise) {\n if (isClockwise) {\n this.add(this.rectPath[loc]);\n loc = $e6b3dc1fa027c309$export$ada4127871f05d7b.getAdjacentLocation(loc, true);\n } else {\n loc = $e6b3dc1fa027c309$export$ada4127871f05d7b.getAdjacentLocation(loc, false);\n this.add(this.rectPath[loc]);\n }\n }\n static getLocation(rec, pt) {\n let loc;\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\n loc = $e6b3dc1fa027c309$var$Location.left; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\n loc = $e6b3dc1fa027c309$var$Location.right; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\n loc = $e6b3dc1fa027c309$var$Location.top; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\n loc = $e6b3dc1fa027c309$var$Location.bottom; // pt on rec\n return {\n success: false,\n loc: loc\n };\n }\n if (pt.x < rec.left) loc = $e6b3dc1fa027c309$var$Location.left;\n else if (pt.x > rec.right) loc = $e6b3dc1fa027c309$var$Location.right;\n else if (pt.y < rec.top) loc = $e6b3dc1fa027c309$var$Location.top;\n else if (pt.y > rec.bottom) loc = $e6b3dc1fa027c309$var$Location.bottom;\n else loc = $e6b3dc1fa027c309$var$Location.inside;\n return {\n success: true,\n loc: loc\n };\n }\n static getIntersection(rectPath, p, p2, loc) {\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\n // when result == false, loc will remain unchanged\n let ip = new $e6b3dc1fa027c309$export$d379afd9763b528f();\n switch(loc){\n case $e6b3dc1fa027c309$var$Location.left:\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n else if (p.y < rectPath[0].y && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $e6b3dc1fa027c309$var$Location.top;\n } else if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $e6b3dc1fa027c309$var$Location.right:\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n else if (p.y < rectPath[0].y && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $e6b3dc1fa027c309$var$Location.top;\n } else if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $e6b3dc1fa027c309$var$Location.top:\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n else if (p.x < rectPath[0].x && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.left;\n } else if (p.x > rectPath[1].x && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $e6b3dc1fa027c309$var$Location.right;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $e6b3dc1fa027c309$var$Location.bottom:\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n else if (p.x < rectPath[3].x && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.left;\n } else if (p.x > rectPath[2].x && $e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $e6b3dc1fa027c309$var$Location.right;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n case $e6b3dc1fa027c309$var$Location.inside:\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.left;\n } else if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\n loc = $e6b3dc1fa027c309$var$Location.top;\n } else if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\n loc = $e6b3dc1fa027c309$var$Location.right;\n } else if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\n ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\n loc = $e6b3dc1fa027c309$var$Location.bottom;\n } else return {\n success: false,\n loc: loc,\n ip: ip\n };\n break;\n }\n return {\n success: true,\n loc: loc,\n ip: ip\n };\n }\n getNextLocation(path, context) {\n switch(context.loc){\n case $e6b3dc1fa027c309$var$Location.left:\n while(context.i <= context.highI && path[context.i].x <= this.rect.left)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].x >= this.rect.right) context.loc = $e6b3dc1fa027c309$var$Location.right;\n else if (path[context.i].y <= this.rect.top) context.loc = $e6b3dc1fa027c309$var$Location.top;\n else if (path[context.i].y >= this.rect.bottom) context.loc = $e6b3dc1fa027c309$var$Location.bottom;\n else context.loc = $e6b3dc1fa027c309$var$Location.inside;\n break;\n case $e6b3dc1fa027c309$var$Location.top:\n while(context.i <= context.highI && path[context.i].y <= this.rect.top)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].y >= this.rect.bottom) context.loc = $e6b3dc1fa027c309$var$Location.bottom;\n else if (path[context.i].x <= this.rect.left) context.loc = $e6b3dc1fa027c309$var$Location.left;\n else if (path[context.i].x >= this.rect.right) context.loc = $e6b3dc1fa027c309$var$Location.right;\n else context.loc = $e6b3dc1fa027c309$var$Location.inside;\n break;\n case $e6b3dc1fa027c309$var$Location.right:\n while(context.i <= context.highI && path[context.i].x >= this.rect.right)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].x <= this.rect.left) context.loc = $e6b3dc1fa027c309$var$Location.left;\n else if (path[context.i].y <= this.rect.top) context.loc = $e6b3dc1fa027c309$var$Location.top;\n else if (path[context.i].y >= this.rect.bottom) context.loc = $e6b3dc1fa027c309$var$Location.bottom;\n else context.loc = $e6b3dc1fa027c309$var$Location.inside;\n break;\n case $e6b3dc1fa027c309$var$Location.bottom:\n while(context.i <= context.highI && path[context.i].y >= this.rect.bottom)context.i++;\n if (context.i > context.highI) break;\n if (path[context.i].y <= this.rect.top) context.loc = $e6b3dc1fa027c309$var$Location.top;\n else if (path[context.i].x <= this.rect.left) context.loc = $e6b3dc1fa027c309$var$Location.left;\n else if (path[context.i].x >= this.rect.right) context.loc = $e6b3dc1fa027c309$var$Location.right;\n else context.loc = $e6b3dc1fa027c309$var$Location.inside;\n break;\n case $e6b3dc1fa027c309$var$Location.inside:\n while(context.i <= context.highI){\n if (path[context.i].x < this.rect.left) context.loc = $e6b3dc1fa027c309$var$Location.left;\n else if (path[context.i].x > this.rect.right) context.loc = $e6b3dc1fa027c309$var$Location.right;\n else if (path[context.i].y > this.rect.bottom) context.loc = $e6b3dc1fa027c309$var$Location.bottom;\n else if (path[context.i].y < this.rect.top) context.loc = $e6b3dc1fa027c309$var$Location.top;\n else {\n this.add(path[context.i]);\n context.i++;\n continue;\n }\n break;\n }\n break;\n }\n }\n executeInternal(path) {\n if (path.length < 3 || this.rect.isEmpty()) return;\n const startLocs = [];\n let firstCross = $e6b3dc1fa027c309$var$Location.inside;\n let crossingLoc = firstCross, prev = firstCross;\n let i;\n const highI = path.length - 1;\n let result = $e6b3dc1fa027c309$export$ada4127871f05d7b.getLocation(this.rect, path[highI]);\n let loc = result.loc;\n if (!result.success) {\n i = highI - 1;\n while(i >= 0 && !result.success){\n i--;\n result = $e6b3dc1fa027c309$export$ada4127871f05d7b.getLocation(this.rect, path[i]);\n prev = result.loc;\n }\n if (i < 0) {\n for (const pt of path)this.add(pt);\n return;\n }\n if (prev == $e6b3dc1fa027c309$var$Location.inside) loc = $e6b3dc1fa027c309$var$Location.inside;\n }\n const startingLoc = loc;\n ///////////////////////////////////////////////////\n i = 0;\n while(i <= highI){\n prev = loc;\n const prevCrossLoc = crossingLoc;\n this.getNextLocation(path, {\n loc: loc,\n i: i,\n highI: highI\n });\n if (i > highI) break;\n const prevPt = i == 0 ? path[highI] : path[i - 1];\n crossingLoc = loc;\n let result = $e6b3dc1fa027c309$export$ada4127871f05d7b.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\n const ip = result.ip;\n if (!result.success) {\n if (prevCrossLoc == $e6b3dc1fa027c309$var$Location.inside) {\n const isClockw = $e6b3dc1fa027c309$export$ada4127871f05d7b.isClockwise(prev, loc, prevPt, path[i], this.mp);\n do {\n startLocs.push(prev);\n prev = $e6b3dc1fa027c309$export$ada4127871f05d7b.getAdjacentLocation(prev, isClockw);\n }while (prev != loc);\n crossingLoc = prevCrossLoc;\n } else if (prev != $e6b3dc1fa027c309$var$Location.inside && prev != loc) {\n const isClockw = $e6b3dc1fa027c309$export$ada4127871f05d7b.isClockwise(prev, loc, prevPt, path[i], this.mp);\n do this.addCornerByRef(prev, isClockw);\n while (prev != loc);\n }\n ++i;\n continue;\n }\n ////////////////////////////////////////////////////\n // we must be crossing the rect boundary to get here\n ////////////////////////////////////////////////////\n if (loc == $e6b3dc1fa027c309$var$Location.inside) {\n if (firstCross == $e6b3dc1fa027c309$var$Location.inside) {\n firstCross = crossingLoc;\n startLocs.push(prev);\n } else if (prev != crossingLoc) {\n const isClockw = $e6b3dc1fa027c309$export$ada4127871f05d7b.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\n do this.addCornerByRef(prev, isClockw);\n while (prev != crossingLoc);\n }\n } else if (prev != $e6b3dc1fa027c309$var$Location.inside) {\n // passing right through rect. 'ip' here will be the second\n // intersect pt but we'll also need the first intersect pt (ip2)\n loc = prev;\n result = $e6b3dc1fa027c309$export$ada4127871f05d7b.getIntersection(this.rectPath, prevPt, path[i], loc);\n const ip2 = result.ip;\n if (prevCrossLoc != $e6b3dc1fa027c309$var$Location.inside && prevCrossLoc != loc) this.addCorner(prevCrossLoc, loc);\n if (firstCross == $e6b3dc1fa027c309$var$Location.inside) {\n firstCross = loc;\n startLocs.push(prev);\n }\n loc = crossingLoc;\n this.add(ip2);\n if (ip == ip2) {\n loc = $e6b3dc1fa027c309$export$ada4127871f05d7b.getLocation(this.rect, path[i]).loc;\n this.addCorner(crossingLoc, loc);\n crossingLoc = loc;\n continue;\n }\n } else {\n loc = crossingLoc;\n if (firstCross == $e6b3dc1fa027c309$var$Location.inside) firstCross = crossingLoc;\n }\n this.add(ip);\n } //while i <= highI\n ///////////////////////////////////////////////////\n if (firstCross == $e6b3dc1fa027c309$var$Location.inside) {\n if (startingLoc != $e6b3dc1fa027c309$var$Location.inside) {\n if (this.pathBounds.containsRect(this.rect) && $e6b3dc1fa027c309$export$ada4127871f05d7b.path1ContainsPath2(path, this.rectPath)) for(let j = 0; j < 4; j++){\n this.add(this.rectPath[j]);\n $e6b3dc1fa027c309$export$ada4127871f05d7b.addToEdge(this.edges[j * 2], this.results[0]);\n }\n }\n } else if (loc != $e6b3dc1fa027c309$var$Location.inside && (loc != firstCross || startLocs.length > 2)) {\n if (startLocs.length > 0) {\n prev = loc;\n for (const loc2 of startLocs){\n if (prev == loc2) continue;\n this.addCornerByRef(prev, $e6b3dc1fa027c309$export$ada4127871f05d7b.headingClockwise(prev, loc2));\n prev = loc2;\n }\n loc = prev;\n }\n if (loc != firstCross) this.addCornerByRef(loc, $e6b3dc1fa027c309$export$ada4127871f05d7b.headingClockwise(loc, firstCross));\n }\n }\n execute(paths) {\n const result = [];\n if (this.rect.isEmpty()) return result;\n for (const path of paths){\n if (path.length < 3) continue;\n this.pathBounds = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.getBounds(path);\n if (!this.rect.intersects(this.pathBounds)) continue;\n else if (this.rect.containsRect(this.pathBounds)) {\n result.push(path);\n continue;\n }\n this.executeInternal(path);\n this.checkEdges();\n for(let i = 0; i < 4; ++i)this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\n for (const op of this.results){\n const tmp = this.getPath(op);\n if (tmp.length > 0) result.push(tmp);\n }\n this.results.length = 0;\n for(let i = 0; i < 8; i++)this.edges[i].length = 0;\n }\n return result;\n }\n checkEdges() {\n for(let i = 0; i < this.results.length; i++){\n let op = this.results[i];\n let op2 = op;\n if (op === undefined) continue;\n do if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\n if (op2 === op) {\n op2 = $e6b3dc1fa027c309$export$ada4127871f05d7b.unlinkOpBack(op2);\n if (op2 === undefined) break;\n op = op2.prev;\n } else {\n op2 = $e6b3dc1fa027c309$export$ada4127871f05d7b.unlinkOpBack(op2);\n if (op2 === undefined) break;\n }\n } else op2 = op2.next;\n while (op2 !== op);\n if (op2 === undefined) {\n this.results[i] = undefined;\n continue;\n }\n this.results[i] = op2;\n let edgeSet1 = $e6b3dc1fa027c309$export$ada4127871f05d7b.getEdgesForPt(op.prev.pt, this.rect);\n op2 = op;\n do {\n const edgeSet2 = $e6b3dc1fa027c309$export$ada4127871f05d7b.getEdgesForPt(op2.pt, this.rect);\n if (edgeSet2 !== 0 && op2.edge === undefined) {\n const combinedSet = edgeSet1 & edgeSet2;\n for(let j = 0; j < 4; ++j)if ((combinedSet & 1 << j) !== 0) {\n if ($e6b3dc1fa027c309$export$ada4127871f05d7b.isHeadingClockwise(op2.prev.pt, op2.pt, j)) $e6b3dc1fa027c309$export$ada4127871f05d7b.addToEdge(this.edges[j * 2], op2);\n else $e6b3dc1fa027c309$export$ada4127871f05d7b.addToEdge(this.edges[j * 2 + 1], op2);\n }\n }\n edgeSet1 = edgeSet2;\n op2 = op2.next;\n }while (op2 !== op);\n }\n }\n tidyEdgePair(idx, cw, ccw) {\n if (ccw.length === 0) return;\n const isHorz = idx === 1 || idx === 3;\n const cwIsTowardLarger = idx === 1 || idx === 2;\n let i = 0, j = 0;\n let p1, p2, p1a, p2a, op, op2;\n while(i < cw.length){\n p1 = cw[i];\n if (!p1 || p1.next === p1.prev) {\n cw[i++] = undefined;\n j = 0;\n continue;\n }\n const jLim = ccw.length;\n while(j < jLim && (!ccw[j] || ccw[j].next === ccw[j].prev))++j;\n if (j === jLim) {\n ++i;\n j = 0;\n continue;\n }\n if (cwIsTowardLarger) {\n p1 = cw[i].prev;\n p1a = cw[i];\n p2 = ccw[j];\n p2a = ccw[j].prev;\n } else {\n p1 = cw[i];\n p1a = cw[i].prev;\n p2 = ccw[j].prev;\n p2a = ccw[j];\n }\n if (isHorz && !$e6b3dc1fa027c309$export$ada4127871f05d7b.hasHorzOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt) || !isHorz && !$e6b3dc1fa027c309$export$ada4127871f05d7b.hasVertOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt)) {\n ++j;\n continue;\n }\n const isRejoining = cw[i].ownerIdx !== ccw[j].ownerIdx;\n if (isRejoining) {\n this.results[p2.ownerIdx] = undefined;\n $e6b3dc1fa027c309$export$ada4127871f05d7b.setNewOwner(p2, p1.ownerIdx);\n }\n if (cwIsTowardLarger) {\n // p1 >> | >> p1a;\n // p2 << | << p2a;\n p1.next = p2;\n p2.prev = p1;\n p1a.prev = p2a;\n p2a.next = p1a;\n } else {\n // p1 << | << p1a;\n // p2 >> | >> p2a;\n p1.prev = p2;\n p2.next = p1;\n p1a.next = p2a;\n p2a.prev = p1a;\n }\n if (!isRejoining) {\n const new_idx = this.results.length;\n this.results.push(p1a);\n $e6b3dc1fa027c309$export$ada4127871f05d7b.setNewOwner(p1a, new_idx);\n }\n if (cwIsTowardLarger) {\n op = p2;\n op2 = p1a;\n } else {\n op = p1;\n op2 = p2a;\n }\n this.results[op.ownerIdx] = op;\n this.results[op2.ownerIdx] = op2;\n // and now lots of work to get ready for the next loop\n let opIsLarger, op2IsLarger;\n if (isHorz) {\n opIsLarger = op.pt.x > op.prev.pt.x;\n op2IsLarger = op2.pt.x > op2.prev.pt.x;\n } else {\n opIsLarger = op.pt.y > op.prev.pt.y;\n op2IsLarger = op2.pt.y > op2.prev.pt.y;\n }\n if (op.next === op.prev || op.pt === op.prev.pt) {\n if (op2IsLarger === cwIsTowardLarger) {\n cw[i] = op2;\n ccw[j++] = undefined;\n } else {\n ccw[j] = op2;\n cw[i++] = undefined;\n }\n } else if (op2.next === op2.prev || op2.pt === op2.prev.pt) {\n if (opIsLarger === cwIsTowardLarger) {\n cw[i] = op;\n ccw[j++] = undefined;\n } else {\n ccw[j] = op;\n cw[i++] = undefined;\n }\n } else if (opIsLarger === op2IsLarger) {\n if (opIsLarger === cwIsTowardLarger) {\n cw[i] = op;\n $e6b3dc1fa027c309$export$ada4127871f05d7b.uncoupleEdge(op2);\n $e6b3dc1fa027c309$export$ada4127871f05d7b.addToEdge(cw, op2);\n ccw[j++] = undefined;\n } else {\n cw[i++] = undefined;\n ccw[j] = op2;\n $e6b3dc1fa027c309$export$ada4127871f05d7b.uncoupleEdge(op);\n $e6b3dc1fa027c309$export$ada4127871f05d7b.addToEdge(ccw, op);\n j = 0;\n }\n } else {\n if (opIsLarger === cwIsTowardLarger) cw[i] = op;\n else ccw[j] = op;\n if (op2IsLarger === cwIsTowardLarger) cw[i] = op2;\n else ccw[j] = op2;\n }\n }\n }\n getPath(op) {\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n if (!op || op.prev === op.next) return result;\n let op2 = op.next;\n while(op2 && op2 !== op)if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\n op = op2.prev;\n op2 = $e6b3dc1fa027c309$export$ada4127871f05d7b.unlinkOp(op2);\n } else op2 = op2.next;\n if (!op2) return new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n result.push(op.pt);\n op2 = op.next;\n while(op2 !== op){\n result.push(op2.pt);\n op2 = op2.next;\n }\n return result;\n }\n}\nclass $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2 extends $e6b3dc1fa027c309$export$ada4127871f05d7b {\n constructor(rect){\n super(rect);\n }\n execute(paths) {\n const result = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n if (this.rect.isEmpty()) return result;\n for (const path of paths){\n if (path.length < 2) continue;\n this.pathBounds = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.getBounds(path);\n if (!this.rect.intersects(this.pathBounds)) continue;\n this.executeInternal(path);\n for (const op of this.results){\n const tmp = this.getPath(op);\n if (tmp.length > 0) result.push(tmp);\n }\n // Clean up after every loop\n this.results.length = 0; // Clear the array\n for(let i = 0; i < 8; i++)this.edges[i].length = 0; // Clear each array\n }\n return result;\n }\n getPath(op) {\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n if (!op || op === op.next) return result;\n op = op.next; // starting at path beginning \n result.push(op.pt);\n let op2 = op.next;\n while(op2 !== op){\n result.push(op2.pt);\n op2 = op2.next;\n }\n return result;\n }\n executeInternal(path) {\n this.results = [];\n if (path.length < 2 || this.rect.isEmpty()) return;\n let prev = $e6b3dc1fa027c309$var$Location.inside;\n let i = 1;\n const highI = path.length - 1;\n let result = $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2.getLocation(this.rect, path[0]);\n let loc = result.loc;\n if (!result.success) {\n while(i <= highI && !result.success){\n i++;\n result = $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2.getLocation(this.rect, path[i]);\n prev = result.loc;\n }\n if (i > highI) for (const pt of path)this.add(pt);\n if (prev == $e6b3dc1fa027c309$var$Location.inside) loc = $e6b3dc1fa027c309$var$Location.inside;\n i = 1;\n }\n if (loc == $e6b3dc1fa027c309$var$Location.inside) this.add(path[0]);\n while(i <= highI){\n prev = loc;\n this.getNextLocation(path, {\n loc: loc,\n i: i,\n highI: highI\n });\n if (i > highI) break;\n const prevPt = path[i - 1];\n let crossingLoc = loc;\n let result = $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\n const ip = result.ip;\n crossingLoc = result.loc;\n if (!result.success) {\n i++;\n continue;\n }\n if (loc == $e6b3dc1fa027c309$var$Location.inside) this.add(ip, true);\n else if (prev !== $e6b3dc1fa027c309$var$Location.inside) {\n crossingLoc = prev;\n result = $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\n const ip2 = result.ip;\n crossingLoc = result.loc;\n this.add(ip2);\n this.add(ip);\n } else this.add(ip);\n }\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nclass $e6b3dc1fa027c309$export$47d6d5d06ccbc908 {\n static get InvalidRect64() {\n if (!$e6b3dc1fa027c309$export$47d6d5d06ccbc908.invalidRect64) $e6b3dc1fa027c309$export$47d6d5d06ccbc908.invalidRect64 = new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(false);\n return this.invalidRect64;\n }\n static Intersect(subject, clip, fillRule) {\n return this.BooleanOp($e6b3dc1fa027c309$export$9e3ecdefb2438757.Intersection, subject, clip, fillRule);\n }\n static Union(subject, clip, fillRule = $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) {\n return this.BooleanOp($e6b3dc1fa027c309$export$9e3ecdefb2438757.Union, subject, clip, fillRule);\n }\n static Difference(subject, clip, fillRule) {\n return this.BooleanOp($e6b3dc1fa027c309$export$9e3ecdefb2438757.Difference, subject, clip, fillRule);\n }\n static Xor(subject, clip, fillRule) {\n return this.BooleanOp($e6b3dc1fa027c309$export$9e3ecdefb2438757.Xor, subject, clip, fillRule);\n }\n static BooleanOp(clipType, subject, clip, fillRule = $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) {\n const solution = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n if (!subject) return solution;\n const c = new $e6b3dc1fa027c309$export$389255fe4ace408b();\n c.addPaths(subject, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject);\n if (clip) c.addPaths(clip, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip);\n c.execute(clipType, fillRule, solution);\n return solution;\n }\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\n // if (!subject) return;\n // const c: Clipper64 = new Clipper64();\n // c.addPaths(subject, PathType.Subject);\n // if (clip)\n // c.addPaths(clip, PathType.Clip);\n // c.execute(clipType, fillRule, polytree);\n //}\n static InflatePaths(paths, delta, joinType, endType, miterLimit = 2.0) {\n const co = new $e6b3dc1fa027c309$export$8cbc02e4273c0b24(miterLimit);\n co.addPaths(paths, joinType, endType);\n const solution = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n co.execute(delta, solution);\n return solution;\n }\n static RectClipPaths(rect, paths) {\n if (rect.isEmpty() || paths.length === 0) return new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n const rc = new $e6b3dc1fa027c309$export$ada4127871f05d7b(rect);\n return rc.execute(paths);\n }\n static RectClip(rect, path) {\n if (rect.isEmpty() || path.length === 0) return new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n const tmp = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n tmp.push(path);\n return this.RectClipPaths(rect, tmp);\n }\n static RectClipLinesPaths(rect, paths) {\n if (rect.isEmpty() || paths.length === 0) return new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n const rc = new $e6b3dc1fa027c309$export$b1d67b8e0b9a10d2(rect);\n return rc.execute(paths);\n }\n static RectClipLines(rect, path) {\n if (rect.isEmpty() || path.length === 0) return new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n const tmp = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n tmp.push(path);\n return this.RectClipLinesPaths(rect, tmp);\n }\n static MinkowskiSum(pattern, path, isClosed) {\n return $e6b3dc1fa027c309$export$d7b4df78e16216b1.sum(pattern, path, isClosed);\n }\n static MinkowskiDiff(pattern, path, isClosed) {\n return $e6b3dc1fa027c309$export$d7b4df78e16216b1.diff(pattern, path, isClosed);\n }\n static area(path) {\n // https://en.wikipedia.org/wiki/Shoelace_formula\n let a = 0.0;\n const cnt = path.length;\n if (cnt < 3) return 0.0;\n let prevPt = path[cnt - 1];\n for (const pt of path){\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\n prevPt = pt;\n }\n return a * 0.5;\n }\n static areaPaths(paths) {\n let a = 0.0;\n for (const path of paths)a += this.area(path);\n return a;\n }\n static isPositive(poly) {\n return this.area(poly) >= 0;\n }\n static path64ToString(path) {\n let result = \"\";\n for (const pt of path)result += pt.toString();\n return result + \"\\n\";\n }\n static paths64ToString(paths) {\n let result = \"\";\n for (const path of paths)result += this.path64ToString(path);\n return result;\n }\n static offsetPath(path, dx, dy) {\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n for (const pt of path)result.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(pt.x + dx, pt.y + dy));\n return result;\n }\n static scalePoint64(pt, scale) {\n const result = new $e6b3dc1fa027c309$export$d379afd9763b528f(Math.round(pt.x * scale), Math.round(pt.y * scale));\n return result;\n }\n static scalePath(path, scale) {\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(scale - 1)) return path;\n const result = [];\n for (const pt of path)result.push({\n x: pt.x * scale,\n y: pt.y * scale\n });\n return result;\n }\n static scalePaths(paths, scale) {\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.isAlmostZero(scale - 1)) return paths;\n const result = [];\n for (const path of paths)result.push(this.scalePath(path, scale));\n return result;\n }\n static translatePath(path, dx, dy) {\n const result = [];\n for (const pt of path)result.push({\n x: pt.x + dx,\n y: pt.y + dy\n });\n return result;\n }\n static translatePaths(paths, dx, dy) {\n const result = [];\n for (const path of paths)result.push(this.translatePath(path, dx, dy));\n return result;\n }\n static reversePath(path) {\n return [\n ...path\n ].reverse();\n }\n static reversePaths(paths) {\n const result = [];\n for (const t of paths)result.push(this.reversePath(t));\n return result;\n }\n static getBounds(path) {\n const result = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.InvalidRect64;\n for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result.left === Number.MAX_SAFE_INTEGER ? new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : result;\n }\n static getBoundsPaths(paths) {\n const result = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.InvalidRect64;\n for (const path of paths)for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result.left === Number.MAX_SAFE_INTEGER ? new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : result;\n }\n static makePath(arr) {\n const len = arr.length / 2;\n const p = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n for(let i = 0; i < len; i++)p.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(arr[i * 2], arr[i * 2 + 1]));\n return p;\n }\n static stripDuplicates(path, isClosedPath) {\n const cnt = path.length;\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n if (cnt === 0) return result;\n let lastPt = path[0];\n result.push(lastPt);\n for(let i = 1; i < cnt; i++)if (lastPt !== path[i]) {\n lastPt = path[i];\n result.push(lastPt);\n }\n if (isClosedPath && lastPt === result[0]) result.pop();\n return result;\n }\n static addPolyNodeToPaths(polyPath, paths) {\n if (polyPath.polygon && polyPath.polygon.length > 0) paths.push(polyPath.polygon);\n for(let i = 0; i < polyPath.count; i++)this.addPolyNodeToPaths(polyPath.children[i], paths);\n }\n static polyTreeToPaths64(polyTree) {\n const result = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9();\n for(let i = 0; i < polyTree.count; i++)$e6b3dc1fa027c309$export$47d6d5d06ccbc908.addPolyNodeToPaths(polyTree.children[i], result);\n return result;\n }\n static perpendicDistFromLineSqrd(pt, line1, line2) {\n const a = pt.x - line1.x;\n const b = pt.y - line1.y;\n const c = line2.x - line1.x;\n const d = line2.y - line1.y;\n if (c === 0 && d === 0) return 0;\n return $e6b3dc1fa027c309$export$47d6d5d06ccbc908.sqr(a * d - c * b) / (c * c + d * d);\n }\n static rdp(path, begin, end, epsSqrd, flags) {\n let idx = 0;\n let max_d = 0;\n while(end > begin && path[begin] === path[end])flags[end--] = false;\n for(let i = begin + 1; i < end; i++){\n const d = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\n if (d <= max_d) continue;\n max_d = d;\n idx = i;\n }\n if (max_d <= epsSqrd) return;\n flags[idx] = true;\n if (idx > begin + 1) $e6b3dc1fa027c309$export$47d6d5d06ccbc908.rdp(path, begin, idx, epsSqrd, flags);\n if (idx < end - 1) $e6b3dc1fa027c309$export$47d6d5d06ccbc908.rdp(path, idx, end, epsSqrd, flags);\n }\n static ramerDouglasPeucker(path, epsilon) {\n const len = path.length;\n if (len < 5) return path;\n const flags = new Array(len).fill(false);\n flags[0] = true;\n flags[len - 1] = true;\n $e6b3dc1fa027c309$export$47d6d5d06ccbc908.rdp(path, 0, len - 1, $e6b3dc1fa027c309$export$47d6d5d06ccbc908.sqr(epsilon), flags);\n const result = [];\n for(let i = 0; i < len; i++)if (flags[i]) result.push(path[i]);\n return result;\n }\n static ramerDouglasPeuckerPaths(paths, epsilon) {\n const result = [];\n for (const path of paths)result.push($e6b3dc1fa027c309$export$47d6d5d06ccbc908.ramerDouglasPeucker(path, epsilon));\n return result;\n }\n static getNext(current, high, flags) {\n current++;\n while(current <= high && flags[current])current++;\n if (current <= high) return current;\n current = 0;\n while(flags[current])current++;\n return current;\n }\n static getPrior(current, high, flags) {\n if (current === 0) current = high;\n else current--;\n while(current > 0 && flags[current])current--;\n if (!flags[current]) return current;\n current = high;\n while(flags[current])current--;\n return current;\n }\n static sqr(value) {\n return value * value;\n }\n static simplifyPath(path, epsilon, isClosedPath = false) {\n const len = path.length;\n const high = len - 1;\n const epsSqr = this.sqr(epsilon);\n if (len < 4) return path;\n const flags = new Array(len).fill(false);\n const dsq = new Array(len).fill(0);\n let prev = high;\n let curr = 0;\n let start, next, prior2, next2;\n if (isClosedPath) {\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\n } else {\n dsq[0] = Number.MAX_VALUE;\n dsq[high] = Number.MAX_VALUE;\n }\n for(let i = 1; i < high; i++)dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\n for(;;){\n if (dsq[curr] > epsSqr) {\n start = curr;\n do curr = this.getNext(curr, high, flags);\n while (curr !== start && dsq[curr] > epsSqr);\n if (curr === start) break;\n }\n prev = this.getPrior(curr, high, flags);\n next = this.getNext(curr, high, flags);\n if (next === prev) break;\n if (dsq[next] < dsq[curr]) {\n flags[next] = true;\n next = this.getNext(next, high, flags);\n next2 = this.getNext(next, high, flags);\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\n if (next !== high || isClosedPath) dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\n curr = next;\n } else {\n flags[curr] = true;\n curr = next;\n next = this.getNext(next, high, flags);\n prior2 = this.getPrior(prev, high, flags);\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\n if (prev !== 0 || isClosedPath) dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\n }\n }\n const result = [];\n for(let i = 0; i < len; i++)if (!flags[i]) result.push(path[i]);\n return result;\n }\n static simplifyPaths(paths, epsilon, isClosedPaths = false) {\n const result = [];\n for (const path of paths)result.push(this.simplifyPath(path, epsilon, isClosedPaths));\n return result;\n }\n //private static getNext(current: number, high: number, flags: boolean[]): number {\n // current++;\n // while (current <= high && flags[current]) current++;\n // return current;\n //}\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\n // if (current === 0) return high;\n // current--;\n // while (current > 0 && flags[current]) current--;\n // return current;\n //}\n static trimCollinear(path, isOpen = false) {\n let len = path.length;\n let i = 0;\n if (!isOpen) {\n while(i < len - 1 && $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(path[len - 1], path[i], path[i + 1]) === 0)i++;\n while(i < len - 1 && $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(path[len - 2], path[len - 1], path[i]) === 0)len--;\n }\n if (len - i < 3) {\n if (!isOpen || len < 2 || path[0] === path[1]) return [];\n return path;\n }\n const result = [];\n let last = path[i];\n result.push(last);\n for(i++; i < len - 1; i++){\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(last, path[i], path[i + 1]) === 0) continue;\n last = path[i];\n result.push(last);\n }\n if (isOpen) result.push(path[len - 1]);\n else if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(last, path[len - 1], result[0]) !== 0) result.push(path[len - 1]);\n else {\n while(result.length > 2 && $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0)result.pop();\n if (result.length < 3) result.splice(0, result.length);\n }\n return result;\n }\n static pointInPolygon(pt, polygon) {\n return $e6b3dc1fa027c309$export$9bad362b29d84293.pointInPolygon(pt, polygon);\n }\n static ellipse(center, radiusX, radiusY = 0, steps = 0) {\n if (radiusX <= 0) return [];\n if (radiusY <= 0) radiusY = radiusX;\n if (steps <= 2) steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\n const si = Math.sin(2 * Math.PI / steps);\n const co = Math.cos(2 * Math.PI / steps);\n let dx = co, dy = si;\n const result = [\n {\n x: center.x + radiusX,\n y: center.y\n }\n ];\n for(let i = 1; i < steps; ++i){\n result.push({\n x: center.x + radiusX * dx,\n y: center.y + radiusY * dy\n });\n const x = dx * co - dy * si;\n dy = dy * co + dx * si;\n dx = x;\n }\n return result;\n }\n static showPolyPathStructure(pp, level) {\n const spaces = \" \".repeat(level * 2);\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\n if (pp.count === 0) console.log(spaces + caption);\n else {\n console.log(spaces + caption + `(${pp.count})`);\n pp.forEach((child)=>this.showPolyPathStructure(child, level + 1));\n }\n }\n static showPolyTreeStructure(polytree) {\n console.log(\"Polytree Root\");\n polytree.forEach((child)=>this.showPolyPathStructure(child, 1));\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\nvar $e6b3dc1fa027c309$export$20896d302a4e5029;\n(function(PointInPolygonResult) {\n PointInPolygonResult[PointInPolygonResult[\"IsOn\"] = 0] = \"IsOn\";\n PointInPolygonResult[PointInPolygonResult[\"IsInside\"] = 1] = \"IsInside\";\n PointInPolygonResult[PointInPolygonResult[\"IsOutside\"] = 2] = \"IsOutside\";\n})($e6b3dc1fa027c309$export$20896d302a4e5029 || ($e6b3dc1fa027c309$export$20896d302a4e5029 = {}));\nvar $e6b3dc1fa027c309$export$6bbe4490a892c1c5;\n(function(VertexFlags) {\n VertexFlags[VertexFlags[\"None\"] = 0] = \"None\";\n VertexFlags[VertexFlags[\"OpenStart\"] = 1] = \"OpenStart\";\n VertexFlags[VertexFlags[\"OpenEnd\"] = 2] = \"OpenEnd\";\n VertexFlags[VertexFlags[\"LocalMax\"] = 4] = \"LocalMax\";\n VertexFlags[VertexFlags[\"LocalMin\"] = 8] = \"LocalMin\";\n})($e6b3dc1fa027c309$export$6bbe4490a892c1c5 || ($e6b3dc1fa027c309$export$6bbe4490a892c1c5 = {}));\nclass $e6b3dc1fa027c309$var$Vertex {\n constructor(pt, flags, prev){\n this.pt = pt;\n this.flags = flags;\n this.next = undefined;\n this.prev = prev;\n }\n}\nclass $e6b3dc1fa027c309$var$LocalMinima {\n constructor(vertex, polytype, isOpen = false){\n this.vertex = vertex;\n this.polytype = polytype;\n this.isOpen = isOpen;\n }\n static equals(lm1, lm2) {\n return lm1.vertex === lm2.vertex;\n }\n static notEquals(lm1, lm2) {\n return lm1.vertex !== lm2.vertex;\n }\n}\nclass $e6b3dc1fa027c309$var$IntersectNode {\n constructor(pt, edge1, edge2){\n this.pt = pt;\n this.edge1 = edge1;\n this.edge2 = edge2;\n }\n}\nclass $e6b3dc1fa027c309$var$OutPt {\n constructor(pt, outrec){\n this.pt = pt;\n this.outrec = outrec;\n this.next = this;\n this.prev = this;\n this.horz = undefined;\n }\n}\nvar $e6b3dc1fa027c309$export$290b84559c467a5c;\n(function(JoinWith) {\n JoinWith[JoinWith[\"None\"] = 0] = \"None\";\n JoinWith[JoinWith[\"Left\"] = 1] = \"Left\";\n JoinWith[JoinWith[\"Right\"] = 2] = \"Right\";\n})($e6b3dc1fa027c309$export$290b84559c467a5c || ($e6b3dc1fa027c309$export$290b84559c467a5c = {}));\nvar $e6b3dc1fa027c309$export$c8278727b7a5228b;\n(function(HorzPosition) {\n HorzPosition[HorzPosition[\"Bottom\"] = 0] = \"Bottom\";\n HorzPosition[HorzPosition[\"Middle\"] = 1] = \"Middle\";\n HorzPosition[HorzPosition[\"Top\"] = 2] = \"Top\";\n})($e6b3dc1fa027c309$export$c8278727b7a5228b || ($e6b3dc1fa027c309$export$c8278727b7a5228b = {}));\nclass $e6b3dc1fa027c309$export$1e0666df669b1ceb {\n constructor(idx){\n this.idx = idx;\n this.isOpen = false;\n }\n}\nclass $e6b3dc1fa027c309$var$HorzSegment {\n constructor(op){\n this.leftOp = op;\n this.rightOp = undefined;\n this.leftToRight = true;\n }\n}\nclass $e6b3dc1fa027c309$var$HorzJoin {\n constructor(ltor, rtol){\n this.op1 = ltor;\n this.op2 = rtol;\n }\n}\n///////////////////////////////////////////////////////////////////\n// Important: UP and DOWN here are premised on Y-axis positive down\n// displays, which is the orientation used in Clipper's development.\n///////////////////////////////////////////////////////////////////\nclass $e6b3dc1fa027c309$export$c3c7cbf43a3f0561 {\n constructor(){\n this.dx = this.windCount = this.windCount2 = 0;\n this.isLeftBound = false;\n this.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n }\n}\nclass $e6b3dc1fa027c309$export$467e9e338ef38141 {\n static addLocMin(vert, polytype, isOpen, minimaList) {\n // make sure the vertex is added only once ...\n if ((vert.flags & $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMin) !== $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None) return;\n vert.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMin;\n const lm = new $e6b3dc1fa027c309$var$LocalMinima(vert, polytype, isOpen);\n minimaList.push(lm);\n }\n static addPathsToVertexList(paths, polytype, isOpen, minimaList, vertexList) {\n let totalVertCnt = 0;\n for (const path of paths)totalVertCnt += path.length;\n for (const path of paths){\n let v0 = undefined;\n let prev_v = undefined;\n let curr_v = undefined;\n for (const pt of path){\n if (!v0) {\n v0 = new $e6b3dc1fa027c309$var$Vertex(pt, $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None, undefined);\n vertexList.push(v0);\n prev_v = v0;\n } else if (prev_v.pt !== pt) {\n curr_v = new $e6b3dc1fa027c309$var$Vertex(pt, $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None, prev_v);\n vertexList.push(curr_v);\n prev_v.next = curr_v;\n prev_v = curr_v;\n }\n }\n if (!prev_v || !prev_v.prev) continue;\n if (!isOpen && prev_v.pt === v0.pt) prev_v = prev_v.prev;\n prev_v.next = v0;\n v0.prev = prev_v;\n if (!isOpen && prev_v.next === prev_v) continue;\n // OK, we have a valid path\n let going_up = false;\n if (isOpen) {\n curr_v = v0.next;\n let count = 0;\n while(curr_v !== v0 && curr_v.pt.y === v0.pt.y){\n curr_v = curr_v.next;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n going_up = curr_v.pt.y <= v0.pt.y;\n if (going_up) {\n v0.flags = $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenStart;\n this.addLocMin(v0, polytype, true, minimaList);\n } else v0.flags = $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenStart | $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax;\n } else {\n prev_v = v0.prev;\n let count = 0;\n while(prev_v !== v0 && prev_v.pt.y === v0.pt.y){\n prev_v = prev_v.prev;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n if (prev_v === v0) continue; // only open paths can be completely flat\n going_up = prev_v.pt.y > v0.pt.y;\n }\n const going_up0 = going_up;\n prev_v = v0;\n curr_v = v0.next;\n let count = 0;\n while(curr_v !== v0){\n if (curr_v.pt.y > prev_v.pt.y && going_up) {\n prev_v.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax;\n going_up = false;\n } else if (curr_v.pt.y < prev_v.pt.y && !going_up) {\n going_up = true;\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\n }\n prev_v = curr_v;\n curr_v = curr_v.next;\n if (count++ > totalVertCnt) {\n console.warn(\"infinite loop detected\");\n break;\n }\n }\n if (isOpen) {\n prev_v.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenEnd;\n if (going_up) prev_v.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax;\n else this.addLocMin(prev_v, polytype, isOpen, minimaList);\n } else if (going_up !== going_up0) {\n if (going_up0) this.addLocMin(prev_v, polytype, false, minimaList);\n else prev_v.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax;\n }\n }\n }\n}\nclass $e6b3dc1fa027c309$export$c17ed8035d0de27b {\n constructor(){\n this._minimaList = [];\n this._vertexList = [];\n }\n clear() {\n this._minimaList.length = 0;\n this._vertexList.length = 0;\n }\n addPaths(paths, pt, isOpen) {\n $e6b3dc1fa027c309$export$467e9e338ef38141.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\n }\n}\nclass $e6b3dc1fa027c309$var$SimpleNavigableSet {\n constructor(){\n this.items = [];\n this.items = [];\n }\n clear() {\n this.items.length = 0;\n }\n isEmpty() {\n return this.items.length == 0;\n }\n pollLast() {\n return this.items.pop();\n }\n add(item) {\n if (!this.items.includes(item)) {\n this.items.push(item);\n this.items.sort((a, b)=>a - b);\n }\n }\n}\nclass $e6b3dc1fa027c309$export$33da2edff2b544f3 {\n constructor(){\n this._cliptype = $e6b3dc1fa027c309$export$9e3ecdefb2438757.None;\n this._fillrule = $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd;\n this._currentLocMin = 0;\n this._currentBotY = 0;\n this._isSortedMinimaList = false;\n this._hasOpenPaths = false;\n this._using_polytree = false;\n this._succeeded = false;\n this.reverseSolution = false;\n this._minimaList = [];\n this._intersectList = [];\n this._vertexList = [];\n this._outrecList = [];\n this._scanlineList = new $e6b3dc1fa027c309$var$SimpleNavigableSet();\n this._horzSegList = [];\n this._horzJoinList = [];\n this.preserveCollinear = true;\n }\n static isOdd(val) {\n return (val & 1) !== 0;\n }\n static isHotEdgeActive(ae) {\n return ae.outrec !== undefined;\n }\n static isOpen(ae) {\n return ae.localMin.isOpen;\n }\n static isOpenEndActive(ae) {\n return ae.localMin.isOpen && $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEnd(ae.vertexTop);\n }\n static isOpenEnd(v) {\n return (v.flags & ($e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenStart | $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenEnd)) !== $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None;\n }\n static getPrevHotEdge(ae) {\n let prev = ae.prevInAEL;\n while(prev && ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(prev) || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(prev)))prev = prev.prevInAEL;\n return prev;\n }\n static isFront(ae) {\n return ae === ae.outrec.frontEdge;\n }\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/ static getDx(pt1, pt2) {\n const dy = pt2.y - pt1.y;\n if (dy !== 0) return (pt2.x - pt1.x) / dy;\n if (pt2.x > pt1.x) return Number.NEGATIVE_INFINITY;\n return Number.POSITIVE_INFINITY;\n }\n static topX(ae, currentY) {\n if (currentY === ae.top.y || ae.top.x === ae.bot.x) return ae.top.x;\n if (currentY === ae.bot.y) return ae.bot.x;\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\n }\n static isHorizontal(ae) {\n return ae.top.y === ae.bot.y;\n }\n static isHeadingRightHorz(ae) {\n return Number.NEGATIVE_INFINITY === ae.dx;\n }\n static isHeadingLeftHorz(ae) {\n return Number.POSITIVE_INFINITY === ae.dx;\n }\n static swapActives(ae1, ae2) {\n [ae2, ae1] = [\n ae1,\n ae2\n ];\n }\n static getPolyType(ae) {\n return ae.localMin.polytype;\n }\n static isSamePolyType(ae1, ae2) {\n return ae1.localMin.polytype === ae2.localMin.polytype;\n }\n static setDx(ae) {\n ae.dx = $e6b3dc1fa027c309$export$33da2edff2b544f3.getDx(ae.bot, ae.top);\n }\n static nextVertex(ae) {\n if (ae.windDx > 0) return ae.vertexTop.next;\n return ae.vertexTop.prev;\n }\n static prevPrevVertex(ae) {\n if (ae.windDx > 0) return ae.vertexTop.prev.prev;\n return ae.vertexTop.next.next;\n }\n static isMaxima(vertex) {\n return (vertex.flags & $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax) !== $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None;\n }\n static isMaximaActive(ae) {\n return $e6b3dc1fa027c309$export$33da2edff2b544f3.isMaxima(ae.vertexTop);\n }\n static getMaximaPair(ae) {\n let ae2 = ae.nextInAEL;\n while(ae2){\n if (ae2.vertexTop === ae.vertexTop) return ae2; // Found!\n ae2 = ae2.nextInAEL;\n }\n return undefined;\n }\n static getCurrYMaximaVertex_Open(ae) {\n let result = ae.vertexTop;\n if (ae.windDx > 0) while(result.next.pt.y === result.pt.y && (result.flags & ($e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenEnd | $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax)) === $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None)result = result.next;\n else while(result.prev.pt.y === result.pt.y && (result.flags & ($e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenEnd | $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMax)) === $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None)result = result.prev;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isMaxima(result)) result = undefined; // not a maxima\n return result;\n }\n static getCurrYMaximaVertex(ae) {\n let result = ae.vertexTop;\n if (ae.windDx > 0) while(result.next.pt.y === result.pt.y)result = result.next;\n else while(result.prev.pt.y === result.pt.y)result = result.prev;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isMaxima(result)) result = undefined; // not a maxima\n return result;\n }\n static setSides(outrec, startEdge, endEdge) {\n outrec.frontEdge = startEdge;\n outrec.backEdge = endEdge;\n }\n static swapOutrecs(ae1, ae2) {\n const or1 = ae1.outrec;\n const or2 = ae2.outrec;\n if (or1 === or2) {\n const ae = or1.frontEdge;\n or1.frontEdge = or1.backEdge;\n or1.backEdge = ae;\n return;\n }\n if (or1) {\n if (ae1 === or1.frontEdge) or1.frontEdge = ae2;\n else or1.backEdge = ae2;\n }\n if (or2) {\n if (ae2 === or2.frontEdge) or2.frontEdge = ae1;\n else or2.backEdge = ae1;\n }\n ae1.outrec = or2;\n ae2.outrec = or1;\n }\n static setOwner(outrec, newOwner) {\n while(newOwner.owner && !newOwner.owner.pts)newOwner.owner = newOwner.owner.owner;\n //make sure that outrec isn't an owner of newOwner\n let tmp = newOwner;\n while(tmp && tmp !== outrec)tmp = tmp.owner;\n if (tmp) newOwner.owner = outrec.owner;\n outrec.owner = newOwner;\n }\n static area(op) {\n // https://en.wikipedia.org/wiki/Shoelace_formula\n let area = 0.0;\n let op2 = op;\n do {\n area += (op2.prev.pt.y + op2.pt.y) * (op2.prev.pt.x - op2.pt.x);\n op2 = op2.next;\n }while (op2 !== op);\n return area * 0.5;\n }\n static areaTriangle(pt1, pt2, pt3) {\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) + (pt1.y + pt2.y) * (pt1.x - pt2.x) + (pt2.y + pt3.y) * (pt2.x - pt3.x);\n }\n static getRealOutRec(outRec) {\n while(outRec !== undefined && outRec.pts === undefined)outRec = outRec.owner;\n return outRec;\n }\n static isValidOwner(outRec, testOwner) {\n while(testOwner !== undefined && testOwner !== outRec)testOwner = testOwner.owner;\n return testOwner === undefined;\n }\n static uncoupleOutRec(ae) {\n const outrec = ae.outrec;\n if (outrec === undefined) return;\n outrec.frontEdge.outrec = undefined;\n outrec.backEdge.outrec = undefined;\n outrec.frontEdge = undefined;\n outrec.backEdge = undefined;\n }\n static outrecIsAscending(hotEdge) {\n return hotEdge === hotEdge.outrec.frontEdge;\n }\n static swapFrontBackSides(outrec) {\n // while this proc. is needed for open paths\n // it's almost never needed for closed paths\n const ae2 = outrec.frontEdge;\n outrec.frontEdge = outrec.backEdge;\n outrec.backEdge = ae2;\n outrec.pts = outrec.pts.next;\n }\n static edgesAdjacentInAEL(inode) {\n return inode.edge1.nextInAEL === inode.edge2 || inode.edge1.prevInAEL === inode.edge2;\n }\n clearSolutionOnly() {\n while(this._actives)this.deleteFromAEL(this._actives);\n this._scanlineList.clear();\n this.disposeIntersectNodes();\n this._outrecList.length = 0;\n this._horzSegList.length = 0;\n this._horzJoinList.length = 0;\n }\n clear() {\n this.clearSolutionOnly();\n this._minimaList.length = 0;\n this._vertexList.length = 0;\n this._currentLocMin = 0;\n this._isSortedMinimaList = false;\n this._hasOpenPaths = false;\n }\n reset() {\n if (!this._isSortedMinimaList) {\n this._minimaList.sort((locMin1, locMin2)=>locMin2.vertex.pt.y - locMin1.vertex.pt.y);\n this._isSortedMinimaList = true;\n }\n for(let i = this._minimaList.length - 1; i >= 0; i--)this._scanlineList.add(this._minimaList[i].vertex.pt.y);\n this._currentBotY = 0;\n this._currentLocMin = 0;\n this._actives = undefined;\n this._sel = undefined;\n this._succeeded = true;\n }\n insertScanline(y) {\n this._scanlineList.add(y);\n }\n popScanline() {\n return this._scanlineList.pollLast();\n }\n hasLocMinAtY(y) {\n return this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y;\n }\n popLocalMinima() {\n return this._minimaList[this._currentLocMin++];\n }\n addLocMin(vert, polytype, isOpen) {\n // make sure the vertex is added only once ...\n if ((vert.flags & $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMin) != $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None) return;\n vert.flags |= $e6b3dc1fa027c309$export$6bbe4490a892c1c5.LocalMin;\n const lm = new $e6b3dc1fa027c309$var$LocalMinima(vert, polytype, isOpen);\n this._minimaList.push(lm);\n }\n addSubject(path) {\n this.addPath(path, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject);\n }\n addOpenSubject(path) {\n this.addPath(path, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject, true);\n }\n addClip(path) {\n this.addPath(path, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip);\n }\n addPath(path, polytype, isOpen = false) {\n const tmp = [\n path\n ];\n this.addPaths(tmp, polytype, isOpen);\n }\n addPaths(paths, polytype, isOpen = false) {\n if (isOpen) this._hasOpenPaths = true;\n this._isSortedMinimaList = false;\n $e6b3dc1fa027c309$export$467e9e338ef38141.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\n }\n addReuseableData(reuseableData) {\n if (reuseableData._minimaList.length === 0) return;\n this._isSortedMinimaList = false;\n for (const lm of reuseableData._minimaList){\n this._minimaList.push(new $e6b3dc1fa027c309$var$LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\n if (lm.isOpen) this._hasOpenPaths = true;\n }\n }\n isContributingClosed(ae) {\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n if (ae.windCount !== 1) return false;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n if (ae.windCount !== -1) return false;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.NonZero:\n if (Math.abs(ae.windCount) !== 1) return false;\n break;\n }\n switch(this._cliptype){\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Intersection:\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n return ae.windCount2 > 0;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n return ae.windCount2 < 0;\n default:\n return ae.windCount2 !== 0;\n }\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Union:\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n return ae.windCount2 <= 0;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n return ae.windCount2 >= 0;\n default:\n return ae.windCount2 === 0;\n }\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Difference:\n const result = this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive ? ae.windCount2 <= 0 : this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative ? ae.windCount2 >= 0 : ae.windCount2 === 0;\n return $e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae) === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject ? result : !result;\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Xor:\n return true;\n default:\n return false;\n }\n }\n isContributingOpen(ae) {\n let isInClip, isInSubj;\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n isInSubj = ae.windCount > 0;\n isInClip = ae.windCount2 > 0;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n isInSubj = ae.windCount < 0;\n isInClip = ae.windCount2 < 0;\n break;\n default:\n isInSubj = ae.windCount !== 0;\n isInClip = ae.windCount2 !== 0;\n break;\n }\n switch(this._cliptype){\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Intersection:\n return isInClip;\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Union:\n return !isInSubj && !isInClip;\n default:\n return !isInClip;\n }\n }\n setWindCountForClosedPathEdge(ae) {\n let ae2 = ae.prevInAEL;\n const pt = $e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae);\n while(ae2 !== undefined && ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae2) !== pt || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)))ae2 = ae2.prevInAEL;\n if (ae2 === undefined) {\n ae.windCount = ae.windDx;\n ae2 = this._actives;\n } else if (this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) {\n ae.windCount = ae.windDx;\n ae.windCount2 = ae2.windCount2;\n ae2 = ae2.nextInAEL;\n } else {\n // NonZero, positive, or negative filling here ...\n // when e2's WindCnt is in the SAME direction as its WindDx,\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\n if (ae2.windCount * ae2.windDx < 0) {\n // opposite directions so 'ae' is outside 'ae2' ...\n if (Math.abs(ae2.windCount) > 1) {\n // outside prev poly but still inside another.\n if (ae2.windDx * ae.windDx < 0) // reversing direction so use the same WC\n ae.windCount = ae2.windCount;\n else // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\n ae.windCount = ae2.windCount + ae.windDx;\n } else // now outside all polys of same polytype so set own WC ...\n ae.windCount = $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae) ? 1 : ae.windDx;\n } else // 'ae' must be inside 'ae2'\n if (ae2.windDx * ae.windDx < 0) // reversing direction so use the same WC\n ae.windCount = ae2.windCount;\n else // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\n ae.windCount = ae2.windCount + ae.windDx;\n ae.windCount2 = ae2.windCount2;\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\n }\n if (this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) while(ae2 !== ae){\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae2) !== pt && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount2 = ae.windCount2 === 0 ? 1 : 0;\n ae2 = ae2.nextInAEL;\n }\n else while(ae2 !== ae){\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae2) !== pt && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount2 += ae2.windDx;\n ae2 = ae2.nextInAEL;\n }\n }\n setWindCountForOpenPathEdge(ae) {\n let ae2 = this._actives;\n if (this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) {\n let cnt1 = 0, cnt2 = 0;\n while(ae2 !== ae){\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae2) === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip) cnt2++;\n else if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) cnt1++;\n ae2 = ae2.nextInAEL;\n }\n ae.windCount = $e6b3dc1fa027c309$export$33da2edff2b544f3.isOdd(cnt1) ? 1 : 0;\n ae.windCount2 = $e6b3dc1fa027c309$export$33da2edff2b544f3.isOdd(cnt2) ? 1 : 0;\n } else while(ae2 !== ae){\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae2) === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip) ae.windCount2 += ae2.windDx;\n else if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) ae.windCount += ae2.windDx;\n ae2 = ae2.nextInAEL;\n }\n }\n static isValidAelOrder(resident, newcomer) {\n if (newcomer.curX !== resident.curX) return newcomer.curX > resident.curX;\n // get the turning direction a1.top, a2.bot, a2.top\n const d = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(resident.top, newcomer.bot, newcomer.top);\n if (d !== 0.0) return d < 0;\n // edges must be collinear to get here\n // for starting open paths, place them according to\n // the direction they're about to turn\n if (!this.isMaximaActive(resident) && resident.top.y > newcomer.top.y) return $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(newcomer.bot, resident.top, this.nextVertex(resident).pt) <= 0;\n if (!this.isMaximaActive(newcomer) && newcomer.top.y > resident.top.y) return $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(newcomer.bot, newcomer.top, this.nextVertex(newcomer).pt) >= 0;\n const y = newcomer.bot.y;\n const newcomerIsLeft = newcomer.isLeftBound;\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y) return newcomer.isLeftBound;\n // resident must also have just been inserted\n if (resident.isLeftBound !== newcomerIsLeft) return newcomerIsLeft;\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(this.prevPrevVertex(resident).pt, resident.bot, resident.top) === 0) return true;\n // compare turning direction of the alternate bound\n return $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(this.prevPrevVertex(resident).pt, newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0 === newcomerIsLeft;\n }\n insertLeftEdge(ae) {\n let ae2;\n if (!this._actives) {\n ae.prevInAEL = undefined;\n ae.nextInAEL = undefined;\n this._actives = ae;\n } else if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isValidAelOrder(this._actives, ae)) {\n ae.prevInAEL = undefined;\n ae.nextInAEL = this._actives;\n this._actives.prevInAEL = ae;\n this._actives = ae;\n } else {\n ae2 = this._actives;\n while(ae2.nextInAEL && $e6b3dc1fa027c309$export$33da2edff2b544f3.isValidAelOrder(ae2.nextInAEL, ae))ae2 = ae2.nextInAEL;\n //don't separate joined edges\n if (ae2.joinWith === $e6b3dc1fa027c309$export$290b84559c467a5c.Right) ae2 = ae2.nextInAEL;\n ae.nextInAEL = ae2.nextInAEL;\n if (ae2.nextInAEL) ae2.nextInAEL.prevInAEL = ae;\n ae.prevInAEL = ae2;\n ae2.nextInAEL = ae;\n }\n }\n static insertRightEdge(ae, ae2) {\n ae2.nextInAEL = ae.nextInAEL;\n if (ae.nextInAEL) ae.nextInAEL.prevInAEL = ae2;\n ae2.prevInAEL = ae;\n ae.nextInAEL = ae2;\n }\n insertLocalMinimaIntoAEL(botY) {\n let localMinima;\n let leftBound;\n let rightBound;\n // Add any local minima (if any) at BotY ...\n // NB horizontal local minima edges should contain locMin.vertex.prev\n while(this.hasLocMinAtY(botY)){\n localMinima = this.popLocalMinima();\n if ((localMinima.vertex.flags & $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenStart) !== $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None) leftBound = undefined;\n else {\n leftBound = new $e6b3dc1fa027c309$export$c3c7cbf43a3f0561();\n leftBound.bot = localMinima.vertex.pt;\n leftBound.curX = localMinima.vertex.pt.x;\n leftBound.windDx = -1;\n leftBound.vertexTop = localMinima.vertex.prev;\n leftBound.top = localMinima.vertex.prev.pt;\n leftBound.outrec = undefined;\n leftBound.localMin = localMinima;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.setDx(leftBound);\n }\n if ((localMinima.vertex.flags & $e6b3dc1fa027c309$export$6bbe4490a892c1c5.OpenEnd) !== $e6b3dc1fa027c309$export$6bbe4490a892c1c5.None) rightBound = undefined;\n else {\n rightBound = new $e6b3dc1fa027c309$export$c3c7cbf43a3f0561();\n rightBound.bot = localMinima.vertex.pt;\n rightBound.curX = localMinima.vertex.pt.x;\n rightBound.windDx = 1;\n rightBound.vertexTop = localMinima.vertex.next;\n rightBound.top = localMinima.vertex.next.pt;\n rightBound.outrec = undefined;\n rightBound.localMin = localMinima;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.setDx(rightBound);\n }\n if (leftBound && rightBound) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(leftBound)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHeadingRightHorz(leftBound)) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(rightBound)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHeadingLeftHorz(rightBound)) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n } else if (leftBound.dx < rightBound.dx) [rightBound, leftBound] = [\n leftBound,\n rightBound\n ];\n //so when leftBound has windDx == 1, the polygon will be oriented\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\n } else if (leftBound === undefined) {\n leftBound = rightBound;\n rightBound = undefined;\n }\n let contributing = false;\n leftBound.isLeftBound = true;\n this.insertLeftEdge(leftBound);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(leftBound)) {\n this.setWindCountForOpenPathEdge(leftBound);\n contributing = this.isContributingOpen(leftBound);\n } else {\n this.setWindCountForClosedPathEdge(leftBound);\n contributing = this.isContributingClosed(leftBound);\n }\n if (rightBound) {\n rightBound.windCount = leftBound.windCount;\n rightBound.windCount2 = leftBound.windCount2;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.insertRightEdge(leftBound, rightBound);\n if (contributing) {\n this.addLocalMinPoly(leftBound, rightBound, leftBound.bot, true);\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(leftBound)) this.checkJoinLeft(leftBound, leftBound.bot);\n }\n while(rightBound.nextInAEL && $e6b3dc1fa027c309$export$33da2edff2b544f3.isValidAelOrder(rightBound.nextInAEL, rightBound)){\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\n }\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(rightBound)) this.pushHorz(rightBound);\n else {\n this.checkJoinRight(rightBound, rightBound.bot);\n this.insertScanline(rightBound.top.y);\n }\n } else if (contributing) this.startOpenPath(leftBound, leftBound.bot);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(leftBound)) this.pushHorz(leftBound);\n else this.insertScanline(leftBound.top.y);\n }\n }\n pushHorz(ae) {\n ae.nextInSEL = this._sel;\n this._sel = ae;\n }\n popHorz() {\n const ae = this._sel;\n if (this._sel === undefined) return undefined;\n this._sel = this._sel.nextInSEL;\n return ae;\n }\n addLocalMinPoly(ae1, ae2, pt, isNew = false) {\n const outrec = this.newOutRec();\n ae1.outrec = outrec;\n ae2.outrec = outrec;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae1)) {\n outrec.owner = undefined;\n outrec.isOpen = true;\n if (ae1.windDx > 0) $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n } else {\n outrec.isOpen = false;\n const prevHotEdge = $e6b3dc1fa027c309$export$33da2edff2b544f3.getPrevHotEdge(ae1);\n // e.windDx is the winding direction of the **input** paths\n // and unrelated to the winding direction of output polygons.\n // Output orientation is determined by e.outrec.frontE which is\n // the ascending edge (see AddLocalMinPoly).\n if (prevHotEdge) {\n if (this._using_polytree) $e6b3dc1fa027c309$export$33da2edff2b544f3.setOwner(outrec, prevHotEdge.outrec);\n outrec.owner = prevHotEdge.outrec;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.outrecIsAscending(prevHotEdge) === isNew) $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n } else {\n outrec.owner = undefined;\n if (isNew) $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae1, ae2);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(outrec, ae2, ae1);\n }\n }\n const op = new $e6b3dc1fa027c309$var$OutPt(pt, outrec);\n outrec.pts = op;\n return op;\n }\n addLocalMaxPoly(ae1, ae2, pt) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae1)) this.split(ae1, pt);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae1) === $e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae2)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(ae1)) $e6b3dc1fa027c309$export$33da2edff2b544f3.swapFrontBackSides(ae1.outrec);\n else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(ae2)) $e6b3dc1fa027c309$export$33da2edff2b544f3.swapFrontBackSides(ae2.outrec);\n else {\n this._succeeded = false;\n return undefined;\n }\n }\n const result = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae1, pt);\n if (ae1.outrec === ae2.outrec) {\n const outrec = ae1.outrec;\n outrec.pts = result;\n if (this._using_polytree) {\n const e = $e6b3dc1fa027c309$export$33da2edff2b544f3.getPrevHotEdge(ae1);\n if (e === undefined) outrec.owner = undefined;\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.setOwner(outrec, e.outrec);\n }\n $e6b3dc1fa027c309$export$33da2edff2b544f3.uncoupleOutRec(ae1);\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae1)) {\n if (ae1.windDx < 0) $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(ae1, ae2);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(ae2, ae1);\n } else if (ae1.outrec.idx < ae2.outrec.idx) $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(ae1, ae2);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(ae2, ae1);\n return result;\n }\n static joinOutrecPaths(ae1, ae2) {\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\n const p1Start = ae1.outrec.pts;\n const p2Start = ae2.outrec.pts;\n const p1End = p1Start.next;\n const p2End = p2Start.next;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae1)) {\n p2End.prev = p1Start;\n p1Start.next = p2End;\n p2Start.next = p1End;\n p1End.prev = p2Start;\n ae1.outrec.pts = p2Start;\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\n ae1.outrec.frontEdge = ae2.outrec.frontEdge;\n if (ae1.outrec.frontEdge) ae1.outrec.frontEdge.outrec = ae1.outrec;\n } else {\n p1End.prev = p2Start;\n p2Start.next = p1End;\n p1Start.next = p2End;\n p2End.prev = p1Start;\n ae1.outrec.backEdge = ae2.outrec.backEdge;\n if (ae1.outrec.backEdge) ae1.outrec.backEdge.outrec = ae1.outrec;\n }\n // after joining, the ae2.OutRec must contains no vertices ...\n ae2.outrec.frontEdge = undefined;\n ae2.outrec.backEdge = undefined;\n ae2.outrec.pts = undefined;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.setOwner(ae2.outrec, ae1.outrec);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(ae1)) {\n ae2.outrec.pts = ae1.outrec.pts;\n ae1.outrec.pts = undefined;\n }\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\n ae1.outrec = undefined;\n ae2.outrec = undefined;\n }\n static addOutPt(ae, pt) {\n const outrec = ae.outrec;\n const toFront = $e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae);\n const opFront = outrec.pts;\n const opBack = opFront.next;\n if (toFront && pt == opFront.pt) return opFront;\n else if (!toFront && pt == opBack.pt) return opBack;\n const newOp = new $e6b3dc1fa027c309$var$OutPt(pt, outrec);\n opBack.prev = newOp;\n newOp.prev = opFront;\n newOp.next = opBack;\n opFront.next = newOp;\n if (toFront) outrec.pts = newOp;\n return newOp;\n }\n newOutRec() {\n const result = new $e6b3dc1fa027c309$export$1e0666df669b1ceb(this._outrecList.length);\n this._outrecList.push(result);\n return result;\n }\n startOpenPath(ae, pt) {\n const outrec = this.newOutRec();\n outrec.isOpen = true;\n if (ae.windDx > 0) {\n outrec.frontEdge = ae;\n outrec.backEdge = undefined;\n } else {\n outrec.frontEdge = undefined;\n outrec.backEdge = ae;\n }\n ae.outrec = outrec;\n const op = new $e6b3dc1fa027c309$var$OutPt(pt, outrec);\n outrec.pts = op;\n return op;\n }\n updateEdgeIntoAEL(ae) {\n ae.bot = ae.top;\n ae.vertexTop = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(ae);\n ae.top = ae.vertexTop.pt;\n ae.curX = ae.bot.x;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.setDx(ae);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.bot);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(ae)) return;\n this.insertScanline(ae.top.y);\n this.checkJoinLeft(ae, ae.bot);\n this.checkJoinRight(ae, ae.bot, true);\n }\n static findEdgeWithMatchingLocMin(e) {\n let result = e.nextInAEL;\n while(result){\n if (result.localMin === e.localMin) return result;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(result) && e.bot !== result.bot) result = undefined;\n else result = result.nextInAEL;\n }\n result = e.prevInAEL;\n while(result){\n if (result.localMin === e.localMin) return result;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(result) && e.bot !== result.bot) return undefined;\n result = result.prevInAEL;\n }\n return result;\n }\n intersectEdges(ae1, ae2, pt) {\n let resultOp = undefined;\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\n if (this._hasOpenPaths && ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae1) || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2))) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae1) && $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) return undefined;\n // the following line avoids duplicating quite a bit of code\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae2)) $e6b3dc1fa027c309$export$33da2edff2b544f3.swapActives(ae1, ae2);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n if (this._cliptype === $e6b3dc1fa027c309$export$9e3ecdefb2438757.Union) {\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae2)) return undefined;\n } else if (ae2.localMin.polytype === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject) return undefined;\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n if (ae2.windCount !== 1) return undefined;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n if (ae2.windCount !== -1) return undefined;\n break;\n default:\n if (Math.abs(ae2.windCount) !== 1) return undefined;\n break;\n }\n // toggle contribution ...\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae1)) {\n resultOp = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae1, pt);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae1)) ae1.outrec.frontEdge = undefined;\n else ae1.outrec.backEdge = undefined;\n ae1.outrec = undefined;\n // horizontal edges can pass under open paths at a LocMins\n } else if (pt === ae1.localMin.vertex.pt && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEnd(ae1.localMin.vertex)) {\n // find the other side of the LocMin and\n // if it's 'hot' join up with it ...\n const ae3 = $e6b3dc1fa027c309$export$33da2edff2b544f3.findEdgeWithMatchingLocMin(ae1);\n if (ae3 && $e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae3)) {\n ae1.outrec = ae3.outrec;\n if (ae1.windDx > 0) $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(ae3.outrec, ae1, ae3);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.setSides(ae3.outrec, ae3, ae1);\n return ae3.outrec.pts;\n }\n resultOp = this.startOpenPath(ae1, pt);\n } else resultOp = this.startOpenPath(ae1, pt);\n return resultOp;\n }\n // MANAGING CLOSED PATHS FROM HERE ON\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae1)) this.split(ae1, pt);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae2)) this.split(ae2, pt);\n // UPDATE WINDING COUNTS...\n let oldE1WindCount;\n let oldE2WindCount;\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\n if (this._fillrule === $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) {\n oldE1WindCount = ae1.windCount;\n ae1.windCount = ae2.windCount;\n ae2.windCount = oldE1WindCount;\n } else {\n if (ae1.windCount + ae2.windDx === 0) ae1.windCount = -ae1.windCount;\n else ae1.windCount += ae2.windDx;\n if (ae2.windCount - ae1.windDx === 0) ae2.windCount = -ae2.windCount;\n else ae2.windCount -= ae1.windDx;\n }\n } else {\n if (this._fillrule !== $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) ae1.windCount2 += ae2.windDx;\n else ae1.windCount2 = ae1.windCount2 === 0 ? 1 : 0;\n if (this._fillrule !== $e6b3dc1fa027c309$export$f26b42c94e8a4f95.EvenOdd) ae2.windCount2 -= ae1.windDx;\n else ae2.windCount2 = ae2.windCount2 === 0 ? 1 : 0;\n }\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n oldE1WindCount = ae1.windCount;\n oldE2WindCount = ae2.windCount;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n oldE1WindCount = -ae1.windCount;\n oldE2WindCount = -ae2.windCount;\n break;\n default:\n oldE1WindCount = Math.abs(ae1.windCount);\n oldE2WindCount = Math.abs(ae2.windCount);\n break;\n }\n const e1WindCountIs0or1 = oldE1WindCount === 0 || oldE1WindCount === 1;\n const e2WindCountIs0or1 = oldE2WindCount === 0 || oldE2WindCount === 1;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae1) && !e1WindCountIs0or1 || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae2) && !e2WindCountIs0or1) return undefined;\n // NOW PROCESS THE INTERSECTION ...\n // if both edges are 'hot' ...\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae1) && $e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae2)) {\n if (oldE1WindCount !== 0 && oldE1WindCount !== 1 || oldE2WindCount !== 0 && oldE2WindCount !== 1 || ae1.localMin.polytype !== ae2.localMin.polytype && this._cliptype !== $e6b3dc1fa027c309$export$9e3ecdefb2438757.Xor) resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\n else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae1) || ae1.outrec === ae2.outrec) {\n // this 'else if' condition isn't strictly needed but\n // it's sensible to split polygons that only touch at\n // a common vertex (not at common edges).\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\n this.addLocalMinPoly(ae1, ae2, pt);\n } else {\n // can't treat as maxima & minima\n resultOp = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae1, pt);\n $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae2, pt);\n $e6b3dc1fa027c309$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n }\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae1)) {\n resultOp = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae1, pt);\n $e6b3dc1fa027c309$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae2)) {\n resultOp = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae2, pt);\n $e6b3dc1fa027c309$export$33da2edff2b544f3.swapOutrecs(ae1, ae2);\n } else {\n let e1Wc2;\n let e2Wc2;\n switch(this._fillrule){\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Positive:\n e1Wc2 = ae1.windCount2;\n e2Wc2 = ae2.windCount2;\n break;\n case $e6b3dc1fa027c309$export$f26b42c94e8a4f95.Negative:\n e1Wc2 = -ae1.windCount2;\n e2Wc2 = -ae2.windCount2;\n break;\n default:\n e1Wc2 = Math.abs(ae1.windCount2);\n e2Wc2 = Math.abs(ae2.windCount2);\n break;\n }\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isSamePolyType(ae1, ae2)) resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\n resultOp = undefined;\n switch(this._cliptype){\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Union:\n if (e1Wc2 > 0 && e2Wc2 > 0) return undefined;\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Difference:\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae1) === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip && e1Wc2 > 0 && e2Wc2 > 0 || $e6b3dc1fa027c309$export$33da2edff2b544f3.getPolyType(ae1) === $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject && e1Wc2 <= 0 && e2Wc2 <= 0) resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n case $e6b3dc1fa027c309$export$9e3ecdefb2438757.Xor:\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n default:\n if (e1Wc2 <= 0 || e2Wc2 <= 0) return undefined;\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\n break;\n }\n }\n }\n return resultOp;\n }\n deleteFromAEL(ae) {\n const prev = ae.prevInAEL;\n const next = ae.nextInAEL;\n if (!prev && !next && ae !== this._actives) return; // already deleted\n if (prev) prev.nextInAEL = next;\n else this._actives = next;\n if (next) next.prevInAEL = prev;\n }\n adjustCurrXAndCopyToSEL(topY) {\n let ae = this._actives;\n this._sel = ae;\n while(ae){\n ae.prevInSEL = ae.prevInAEL;\n ae.nextInSEL = ae.nextInAEL;\n ae.jump = ae.nextInSEL;\n if (ae.joinWith === $e6b3dc1fa027c309$export$290b84559c467a5c.Left) ae.curX = ae.prevInAEL.curX; // This also avoids complications\n else ae.curX = $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, topY);\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\n ae = ae.nextInAEL;\n }\n }\n executeInternal(ct, fillRule) {\n if (ct === $e6b3dc1fa027c309$export$9e3ecdefb2438757.None) return;\n this._fillrule = fillRule;\n this._cliptype = ct;\n this.reset();\n let y = this.popScanline();\n if (y === undefined) return;\n while(this._succeeded){\n this.insertLocalMinimaIntoAEL(y);\n let ae = this.popHorz();\n while(ae){\n this.doHorizontal(ae);\n ae = this.popHorz();\n }\n if (this._horzSegList.length > 0) {\n this.convertHorzSegsToJoins();\n this._horzSegList.length = 0;\n }\n this._currentBotY = y; // bottom of scanbeam\n y = this.popScanline();\n if (y === undefined) break; // y new top of scanbeam\n this.doIntersections(y);\n this.doTopOfScanbeam(y);\n ae = this.popHorz();\n while(ae){\n this.doHorizontal(ae);\n ae = this.popHorz();\n }\n }\n if (this._succeeded) this.processHorzJoins();\n }\n doIntersections(topY) {\n if (this.buildIntersectList(topY)) {\n this.processIntersectList();\n this.disposeIntersectNodes();\n }\n }\n disposeIntersectNodes() {\n this._intersectList.length = 0;\n }\n addNewIntersectNode(ae1, ae2, topY) {\n const result = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top);\n let ip = result.ip;\n if (!result.success) ip = new $e6b3dc1fa027c309$export$d379afd9763b528f(ae1.curX, topY);\n if (ip.y > this._currentBotY || ip.y < topY) {\n const absDx1 = Math.abs(ae1.dx);\n const absDx2 = Math.abs(ae2.dx);\n if (absDx1 > 100 && absDx2 > 100) {\n if (absDx1 > absDx2) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\n else ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\n } else if (absDx1 > 100) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\n else if (absDx2 > 100) ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\n else {\n if (ip.y < topY) ip.y = topY;\n else ip.y = this._currentBotY;\n if (absDx1 < absDx2) ip.x = $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae1, ip.y);\n else ip.x = $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae2, ip.y);\n }\n }\n const node = new $e6b3dc1fa027c309$var$IntersectNode(ip, ae1, ae2);\n this._intersectList.push(node);\n }\n static extractFromSEL(ae) {\n const res = ae.nextInSEL;\n if (res) res.prevInSEL = ae.prevInSEL;\n ae.prevInSEL.nextInSEL = res;\n return res;\n }\n static insert1Before2InSEL(ae1, ae2) {\n ae1.prevInSEL = ae2.prevInSEL;\n if (ae1.prevInSEL) ae1.prevInSEL.nextInSEL = ae1;\n ae1.nextInSEL = ae2;\n ae2.prevInSEL = ae1;\n }\n buildIntersectList(topY) {\n if (!this._actives || !this._actives.nextInAEL) return false;\n // Calculate edge positions at the top of the current scanbeam, and from this\n // we will determine the intersections required to reach these new positions.\n this.adjustCurrXAndCopyToSEL(topY);\n // Find all edge intersections in the current scanbeam using a stable merge\n // sort that ensures only adjacent edges are intersecting. Intersect info is\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\n let left = this._sel, right, lEnd, rEnd, currBase, prevBase, tmp;\n while(left.jump){\n prevBase = undefined;\n while(left && left.jump){\n currBase = left;\n right = left.jump;\n lEnd = right;\n rEnd = right.jump;\n left.jump = rEnd;\n while(left !== lEnd && right !== rEnd)if (right.curX < left.curX) {\n tmp = right.prevInSEL;\n for(;;){\n this.addNewIntersectNode(tmp, right, topY);\n if (tmp === left) break;\n tmp = tmp.prevInSEL;\n }\n tmp = right;\n right = $e6b3dc1fa027c309$export$33da2edff2b544f3.extractFromSEL(tmp);\n lEnd = right;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.insert1Before2InSEL(tmp, left);\n if (left === currBase) {\n currBase = tmp;\n currBase.jump = rEnd;\n if (prevBase === undefined) this._sel = currBase;\n else prevBase.jump = currBase;\n }\n } else left = left.nextInSEL;\n prevBase = currBase;\n left = rEnd;\n }\n left = this._sel;\n }\n return this._intersectList.length > 0;\n }\n processIntersectList() {\n // We now have a list of intersections required so that edges will be\n // correctly positioned at the top of the scanbeam. However, it's important\n // that edge intersections are processed from the bottom up, but it's also\n // crucial that intersections only occur between adjacent edges.\n // First we do a quicksort so intersections proceed in a bottom up order ...\n this._intersectList.sort((a, b)=>{\n if (a.pt.y === b.pt.y) {\n if (a.pt.x === b.pt.x) return 0;\n return a.pt.x < b.pt.x ? -1 : 1;\n }\n return a.pt.y > b.pt.y ? -1 : 1;\n });\n // Now as we process these intersections, we must sometimes adjust the order\n // to ensure that intersecting edges are always adjacent ...\n for(let i = 0; i < this._intersectList.length; ++i){\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.edgesAdjacentInAEL(this._intersectList[i])) {\n let j = i + 1;\n while(!$e6b3dc1fa027c309$export$33da2edff2b544f3.edgesAdjacentInAEL(this._intersectList[j]))j++;\n // swap\n [this._intersectList[j], this._intersectList[i]] = [\n this._intersectList[i],\n this._intersectList[j]\n ];\n }\n const node = this._intersectList[i];\n this.intersectEdges(node.edge1, node.edge2, node.pt);\n this.swapPositionsInAEL(node.edge1, node.edge2);\n node.edge1.curX = node.pt.x;\n node.edge2.curX = node.pt.x;\n this.checkJoinLeft(node.edge2, node.pt, true);\n this.checkJoinRight(node.edge1, node.pt, true);\n }\n }\n swapPositionsInAEL(ae1, ae2) {\n // preconditon: ae1 must be immediately to the left of ae2\n const next = ae2.nextInAEL;\n if (next) next.prevInAEL = ae1;\n const prev = ae1.prevInAEL;\n if (prev) prev.nextInAEL = ae2;\n ae2.prevInAEL = prev;\n ae2.nextInAEL = ae1;\n ae1.prevInAEL = ae2;\n ae1.nextInAEL = next;\n if (!ae2.prevInAEL) this._actives = ae2;\n }\n static resetHorzDirection(horz, vertexMax) {\n let leftX, rightX;\n if (horz.bot.x === horz.top.x) {\n // the horizontal edge is going nowhere ...\n leftX = horz.curX;\n rightX = horz.curX;\n let ae = horz.nextInAEL;\n while(ae && ae.vertexTop !== vertexMax)ae = ae.nextInAEL;\n return {\n isLeftToRight: ae !== undefined,\n leftX: leftX,\n rightX: rightX\n };\n }\n if (horz.curX < horz.top.x) {\n leftX = horz.curX;\n rightX = horz.top.x;\n return {\n isLeftToRight: true,\n leftX: leftX,\n rightX: rightX\n };\n }\n leftX = horz.top.x;\n rightX = horz.curX;\n return {\n isLeftToRight: false,\n leftX: leftX,\n rightX: rightX\n }; // right to left\n }\n static horzIsSpike(horz) {\n const nextPt = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horz).pt;\n return horz.bot.x < horz.top.x !== horz.top.x < nextPt.x;\n }\n static trimHorz(horzEdge, preserveCollinear) {\n let wasTrimmed = false;\n let pt = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horzEdge).pt;\n while(pt.y === horzEdge.top.y){\n // always trim 180 deg. spikes (in closed paths)\n // but otherwise break if preserveCollinear = true\n if (preserveCollinear && pt.x < horzEdge.top.x !== horzEdge.bot.x < horzEdge.top.x) break;\n horzEdge.vertexTop = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horzEdge);\n horzEdge.top = pt;\n wasTrimmed = true;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isMaximaActive(horzEdge)) break;\n pt = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horzEdge).pt;\n }\n if (wasTrimmed) $e6b3dc1fa027c309$export$33da2edff2b544f3.setDx(horzEdge); // +/-infinity\n }\n addToHorzSegList(op) {\n if (op.outrec.isOpen) return;\n this._horzSegList.push(new $e6b3dc1fa027c309$var$HorzSegment(op));\n }\n getLastOp(hotEdge) {\n const outrec = hotEdge.outrec;\n return hotEdge === outrec.frontEdge ? outrec.pts : outrec.pts.next;\n }\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/ doHorizontal(horz) {\n let pt;\n const horzIsOpen = $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(horz);\n const Y = horz.bot.y;\n const vertex_max = horzIsOpen ? $e6b3dc1fa027c309$export$33da2edff2b544f3.getCurrYMaximaVertex_Open(horz) : $e6b3dc1fa027c309$export$33da2edff2b544f3.getCurrYMaximaVertex(horz);\n // remove 180 deg.spikes and also simplify\n // consecutive horizontals when PreserveCollinear = true\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop) $e6b3dc1fa027c309$export$33da2edff2b544f3.trimHorz(horz, this.preserveCollinear);\n let { isLeftToRight: isLeftToRight, leftX: leftX, rightX: rightX } = $e6b3dc1fa027c309$export$33da2edff2b544f3.resetHorzDirection(horz, vertex_max);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n const op = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(horz, new $e6b3dc1fa027c309$export$d379afd9763b528f(horz.curX, Y));\n this.addToHorzSegList(op);\n }\n for(;;){\n // loops through consec. horizontal edges (if open)\n let ae = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\n while(ae){\n if (ae.vertexTop === vertex_max) {\n // do this first!!\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz) && $e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.top);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n while(horz.vertexTop !== vertex_max){\n $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.updateEdgeIntoAEL(horz);\n }\n if (isLeftToRight) this.addLocalMaxPoly(horz, ae, horz.top);\n else this.addLocalMaxPoly(ae, horz, horz.top);\n }\n this.deleteFromAEL(ae);\n this.deleteFromAEL(horz);\n return;\n }\n // if horzEdge is a maxima, keep going until we reach\n // its maxima pair, otherwise check for break conditions\n if (vertex_max !== horz.vertexTop || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(horz)) {\n // otherwise stop when 'ae' is beyond the end of the horizontal line\n if (isLeftToRight && ae.curX > rightX || !isLeftToRight && ae.curX < leftX) break;\n if (ae.curX === horz.top.x && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(ae)) {\n pt = $e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horz).pt;\n // to maximize the possibility of putting open edges into\n // solutions, we'll only break if it's past HorzEdge's end\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae) && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isSamePolyType(ae, horz) && !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) {\n if (isLeftToRight && $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, pt.y) > pt.x || !isLeftToRight && $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, pt.y) < pt.x) break;\n } else if (isLeftToRight && $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, pt.y) >= pt.x || !isLeftToRight && $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, pt.y) <= pt.x) break;\n }\n }\n pt = new $e6b3dc1fa027c309$export$d379afd9763b528f(ae.curX, Y);\n if (isLeftToRight) {\n this.intersectEdges(horz, ae, pt);\n this.swapPositionsInAEL(horz, ae);\n horz.curX = ae.curX;\n ae = horz.nextInAEL;\n } else {\n this.intersectEdges(ae, horz, pt);\n this.swapPositionsInAEL(ae, horz);\n horz.curX = ae.curX;\n ae = horz.prevInAEL;\n }\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) this.addToHorzSegList(this.getLastOp(horz));\n } // we've reached the end of this horizontal\n // check if we've finished looping\n // through consecutive horizontals\n if (horzIsOpen && $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(horz)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(horz)) horz.outrec.frontEdge = undefined;\n else horz.outrec.backEdge = undefined;\n horz.outrec = undefined;\n }\n this.deleteFromAEL(horz);\n return;\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.nextVertex(horz).pt.y !== horz.top.y) break;\n // still more horizontals in bound to process ...\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.updateEdgeIntoAEL(horz);\n if (this.preserveCollinear && !horzIsOpen && $e6b3dc1fa027c309$export$33da2edff2b544f3.horzIsSpike(horz)) $e6b3dc1fa027c309$export$33da2edff2b544f3.trimHorz(horz, true);\n const result = $e6b3dc1fa027c309$export$33da2edff2b544f3.resetHorzDirection(horz, vertex_max);\n isLeftToRight = result.isLeftToRight;\n leftX = result.leftX;\n rightX = result.rightX;\n }\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(horz)) {\n const op = $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(horz, horz.top);\n this.addToHorzSegList(op);\n }\n this.updateEdgeIntoAEL(horz);\n }\n doTopOfScanbeam(y) {\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\n let ae = this._actives;\n while(ae){\n // NB 'ae' will never be horizontal here\n if (ae.top.y === y) {\n ae.curX = ae.top.x;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isMaximaActive(ae)) {\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\n continue;\n }\n // INTERMEDIATE VERTEX ...\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae, ae.top);\n this.updateEdgeIntoAEL(ae);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(ae)) this.pushHorz(ae); // horizontals are processed later\n } else ae.curX = $e6b3dc1fa027c309$export$33da2edff2b544f3.topX(ae, y);\n ae = ae.nextInAEL;\n }\n }\n doMaxima(ae) {\n const prevE = ae.prevInAEL;\n let nextE = ae.nextInAEL;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpenEndActive(ae)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) $e6b3dc1fa027c309$export$33da2edff2b544f3.addOutPt(ae, ae.top);\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isHorizontal(ae)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isFront(ae)) ae.outrec.frontEdge = undefined;\n else ae.outrec.backEdge = undefined;\n ae.outrec = undefined;\n }\n this.deleteFromAEL(ae);\n }\n return nextE;\n }\n const maxPair = $e6b3dc1fa027c309$export$33da2edff2b544f3.getMaximaPair(ae);\n if (!maxPair) return nextE; // eMaxPair is horizontal\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(ae)) this.split(ae, ae.top);\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(maxPair)) this.split(maxPair, maxPair.top);\n // only non-horizontal maxima here.\n // process any edges between maxima pair ...\n while(nextE !== maxPair){\n this.intersectEdges(ae, nextE, ae.top);\n this.swapPositionsInAEL(ae, nextE);\n nextE = ae.nextInAEL;\n }\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(ae)) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) this.addLocalMaxPoly(ae, maxPair, ae.top);\n this.deleteFromAEL(maxPair);\n this.deleteFromAEL(ae);\n return prevE ? prevE.nextInAEL : this._actives;\n }\n // here ae.nextInAel == ENext == EMaxPair ...\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(ae)) this.addLocalMaxPoly(ae, maxPair, ae.top);\n this.deleteFromAEL(ae);\n this.deleteFromAEL(maxPair);\n return prevE ? prevE.nextInAEL : this._actives;\n }\n static isJoined(e) {\n return e.joinWith !== $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n }\n split(e, currPt) {\n if (e.joinWith === $e6b3dc1fa027c309$export$290b84559c467a5c.Right) {\n e.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n e.nextInAEL.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n this.addLocalMinPoly(e, e.nextInAEL, currPt, true);\n } else {\n e.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n e.prevInAEL.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.None;\n this.addLocalMinPoly(e.prevInAEL, e, currPt, true);\n }\n }\n checkJoinLeft(e, pt, checkCurrX = false) {\n const prev = e.prevInAEL;\n if (!prev || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(e) || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(prev) || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(e) || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(prev)) return;\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\n (e.bot.y > pt.y || prev.bot.y > pt.y)) return; // (#490)\n if (checkCurrX) {\n if ($e6b3dc1fa027c309$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25) return;\n } else if (e.curX !== prev.curX) return;\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(e.top, pt, prev.top) !== 0) return;\n if (e.outrec.idx === prev.outrec.idx) this.addLocalMaxPoly(prev, e, pt);\n else if (e.outrec.idx < prev.outrec.idx) $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(e, prev);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(prev, e);\n prev.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.Right;\n e.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.Left;\n }\n checkJoinRight(e, pt, checkCurrX = false) {\n const next = e.nextInAEL;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(e) || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(e) || $e6b3dc1fa027c309$export$33da2edff2b544f3.isJoined(e) || !next || $e6b3dc1fa027c309$export$33da2edff2b544f3.isOpen(next) || !$e6b3dc1fa027c309$export$33da2edff2b544f3.isHotEdgeActive(next)) return;\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\n (e.bot.y > pt.y || next.bot.y > pt.y)) return; // (#490)\n if (checkCurrX) {\n if ($e6b3dc1fa027c309$export$47d6d5d06ccbc908.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25) return;\n } else if (e.curX !== next.curX) return;\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(e.top, pt, next.top) !== 0) return;\n if (e.outrec.idx === next.outrec.idx) this.addLocalMaxPoly(e, next, pt);\n else if (e.outrec.idx < next.outrec.idx) $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(e, next);\n else $e6b3dc1fa027c309$export$33da2edff2b544f3.joinOutrecPaths(next, e);\n e.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.Right;\n next.joinWith = $e6b3dc1fa027c309$export$290b84559c467a5c.Left;\n }\n static fixOutRecPts(outrec) {\n let op = outrec.pts;\n do {\n op.outrec = outrec;\n op = op.next;\n }while (op !== outrec.pts);\n }\n static setHorzSegHeadingForward(hs, opP, opN) {\n if (opP.pt.x === opN.pt.x) return false;\n if (opP.pt.x < opN.pt.x) {\n hs.leftOp = opP;\n hs.rightOp = opN;\n hs.leftToRight = true;\n } else {\n hs.leftOp = opN;\n hs.rightOp = opP;\n hs.leftToRight = false;\n }\n return true;\n }\n static updateHorzSegment(hs) {\n const op = hs.leftOp;\n const outrec = this.getRealOutRec(op.outrec);\n const outrecHasEdges = outrec.frontEdge !== undefined;\n const curr_y = op.pt.y;\n let opP = op, opN = op;\n if (outrecHasEdges) {\n const opA = outrec.pts, opZ = opA.next;\n while(opP !== opZ && opP.prev.pt.y === curr_y)opP = opP.prev;\n while(opN !== opA && opN.next.pt.y === curr_y)opN = opN.next;\n } else {\n while(opP.prev !== opN && opP.prev.pt.y === curr_y)opP = opP.prev;\n while(opN.next !== opP && opN.next.pt.y === curr_y)opN = opN.next;\n }\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp.horz === undefined;\n if (result) hs.leftOp.horz = hs;\n else hs.rightOp = undefined; // (for sorting)\n return result;\n }\n static duplicateOp(op, insert_after) {\n const result = new $e6b3dc1fa027c309$var$OutPt(op.pt, op.outrec);\n if (insert_after) {\n result.next = op.next;\n result.next.prev = result;\n result.prev = op;\n op.next = result;\n } else {\n result.prev = op.prev;\n result.prev.next = result;\n result.next = op;\n op.prev = result;\n }\n return result;\n }\n convertHorzSegsToJoins() {\n let k = 0;\n for (const hs of this._horzSegList)if ($e6b3dc1fa027c309$export$33da2edff2b544f3.updateHorzSegment(hs)) k++;\n if (k < 2) return;\n this._horzSegList.sort((hs1, hs2)=>{\n if (!hs1 || !hs2) return 0;\n if (!hs1.rightOp) return !hs2.rightOp ? 0 : 1;\n else if (!hs2.rightOp) return -1;\n else return hs1.leftOp.pt.x - hs2.leftOp.pt.x;\n });\n for(let i = 0; i < k - 1; i++){\n const hs1 = this._horzSegList[i];\n // for each HorzSegment, find others that overlap\n for(let j = i + 1; j < k; j++){\n const hs2 = this._horzSegList[j];\n if (hs2.leftOp.pt.x >= hs1.rightOp.pt.x || hs2.leftToRight === hs1.leftToRight || hs2.rightOp.pt.x <= hs1.leftOp.pt.x) continue;\n const curr_y = hs1.leftOp.pt.y;\n if (hs1.leftToRight) {\n while(hs1.leftOp.next.pt.y === curr_y && hs1.leftOp.next.pt.x <= hs2.leftOp.pt.x)hs1.leftOp = hs1.leftOp.next;\n while(hs2.leftOp.prev.pt.y === curr_y && hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x)hs2.leftOp = hs2.leftOp.prev;\n const join = new $e6b3dc1fa027c309$var$HorzJoin($e6b3dc1fa027c309$export$33da2edff2b544f3.duplicateOp(hs1.leftOp, true), $e6b3dc1fa027c309$export$33da2edff2b544f3.duplicateOp(hs2.leftOp, false));\n this._horzJoinList.push(join);\n } else {\n while(hs1.leftOp.prev.pt.y === curr_y && hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x)hs1.leftOp = hs1.leftOp.prev;\n while(hs2.leftOp.next.pt.y === curr_y && hs2.leftOp.next.pt.x <= hs1.leftOp.pt.x)hs2.leftOp = hs2.leftOp.next;\n const join = new $e6b3dc1fa027c309$var$HorzJoin($e6b3dc1fa027c309$export$33da2edff2b544f3.duplicateOp(hs2.leftOp, true), $e6b3dc1fa027c309$export$33da2edff2b544f3.duplicateOp(hs1.leftOp, false));\n this._horzJoinList.push(join);\n }\n }\n }\n }\n static getCleanPath(op) {\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n let op2 = op;\n while(op2.next !== op && (op2.pt.x === op2.next.pt.x && op2.pt.x === op2.prev.pt.x || op2.pt.y === op2.next.pt.y && op2.pt.y === op2.prev.pt.y))op2 = op2.next;\n result.push(op2.pt);\n let prevOp = op2;\n op2 = op2.next;\n while(op2 !== op){\n if ((op2.pt.x !== op2.next.pt.x || op2.pt.x !== prevOp.pt.x) && (op2.pt.y !== op2.next.pt.y || op2.pt.y !== prevOp.pt.y)) {\n result.push(op2.pt);\n prevOp = op2;\n }\n op2 = op2.next;\n }\n return result;\n }\n static pointInOpPolygon(pt, op) {\n if (op === op.next || op.prev === op.next) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n let op2 = op;\n do {\n if (op.pt.y !== pt.y) break;\n op = op.next;\n }while (op !== op2);\n if (op.pt.y === pt.y) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n let isAbove = op.pt.y < pt.y;\n const startingAbove = isAbove;\n let val = 0;\n op2 = op.next;\n while(op2 !== op){\n if (isAbove) while(op2 !== op && op2.pt.y < pt.y)op2 = op2.next;\n else while(op2 !== op && op2.pt.y > pt.y)op2 = op2.next;\n if (op2 === op) break;\n if (op2.pt.y === pt.y) {\n if (op2.pt.x === pt.x || op2.pt.y === op2.prev.pt.y && pt.x < op2.prev.pt.x !== pt.x < op2.pt.x) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n op2 = op2.next;\n if (op2 === op) break;\n continue;\n }\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x) val = 1 - val;\n else {\n const d = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, pt);\n if (d === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n }\n isAbove = !isAbove;\n op2 = op2.next;\n }\n if (isAbove !== startingAbove) {\n const d = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, pt);\n if (d === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n if (val === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n else return $e6b3dc1fa027c309$export$20896d302a4e5029.IsInside;\n }\n static path1InsidePath2(op1, op2) {\n let result;\n let outside_cnt = 0;\n let op = op1;\n do {\n result = this.pointInOpPolygon(op.pt, op2);\n if (result === $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside) ++outside_cnt;\n else if (result === $e6b3dc1fa027c309$export$20896d302a4e5029.IsInside) --outside_cnt;\n op = op.next;\n }while (op !== op1 && Math.abs(outside_cnt) < 2);\n if (Math.abs(outside_cnt) > 1) return outside_cnt < 0;\n const mp = $e6b3dc1fa027c309$export$33da2edff2b544f3.getBoundsPath(this.getCleanPath(op1)).midPoint();\n const path2 = this.getCleanPath(op2);\n return $e6b3dc1fa027c309$export$9bad362b29d84293.pointInPolygon(mp, path2) !== $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n }\n moveSplits(fromOr, toOr) {\n if (!fromOr.splits) return;\n toOr.splits = toOr.splits || [];\n for (const i of fromOr.splits)toOr.splits.push(i);\n fromOr.splits = undefined;\n }\n processHorzJoins() {\n for (const j of this._horzJoinList){\n const or1 = $e6b3dc1fa027c309$export$33da2edff2b544f3.getRealOutRec(j.op1.outrec);\n let or2 = $e6b3dc1fa027c309$export$33da2edff2b544f3.getRealOutRec(j.op2.outrec);\n const op1b = j.op1.next;\n const op2b = j.op2.prev;\n j.op1.next = j.op2;\n j.op2.prev = j.op1;\n op1b.prev = op2b;\n op2b.next = op1b;\n if (or1 === or2) {\n or2 = this.newOutRec();\n or2.pts = op1b;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.fixOutRecPts(or2);\n if (or1.pts.outrec === or2) {\n or1.pts = j.op1;\n or1.pts.outrec = or1;\n }\n if (this._using_polytree) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.path1InsidePath2(or1.pts, or2.pts)) {\n const tmp = or1.pts;\n or1.pts = or2.pts;\n or2.pts = tmp;\n $e6b3dc1fa027c309$export$33da2edff2b544f3.fixOutRecPts(or1);\n $e6b3dc1fa027c309$export$33da2edff2b544f3.fixOutRecPts(or2);\n or2.owner = or1.owner;\n } else if ($e6b3dc1fa027c309$export$33da2edff2b544f3.path1InsidePath2(or2.pts, or1.pts)) or2.owner = or1;\n else or2.owner = or1.owner;\n or1.splits = or1.splits || [];\n or1.splits.push(or2.idx);\n } else or2.owner = or1;\n } else {\n or2.pts = undefined;\n if (this._using_polytree) {\n $e6b3dc1fa027c309$export$33da2edff2b544f3.setOwner(or2, or1);\n this.moveSplits(or2, or1);\n } else or2.owner = or1;\n }\n }\n }\n static ptsReallyClose(pt1, pt2) {\n return Math.abs(pt1.x - pt2.x) < 2 && Math.abs(pt1.y - pt2.y) < 2;\n }\n static isVerySmallTriangle(op) {\n return op.next.next === op.prev && (this.ptsReallyClose(op.prev.pt, op.next.pt) || this.ptsReallyClose(op.pt, op.next.pt) || this.ptsReallyClose(op.pt, op.prev.pt));\n }\n static isValidClosedPath(op) {\n return op !== undefined && op.next !== op && (op.next !== op.prev || !this.isVerySmallTriangle(op));\n }\n static disposeOutPt(op) {\n const result = op.next === op ? undefined : op.next;\n op.prev.next = op.next;\n op.next.prev = op.prev;\n return result;\n }\n cleanCollinear(outrec) {\n outrec = $e6b3dc1fa027c309$export$33da2edff2b544f3.getRealOutRec(outrec);\n if (outrec === undefined || outrec.isOpen) return;\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isValidClosedPath(outrec.pts)) {\n outrec.pts = undefined;\n return;\n }\n let startOp = outrec.pts;\n let op2 = startOp;\n for(;;){\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0 && (op2.pt === op2.prev.pt || op2.pt === op2.next.pt || !this.preserveCollinear || $e6b3dc1fa027c309$export$9bad362b29d84293.dotProduct(op2.prev.pt, op2.pt, op2.next.pt) < 0)) {\n if (op2 === outrec.pts) outrec.pts = op2.prev;\n op2 = $e6b3dc1fa027c309$export$33da2edff2b544f3.disposeOutPt(op2);\n if (!$e6b3dc1fa027c309$export$33da2edff2b544f3.isValidClosedPath(op2)) {\n outrec.pts = undefined;\n return;\n }\n startOp = op2;\n continue;\n }\n op2 = op2.next;\n if (op2 === startOp) break;\n }\n this.fixSelfIntersects(outrec);\n }\n doSplitOp(outrec, splitOp) {\n // splitOp.prev <=> splitOp &&\n // splitOp.next <=> splitOp.next.next are intersecting\n const prevOp = splitOp.prev;\n const nextNextOp = splitOp.next.next;\n outrec.pts = prevOp;\n const ip = $e6b3dc1fa027c309$export$9bad362b29d84293.getIntersectPoint(prevOp.pt, splitOp.pt, splitOp.next.pt, nextNextOp.pt).ip;\n const area1 = $e6b3dc1fa027c309$export$33da2edff2b544f3.area(prevOp);\n const absArea1 = Math.abs(area1);\n if (absArea1 < 2) {\n outrec.pts = undefined;\n return;\n }\n const area2 = $e6b3dc1fa027c309$export$33da2edff2b544f3.areaTriangle(ip, splitOp.pt, splitOp.next.pt);\n const absArea2 = Math.abs(area2);\n // de-link splitOp and splitOp.next from the path\n // while inserting the intersection point\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\n nextNextOp.prev = prevOp;\n prevOp.next = nextNextOp;\n } else {\n const newOp2 = new $e6b3dc1fa027c309$var$OutPt(ip, outrec);\n newOp2.prev = prevOp;\n newOp2.next = nextNextOp;\n nextNextOp.prev = newOp2;\n prevOp.next = newOp2;\n }\n // nb: area1 is the path's area *before* splitting, whereas area2 is\n // the area of the triangle containing splitOp & splitOp.next.\n // So the only way for these areas to have the same sign is if\n // the split triangle is larger than the path containing prevOp or\n // if there's more than one self=intersection.\n if (absArea2 > 1 && (absArea2 > absArea1 || area2 > 0 === area1 > 0)) {\n const newOutRec = this.newOutRec();\n newOutRec.owner = outrec.owner;\n splitOp.outrec = newOutRec;\n splitOp.next.outrec = newOutRec;\n const newOp = new $e6b3dc1fa027c309$var$OutPt(ip, newOutRec);\n newOp.prev = splitOp.next;\n newOp.next = splitOp;\n newOutRec.pts = newOp;\n splitOp.prev = newOp;\n splitOp.next.next = newOp;\n if (this._using_polytree) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.path1InsidePath2(prevOp, newOp)) {\n newOutRec.splits = newOutRec.splits || [];\n newOutRec.splits.push(outrec.idx);\n } else {\n outrec.splits = outrec.splits || [];\n outrec.splits.push(newOutRec.idx);\n }\n }\n }\n // else { splitOp = undefined; splitOp.next = undefined; }\n }\n fixSelfIntersects(outrec) {\n let op2 = outrec.pts;\n for(;;){\n if (op2.prev === op2.next.next) break;\n if ($e6b3dc1fa027c309$export$9bad362b29d84293.segsIntersect(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt)) {\n this.doSplitOp(outrec, op2);\n if (!outrec.pts) return;\n op2 = outrec.pts;\n continue;\n } else op2 = op2.next;\n if (op2 === outrec.pts) break;\n }\n }\n static buildPath(op, reverse, isOpen, path) {\n if (op === undefined || op.next === op || !isOpen && op.next === op.prev) return false;\n path.length = 0;\n let lastPt;\n let op2;\n if (reverse) {\n lastPt = op.pt;\n op2 = op.prev;\n } else {\n op = op.next;\n lastPt = op.pt;\n op2 = op.next;\n }\n path.push(lastPt);\n while(op2 !== op){\n if (op2.pt !== lastPt) {\n lastPt = op2.pt;\n path.push(lastPt);\n }\n if (reverse) op2 = op2.prev;\n else op2 = op2.next;\n }\n if (path.length === 3 && this.isVerySmallTriangle(op2)) return false;\n else return true;\n }\n buildPaths(solutionClosed, solutionOpen) {\n solutionClosed.length = 0;\n solutionOpen.length = 0;\n let i = 0;\n while(i < this._outrecList.length){\n const outrec = this._outrecList[i++];\n if (!outrec.pts) continue;\n const path = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n if (outrec.isOpen) {\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, true, path)) solutionOpen.push(path);\n } else {\n this.cleanCollinear(outrec);\n // closed paths should always return a Positive orientation\n // except when reverseSolution == true\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, false, path)) solutionClosed.push(path);\n }\n }\n return true;\n }\n static getBoundsPath(path) {\n if (path.length === 0) return new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f();\n const result = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.InvalidRect64;\n for (const pt of path){\n if (pt.x < result.left) result.left = pt.x;\n if (pt.x > result.right) result.right = pt.x;\n if (pt.y < result.top) result.top = pt.y;\n if (pt.y > result.bottom) result.bottom = pt.y;\n }\n return result;\n }\n checkBounds(outrec) {\n if (outrec.pts === undefined) return false;\n if (!outrec.bounds.isEmpty()) return true;\n this.cleanCollinear(outrec);\n if (outrec.pts === undefined || !$e6b3dc1fa027c309$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, false, outrec.path)) return false;\n outrec.bounds = $e6b3dc1fa027c309$export$33da2edff2b544f3.getBoundsPath(outrec.path);\n return true;\n }\n checkSplitOwner(outrec, splits) {\n for (const i of splits){\n const split = $e6b3dc1fa027c309$export$33da2edff2b544f3.getRealOutRec(this._outrecList[i]);\n if (split === undefined || split === outrec || split.recursiveSplit === outrec) continue;\n split.recursiveSplit = outrec; //#599\n if (split.splits !== undefined && this.checkSplitOwner(outrec, split.splits)) return true;\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.isValidOwner(outrec, split) && this.checkBounds(split) && split.bounds.containsRect(outrec.bounds) && $e6b3dc1fa027c309$export$33da2edff2b544f3.path1InsidePath2(outrec.pts, split.pts)) {\n outrec.owner = split; //found in split\n return true;\n }\n }\n return false;\n }\n recursiveCheckOwners(outrec, polypath) {\n // pre-condition: outrec will have valid bounds\n // post-condition: if a valid path, outrec will have a polypath\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty()) return;\n while(outrec.owner !== undefined){\n if (outrec.owner.splits !== undefined && this.checkSplitOwner(outrec, outrec.owner.splits)) break;\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) && $e6b3dc1fa027c309$export$33da2edff2b544f3.path1InsidePath2(outrec.pts, outrec.owner.pts)) break;\n outrec.owner = outrec.owner.owner;\n }\n if (outrec.owner !== undefined) {\n if (outrec.owner.polypath === undefined) this.recursiveCheckOwners(outrec.owner, polypath);\n outrec.polypath = outrec.owner.polypath.addChild(outrec.path);\n } else outrec.polypath = polypath.addChild(outrec.path);\n }\n buildTree(polytree, solutionOpen) {\n polytree.clear();\n solutionOpen.length = 0;\n let i = 0;\n while(i < this._outrecList.length){\n const outrec = this._outrecList[i++];\n if (outrec.pts === undefined) continue;\n if (outrec.isOpen) {\n const open_path = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n if ($e6b3dc1fa027c309$export$33da2edff2b544f3.buildPath(outrec.pts, this.reverseSolution, true, open_path)) solutionOpen.push(open_path);\n continue;\n }\n if (this.checkBounds(outrec)) this.recursiveCheckOwners(outrec, polytree);\n }\n }\n getBounds() {\n const bounds = $e6b3dc1fa027c309$export$47d6d5d06ccbc908.InvalidRect64;\n for (const t of this._vertexList){\n let v = t;\n do {\n if (v.pt.x < bounds.left) bounds.left = v.pt.x;\n if (v.pt.x > bounds.right) bounds.right = v.pt.x;\n if (v.pt.y < bounds.top) bounds.top = v.pt.y;\n if (v.pt.y > bounds.bottom) bounds.bottom = v.pt.y;\n v = v.next;\n }while (v !== t);\n }\n return bounds.isEmpty() ? new $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f(0, 0, 0, 0) : bounds;\n }\n}\nclass $e6b3dc1fa027c309$export$389255fe4ace408b extends $e6b3dc1fa027c309$export$33da2edff2b544f3 {\n addPath(path, polytype, isOpen = false) {\n super.addPath(path, polytype, isOpen);\n }\n addReusableData(reusableData) {\n super.addReuseableData(reusableData);\n }\n addPaths(paths, polytype, isOpen = false) {\n super.addPaths(paths, polytype, isOpen);\n }\n addSubjectPaths(paths) {\n this.addPaths(paths, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject);\n }\n addOpenSubjectPaths(paths) {\n this.addPaths(paths, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Subject, true);\n }\n addClipPaths(paths) {\n this.addPaths(paths, $e6b3dc1fa027c309$export$1ede5f4f7cadbc19.Clip);\n }\n execute(clipType, fillRule, solutionClosed, solutionOpen = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9()) {\n solutionClosed.length = 0;\n solutionOpen.length = 0;\n try {\n this.executeInternal(clipType, fillRule);\n this.buildPaths(solutionClosed, solutionOpen);\n } catch (error) {\n this._succeeded = false;\n }\n this.clearSolutionOnly();\n return this._succeeded;\n }\n executePolyTree(clipType, fillRule, polytree, openPaths = new $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9()) {\n polytree.clear();\n openPaths.length = 0;\n this._using_polytree = true;\n try {\n this.executeInternal(clipType, fillRule);\n this.buildTree(polytree, openPaths);\n } catch (error) {\n this._succeeded = false;\n }\n this.clearSolutionOnly();\n return this._succeeded;\n }\n}\nclass $e6b3dc1fa027c309$export$106ec032583e753f {\n get isHole() {\n return this.getIsHole();\n }\n constructor(parent){\n this.children = [];\n this.forEach = this.children.forEach;\n this._parent = parent;\n }\n getLevel() {\n let result = 0;\n let pp = this._parent;\n while(pp !== undefined){\n ++result;\n pp = pp._parent;\n }\n return result;\n }\n get level() {\n return this.getLevel();\n }\n getIsHole() {\n const lvl = this.getLevel();\n return lvl !== 0 && (lvl & 1) === 0;\n }\n get count() {\n return this.children.length;\n }\n clear() {\n this.children.length = 0;\n }\n} // end of PolyPathBase class\nclass $e6b3dc1fa027c309$export$da0488db9930c0ed extends $e6b3dc1fa027c309$export$106ec032583e753f {\n constructor(parent){\n super(parent);\n }\n addChild(p) {\n const newChild = new $e6b3dc1fa027c309$export$da0488db9930c0ed(this);\n newChild.polygon = p;\n this.children.push(newChild);\n return newChild;\n }\n get(index) {\n if (index < 0 || index >= this.children.length) throw new Error(\"InvalidOperationException\");\n return this.children[index];\n }\n child(index) {\n if (index < 0 || index >= this.children.length) throw new Error(\"InvalidOperationException\");\n return this.children[index];\n }\n area() {\n let result = this.polygon ? $e6b3dc1fa027c309$export$47d6d5d06ccbc908.area(this.polygon) : 0;\n for (const polyPathBase of this.children){\n const child = polyPathBase;\n result += child.area();\n }\n return result;\n }\n}\nclass $e6b3dc1fa027c309$export$a6691aab770c5bdb extends $e6b3dc1fa027c309$export$da0488db9930c0ed {\n}\nclass $e6b3dc1fa027c309$export$d4a89d8e4fb761df extends Error {\n constructor(description){\n super(description);\n }\n}\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/ //\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\n// Removed support for USINGZ\n//\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\n//\n// Note: all clipping operations except for Difference are commutative.\nvar $e6b3dc1fa027c309$export$9e3ecdefb2438757;\n(function(ClipType) {\n ClipType[ClipType[\"None\"] = 0] = \"None\";\n ClipType[ClipType[\"Intersection\"] = 1] = \"Intersection\";\n ClipType[ClipType[\"Union\"] = 2] = \"Union\";\n ClipType[ClipType[\"Difference\"] = 3] = \"Difference\";\n ClipType[ClipType[\"Xor\"] = 4] = \"Xor\";\n})($e6b3dc1fa027c309$export$9e3ecdefb2438757 || ($e6b3dc1fa027c309$export$9e3ecdefb2438757 = {}));\nvar $e6b3dc1fa027c309$export$1ede5f4f7cadbc19;\n(function(PathType) {\n PathType[PathType[\"Subject\"] = 0] = \"Subject\";\n PathType[PathType[\"Clip\"] = 1] = \"Clip\";\n})($e6b3dc1fa027c309$export$1ede5f4f7cadbc19 || ($e6b3dc1fa027c309$export$1ede5f4f7cadbc19 = {}));\n// By far the most widely used filling rules for polygons are EvenOdd\n// and NonZero, sometimes called Alternate and Winding respectively.\n// https://en.wikipedia.org/wiki/Nonzero-rule\nvar $e6b3dc1fa027c309$export$f26b42c94e8a4f95;\n(function(FillRule) {\n FillRule[FillRule[\"EvenOdd\"] = 0] = \"EvenOdd\";\n FillRule[FillRule[\"NonZero\"] = 1] = \"NonZero\";\n FillRule[FillRule[\"Positive\"] = 2] = \"Positive\";\n FillRule[FillRule[\"Negative\"] = 3] = \"Negative\";\n})($e6b3dc1fa027c309$export$f26b42c94e8a4f95 || ($e6b3dc1fa027c309$export$f26b42c94e8a4f95 = {}));\n// PointInPolygon\nvar $e6b3dc1fa027c309$export$6a3f4acf2fce52a0;\n(function(PipResult) {\n PipResult[PipResult[\"Inside\"] = 0] = \"Inside\";\n PipResult[PipResult[\"Outside\"] = 1] = \"Outside\";\n PipResult[PipResult[\"OnEdge\"] = 2] = \"OnEdge\";\n})($e6b3dc1fa027c309$export$6a3f4acf2fce52a0 || ($e6b3dc1fa027c309$export$6a3f4acf2fce52a0 = {}));\nclass $e6b3dc1fa027c309$export$b12670b10302a8b7 extends Array {\n}\nclass $e6b3dc1fa027c309$export$3a7c4895ca9e3ca9 extends Array {\n}\nclass $e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f {\n constructor(lOrIsValidOrRec, t, r, b){\n if (typeof lOrIsValidOrRec === \"boolean\") {\n if (lOrIsValidOrRec) {\n this.left = 0;\n this.top = 0;\n this.right = 0;\n this.bottom = 0;\n } else {\n this.left = Number.MAX_SAFE_INTEGER;\n this.top = Number.MAX_SAFE_INTEGER;\n this.right = Number.MIN_SAFE_INTEGER;\n this.bottom = Number.MIN_SAFE_INTEGER;\n }\n } else if (typeof lOrIsValidOrRec === \"number\") {\n this.left = lOrIsValidOrRec;\n this.top = t;\n this.right = r;\n this.bottom = b;\n } else {\n this.left = lOrIsValidOrRec.left;\n this.top = lOrIsValidOrRec.top;\n this.right = lOrIsValidOrRec.right;\n this.bottom = lOrIsValidOrRec.bottom;\n }\n }\n get width() {\n return this.right - this.left;\n }\n set width(value) {\n this.right = this.left + value;\n }\n get height() {\n return this.bottom - this.top;\n }\n set height(value) {\n this.bottom = this.top + value;\n }\n isEmpty() {\n return this.bottom <= this.top || this.right <= this.left;\n }\n midPoint() {\n return new $e6b3dc1fa027c309$export$d379afd9763b528f((this.left + this.right) / 2, (this.top + this.bottom) / 2);\n }\n contains(pt) {\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\n }\n containsRect(rec) {\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\n }\n intersects(rec) {\n return Math.max(this.left, rec.left) <= Math.min(this.right, rec.right) && Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom);\n }\n asPath() {\n const result = new $e6b3dc1fa027c309$export$b12670b10302a8b7();\n result.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(this.left, this.top));\n result.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(this.right, this.top));\n result.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(this.right, this.bottom));\n result.push(new $e6b3dc1fa027c309$export$d379afd9763b528f(this.left, this.bottom));\n return result;\n }\n}\nclass $e6b3dc1fa027c309$export$d379afd9763b528f {\n constructor(xOrPt, yOrScale){\n if (typeof xOrPt === \"number\" && typeof yOrScale === \"number\") {\n this.x = Math.round(xOrPt);\n this.y = Math.round(yOrScale);\n } else {\n const pt = xOrPt;\n if (yOrScale !== undefined) {\n this.x = Math.round(pt.x * yOrScale);\n this.y = Math.round(pt.y * yOrScale);\n } else {\n this.x = pt.x;\n this.y = pt.y;\n }\n //} else {\n // const pt = xOrPt as Point64\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\n }\n }\n static equals(lhs, rhs) {\n return lhs.x === rhs.x && lhs.y === rhs.y;\n }\n static notEquals(lhs, rhs) {\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\n }\n static add(lhs, rhs) {\n return new $e6b3dc1fa027c309$export$d379afd9763b528f(lhs.x + rhs.x, lhs.y + rhs.y);\n }\n static subtract(lhs, rhs) {\n return new $e6b3dc1fa027c309$export$d379afd9763b528f(lhs.x - rhs.x, lhs.y - rhs.y);\n }\n toString() {\n return `${this.x},${this.y} `;\n }\n equals(obj) {\n if (obj instanceof $e6b3dc1fa027c309$export$d379afd9763b528f) return $e6b3dc1fa027c309$export$d379afd9763b528f.equals(this, obj);\n return false;\n }\n}\nclass $e6b3dc1fa027c309$export$9bad362b29d84293 {\n static checkPrecision(precision) {\n if (precision < -8 || precision > 8) throw new Error(this.precision_range_error);\n }\n static isAlmostZero(value) {\n return Math.abs(value) <= this.floatingPointTolerance;\n }\n static crossProduct(pt1, pt2, pt3) {\n return (pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x);\n }\n static dotProduct(pt1, pt2, pt3) {\n return (pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y);\n }\n static checkCastInt64(val) {\n if (val >= this.max_coord || val <= this.min_coord) return this.Invalid64;\n return Math.round(val);\n }\n static getIntersectPt(ln1a, ln1b, ln2a, ln2b) {\n const dy1 = ln1b.y - ln1a.y;\n const dx1 = ln1b.x - ln1a.x;\n const dy2 = ln2b.y - ln2a.y;\n const dx2 = ln2b.x - ln2a.x;\n const det = dy1 * dx2 - dy2 * dx1;\n let ip;\n if (det === 0.0) {\n ip = new $e6b3dc1fa027c309$export$d379afd9763b528f(0, 0);\n return {\n ip: ip,\n success: false\n };\n }\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\n if (t <= 0.0) ip = ln1a;\n else if (t >= 1.0) ip = ln1b;\n else ip = new $e6b3dc1fa027c309$export$d379afd9763b528f(ln1a.x + t * dx1, ln1a.y + t * dy1);\n return {\n ip: ip,\n success: true\n };\n }\n static getIntersectPoint(ln1a, ln1b, ln2a, ln2b) {\n const dy1 = ln1b.y - ln1a.y;\n const dx1 = ln1b.x - ln1a.x;\n const dy2 = ln2b.y - ln2a.y;\n const dx2 = ln2b.x - ln2a.x;\n const det = dy1 * dx2 - dy2 * dx1;\n let ip;\n if (det === 0.0) {\n ip = new $e6b3dc1fa027c309$export$d379afd9763b528f(0, 0);\n return {\n ip: ip,\n success: false\n };\n }\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\n if (t <= 0.0) ip = ln1a;\n else if (t >= 1.0) ip = ln2a;\n else ip = new $e6b3dc1fa027c309$export$d379afd9763b528f(ln1a.x + t * dx1, ln1a.y + t * dy1);\n return {\n ip: ip,\n success: true\n };\n }\n static segsIntersect(seg1a, seg1b, seg2a, seg2b, inclusive = false) {\n if (inclusive) {\n const res1 = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg1a, seg2a, seg2b);\n const res2 = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg1b, seg2a, seg2b);\n if (res1 * res2 > 0) return false;\n const res3 = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg2a, seg1a, seg1b);\n const res4 = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg2b, seg1a, seg1b);\n if (res3 * res4 > 0) return false;\n return res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0;\n } else return $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg1a, seg2a, seg2b) * $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg1b, seg2a, seg2b) < 0 && $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg2a, seg1a, seg1b) * $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(seg2b, seg1a, seg1b) < 0;\n }\n static getClosestPtOnSegment(offPt, seg1, seg2) {\n if (seg1.x === seg2.x && seg1.y === seg2.y) return seg1;\n const dx = seg2.x - seg1.x;\n const dy = seg2.y - seg1.y;\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / (dx * dx + dy * dy);\n if (q < 0) q = 0;\n else if (q > 1) q = 1;\n return new $e6b3dc1fa027c309$export$d379afd9763b528f(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\n }\n static pointInPolygon(pt, polygon) {\n const len = polygon.length;\n let start = 0;\n if (len < 3) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n while(start < len && polygon[start].y === pt.y)start++;\n if (start === len) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n let d = 0;\n let isAbove = polygon[start].y < pt.y;\n const startingAbove = isAbove;\n let val = 0;\n let i = start + 1;\n let end = len;\n for(;;){\n if (i === end) {\n if (end === 0 || start === 0) break;\n end = start;\n i = 0;\n }\n if (isAbove) {\n while(i < end && polygon[i].y < pt.y)i++;\n if (i === end) continue;\n } else {\n while(i < end && polygon[i].y > pt.y)i++;\n if (i === end) continue;\n }\n const curr = polygon[i];\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\n if (curr.y === pt.y) {\n if (curr.x === pt.x || curr.y === prev.y && pt.x < prev.x !== pt.x < curr.x) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n i++;\n if (i === start) break;\n continue;\n }\n if (pt.x < curr.x && pt.x < prev.x) ;\n else if (pt.x > prev.x && pt.x > curr.x) val = 1 - val; // toggle val\n else {\n d = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(prev, curr, pt);\n if (d === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n isAbove = !isAbove;\n i++;\n }\n if (isAbove !== startingAbove) {\n if (i === len) i = 0;\n else d = $e6b3dc1fa027c309$export$9bad362b29d84293.crossProduct(polygon[i - 1], polygon[i], pt);\n if (d === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOn;\n if (d < 0 === isAbove) val = 1 - val;\n }\n if (val === 0) return $e6b3dc1fa027c309$export$20896d302a4e5029.IsOutside;\n return $e6b3dc1fa027c309$export$20896d302a4e5029.IsInside;\n }\n}\n$e6b3dc1fa027c309$export$9bad362b29d84293.MaxInt64 = 9223372036854775807;\n$e6b3dc1fa027c309$export$9bad362b29d84293.MaxCoord = $e6b3dc1fa027c309$export$9bad362b29d84293.MaxInt64 / 4;\n$e6b3dc1fa027c309$export$9bad362b29d84293.max_coord = $e6b3dc1fa027c309$export$9bad362b29d84293.MaxCoord;\n$e6b3dc1fa027c309$export$9bad362b29d84293.min_coord = -$e6b3dc1fa027c309$export$9bad362b29d84293.MaxCoord;\n$e6b3dc1fa027c309$export$9bad362b29d84293.Invalid64 = $e6b3dc1fa027c309$export$9bad362b29d84293.MaxInt64;\n$e6b3dc1fa027c309$export$9bad362b29d84293.defaultArcTolerance = 0.25;\n$e6b3dc1fa027c309$export$9bad362b29d84293.floatingPointTolerance = 1E-12;\n$e6b3dc1fa027c309$export$9bad362b29d84293.defaultMinimumEdgeLength = 0.1;\n$e6b3dc1fa027c309$export$9bad362b29d84293.precision_range_error = \"Error: Precision is out of range.\";\n\n});\n\nparcelRequire.register(\"9bB8r\", function(module, exports) {\n\n$parcel$export(module.exports, \"compressPoints\", () => $6b01f26c0fbb53df$export$a1384fe5bb05e0aa);\nconst $6b01f26c0fbb53df$var$DIRECTION_EPSILON = 1e-3;\nconst $6b01f26c0fbb53df$var$DIST_EPSILON = 1e2;\nfunction $6b01f26c0fbb53df$var$sameDirection(p0, p1, p2) {\n const dx1 = p1.x - p0.x;\n const dy1 = p1.y - p0.y;\n const dx2 = p2.x - p1.x;\n const dy2 = p2.y - p1.y;\n const s1 = dx1 / dy1;\n const s2 = dx2 / dy2;\n return Math.abs(s1 - s2) < $6b01f26c0fbb53df$var$DIRECTION_EPSILON;\n}\nfunction $6b01f26c0fbb53df$var$areClose(p0, p1) {\n const dx = p1.x - p0.x;\n const dy = p1.y - p0.y;\n return Math.sqrt(dx * dx + dy * dy) < $6b01f26c0fbb53df$var$DIST_EPSILON;\n}\nfunction $6b01f26c0fbb53df$var$areEqual(p0, p1) {\n return p0.x === p1.x && p0.y === p1.y;\n}\nfunction $6b01f26c0fbb53df$export$a1384fe5bb05e0aa(points) {\n for(let k = 0; k < points.length; k++){\n // remove points that are equal or very close to each other\n const v = points[k];\n while(true){\n const k1 = k + 1;\n if (points.length > k1 && ($6b01f26c0fbb53df$var$areEqual(v, points[k1]) || $6b01f26c0fbb53df$var$areClose(v, points[k1]))) points.splice(k1, 1);\n else break;\n }\n // join lines that are almost the same direction\n while(true){\n const k1 = k + 1;\n const k2 = k + 2;\n if (points.length > k2 && $6b01f26c0fbb53df$var$sameDirection(v, points[k1], points[k2])) points.splice(k + 1, 1);\n else break;\n }\n }\n}\n\n});\n\nparcelRequire.register(\"e5S3P\", function(module, exports) {\n\n$parcel$export(module.exports, \"triangleIsInsidePaths\", () => $a42b77ae67a84214$export$a4592ad7ee5e85f);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\nfunction $a42b77ae67a84214$var$xzToXzCopy(v, target) {\n target.x = v.x;\n target.y = v.z;\n}\nfunction $a42b77ae67a84214$var$epsEquals(a, b) {\n return Math.abs(a - b) <= 500;\n}\nfunction $a42b77ae67a84214$var$vectorEpsEquals(v0, v1) {\n return $a42b77ae67a84214$var$epsEquals(v0.x, v1.x) && $a42b77ae67a84214$var$epsEquals(v0.y, v1.y) && $a42b77ae67a84214$var$epsEquals(v0.z, v1.z);\n}\nfunction $a42b77ae67a84214$export$a4592ad7ee5e85f(tri, paths) {\n const indices = [\n \"a\",\n \"b\",\n \"c\"\n ];\n const edges = [\n new (0, $ilwiq.Line3)(),\n new (0, $ilwiq.Line3)(),\n new (0, $ilwiq.Line3)()\n ];\n const line = new (0, $ilwiq.Line3)();\n const ray = new (0, $ilwiq.Line3)();\n ray.start.set(0, 0, 0).addScaledVector(tri.a, 1 / 3).addScaledVector(tri.b, 1 / 3).addScaledVector(tri.c, 1 / 3);\n $a42b77ae67a84214$var$xzToXzCopy(ray.start, ray.start);\n ray.end.copy(ray.start);\n ray.end.y += 1e10;\n // get all triangle edges\n for(let i = 0; i < 3; i++){\n const i1 = (i + 1) % 3;\n const p0 = tri[indices[i]];\n const p1 = tri[indices[i1]];\n const edge = edges[i];\n $a42b77ae67a84214$var$xzToXzCopy(p0, edge.start);\n $a42b77ae67a84214$var$xzToXzCopy(p1, edge.end);\n }\n let crossCount = 0;\n for(let p = 0, pl = paths.length; p < pl; p++){\n const points = paths[p];\n for(let i = 0, l = points.length; i < l; i++){\n const i1 = (i + 1) % l;\n line.start.copy(points[i]);\n line.start.z = 0;\n line.end.copy(points[i1]);\n line.end.z = 0;\n if ($a42b77ae67a84214$var$lineCrossesLine(ray, line)) crossCount++;\n for(let e = 0; e < 3; e++){\n const edge = edges[e];\n if ($a42b77ae67a84214$var$lineCrossesLine(edge, line) || $a42b77ae67a84214$var$vectorEpsEquals(edge.start, line.start) || $a42b77ae67a84214$var$vectorEpsEquals(edge.end, line.end) || $a42b77ae67a84214$var$vectorEpsEquals(edge.end, line.start) || $a42b77ae67a84214$var$vectorEpsEquals(edge.start, line.end)) return false;\n }\n }\n }\n return crossCount % 2 === 1;\n}\n// https://stackoverflow.com/questions/3838329/how-can-i-check-if-two-segments-intersect\nfunction $a42b77ae67a84214$var$lineCrossesLine(l1, l2) {\n function ccw(A, B, C) {\n return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);\n }\n const A = l1.start;\n const B = l1.end;\n const C = l2.start;\n const D = l2.end;\n return ccw(A, C, D) !== ccw(B, C, D) && ccw(A, B, C) !== ccw(A, B, D);\n}\n\n});\n\nparcelRequire.register(\"2lMur\", function(module, exports) {\n\n$parcel$export(module.exports, \"getSizeSortedTriList\", () => $1b63280c8944b3c2$export$22df3f56fb458152);\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $ahD9r = parcelRequire(\"ahD9r\");\nconst $1b63280c8944b3c2$var$_tri = new (0, $ilwiq.Triangle)();\nfunction $1b63280c8944b3c2$export$22df3f56fb458152(geometry) {\n const index = geometry.index;\n const posAttr = geometry.attributes.position;\n const triCount = (0, $ahD9r.getTriCount)(geometry);\n return new Array(triCount).fill().map((v, i)=>{\n let i0 = i * 3 + 0;\n let i1 = i * 3 + 1;\n let i2 = i * 3 + 2;\n if (index) {\n i0 = index.getX(i0);\n i1 = index.getX(i1);\n i2 = index.getX(i2);\n }\n $1b63280c8944b3c2$var$_tri.a.fromBufferAttribute(posAttr, i0);\n $1b63280c8944b3c2$var$_tri.b.fromBufferAttribute(posAttr, i1);\n $1b63280c8944b3c2$var$_tri.c.fromBufferAttribute(posAttr, i2);\n $1b63280c8944b3c2$var$_tri.a.y = 0;\n $1b63280c8944b3c2$var$_tri.b.y = 0;\n $1b63280c8944b3c2$var$_tri.c.y = 0;\n // get the projected area of the triangle to sort largest triangles first\n return {\n area: $1b63280c8944b3c2$var$_tri.getArea(),\n index: i\n };\n }).sort((a, b)=>{\n // sort the triangles largest to smallest\n return b.area - a.area;\n }).map((o)=>{\n // map to the triangle index\n return o.index;\n });\n}\n\n});\nparcelRequire.register(\"ahD9r\", function(module, exports) {\n\n$parcel$export(module.exports, \"getTriCount\", () => $77c9dc8b1808b43f$export$c56c51fae37b2d63);\nfunction $77c9dc8b1808b43f$export$c56c51fae37b2d63(geometry) {\n const { index: index } = geometry;\n const posAttr = geometry.attributes.position;\n return index ? index.count / 3 : posAttr.count / 3;\n}\n\n});\n\n\n\n\n\n//# sourceMappingURL=silhouetteProjection.4adac46b.js.map\n","/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '155';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst TwoPassDoubleSide = 2; // r149\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst AlphaFormat = 1021;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */\nconst LinearEncoding = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */\nconst sRGBEncoding = 3001;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst _SRGBAFormat = 1035; // fallback for WebGL 1\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [\n\t0.8224621, 0.0331941, 0.0170827,\n\t0.1775380, 0.9668058, 0.0723974,\n\t- 0.0000001, 0.0000001, 0.9105199\n] );\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [\n\t1.2249401, - 0.0420569, - 0.0196376,\n\t- 0.2249404, 1.0420571, - 0.0786361,\n\t0.0000001, 0.0000000, 1.0982735\n] );\n\nfunction DisplayP3ToLinearSRGB( color ) {\n\n\t// Display P3 uses the sRGB transfer functions\n\treturn color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );\n\n}\n\nfunction LinearSRGBToDisplayP3( color ) {\n\n\t// Display P3 uses the sRGB transfer functions\n\treturn color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB();\n\n}\n\n// Conversions from to Linear-sRGB reference space.\nconst TO_LINEAR = {\n\t[ LinearSRGBColorSpace ]: ( color ) => color,\n\t[ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),\n\t[ DisplayP3ColorSpace ]: DisplayP3ToLinearSRGB,\n};\n\n// Conversions to from Linear-sRGB reference space.\nconst FROM_LINEAR = {\n\t[ LinearSRGBColorSpace ]: ( color ) => color,\n\t[ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),\n\t[ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,\n};\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\tget legacyMode() {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\treturn ! this.enabled;\n\n\t},\n\n\tset legacyMode( legacyMode ) {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\tthis.enabled = ! legacyMode;\n\n\t},\n\n\tget workingColorSpace() {\n\n\t\treturn LinearSRGBColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .workingColorSpace is readonly.' );\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToLinear = TO_LINEAR[ sourceColorSpace ];\n\t\tconst targetFromLinear = FROM_LINEAR[ targetColorSpace ];\n\n\t\tif ( sourceToLinear === undefined || targetFromLinear === undefined ) {\n\n\t\t\tthrow new Error( `Unsupported color space conversion, \"${ sourceColorSpace }\" to \"${ targetColorSpace }\".` );\n\n\t\t}\n\n\t\treturn targetFromLinear( sourceToLinear( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this.workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this.workingColorSpace );\n\n\t},\n\n};\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tif ( typeof colorSpace === 'string' ) {\n\n\t\t\tthis.colorSpace = colorSpace;\n\n\t\t} else { // @deprecated, r152\n\n\t\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\t\tthis.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tget encoding() { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\treturn this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset encoding( encoding ) { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\tthis.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.flipY = false;\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n\t\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n\n\t\tthis.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n\n\t\tthis.samples = options.samples !== undefined ? options.samples : 0;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\t\t\tthis.texture.image.depth = depth;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t\tconst texture = this.texture;\n\n\t\tthis.texture = [];\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.texture[ i ] = texture.clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.texture.length; i < il; i ++ ) {\n\n\t\t\t\tthis.texture[ i ].image.width = width;\n\t\t\t\tthis.texture[ i ].image.height = height;\n\t\t\t\tthis.texture[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.dispose();\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.texture.length = 0;\n\n\t\tfor ( let i = 0, il = source.texture.length; i < il; i ++ ) {\n\n\t\t\tthis.texture[ i ] = source.texture[ i ].clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize();\n\t\t\tthis._onChangeCallback();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// calculate quat * vector\n\n\t\tconst ix = qw * x + qy * z - qz * y;\n\t\tconst iy = qw * y + qz * x - qx * z;\n\t\tconst iz = qw * z + qx * y - qy * x;\n\t\tconst iw = - qx * x - qy * y - qz * z;\n\n\t\t// calculate result * inverse quat\n\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$b.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$b );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$b.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$a.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\t_box$3.copy( object.boundingBox );\n\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\tthis.union( _box$3 );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry !== undefined ) {\n\n\t\t\t\tif ( precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined ) {\n\n\t\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\t\tfor ( let i = 0, l = position.count; i < l; i ++ ) {\n\n\t\t\t\t\t\t_vector$a.fromBufferAttribute( position, i ).applyMatrix4( object.matrixWorld );\n\t\t\t\t\t\tthis.expandByPoint( _vector$a );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$3.copy( geometry.boundingBox );\n\t\t\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\t\t\tthis.union( _box$3 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$a );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$a.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$a ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$a ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\n\nconst _box$3 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$2.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$9 ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$9.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$9.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$9.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$9.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$9.dot( this.direction );\n\t\tconst d2 = _vector$9.dot( _vector$9 ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$9 ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\tconst object = this.children[ i ];\n\n\t\t\tobject.parent = null;\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\tthis.children.length = 0;\n\n\t\treturn this;\n\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value ) {\n\n\t\tlet result = [];\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst childResult = this.children[ i ].getObjectsByProperty( name, value );\n\n\t\t\tif ( childResult.length > 0 ) {\n\n\t\t\t\tresult = result.concat( childResult );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$1 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nlet warnedGetUV = false;\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\t// arbitrary location outside of triangle?\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\n\t\t\treturn target.set( - 2, - 1, - 1 );\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\tthis.getBarycoord( point, a, b, c, _v3$1 );\n\n\t\treturn ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tthis.getBarycoord( point, p1, p2, p3, _v3$1 );\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$1.x );\n\t\ttarget.addScaledVector( v2, _v3$1.y );\n\t\ttarget.addScaledVector( v3, _v3$1.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nlet materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = this.transparent;\n\n\t\tdata.depthFunc = this.depthFunc;\n\t\tdata.depthTest = this.depthTest;\n\t\tdata.depthWrite = this.depthWrite;\n\t\tdata.colorWrite = this.colorWrite;\n\n\t\tdata.stencilWrite = this.stencilWrite;\n\t\tdata.stencilWriteMask = this.stencilWriteMask;\n\t\tdata.stencilFunc = this.stencilFunc;\n\t\tdata.stencilRef = this.stencilRef;\n\t\tdata.stencilFuncMask = this.stencilFuncMask;\n\t\tdata.stencilFail = this.stencilFail;\n\t\tdata.stencilZFail = this.stencilZFail;\n\t\tdata.stencilZPass = this.stencilZPass;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = this.alphaHash;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;\n\n\t\tif ( this.wireframe === true ) data.wireframe = this.wireframe;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = this.flatShading;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\t_hslA.h += h; _hslA.s += s; _hslA.l += l;\n\n\t\tthis.setHSL( _hslA.h, _hslA.s, _hslA.l );\n\n\t\treturn this;\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$8 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( this, i );\n\t\t\t\t_vector$8.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\t\tif ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$1 = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$1 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$1.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.min, _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.max, _box$1.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$1.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$1.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$7.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$7.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$7.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = this.getAttribute( 'tangent' ).array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$7.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$7.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$7.x, _vector$7.y, _vector$7.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$5.copy( geometry.boundingSphere );\n\t\t_sphere$5.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$5.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$5, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\t\t\tintersection.uv2 = intersection.uv1; // @deprecated, r152\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tif ( renderer.getRenderTarget() === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\treturn LinearSRGBColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tderivatives: false, // set to use derivatives\n\t\t\tfragDepth: false, // set to use fragment depth values\n\t\t\tdrawBuffers: false, // set to use draw buffers\n\t\t\tshaderTextureLOD: false // set to use shader texture LOD\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst renderTarget = this.renderTarget;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0 );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1 );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2 );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3 );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4 );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5 );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$4.center.set( 0, 0, 0 );\n\t\t_sphere$4.radius = 0.7071067811865476;\n\t\t_sphere$4.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$6 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute.updateRange;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 ) {\n\n\t\t\t// Not using update ranges\n\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = dFdx( surf_pos.xyz );\\n\\t\\tvec3 vSigmaY = dFdy( surf_pos.xyz );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\\tvec3 position;\\n\\tvec3 normal;\\n\\tvec3 viewDir;\\n#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal;\\n#endif\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_v0 0.339\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_v1 0.276\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_v4 0.046\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_v5 0.016\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_v6 0.0038\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"vec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\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}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\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\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\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\";\n\nvar 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\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar 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 vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tanisotropyV /= material.anisotropy;\\n\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec3 sheenSpecular = vec3( 0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometry.normal;\\n\\t\\tvec3 viewDir = geometry.viewDir;\\n\\t\\tvec3 position = geometry.position;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( 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\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar 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\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, vMapUv );\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar 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}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\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 depth, const in float near, const in float far ) {\\n\\treturn depth * ( 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 depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar 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;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar 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\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\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\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar 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, vSpotLightCoord[ 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}\";\n\nvar 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\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tuniform int boneTextureSize;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tfloat j = i * 4.0;\\n\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\ty = dy * ( y + 0.5 );\\n\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\treturn bone;\\n\\t}\\n#endif\";\n\nvar 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\";\n\nvar 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\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\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\";\n\nconst vertex$h = \"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}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst xr = renderer.xr;\n\t\tconst environmentBlendMode = xr.getEnvironmentBlendMode();\n\n\t\tswitch ( environmentBlendMode ) {\n\n\t\t\tcase 'opaque':\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'additive':\n\t\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'alpha-blend':\n\t\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\t\t\t\tforceClear = true;\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, extensions, attributes, capabilities ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );\n\tconst vaoAvailable = capabilities.isWebGL2 || extension !== null;\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tif ( vaoAvailable ) {\n\n\t\t\tconst state = getBindingState( geometry, program, material );\n\n\t\t\tif ( currentState !== state ) {\n\n\t\t\t\tcurrentState = state;\n\t\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t\t}\n\n\t\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\t} else {\n\n\t\t\tconst wireframe = ( material.wireframe === true );\n\n\t\t\tif ( currentState.geometry !== geometry.id ||\n\t\t\t\tcurrentState.program !== program.id ||\n\t\t\t\tcurrentState.wireframe !== wireframe ) {\n\n\t\t\t\tcurrentState.geometry = geometry.id;\n\t\t\t\tcurrentState.program = program.id;\n\t\t\t\tcurrentState.wireframe = wireframe;\n\n\t\t\t\tupdateBuffers = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.createVertexArray();\n\n\t\treturn extension.createVertexArrayOES();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );\n\n\t\treturn extension.bindVertexArrayOES( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );\n\n\t\treturn extension.deleteVertexArrayOES( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tconst extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes (WebGL 2 only)\n\n\t\t\t\t\tconst integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tconst isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\tconst floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );\n\tconst floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tconst maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tdrawBuffers: drawBuffers,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height / 2 );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {\n\n\t\t\t\t\ttexture.needsPMREMUpdate = false;\n\n\t\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cubeUVmaps.has( texture ) ) {\n\n\t\t\t\t\t\treturn cubeUVmaps.get( texture ).texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\tconst renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function ( capabilities ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\n\t\t\t} else {\n\n\t\t\t\tgetExtension( 'WEBGL_depth_texture' );\n\t\t\t\tgetExtension( 'OES_texture_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float_linear' );\n\t\t\t\tgetExtension( 'OES_standard_derivatives' );\n\t\t\t\tgetExtension( 'OES_element_index_uint' );\n\t\t\t\tgetExtension( 'OES_vertex_array_object' );\n\t\t\t\tgetExtension( 'ANGLE_instanced_arrays' );\n\n\t\t\t}\n\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction numericalSort( a, b ) {\n\n\treturn a[ 0 ] - b[ 0 ];\n\n}\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst influencesList = {};\n\tconst morphInfluences = new Float32Array( 8 );\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tconst workInfluences = [];\n\n\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\tworkInfluences[ i ] = [ i, 0 ];\n\n\t}\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tif ( capabilities.isWebGL2 === true ) {\n\n\t\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tlet entry = morphTextures.get( geometry );\n\n\t\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\t\tlet vertexDataCount = 0;\n\n\t\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\t\tlet height = 1;\n\n\t\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t\t}\n\n\t\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\t\ttexture.type = FloatType;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t// fill buffer\n\n\t\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tentry = {\n\t\t\t\t\tcount: morphTargetsCount,\n\t\t\t\t\ttexture: texture,\n\t\t\t\t\tsize: new Vector2( width, height )\n\t\t\t\t};\n\n\t\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\t\tfunction disposeTexture() {\n\n\t\t\t\t\ttexture.dispose();\n\n\t\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\n\t\t} else {\n\n\t\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\t\tconst length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\t\tlet influences = influencesList[ geometry.id ];\n\n\t\t\tif ( influences === undefined || influences.length !== length ) {\n\n\t\t\t\t// initialise list\n\n\t\t\t\tinfluences = [];\n\n\t\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t\t}\n\n\t\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t\t}\n\n\t\t\t// Collect influences\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst influence = influences[ i ];\n\n\t\t\t\tinfluence[ 0 ] = i;\n\t\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tinfluences.sort( absNumericalSort );\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tif ( i < length && influences[ i ][ 1 ] ) {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = influences[ i ][ 0 ];\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = influences[ i ][ 1 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tworkInfluences.sort( numericalSort );\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\tconst morphNormals = geometry.morphAttributes.normal;\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tconst influence = workInfluences[ i ];\n\t\t\t\tconst index = influence[ 0 ];\n\t\t\t\tconst value = influence[ 1 ];\n\n\t\t\t\tif ( index !== Number.MAX_SAFE_INTEGER && value ) {\n\n\t\t\t\t\tif ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphTarget' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\t\treturn [ 'Linear', '( value )' ];\n\t\tcase SRGBColorSpace:\n\t\t\treturn [ 'sRGB', '( value )' ];\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ 'Linear', '( value )' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tconst chunks = [\n\t\t( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map( [\n\t[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154\n\t[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154\n\t[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154\n] );\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\t// check for link errors\n\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\tlet runnable = true;\n\t\tlet haveDiagnostics = true;\n\n\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\trunnable = false;\n\n\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t} else {\n\n\t\t\t\t// default error reporting\n\n\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\tconsole.error(\n\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\tfragmentErrors\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t} else if ( programLog !== '' ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\thaveDiagnostics = false;\n\n\t\t}\n\n\t\tif ( haveDiagnostics ) {\n\n\t\t\tthis.diagnostics = {\n\n\t\t\t\trunnable: runnable,\n\n\t\t\t\tprogramLog: programLog,\n\n\t\t\t\tvertexShader: {\n\n\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t},\n\n\t\t\t\tfragmentShader: {\n\n\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}\n\n\t}\n\n\t// Clean up\n\n\t// Crashes in iOS9 and iOS10. #18402\n\t// gl.detachShader( program, glVertexShader );\n\t// gl.detachShader( program, glFragmentShader );\n\n\tgl.deleteShader( glVertexShader );\n\tgl.deleteShader( glFragmentShader );\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst programs = [];\n\n\tconst IS_WEBGL2 = capabilities.isWebGL2;\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tconst HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;\n\t\tconst HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;\n\t\tconst HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tisWebGL2: IS_WEBGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\t\t\tvertexUv1s: HAS_ATTRIBUTE_UV1,\n\t\t\tvertexUv2s: HAS_ATTRIBUTE_UV2,\n\t\t\tvertexUv3s: HAS_ATTRIBUTE_UV3,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\t\t\tuseLegacyLights: renderer._useLegacyLights,\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n\t\t\textensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n\t\t\textensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n\t\t\textensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n\n\t\t\trendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),\n\t\t\trendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),\n\t\t\trendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.isWebGL2 )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.useLegacyLights )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions, capabilities ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, useLegacyLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t// WebGL 2\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\t// WebGL 1\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions, capabilities ) {\n\n\tconst lights = new WebGLLights( extensions, capabilities );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( useLegacyLights ) {\n\n\t\tlights.setup( lightsArray, useLegacyLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions, capabilities ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = _renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\n\tif ( isWebGL2 ) {\n\n\t\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\t\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t}\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tdrawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t\t} else {\n\n\t\t\t\textensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );\n\n\t\t\t}\n\n\t\t}\n\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = gl.MIN;\n\t\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\t} else {\n\n\t\tconst extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\n\t\tif ( isWebGL2 === true ) {\n\n\t\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\t}\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst maxTextures = capabilities.maxTextures;\n\tconst maxCubemapSize = capabilities.maxCubemapSize;\n\tconst maxTextureSize = capabilities.maxTextureSize;\n\tconst maxSamples = capabilities.maxSamples;\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tconst floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n\n\t\t\t\tconst width = floor( scale * image.width );\n\t\t\t\tconst height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo$1( image ) {\n\n\t\treturn isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image, supportsMips ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn _gl.NEAREST;\n\n\t\t}\n\n\t\treturn _gl.LINEAR;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t\tinfo.memory.textures --;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = texture.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachmentProperties = properties.get( texture[ i ] );\n\n\t\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\t\tinfo.memory.textures --;\n\n\t\t\t\t}\n\n\t\t\t\tproperties.remove( texture[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2\n\t\t\tif ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );\n\n\t\t\tconst needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;\n\t\t\tlet image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst supportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tlet glType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\t// populate depth texture with dummy data\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT;\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tconsole.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// validation checks for WebGL 1\n\n\t\t\t\tif ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedIntType;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_STENCIL;\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tsupportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tlet levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\tif ( isMultisample || useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets !== true ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tif ( capabilities.drawBuffers ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = isMultipleRenderTargets ? texture : [ texture ];\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tconst textures = renderTarget.texture;\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture, supportsMips );\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\tconst invalidationArray = [];\n\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\n\t\t\t// If MRT we need to remove FBO attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tinvalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\tinvalidationArray.push( depthStyle );\n\n\t\t\t\t}\n\n\t\t\t\tconst ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;\n\n\t\t\t\tif ( ignoreDepthValues === false ) {\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\t\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ignoreDepthValues === true ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\tif ( supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( colorSpace === SRGBColorSpace ) {\n\n\t\t\t\tif ( isWebGL2 === false ) {\n\n\t\t\t\t\t// in WebGL 1, try to use EXT_sRGB extension and unsized formats\n\n\t\t\t\t\tif ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {\n\n\t\t\t\t\t\ttexture.format = _SRGBAFormat;\n\n\t\t\t\t\t\t// it's not possible to generate mips in WebGL 1 with this extension\n\n\t\t\t\t\t\ttexture.minFilter = LinearFilter;\n\t\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// slow fallback (CPU decode)\n\n\t\t\t\t\t\timage = ImageUtils.sRGBToLinear( image );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return gl.HALF_FLOAT;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL 1 sRGB fallback\n\n\t\tif ( p === _SRGBAFormat ) {\n\n\t\t\textension = extensions.get( 'EXT_sRGB' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.SRGB_ALPHA_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( colorSpace === SRGBColorSpace ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC1\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC2\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\t\tconst attributes = gl.getContextAttributes();\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tif ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0\n\t\t\t\t\t\t} );\n\n\t\t\t\t\tconst renderTargetProperties = renderer.properties.get( newRenderTarget );\n\t\t\t\t\trenderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tconst children = camera.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tchildren[ i ].updateMatrixWorld( true );\n\n\t\t\t}\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\n\t\t\t// artist-friendly light intensity scaling factor\n\t\t\tconst scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;\n\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\t// partly update the buffer if necessary\n\n\t\t\tif ( hasUniformChanged( uniform, i, cache ) === true ) {\n\n\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\tuniform.__data[ 3 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\tuniform.__data[ 7 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\tuniform.__data[ 11 ] = value.elements[ 0 ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, cache ) {\n\n\t\tconst value = uniform.value;\n\n\t\tif ( cache[ index ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tcache[ index ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tconst tempValues = [];\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\ttempValues.push( values[ i ].clone() );\n\n\t\t\t\t}\n\n\t\t\t\tcache[ index ] = tempValues;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tif ( cache[ index ] !== value ) {\n\n\t\t\t\t\tcache[ index ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tfor ( let i = 0; i < cachedObjects.length; i ++ ) {\n\n\t\t\t\t\tconst cachedObject = cachedObjects[ i ];\n\n\t\t\t\t\tif ( cachedObject.equals( values[ i ] ) === false ) {\n\n\t\t\t\t\t\tcachedObject.copy( values[ i ] );\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\t\tlet chunkOffset = 0; // offset within a single chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\tconst infos = {\n\t\t\t\tboundary: 0, // bytes\n\t\t\t\tstorage: 0 // bytes\n\t\t\t};\n\n\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\tfor ( let j = 0, jl = values.length; j < jl; j ++ ) {\n\n\t\t\t\tconst value = values[ j ];\n\n\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\tinfos.boundary += info.boundary;\n\t\t\t\tinfos.storage += info.storage;\n\n\t\t\t}\n\n\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\tuniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\tuniform.__offset = offset;\n\n\t\t\t//\n\n\t\t\tif ( i > 0 ) {\n\n\t\t\t\tchunkOffset = offset % chunkSize;\n\n\t\t\t\tconst remainingSizeInChunk = chunkSize - chunkOffset;\n\n\t\t\t\t// check for chunk overflow\n\n\t\t\t\tif ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {\n\n\t\t\t\t\t// add padding and adjust offset\n\n\t\t\t\t\toffset += ( chunkSize - chunkOffset );\n\t\t\t\t\tuniform.__offset = offset;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\toffset += infos.storage;\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tchunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' ) {\n\n\t\t\t// float/int\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = true,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis.outputColorSpace = SRGBColorSpace;\n\n\t\t// physical lights\n\n\t\tthis._useLegacyLights = false;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// transmission\n\n\t\tlet _transmissionRenderTarget = null;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector2 = new Vector2();\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextNames, contextAttributes ) {\n\n\t\t\tfor ( let i = 0; i < contextNames.length; i ++ ) {\n\n\t\t\t\tconst contextName = contextNames[ i ];\n\t\t\t\tconst context = canvas.getContext( contextName, contextAttributes );\n\t\t\t\tif ( context !== null ) return context;\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];\n\n\t\t\t\tif ( _this.isWebGL1Renderer === true ) {\n\n\t\t\t\t\tcontextNames.shift();\n\n\t\t\t\t}\n\n\t\t\t\t_gl = getContext( contextNames, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextNames ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );\n\n\t\t\t}\n\n\t\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\t\textensions.init( capabilities );\n\n\t\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions, capabilities );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) bits |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tif ( _transmissionRenderTarget ) {\n\n\t\t\t\t_transmissionRenderTarget.dispose();\n\t\t\t\t_transmissionRenderTarget = null;\n\n\t\t\t}\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tthis.compile = function ( scene, camera ) {\n\n\t\t\tfunction prepare( material, scene, object ) {\n\n\t\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tcurrentRenderState = renderStates.get( scene );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepare( material2, scene, object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepare( material, scene, object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\n\t\t\t//\n\n\t\t\tbackground.render( currentRenderList, scene );\n\n\t\t\t// render scene\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector3\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst isWebGL2 = capabilities.isWebGL2;\n\n\t\t\tif ( _transmissionRenderTarget === null ) {\n\n\t\t\t\t_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: ( isWebGL2 ) ? 4 : 0\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\t_this.getDrawingBufferSize( _vector2 );\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );\n\n\t\t\t} else {\n\n\t\t\t\t_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( _transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = renderItem.material;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tconst progUniforms = program.getUniforms();\n\t\t\tconst uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms );\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = uniformsList;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t\t// load material specific uniforms\n\t\t\t\t// (shader material also gets them for the sake of genericity)\n\n\t\t\t\tif ( material.isShaderMaterial ||\n\t\t\t\t\tmaterial.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.envMap ) {\n\n\t\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\t\tuCamPos.setValue( _gl,\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ||\n\t\t\t\t\tmaterial.isShadowMaterial ||\n\t\t\t\t\tobject.isSkinnedMesh ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );\n\n\t\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\tif ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );\n\n\t\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t\t! halfFloatSupportedByExt ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = srcTexture.image.width;\n\t\t\tconst height = srcTexture.image.height;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tif ( _this.isWebGL1Renderer ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst width = sourceBox.max.x - sourceBox.min.x + 1;\n\t\t\tconst height = sourceBox.max.y - sourceBox.min.y + 1;\n\t\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget physicallyCorrectLights() { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\treturn ! this.useLegacyLights;\n\n\t}\n\n\tset physicallyCorrectLights( value ) { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\tthis.useLegacyLights = ! value;\n\n\t}\n\n\tget outputEncoding() { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\treturn this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset outputEncoding( encoding ) { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\tthis.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\n\t}\n\n\tget useLegacyLights() { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\treturn this._useLegacyLights;\n\n\t}\n\n\tset useLegacyLights( value ) { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\tthis._useLegacyLights = value;\n\n\t}\n\n}\n\nclass WebGL1Renderer extends WebGLRenderer {}\n\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$5 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = ( material !== undefined ) ? material : new SpriteMaterial();\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = 'attached';\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\t_vertex.fromBufferAttribute( positionAttribute, i );\n\t\t\tthis.applyBoneTransform( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\t_vertex.fromBufferAttribute( positionAttribute, i );\n\t\t\tthis.applyBoneTransform( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === 'attached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === 'detached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n\tboneTransform( index, vector ) { // @deprecated, r151\n\n\t\tconsole.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );\n\t\treturn this.applyBoneTransform( index, vector );\n\n\t}\n\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\t\tthis.boneTextureSize = 0;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = ceilPowerOfTwo( size );\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\t\tthis.boneTextureSize = size;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$2.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$2.copy( this.boundingSphere );\n\t\t_sphere$2.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tthis.curves.push( new LineCurve( endPoint, startPoint ) );\n\n\t\t}\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// same as Array.prototype.slice, but also works on typed arrays\nfunction arraySlice( array, from, to ) {\n\n\tif ( isTypedArray( array ) ) {\n\n\t\t// in ios9 array.subarray(from, undefined) will return empty array\n\t\t// but array.subarray(from) or array.subarray(from, len) is correct\n\t\treturn new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );\n\n\t}\n\n\treturn array.slice( from, to );\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = arraySlice( interpolant.resultBuffer, startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tarraySlice: arraySlice,\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = arraySlice( times, from, to );\n\t\t\tthis.values = arraySlice( this.values, from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = arraySlice( this.times ),\n\t\t\tvalues = arraySlice( this.values ),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = arraySlice( times, 0, writeIndex );\n\t\t\tthis.values = arraySlice( values, 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = arraySlice( this.times, 0 );\n\t\tconst values = arraySlice( this.values, 0 );\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' ) || response.headers.get( 'X-File-Size' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t} else if ( texData.encoding !== undefined ) { // @deprecated, r152\n\n\t\t\t\ttexture.encoding = texData.encoding;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== 1 ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tif ( attribute.updateRange !== undefined ) {\n\n\t\t\t\tbufferAttribute.updateRange.offset = attribute.updateRange.offset;\n\t\t\t\tbufferAttribute.updateRange.count = attribute.updateRange.count;\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tfetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t}, handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nclass HemisphereLightProbe extends LightProbe {\n\n\tconstructor( skyColor, groundColor, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isHemisphereLightProbe = true;\n\n\t\tconst color1 = new Color().set( skyColor );\n\t\tconst color2 = new Color().set( groundColor );\n\n\t\tconst sky = new Vector3( color1.r, color1.g, color1.b );\n\t\tconst ground = new Vector3( color2.r, color2.g, color2.b );\n\n\t\t// without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n\t\tconst c0 = Math.sqrt( Math.PI );\n\t\tconst c1 = c0 * Math.sqrt( 0.75 );\n\n\t\tthis.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 );\n\t\tthis.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 );\n\n\t}\n\n}\n\nclass AmbientLightProbe extends LightProbe {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isAmbientLightProbe = true;\n\n\t\tconst color1 = new Color().set( color );\n\n\t\t// without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n\t\tthis.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) );\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tthis.uniforms.push( uniformsSource[ i ].clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\n\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = 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 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = 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 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, sRGBEncoding };\n","import {\n\tEventDispatcher,\n\tMOUSE,\n\tQuaternion,\n\tSpherical,\n\tTOUCH,\n\tVector2,\n\tVector3,\n\tPlane,\n\tRay,\n\tMathUtils\n} from 'three';\n\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nconst _changeEvent = { type: 'change' };\nconst _startEvent = { type: 'start' };\nconst _endEvent = { type: 'end' };\nconst _ray = new Ray();\nconst _plane = new Plane();\nconst TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD );\n\nclass OrbitControls extends EventDispatcher {\n\n\tconstructor( object, domElement ) {\n\n\t\tsuper();\n\n\t\tthis.object = object;\n\t\tthis.domElement = domElement;\n\t\tthis.domElement.style.touchAction = 'none'; // disable touch scroll\n\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new Vector3();\n\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n\t\tthis.minAzimuthAngle = - Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.05;\n\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.panSpeed = 1.0;\n\t\tthis.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n\t\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\t\tthis.zoomToCursor = false;\n\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' };\n\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };\n\n\t\t// Touch fingers\n\t\tthis.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\n\t\t// the target DOM element for key events\n\t\tthis._domElementKeyEvents = null;\n\n\t\t//\n\t\t// public methods\n\t\t//\n\n\t\tthis.getPolarAngle = function () {\n\n\t\t\treturn spherical.phi;\n\n\t\t};\n\n\t\tthis.getAzimuthalAngle = function () {\n\n\t\t\treturn spherical.theta;\n\n\t\t};\n\n\t\tthis.getDistance = function () {\n\n\t\t\treturn this.object.position.distanceTo( this.target );\n\n\t\t};\n\n\t\tthis.listenToKeyEvents = function ( domElement ) {\n\n\t\t\tdomElement.addEventListener( 'keydown', onKeyDown );\n\t\t\tthis._domElementKeyEvents = domElement;\n\n\t\t};\n\n\t\tthis.stopListenToKeyEvents = function () {\n\n\t\t\tthis._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );\n\t\t\tthis._domElementKeyEvents = null;\n\n\t\t};\n\n\t\tthis.saveState = function () {\n\n\t\t\tscope.target0.copy( scope.target );\n\t\t\tscope.position0.copy( scope.object.position );\n\t\t\tscope.zoom0 = scope.object.zoom;\n\n\t\t};\n\n\t\tthis.reset = function () {\n\n\t\t\tscope.target.copy( scope.target0 );\n\t\t\tscope.object.position.copy( scope.position0 );\n\t\t\tscope.object.zoom = scope.zoom0;\n\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent( _changeEvent );\n\n\t\t\tscope.update();\n\n\t\t\tstate = STATE.NONE;\n\n\t\t};\n\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = function () {\n\n\t\t\tconst offset = new Vector3();\n\n\t\t\t// so camera.up is the orbit axis\n\t\t\tconst quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) );\n\t\t\tconst quatInverse = quat.clone().invert();\n\n\t\t\tconst lastPosition = new Vector3();\n\t\t\tconst lastQuaternion = new Quaternion();\n\t\t\tconst lastTargetPosition = new Vector3();\n\n\t\t\tconst twoPI = 2 * Math.PI;\n\n\t\t\treturn function update() {\n\n\t\t\t\tconst position = scope.object.position;\n\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t\t// angle from z-axis around y-axis\n\t\t\t\tspherical.setFromVector3( offset );\n\n\t\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t\t}\n\n\t\t\t\tif ( scope.enableDamping ) {\n\n\t\t\t\t\tspherical.theta += sphericalDelta.theta * scope.dampingFactor;\n\t\t\t\t\tspherical.phi += sphericalDelta.phi * scope.dampingFactor;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tspherical.theta += sphericalDelta.theta;\n\t\t\t\t\tspherical.phi += sphericalDelta.phi;\n\n\t\t\t\t}\n\n\t\t\t\t// restrict theta to be between desired limits\n\n\t\t\t\tlet min = scope.minAzimuthAngle;\n\t\t\t\tlet max = scope.maxAzimuthAngle;\n\n\t\t\t\tif ( isFinite( min ) && isFinite( max ) ) {\n\n\t\t\t\t\tif ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;\n\n\t\t\t\t\tif ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;\n\n\t\t\t\t\tif ( min <= max ) {\n\n\t\t\t\t\t\tspherical.theta = Math.max( min, Math.min( max, spherical.theta ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tspherical.theta = ( spherical.theta > ( min + max ) / 2 ) ?\n\t\t\t\t\t\t\tMath.max( min, spherical.theta ) :\n\t\t\t\t\t\t\tMath.min( max, spherical.theta );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tspherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );\n\n\t\t\t\tspherical.makeSafe();\n\n\n\t\t\t\t// move target to panned location\n\n\t\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\t\tscope.target.addScaledVector( panOffset, scope.dampingFactor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tscope.target.add( panOffset );\n\n\t\t\t\t}\n\n\t\t\t\t// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera\n\t\t\t\t// we adjust zoom later in these cases\n\t\t\t\tif ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\tspherical.radius = clampDistance( spherical.radius );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tspherical.radius = clampDistance( spherical.radius * scale );\n\n\t\t\t\t}\n\n\n\t\t\t\toffset.setFromSpherical( spherical );\n\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\t\tsphericalDelta.theta *= ( 1 - scope.dampingFactor );\n\t\t\t\t\tsphericalDelta.phi *= ( 1 - scope.dampingFactor );\n\n\t\t\t\t\tpanOffset.multiplyScalar( 1 - scope.dampingFactor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsphericalDelta.set( 0, 0, 0 );\n\n\t\t\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t// adjust camera position\n\t\t\t\tlet zoomChanged = false;\n\t\t\t\tif ( scope.zoomToCursor && performCursorZoom ) {\n\n\t\t\t\t\tlet newRadius = null;\n\t\t\t\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\t\t\t\t// move the camera down the pointer ray\n\t\t\t\t\t\t// this method avoids floating point error\n\t\t\t\t\t\tconst prevRadius = offset.length();\n\t\t\t\t\t\tnewRadius = clampDistance( prevRadius * scale );\n\n\t\t\t\t\t\tconst radiusDelta = prevRadius - newRadius;\n\t\t\t\t\t\tscope.object.position.addScaledVector( dollyDirection, radiusDelta );\n\t\t\t\t\t\tscope.object.updateMatrixWorld();\n\n\t\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\t\t// adjust the ortho camera position based on zoom changes\n\t\t\t\t\t\tconst mouseBefore = new Vector3( mouse.x, mouse.y, 0 );\n\t\t\t\t\t\tmouseBefore.unproject( scope.object );\n\n\t\t\t\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );\n\t\t\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\t\t\tzoomChanged = true;\n\n\t\t\t\t\t\tconst mouseAfter = new Vector3( mouse.x, mouse.y, 0 );\n\t\t\t\t\t\tmouseAfter.unproject( scope.object );\n\n\t\t\t\t\t\tscope.object.position.sub( mouseAfter ).add( mouseBefore );\n\t\t\t\t\t\tscope.object.updateMatrixWorld();\n\n\t\t\t\t\t\tnewRadius = offset.length();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' );\n\t\t\t\t\t\tscope.zoomToCursor = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// handle the placement of the target\n\t\t\t\t\tif ( newRadius !== null ) {\n\n\t\t\t\t\t\tif ( this.screenSpacePanning ) {\n\n\t\t\t\t\t\t\t// position the orbit target in front of the new camera position\n\t\t\t\t\t\t\tscope.target.set( 0, 0, - 1 )\n\t\t\t\t\t\t\t\t.transformDirection( scope.object.matrix )\n\t\t\t\t\t\t\t\t.multiplyScalar( newRadius )\n\t\t\t\t\t\t\t\t.add( scope.object.position );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// get the ray and translation plane to compute target\n\t\t\t\t\t\t\t_ray.origin.copy( scope.object.position );\n\t\t\t\t\t\t\t_ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix );\n\n\t\t\t\t\t\t\t// if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid\n\t\t\t\t\t\t\t// extremely large values\n\t\t\t\t\t\t\tif ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) {\n\n\t\t\t\t\t\t\t\tobject.lookAt( scope.target );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t_plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target );\n\t\t\t\t\t\t\t\t_ray.intersectPlane( _plane, scope.target );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );\n\t\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\t\tzoomChanged = true;\n\n\t\t\t\t}\n\n\t\t\t\tscale = 1;\n\t\t\t\tperformCursorZoom = false;\n\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\t\tif ( zoomChanged ||\n\t\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||\n\t\t\t\t\tlastTargetPosition.distanceToSquared( scope.target ) > 0 ) {\n\n\t\t\t\t\tscope.dispatchEvent( _changeEvent );\n\n\t\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\t\tlastTargetPosition.copy( scope.target );\n\n\t\t\t\t\tzoomChanged = false;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t};\n\n\t\t}();\n\n\t\tthis.dispose = function () {\n\n\t\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu );\n\n\t\t\tscope.domElement.removeEventListener( 'pointerdown', onPointerDown );\n\t\t\tscope.domElement.removeEventListener( 'pointercancel', onPointerUp );\n\t\t\tscope.domElement.removeEventListener( 'wheel', onMouseWheel );\n\n\t\t\tscope.domElement.removeEventListener( 'pointermove', onPointerMove );\n\t\t\tscope.domElement.removeEventListener( 'pointerup', onPointerUp );\n\n\n\t\t\tif ( scope._domElementKeyEvents !== null ) {\n\n\t\t\t\tscope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );\n\t\t\t\tscope._domElementKeyEvents = null;\n\n\t\t\t}\n\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t\t};\n\n\t\t//\n\t\t// internals\n\t\t//\n\n\t\tconst scope = this;\n\n\t\tconst STATE = {\n\t\t\tNONE: - 1,\n\t\t\tROTATE: 0,\n\t\t\tDOLLY: 1,\n\t\t\tPAN: 2,\n\t\t\tTOUCH_ROTATE: 3,\n\t\t\tTOUCH_PAN: 4,\n\t\t\tTOUCH_DOLLY_PAN: 5,\n\t\t\tTOUCH_DOLLY_ROTATE: 6\n\t\t};\n\n\t\tlet state = STATE.NONE;\n\n\t\tconst EPS = 0.000001;\n\n\t\t// current position in spherical coordinates\n\t\tconst spherical = new Spherical();\n\t\tconst sphericalDelta = new Spherical();\n\n\t\tlet scale = 1;\n\t\tconst panOffset = new Vector3();\n\n\t\tconst rotateStart = new Vector2();\n\t\tconst rotateEnd = new Vector2();\n\t\tconst rotateDelta = new Vector2();\n\n\t\tconst panStart = new Vector2();\n\t\tconst panEnd = new Vector2();\n\t\tconst panDelta = new Vector2();\n\n\t\tconst dollyStart = new Vector2();\n\t\tconst dollyEnd = new Vector2();\n\t\tconst dollyDelta = new Vector2();\n\n\t\tconst dollyDirection = new Vector3();\n\t\tconst mouse = new Vector2();\n\t\tlet performCursorZoom = false;\n\n\t\tconst pointers = [];\n\t\tconst pointerPositions = {};\n\n\t\tfunction getAutoRotationAngle() {\n\n\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t\t}\n\n\t\tfunction getZoomScale() {\n\n\t\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t\t}\n\n\t\tfunction rotateLeft( angle ) {\n\n\t\t\tsphericalDelta.theta -= angle;\n\n\t\t}\n\n\t\tfunction rotateUp( angle ) {\n\n\t\t\tsphericalDelta.phi -= angle;\n\n\t\t}\n\n\t\tconst panLeft = function () {\n\n\t\t\tconst v = new Vector3();\n\n\t\t\treturn function panLeft( distance, objectMatrix ) {\n\n\t\t\t\tv.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix\n\t\t\t\tv.multiplyScalar( - distance );\n\n\t\t\t\tpanOffset.add( v );\n\n\t\t\t};\n\n\t\t}();\n\n\t\tconst panUp = function () {\n\n\t\t\tconst v = new Vector3();\n\n\t\t\treturn function panUp( distance, objectMatrix ) {\n\n\t\t\t\tif ( scope.screenSpacePanning === true ) {\n\n\t\t\t\t\tv.setFromMatrixColumn( objectMatrix, 1 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tv.setFromMatrixColumn( objectMatrix, 0 );\n\t\t\t\t\tv.crossVectors( scope.object.up, v );\n\n\t\t\t\t}\n\n\t\t\t\tv.multiplyScalar( distance );\n\n\t\t\t\tpanOffset.add( v );\n\n\t\t\t};\n\n\t\t}();\n\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tconst pan = function () {\n\n\t\t\tconst offset = new Vector3();\n\n\t\t\treturn function pan( deltaX, deltaY ) {\n\n\t\t\t\tconst element = scope.domElement;\n\n\t\t\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\t\t\t// perspective\n\t\t\t\t\tconst position = scope.object.position;\n\t\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\t\tlet targetDistance = offset.length();\n\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t\t// we use only clientHeight here so aspect ratio does not distort speed\n\t\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );\n\t\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\t\tscope.enablePan = false;\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}();\n\n\t\tfunction dollyOut( dollyScale ) {\n\n\t\t\tif ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {\n\n\t\t\t\tscale /= dollyScale;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\t\tscope.enableZoom = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction dollyIn( dollyScale ) {\n\n\t\t\tif ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {\n\n\t\t\t\tscale *= dollyScale;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\t\tscope.enableZoom = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction updateMouseParameters( event ) {\n\n\t\t\tif ( ! scope.zoomToCursor ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tperformCursorZoom = true;\n\n\t\t\tconst rect = scope.domElement.getBoundingClientRect();\n\t\t\tconst x = event.clientX - rect.left;\n\t\t\tconst y = event.clientY - rect.top;\n\t\t\tconst w = rect.width;\n\t\t\tconst h = rect.height;\n\n\t\t\tmouse.x = ( x / w ) * 2 - 1;\n\t\t\tmouse.y = - ( y / h ) * 2 + 1;\n\n\t\t\tdollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();\n\n\t\t}\n\n\t\tfunction clampDistance( dist ) {\n\n\t\t\treturn Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) );\n\n\t\t}\n\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\n\t\tfunction handleMouseDownRotate( event ) {\n\n\t\t\trotateStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseDownDolly( event ) {\n\n\t\t\tupdateMouseParameters( event );\n\t\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseDownPan( event ) {\n\n\t\t\tpanStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseMoveRotate( event ) {\n\n\t\t\trotateEnd.set( event.clientX, event.clientY );\n\n\t\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\t\tconst element = scope.domElement;\n\n\t\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\t\trotateStart.copy( rotateEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseMoveDolly( event ) {\n\n\t\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\t\tdollyOut( getZoomScale() );\n\n\t\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\t\tdollyIn( getZoomScale() );\n\n\t\t\t}\n\n\t\t\tdollyStart.copy( dollyEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseMovePan( event ) {\n\n\t\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\t\tpan( panDelta.x, panDelta.y );\n\n\t\t\tpanStart.copy( panEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseWheel( event ) {\n\n\t\t\tupdateMouseParameters( event );\n\n\t\t\tif ( event.deltaY < 0 ) {\n\n\t\t\t\tdollyIn( getZoomScale() );\n\n\t\t\t} else if ( event.deltaY > 0 ) {\n\n\t\t\t\tdollyOut( getZoomScale() );\n\n\t\t\t}\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleKeyDown( event ) {\n\n\t\t\tlet needsUpdate = false;\n\n\t\t\tswitch ( event.code ) {\n\n\t\t\t\tcase scope.keys.UP:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateUp( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( 0, scope.keyPanSpeed );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.BOTTOM:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateUp( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.LEFT:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateLeft( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.RIGHT:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateLeft( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( needsUpdate ) {\n\n\t\t\t\t// prevent the browser from scrolling on cursor keys\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tscope.update();\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tfunction handleTouchStartRotate() {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\trotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );\n\t\t\t\tconst y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );\n\n\t\t\t\trotateStart.set( x, y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction handleTouchStartPan() {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\tpanStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );\n\t\t\t\tconst y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );\n\n\t\t\t\tpanStart.set( x, y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction handleTouchStartDolly() {\n\n\t\t\tconst dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;\n\t\t\tconst dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;\n\n\t\t\tconst distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\t\tdollyStart.set( 0, distance );\n\n\t\t}\n\n\t\tfunction handleTouchStartDollyPan() {\n\n\t\t\tif ( scope.enableZoom ) handleTouchStartDolly();\n\n\t\t\tif ( scope.enablePan ) handleTouchStartPan();\n\n\t\t}\n\n\t\tfunction handleTouchStartDollyRotate() {\n\n\t\t\tif ( scope.enableZoom ) handleTouchStartDolly();\n\n\t\t\tif ( scope.enableRotate ) handleTouchStartRotate();\n\n\t\t}\n\n\t\tfunction handleTouchMoveRotate( event ) {\n\n\t\t\tif ( pointers.length == 1 ) {\n\n\t\t\t\trotateEnd.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\trotateEnd.set( x, y );\n\n\t\t\t}\n\n\t\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\t\tconst element = scope.domElement;\n\n\t\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\t\trotateStart.copy( rotateEnd );\n\n\t\t}\n\n\t\tfunction handleTouchMovePan( event ) {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\tpanEnd.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\tpanEnd.set( x, y );\n\n\t\t\t}\n\n\t\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\t\tpan( panDelta.x, panDelta.y );\n\n\t\t\tpanStart.copy( panEnd );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDolly( event ) {\n\n\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\tconst dx = event.pageX - position.x;\n\t\t\tconst dy = event.pageY - position.y;\n\n\t\t\tconst distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\t\tdollyEnd.set( 0, distance );\n\n\t\t\tdollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );\n\n\t\t\tdollyOut( dollyDelta.y );\n\n\t\t\tdollyStart.copy( dollyEnd );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDollyPan( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\t\tif ( scope.enablePan ) handleTouchMovePan( event );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDollyRotate( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\t\tif ( scope.enableRotate ) handleTouchMoveRotate( event );\n\n\t\t}\n\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\n\t\tfunction onPointerDown( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tif ( pointers.length === 0 ) {\n\n\t\t\t\tscope.domElement.setPointerCapture( event.pointerId );\n\n\t\t\t\tscope.domElement.addEventListener( 'pointermove', onPointerMove );\n\t\t\t\tscope.domElement.addEventListener( 'pointerup', onPointerUp );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\taddPointer( event );\n\n\t\t\tif ( event.pointerType === 'touch' ) {\n\n\t\t\t\tonTouchStart( event );\n\n\t\t\t} else {\n\n\t\t\t\tonMouseDown( event );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onPointerMove( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tif ( event.pointerType === 'touch' ) {\n\n\t\t\t\tonTouchMove( event );\n\n\t\t\t} else {\n\n\t\t\t\tonMouseMove( event );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onPointerUp( event ) {\n\n\t\t\tremovePointer( event );\n\n\t\t\tif ( pointers.length === 0 ) {\n\n\t\t\t\tscope.domElement.releasePointerCapture( event.pointerId );\n\n\t\t\t\tscope.domElement.removeEventListener( 'pointermove', onPointerMove );\n\t\t\t\tscope.domElement.removeEventListener( 'pointerup', onPointerUp );\n\n\t\t\t}\n\n\t\t\tscope.dispatchEvent( _endEvent );\n\n\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tfunction onMouseDown( event ) {\n\n\t\t\tlet mouseAction;\n\n\t\t\tswitch ( event.button ) {\n\n\t\t\t\tcase 0:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.LEFT;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.MIDDLE;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.RIGHT;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tmouseAction = - 1;\n\n\t\t\t}\n\n\t\t\tswitch ( mouseAction ) {\n\n\t\t\t\tcase MOUSE.DOLLY:\n\n\t\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\t\thandleMouseDownDolly( event );\n\n\t\t\t\t\tstate = STATE.DOLLY;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MOUSE.ROTATE:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MOUSE.PAN:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t\tif ( state !== STATE.NONE ) {\n\n\t\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onMouseMove( event ) {\n\n\t\t\tswitch ( state ) {\n\n\t\t\t\tcase STATE.ROTATE:\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleMouseMoveRotate( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.DOLLY:\n\n\t\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\t\thandleMouseMoveDolly( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.PAN:\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleMouseMovePan( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onMouseWheel( event ) {\n\n\t\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\t\tevent.preventDefault();\n\n\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\thandleMouseWheel( event );\n\n\t\t\tscope.dispatchEvent( _endEvent );\n\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\n\t\t\tif ( scope.enabled === false || scope.enablePan === false ) return;\n\n\t\t\thandleKeyDown( event );\n\n\t\t}\n\n\t\tfunction onTouchStart( event ) {\n\n\t\t\ttrackPointer( event );\n\n\t\t\tswitch ( pointers.length ) {\n\n\t\t\t\tcase 1:\n\n\t\t\t\t\tswitch ( scope.touches.ONE ) {\n\n\t\t\t\t\t\tcase TOUCH.ROTATE:\n\n\t\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartRotate();\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase TOUCH.PAN:\n\n\t\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartPan();\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\n\t\t\t\t\tswitch ( scope.touches.TWO ) {\n\n\t\t\t\t\t\tcase TOUCH.DOLLY_PAN:\n\n\t\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartDollyPan();\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_PAN;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase TOUCH.DOLLY_ROTATE:\n\n\t\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartDollyRotate();\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_ROTATE;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t\tif ( state !== STATE.NONE ) {\n\n\t\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onTouchMove( event ) {\n\n\t\t\ttrackPointer( event );\n\n\t\t\tswitch ( state ) {\n\n\t\t\t\tcase STATE.TOUCH_ROTATE:\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_PAN:\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_DOLLY_PAN:\n\n\t\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\t\thandleTouchMoveDollyPan( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_DOLLY_ROTATE:\n\n\t\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleTouchMoveDollyRotate( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onContextMenu( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tevent.preventDefault();\n\n\t\t}\n\n\t\tfunction addPointer( event ) {\n\n\t\t\tpointers.push( event );\n\n\t\t}\n\n\t\tfunction removePointer( event ) {\n\n\t\t\tdelete pointerPositions[ event.pointerId ];\n\n\t\t\tfor ( let i = 0; i < pointers.length; i ++ ) {\n\n\t\t\t\tif ( pointers[ i ].pointerId == event.pointerId ) {\n\n\t\t\t\t\tpointers.splice( i, 1 );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction trackPointer( event ) {\n\n\t\t\tlet position = pointerPositions[ event.pointerId ];\n\n\t\t\tif ( position === undefined ) {\n\n\t\t\t\tposition = new Vector2();\n\t\t\t\tpointerPositions[ event.pointerId ] = position;\n\n\t\t\t}\n\n\t\t\tposition.set( event.pageX, event.pageY );\n\n\t\t}\n\n\t\tfunction getSecondPointerPosition( event ) {\n\n\t\t\tconst pointer = ( event.pointerId === pointers[ 0 ].pointerId ) ? pointers[ 1 ] : pointers[ 0 ];\n\n\t\t\treturn pointerPositions[ pointer.pointerId ];\n\n\t\t}\n\n\t\t//\n\n\t\tscope.domElement.addEventListener( 'contextmenu', onContextMenu );\n\n\t\tscope.domElement.addEventListener( 'pointerdown', onPointerDown );\n\t\tscope.domElement.addEventListener( 'pointercancel', onPointerUp );\n\t\tscope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );\n\n\t\t// force an update at start\n\n\t\tthis.update();\n\n\t}\n\n}\n\nexport { OrbitControls };\n","import {\n\tBufferAttribute,\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tInstancedBufferAttribute,\n\tInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tTriangleFanDrawMode,\n\tTriangleStripDrawMode,\n\tTrianglesDrawMode,\n\tVector3,\n} from 'three';\n\nfunction computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {\n\n\tif ( ! MikkTSpace || ! MikkTSpace.isReady ) {\n\n\t\tthrow new Error( 'BufferGeometryUtils: Initialized MikkTSpace library required.' );\n\n\t}\n\n\tif ( ! geometry.hasAttribute( 'position' ) || ! geometry.hasAttribute( 'normal' ) || ! geometry.hasAttribute( 'uv' ) ) {\n\n\t\tthrow new Error( 'BufferGeometryUtils: Tangents require \"position\", \"normal\", and \"uv\" attributes.' );\n\n\t}\n\n\tfunction getAttributeArray( attribute ) {\n\n\t\tif ( attribute.normalized || attribute.isInterleavedBufferAttribute ) {\n\n\t\t\tconst dstArray = new Float32Array( attribute.count * attribute.itemSize );\n\n\t\t\tfor ( let i = 0, j = 0; i < attribute.count; i ++ ) {\n\n\t\t\t\tdstArray[ j ++ ] = attribute.getX( i );\n\t\t\t\tdstArray[ j ++ ] = attribute.getY( i );\n\n\t\t\t\tif ( attribute.itemSize > 2 ) {\n\n\t\t\t\t\tdstArray[ j ++ ] = attribute.getZ( i );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn dstArray;\n\n\t\t}\n\n\t\tif ( attribute.array instanceof Float32Array ) {\n\n\t\t\treturn attribute.array;\n\n\t\t}\n\n\t\treturn new Float32Array( attribute.array );\n\n\t}\n\n\t// MikkTSpace algorithm requires non-indexed input.\n\n\tconst _geometry = geometry.index ? geometry.toNonIndexed() : geometry;\n\n\t// Compute vertex tangents.\n\n\tconst tangents = MikkTSpace.generateTangents(\n\n\t\tgetAttributeArray( _geometry.attributes.position ),\n\t\tgetAttributeArray( _geometry.attributes.normal ),\n\t\tgetAttributeArray( _geometry.attributes.uv )\n\n\t);\n\n\t// Texture coordinate convention of glTF differs from the apparent\n\t// default of the MikkTSpace library; .w component must be flipped.\n\n\tif ( negateSign ) {\n\n\t\tfor ( let i = 3; i < tangents.length; i += 4 ) {\n\n\t\t\ttangents[ i ] *= - 1;\n\n\t\t}\n\n\t}\n\n\t//\n\n\t_geometry.setAttribute( 'tangent', new BufferAttribute( tangents, 4 ) );\n\n\tif ( geometry !== _geometry ) {\n\n\t\tgeometry.copy( _geometry );\n\n\t}\n\n\treturn geometry;\n\n}\n\n/**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */\nfunction mergeGeometries( geometries, useGroups = false ) {\n\n\tconst isIndexed = geometries[ 0 ].index !== null;\n\n\tconst attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );\n\tconst morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );\n\n\tconst attributes = {};\n\tconst morphAttributes = {};\n\n\tconst morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;\n\n\tconst mergedGeometry = new BufferGeometry();\n\n\tlet offset = 0;\n\n\tfor ( let i = 0; i < geometries.length; ++ i ) {\n\n\t\tconst geometry = geometries[ i ];\n\t\tlet attributesCount = 0;\n\n\t\t// ensure that all geometries are indexed, or none\n\n\t\tif ( isIndexed !== ( geometry.index !== null ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// gather attributes, exit early if they're different\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tif ( ! attributesUsed.has( name ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure \"' + name + '\" attribute exists among all geometries, or in none of them.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tif ( attributes[ name ] === undefined ) attributes[ name ] = [];\n\n\t\t\tattributes[ name ].push( geometry.attributes[ name ] );\n\n\t\t\tattributesCount ++;\n\n\t\t}\n\n\t\t// ensure geometries have the same number of attributes\n\n\t\tif ( attributesCount !== attributesUsed.size ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// gather morph attributes, exit early if they're different\n\n\t\tif ( morphTargetsRelative !== geometry.morphTargetsRelative ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tif ( ! morphAttributesUsed.has( name ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tif ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];\n\n\t\t\tmorphAttributes[ name ].push( geometry.morphAttributes[ name ] );\n\n\t\t}\n\n\t\tif ( useGroups ) {\n\n\t\t\tlet count;\n\n\t\t\tif ( isIndexed ) {\n\n\t\t\t\tcount = geometry.index.count;\n\n\t\t\t} else if ( geometry.attributes.position !== undefined ) {\n\n\t\t\t\tcount = geometry.attributes.position.count;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tmergedGeometry.addGroup( offset, count, i );\n\n\t\t\toffset += count;\n\n\t\t}\n\n\t}\n\n\t// merge indices\n\n\tif ( isIndexed ) {\n\n\t\tlet indexOffset = 0;\n\t\tconst mergedIndex = [];\n\n\t\tfor ( let i = 0; i < geometries.length; ++ i ) {\n\n\t\t\tconst index = geometries[ i ].index;\n\n\t\t\tfor ( let j = 0; j < index.count; ++ j ) {\n\n\t\t\t\tmergedIndex.push( index.getX( j ) + indexOffset );\n\n\t\t\t}\n\n\t\t\tindexOffset += geometries[ i ].attributes.position.count;\n\n\t\t}\n\n\t\tmergedGeometry.setIndex( mergedIndex );\n\n\t}\n\n\t// merge attributes\n\n\tfor ( const name in attributes ) {\n\n\t\tconst mergedAttribute = mergeAttributes( attributes[ name ] );\n\n\t\tif ( ! mergedAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + name + ' attribute.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tmergedGeometry.setAttribute( name, mergedAttribute );\n\n\t}\n\n\t// merge morph attributes\n\n\tfor ( const name in morphAttributes ) {\n\n\t\tconst numMorphTargets = morphAttributes[ name ][ 0 ].length;\n\n\t\tif ( numMorphTargets === 0 ) break;\n\n\t\tmergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n\t\tmergedGeometry.morphAttributes[ name ] = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; ++ i ) {\n\n\t\t\tconst morphAttributesToMerge = [];\n\n\t\t\tfor ( let j = 0; j < morphAttributes[ name ].length; ++ j ) {\n\n\t\t\t\tmorphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );\n\n\t\t\t}\n\n\t\t\tconst mergedMorphAttribute = mergeAttributes( morphAttributesToMerge );\n\n\t\t\tif ( ! mergedMorphAttribute ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\tmergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );\n\n\t\t}\n\n\t}\n\n\treturn mergedGeometry;\n\n}\n\n/**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */\nfunction mergeAttributes( attributes ) {\n\n\tlet TypedArray;\n\tlet itemSize;\n\tlet normalized;\n\tlet gpuType = - 1;\n\tlet arrayLength = 0;\n\n\tfor ( let i = 0; i < attributes.length; ++ i ) {\n\n\t\tconst attribute = attributes[ i ];\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( TypedArray === undefined ) TypedArray = attribute.array.constructor;\n\t\tif ( TypedArray !== attribute.array.constructor ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( itemSize === undefined ) itemSize = attribute.itemSize;\n\t\tif ( itemSize !== attribute.itemSize ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( normalized === undefined ) normalized = attribute.normalized;\n\t\tif ( normalized !== attribute.normalized ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tif ( gpuType === - 1 ) gpuType = attribute.gpuType;\n\t\tif ( gpuType !== attribute.gpuType ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tarrayLength += attribute.array.length;\n\n\t}\n\n\tconst array = new TypedArray( arrayLength );\n\tlet offset = 0;\n\n\tfor ( let i = 0; i < attributes.length; ++ i ) {\n\n\t\tarray.set( attributes[ i ].array, offset );\n\n\t\toffset += attributes[ i ].array.length;\n\n\t}\n\n\tconst result = new BufferAttribute( array, itemSize, normalized );\n\tif ( gpuType !== undefined ) {\n\n\t\tresult.gpuType = gpuType;\n\n\t}\n\n\treturn result;\n\n}\n\n/**\n * @param {BufferAttribute}\n * @return {BufferAttribute}\n */\nexport function deepCloneAttribute( attribute ) {\n\n\tif ( attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute ) {\n\n\t\treturn deinterleaveAttribute( attribute );\n\n\t}\n\n\tif ( attribute.isInstancedBufferAttribute ) {\n\n\t\treturn new InstancedBufferAttribute().copy( attribute );\n\n\t}\n\n\treturn new BufferAttribute().copy( attribute );\n\n}\n\n/**\n * @param {Array} attributes\n * @return {Array}\n */\nfunction interleaveAttributes( attributes ) {\n\n\t// Interleaves the provided attributes into an InterleavedBuffer and returns\n\t// a set of InterleavedBufferAttributes for each attribute\n\tlet TypedArray;\n\tlet arrayLength = 0;\n\tlet stride = 0;\n\n\t// calculate the length and type of the interleavedBuffer\n\tfor ( let i = 0, l = attributes.length; i < l; ++ i ) {\n\n\t\tconst attribute = attributes[ i ];\n\n\t\tif ( TypedArray === undefined ) TypedArray = attribute.array.constructor;\n\t\tif ( TypedArray !== attribute.array.constructor ) {\n\n\t\t\tconsole.error( 'AttributeBuffers of different types cannot be interleaved' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tarrayLength += attribute.array.length;\n\t\tstride += attribute.itemSize;\n\n\t}\n\n\t// Create the set of buffer attributes\n\tconst interleavedBuffer = new InterleavedBuffer( new TypedArray( arrayLength ), stride );\n\tlet offset = 0;\n\tconst res = [];\n\tconst getters = [ 'getX', 'getY', 'getZ', 'getW' ];\n\tconst setters = [ 'setX', 'setY', 'setZ', 'setW' ];\n\n\tfor ( let j = 0, l = attributes.length; j < l; j ++ ) {\n\n\t\tconst attribute = attributes[ j ];\n\t\tconst itemSize = attribute.itemSize;\n\t\tconst count = attribute.count;\n\t\tconst iba = new InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );\n\t\tres.push( iba );\n\n\t\toffset += itemSize;\n\n\t\t// Move the data for each attribute into the new interleavedBuffer\n\t\t// at the appropriate offset\n\t\tfor ( let c = 0; c < count; c ++ ) {\n\n\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\tiba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\n// returns a new, non-interleaved version of the provided attribute\nexport function deinterleaveAttribute( attribute ) {\n\n\tconst cons = attribute.data.array.constructor;\n\tconst count = attribute.count;\n\tconst itemSize = attribute.itemSize;\n\tconst normalized = attribute.normalized;\n\n\tconst array = new cons( count * itemSize );\n\tlet newAttribute;\n\tif ( attribute.isInstancedInterleavedBufferAttribute ) {\n\n\t\tnewAttribute = new InstancedBufferAttribute( array, itemSize, normalized, attribute.meshPerAttribute );\n\n\t} else {\n\n\t\tnewAttribute = new BufferAttribute( array, itemSize, normalized );\n\n\t}\n\n\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\tnewAttribute.setX( i, attribute.getX( i ) );\n\n\t\tif ( itemSize >= 2 ) {\n\n\t\t\tnewAttribute.setY( i, attribute.getY( i ) );\n\n\t\t}\n\n\t\tif ( itemSize >= 3 ) {\n\n\t\t\tnewAttribute.setZ( i, attribute.getZ( i ) );\n\n\t\t}\n\n\t\tif ( itemSize >= 4 ) {\n\n\t\t\tnewAttribute.setW( i, attribute.getW( i ) );\n\n\t\t}\n\n\t}\n\n\treturn newAttribute;\n\n}\n\n// deinterleaves all attributes on the geometry\nexport function deinterleaveGeometry( geometry ) {\n\n\tconst attributes = geometry.attributes;\n\tconst morphTargets = geometry.morphTargets;\n\tconst attrMap = new Map();\n\n\tfor ( const key in attributes ) {\n\n\t\tconst attr = attributes[ key ];\n\t\tif ( attr.isInterleavedBufferAttribute ) {\n\n\t\t\tif ( ! attrMap.has( attr ) ) {\n\n\t\t\t\tattrMap.set( attr, deinterleaveAttribute( attr ) );\n\n\t\t\t}\n\n\t\t\tattributes[ key ] = attrMap.get( attr );\n\n\t\t}\n\n\t}\n\n\tfor ( const key in morphTargets ) {\n\n\t\tconst attr = morphTargets[ key ];\n\t\tif ( attr.isInterleavedBufferAttribute ) {\n\n\t\t\tif ( ! attrMap.has( attr ) ) {\n\n\t\t\t\tattrMap.set( attr, deinterleaveAttribute( attr ) );\n\n\t\t\t}\n\n\t\t\tmorphTargets[ key ] = attrMap.get( attr );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * @param {Array} geometry\n * @return {number}\n */\nfunction estimateBytesUsed( geometry ) {\n\n\t// Return the estimated memory used by this geometry in bytes\n\t// Calculate using itemSize, count, and BYTES_PER_ELEMENT to account\n\t// for InterleavedBufferAttributes.\n\tlet mem = 0;\n\tfor ( const name in geometry.attributes ) {\n\n\t\tconst attr = geometry.getAttribute( name );\n\t\tmem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n\n\t}\n\n\tconst indices = geometry.getIndex();\n\tmem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n\treturn mem;\n\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry}\n */\nfunction mergeVertices( geometry, tolerance = 1e-4 ) {\n\n\ttolerance = Math.max( tolerance, Number.EPSILON );\n\n\t// Generate an index buffer if the geometry doesn't have one, or optimize it\n\t// if it's already available.\n\tconst hashToIndex = {};\n\tconst indices = geometry.getIndex();\n\tconst positions = geometry.getAttribute( 'position' );\n\tconst vertexCount = indices ? indices.count : positions.count;\n\n\t// next value for triangle indices\n\tlet nextIndex = 0;\n\n\t// attributes and new attribute arrays\n\tconst attributeNames = Object.keys( geometry.attributes );\n\tconst tmpAttributes = {};\n\tconst tmpMorphAttributes = {};\n\tconst newIndices = [];\n\tconst getters = [ 'getX', 'getY', 'getZ', 'getW' ];\n\tconst setters = [ 'setX', 'setY', 'setZ', 'setW' ];\n\n\t// Initialize the arrays, allocating space conservatively. Extra\n\t// space will be trimmed in the last step.\n\tfor ( let i = 0, l = attributeNames.length; i < l; i ++ ) {\n\n\t\tconst name = attributeNames[ i ];\n\t\tconst attr = geometry.attributes[ name ];\n\n\t\ttmpAttributes[ name ] = new BufferAttribute(\n\t\t\tnew attr.array.constructor( attr.count * attr.itemSize ),\n\t\t\tattr.itemSize,\n\t\t\tattr.normalized\n\t\t);\n\n\t\tconst morphAttr = geometry.morphAttributes[ name ];\n\t\tif ( morphAttr ) {\n\n\t\t\ttmpMorphAttributes[ name ] = new BufferAttribute(\n\t\t\t\tnew morphAttr.array.constructor( morphAttr.count * morphAttr.itemSize ),\n\t\t\t\tmorphAttr.itemSize,\n\t\t\t\tmorphAttr.normalized\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\t// convert the error tolerance to an amount of decimal places to truncate to\n\tconst decimalShift = Math.log10( 1 / tolerance );\n\tconst shiftMultiplier = Math.pow( 10, decimalShift );\n\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\tconst index = indices ? indices.getX( i ) : i;\n\n\t\t// Generate a hash for the vertex attributes at the current index 'i'\n\t\tlet hash = '';\n\t\tfor ( let j = 0, l = attributeNames.length; j < l; j ++ ) {\n\n\t\t\tconst name = attributeNames[ j ];\n\t\t\tconst attribute = geometry.getAttribute( name );\n\t\t\tconst itemSize = attribute.itemSize;\n\n\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\t// double tilde truncates the decimal value\n\t\t\t\thash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Add another reference to the vertex if it's already\n\t\t// used by another index\n\t\tif ( hash in hashToIndex ) {\n\n\t\t\tnewIndices.push( hashToIndex[ hash ] );\n\n\t\t} else {\n\n\t\t\t// copy data to the new index in the temporary attributes\n\t\t\tfor ( let j = 0, l = attributeNames.length; j < l; j ++ ) {\n\n\t\t\t\tconst name = attributeNames[ j ];\n\t\t\t\tconst attribute = geometry.getAttribute( name );\n\t\t\t\tconst morphAttr = geometry.morphAttributes[ name ];\n\t\t\t\tconst itemSize = attribute.itemSize;\n\t\t\t\tconst newarray = tmpAttributes[ name ];\n\t\t\t\tconst newMorphArrays = tmpMorphAttributes[ name ];\n\n\t\t\t\tfor ( let k = 0; k < itemSize; k ++ ) {\n\n\t\t\t\t\tconst getterFunc = getters[ k ];\n\t\t\t\t\tconst setterFunc = setters[ k ];\n\t\t\t\t\tnewarray[ setterFunc ]( nextIndex, attribute[ getterFunc ]( index ) );\n\n\t\t\t\t\tif ( morphAttr ) {\n\n\t\t\t\t\t\tfor ( let m = 0, ml = morphAttr.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\t\tnewMorphArrays[ m ][ setterFunc ]( nextIndex, morphAttr[ m ][ getterFunc ]( index ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\thashToIndex[ hash ] = nextIndex;\n\t\t\tnewIndices.push( nextIndex );\n\t\t\tnextIndex ++;\n\n\t\t}\n\n\t}\n\n\t// generate result BufferGeometry\n\tconst result = geometry.clone();\n\tfor ( const name in geometry.attributes ) {\n\n\t\tconst tmpAttribute = tmpAttributes[ name ];\n\n\t\tresult.setAttribute( name, new BufferAttribute(\n\t\t\ttmpAttribute.array.slice( 0, nextIndex * tmpAttribute.itemSize ),\n\t\t\ttmpAttribute.itemSize,\n\t\t\ttmpAttribute.normalized,\n\t\t) );\n\n\t\tif ( ! ( name in tmpMorphAttributes ) ) continue;\n\n\t\tfor ( let j = 0; j < tmpMorphAttributes[ name ].length; j ++ ) {\n\n\t\t\tconst tmpMorphAttribute = tmpMorphAttributes[ name ][ j ];\n\n\t\t\tresult.morphAttributes[ name ][ j ] = new BufferAttribute(\n\t\t\t\ttmpMorphAttribute.array.slice( 0, nextIndex * tmpMorphAttribute.itemSize ),\n\t\t\t\ttmpMorphAttribute.itemSize,\n\t\t\t\ttmpMorphAttribute.normalized,\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\t// indices\n\n\tresult.setIndex( newIndices );\n\n\treturn result;\n\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry}\n */\nfunction toTrianglesDrawMode( geometry, drawMode ) {\n\n\tif ( drawMode === TrianglesDrawMode ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );\n\t\treturn geometry;\n\n\t}\n\n\tif ( drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode ) {\n\n\t\tlet index = geometry.getIndex();\n\n\t\t// generate index if not present\n\n\t\tif ( index === null ) {\n\n\t\t\tconst indices = [];\n\n\t\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t\tif ( position !== undefined ) {\n\n\t\t\t\tfor ( let i = 0; i < position.count; i ++ ) {\n\n\t\t\t\t\tindices.push( i );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setIndex( indices );\n\t\t\t\tindex = geometry.getIndex();\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );\n\t\t\t\treturn geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst numberOfTriangles = index.count - 2;\n\t\tconst newIndices = [];\n\n\t\tif ( drawMode === TriangleFanDrawMode ) {\n\n\t\t\t// gl.TRIANGLE_FAN\n\n\t\t\tfor ( let i = 1; i <= numberOfTriangles; i ++ ) {\n\n\t\t\t\tnewIndices.push( index.getX( 0 ) );\n\t\t\t\tnewIndices.push( index.getX( i ) );\n\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// gl.TRIANGLE_STRIP\n\n\t\t\tfor ( let i = 0; i < numberOfTriangles; i ++ ) {\n\n\t\t\t\tif ( i % 2 === 0 ) {\n\n\t\t\t\t\tnewIndices.push( index.getX( i ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 2 ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tnewIndices.push( index.getX( i + 2 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i + 1 ) );\n\t\t\t\t\tnewIndices.push( index.getX( i ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( ( newIndices.length / 3 ) !== numberOfTriangles ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );\n\n\t\t}\n\n\t\t// build final geometry\n\n\t\tconst newGeometry = geometry.clone();\n\t\tnewGeometry.setIndex( newIndices );\n\t\tnewGeometry.clearGroups();\n\n\t\treturn newGeometry;\n\n\t} else {\n\n\t\tconsole.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );\n\t\treturn geometry;\n\n\t}\n\n}\n\n/**\n * Calculates the morphed attributes of a morphed/skinned BufferGeometry.\n * Helpful for Raytracing or Decals.\n * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.\n * @return {Object} An Object with original position/normal attributes and morphed ones.\n */\nfunction computeMorphedAttributes( object ) {\n\n\tconst _vA = new Vector3();\n\tconst _vB = new Vector3();\n\tconst _vC = new Vector3();\n\n\tconst _tempA = new Vector3();\n\tconst _tempB = new Vector3();\n\tconst _tempC = new Vector3();\n\n\tconst _morphA = new Vector3();\n\tconst _morphB = new Vector3();\n\tconst _morphC = new Vector3();\n\n\tfunction _calculateMorphedAttributeData(\n\t\tobject,\n\t\tattribute,\n\t\tmorphAttribute,\n\t\tmorphTargetsRelative,\n\t\ta,\n\t\tb,\n\t\tc,\n\t\tmodifiedAttributeArray\n\t) {\n\n\t\t_vA.fromBufferAttribute( attribute, a );\n\t\t_vB.fromBufferAttribute( attribute, b );\n\t\t_vC.fromBufferAttribute( attribute, c );\n\n\t\tconst morphInfluences = object.morphTargetInfluences;\n\n\t\tif ( morphAttribute && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\t\t\t_morphB.set( 0, 0, 0 );\n\t\t\t_morphC.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morph = morphAttribute[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morph, a );\n\t\t\t\t_tempB.fromBufferAttribute( morph, b );\n\t\t\t\t_tempC.fromBufferAttribute( morph, c );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\t\t\t\t\t_morphB.addScaledVector( _tempB, influence );\n\t\t\t\t\t_morphC.addScaledVector( _tempC, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( _vA ), influence );\n\t\t\t\t\t_morphB.addScaledVector( _tempB.sub( _vB ), influence );\n\t\t\t\t\t_morphC.addScaledVector( _tempC.sub( _vC ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_vA.add( _morphA );\n\t\t\t_vB.add( _morphB );\n\t\t\t_vC.add( _morphC );\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tobject.applyBoneTransform( a, _vA );\n\t\t\tobject.applyBoneTransform( b, _vB );\n\t\t\tobject.applyBoneTransform( c, _vC );\n\n\t\t}\n\n\t\tmodifiedAttributeArray[ a * 3 + 0 ] = _vA.x;\n\t\tmodifiedAttributeArray[ a * 3 + 1 ] = _vA.y;\n\t\tmodifiedAttributeArray[ a * 3 + 2 ] = _vA.z;\n\t\tmodifiedAttributeArray[ b * 3 + 0 ] = _vB.x;\n\t\tmodifiedAttributeArray[ b * 3 + 1 ] = _vB.y;\n\t\tmodifiedAttributeArray[ b * 3 + 2 ] = _vB.z;\n\t\tmodifiedAttributeArray[ c * 3 + 0 ] = _vC.x;\n\t\tmodifiedAttributeArray[ c * 3 + 1 ] = _vC.y;\n\t\tmodifiedAttributeArray[ c * 3 + 2 ] = _vC.z;\n\n\t}\n\n\tconst geometry = object.geometry;\n\tconst material = object.material;\n\n\tlet a, b, c;\n\tconst index = geometry.index;\n\tconst positionAttribute = geometry.attributes.position;\n\tconst morphPosition = geometry.morphAttributes.position;\n\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\tconst normalAttribute = geometry.attributes.normal;\n\tconst morphNormal = geometry.morphAttributes.position;\n\n\tconst groups = geometry.groups;\n\tconst drawRange = geometry.drawRange;\n\tlet i, j, il, jl;\n\tlet group;\n\tlet start, end;\n\n\tconst modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );\n\tconst modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );\n\n\tif ( index !== null ) {\n\n\t\t// indexed buffer geometry\n\n\t\tif ( Array.isArray( material ) ) {\n\n\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\tgroup = groups[ i ];\n\n\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\ta = index.getX( j );\n\t\t\t\t\tb = index.getX( j + 1 );\n\t\t\t\t\tc = index.getX( j + 2 );\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tpositionAttribute,\n\t\t\t\t\t\tmorphPosition,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedPosition\n\t\t\t\t\t);\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tnormalAttribute,\n\t\t\t\t\t\tmorphNormal,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedNormal\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\tend = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\ta = index.getX( i );\n\t\t\t\tb = index.getX( i + 1 );\n\t\t\t\tc = index.getX( i + 2 );\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tpositionAttribute,\n\t\t\t\t\tmorphPosition,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedPosition\n\t\t\t\t);\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tnormalAttribute,\n\t\t\t\t\tmorphNormal,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedNormal\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// non-indexed buffer geometry\n\n\t\tif ( Array.isArray( material ) ) {\n\n\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\tgroup = groups[ i ];\n\n\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\ta = j;\n\t\t\t\t\tb = j + 1;\n\t\t\t\t\tc = j + 2;\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tpositionAttribute,\n\t\t\t\t\t\tmorphPosition,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedPosition\n\t\t\t\t\t);\n\n\t\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tnormalAttribute,\n\t\t\t\t\t\tmorphNormal,\n\t\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\t\ta, b, c,\n\t\t\t\t\t\tmodifiedNormal\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\tend = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\ta = i;\n\t\t\t\tb = i + 1;\n\t\t\t\tc = i + 2;\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tpositionAttribute,\n\t\t\t\t\tmorphPosition,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedPosition\n\t\t\t\t);\n\n\t\t\t\t_calculateMorphedAttributeData(\n\t\t\t\t\tobject,\n\t\t\t\t\tnormalAttribute,\n\t\t\t\t\tmorphNormal,\n\t\t\t\t\tmorphTargetsRelative,\n\t\t\t\t\ta, b, c,\n\t\t\t\t\tmodifiedNormal\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tconst morphedPositionAttribute = new Float32BufferAttribute( modifiedPosition, 3 );\n\tconst morphedNormalAttribute = new Float32BufferAttribute( modifiedNormal, 3 );\n\n\treturn {\n\n\t\tpositionAttribute: positionAttribute,\n\t\tnormalAttribute: normalAttribute,\n\t\tmorphedPositionAttribute: morphedPositionAttribute,\n\t\tmorphedNormalAttribute: morphedNormalAttribute\n\n\t};\n\n}\n\nfunction mergeGroups( geometry ) {\n\n\tif ( geometry.groups.length === 0 ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge.' );\n\t\treturn geometry;\n\n\t}\n\n\tlet groups = geometry.groups;\n\n\t// sort groups by material index\n\n\tgroups = groups.sort( ( a, b ) => {\n\n\t\tif ( a.materialIndex !== b.materialIndex ) return a.materialIndex - b.materialIndex;\n\n\t\treturn a.start - b.start;\n\n\t} );\n\n\t// create index for non-indexed geometries\n\n\tif ( geometry.getIndex() === null ) {\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\t\tconst indices = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i += 3 ) {\n\n\t\t\tindices.push( i, i + 1, i + 2 );\n\n\t\t}\n\n\t\tgeometry.setIndex( indices );\n\n\t}\n\n\t// sort index\n\n\tconst index = geometry.getIndex();\n\n\tconst newIndices = [];\n\n\tfor ( let i = 0; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tconst groupStart = group.start;\n\t\tconst groupLength = groupStart + group.count;\n\n\t\tfor ( let j = groupStart; j < groupLength; j ++ ) {\n\n\t\t\tnewIndices.push( index.getX( j ) );\n\n\t\t}\n\n\t}\n\n\tgeometry.dispose(); // Required to force buffer recreation\n\tgeometry.setIndex( newIndices );\n\n\t// update groups indices\n\n\tlet start = 0;\n\n\tfor ( let i = 0; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tgroup.start = start;\n\t\tstart += group.count;\n\n\t}\n\n\t// merge groups\n\n\tlet currentGroup = groups[ 0 ];\n\n\tgeometry.groups = [ currentGroup ];\n\n\tfor ( let i = 1; i < groups.length; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\n\t\tif ( currentGroup.materialIndex === group.materialIndex ) {\n\n\t\t\tcurrentGroup.count += group.count;\n\n\t\t} else {\n\n\t\t\tcurrentGroup = group;\n\t\t\tgeometry.groups.push( currentGroup );\n\n\t\t}\n\n\t}\n\n\treturn geometry;\n\n}\n\n\n/**\n * Modifies the supplied geometry if it is non-indexed, otherwise creates a new,\n * non-indexed geometry. Returns the geometry with smooth normals everywhere except\n * faces that meet at an angle greater than the crease angle.\n *\n * @param {BufferGeometry} geometry\n * @param {number} [creaseAngle]\n * @return {BufferGeometry}\n */\nfunction toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {\n\n\tconst creaseDot = Math.cos( creaseAngle );\n\tconst hashMultiplier = ( 1 + 1e-10 ) * 1e2;\n\n\t// reusable vectors\n\tconst verts = [ new Vector3(), new Vector3(), new Vector3() ];\n\tconst tempVec1 = new Vector3();\n\tconst tempVec2 = new Vector3();\n\tconst tempNorm = new Vector3();\n\tconst tempNorm2 = new Vector3();\n\n\t// hashes a vector\n\tfunction hashVertex( v ) {\n\n\t\tconst x = ~ ~ ( v.x * hashMultiplier );\n\t\tconst y = ~ ~ ( v.y * hashMultiplier );\n\t\tconst z = ~ ~ ( v.z * hashMultiplier );\n\t\treturn `${x},${y},${z}`;\n\n\t}\n\n\t// BufferGeometry.toNonIndexed() warns if the geometry is non-indexed\n\t// and returns the original geometry\n\tconst resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;\n\tconst posAttr = resultGeometry.attributes.position;\n\tconst vertexMap = {};\n\n\t// find all the normals shared by commonly located vertices\n\tfor ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {\n\n\t\tconst i3 = 3 * i;\n\t\tconst a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );\n\t\tconst b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );\n\t\tconst c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );\n\n\t\ttempVec1.subVectors( c, b );\n\t\ttempVec2.subVectors( a, b );\n\n\t\t// add the normal to the map for all vertices\n\t\tconst normal = new Vector3().crossVectors( tempVec1, tempVec2 ).normalize();\n\t\tfor ( let n = 0; n < 3; n ++ ) {\n\n\t\t\tconst vert = verts[ n ];\n\t\t\tconst hash = hashVertex( vert );\n\t\t\tif ( ! ( hash in vertexMap ) ) {\n\n\t\t\t\tvertexMap[ hash ] = [];\n\n\t\t\t}\n\n\t\t\tvertexMap[ hash ].push( normal );\n\n\t\t}\n\n\t}\n\n\t// average normals from all vertices that share a common location if they are within the\n\t// provided crease threshold\n\tconst normalArray = new Float32Array( posAttr.count * 3 );\n\tconst normAttr = new BufferAttribute( normalArray, 3, false );\n\tfor ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {\n\n\t\t// get the face normal for this vertex\n\t\tconst i3 = 3 * i;\n\t\tconst a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );\n\t\tconst b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );\n\t\tconst c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );\n\n\t\ttempVec1.subVectors( c, b );\n\t\ttempVec2.subVectors( a, b );\n\n\t\ttempNorm.crossVectors( tempVec1, tempVec2 ).normalize();\n\n\t\t// average all normals that meet the threshold and set the normal value\n\t\tfor ( let n = 0; n < 3; n ++ ) {\n\n\t\t\tconst vert = verts[ n ];\n\t\t\tconst hash = hashVertex( vert );\n\t\t\tconst otherNormals = vertexMap[ hash ];\n\t\t\ttempNorm2.set( 0, 0, 0 );\n\n\t\t\tfor ( let k = 0, lk = otherNormals.length; k < lk; k ++ ) {\n\n\t\t\t\tconst otherNorm = otherNormals[ k ];\n\t\t\t\tif ( tempNorm.dot( otherNorm ) > creaseDot ) {\n\n\t\t\t\t\ttempNorm2.add( otherNorm );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttempNorm2.normalize();\n\t\t\tnormAttr.setXYZ( i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z );\n\n\t\t}\n\n\t}\n\n\tresultGeometry.setAttribute( 'normal', normAttr );\n\treturn resultGeometry;\n\n}\n\nfunction mergeBufferGeometries( geometries, useGroups = false ) {\n\n\tconsole.warn( 'THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries().' ); // @deprecated, r151\n\treturn mergeGeometries( geometries, useGroups );\n\n}\n\nfunction mergeBufferAttributes( attributes ) {\n\n\tconsole.warn( 'THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().' ); // @deprecated, r151\n\treturn mergeAttributes( attributes );\n\n}\n\nexport {\n\tcomputeMikkTSpaceTangents,\n\tmergeGeometries,\n\tmergeBufferGeometries,\n\tmergeAttributes,\n\tmergeBufferAttributes,\n\tinterleaveAttributes,\n\testimateBytesUsed,\n\tmergeVertices,\n\ttoTrianglesDrawMode,\n\tcomputeMorphedAttributes,\n\tmergeGroups,\n\ttoCreasedNormals\n};\n","export * from './ProjectionGenerator.js';\nexport * from './SilhouetteGenerator.js';\n","import {\n\tBufferGeometry,\n\tVector3,\n\tLine3,\n\tRay,\n\tBufferAttribute,\n} from 'three';\nimport { MeshBVH } from 'three-mesh-bvh';\nimport {\n\tisYProjectedTriangleDegenerate,\n\tisLineTriangleEdge,\n\tisYProjectedLineDegenerate,\n} from './utils/triangleLineUtils.js';\nimport { generateEdges } from './utils/generateEdges.js';\nimport { compressEdgeOverlaps, overlapsToLines } from './utils/overlapUtils.js';\nimport { trimToBeneathTriPlane } from './utils/trimToBeneathTriPlane.js';\nimport { getProjectedLineOverlap } from './utils/getProjectedLineOverlap.js';\nimport { appendOverlapRange } from './utils/getProjectedOverlaps.js';\nimport { generateIntersectionEdges } from './utils/generateIntersectionEdges.js';\n\n// these shared variables are not used across \"yield\" boundaries in the\n// generator so there's no risk of overwriting another tasks data\nconst DIST_THRESHOLD = 1e-10;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _beneathLine = /* @__PURE__ */ new Line3();\nconst _ray = /* @__PURE__ */ new Ray();\nconst _vec = /* @__PURE__ */ new Vector3();\nconst _overlapLine = /* @__PURE__ */ new Line3();\n\nclass EdgeSet {\n\n\tconstructor() {\n\n\t\tthis.edges = [];\n\n\t}\n\n\tgetLineGeometry( y = 0 ) {\n\n\t\tconst edges = this.edges;\n\t\tconst edgeArray = new Float32Array( edges.length * 6 );\n\t\tlet c = 0;\n\t\tfor ( let i = 0, l = edges.length; i < l; i ++ ) {\n\n\t\t\tconst line = edges[ i ];\n\t\t\tedgeArray[ c ++ ] = line[ 0 ];\n\t\t\tedgeArray[ c ++ ] = y;\n\t\t\tedgeArray[ c ++ ] = line[ 2 ];\n\t\t\tedgeArray[ c ++ ] = line[ 3 ];\n\t\t\tedgeArray[ c ++ ] = y;\n\t\t\tedgeArray[ c ++ ] = line[ 5 ];\n\n\t\t}\n\n\t\tconst edgeGeom = new BufferGeometry();\n\t\tconst edgeBuffer = new BufferAttribute( edgeArray, 3, true );\n\t\tedgeGeom.setAttribute( 'position', edgeBuffer );\n\t\treturn edgeGeom;\n\n\t}\n\n}\n\nexport class ProjectionGenerator {\n\n\tconstructor() {\n\n\t\tthis.sortEdges = true;\n\t\tthis.iterationTime = 30;\n\t\tthis.angleThreshold = 50;\n\t\tthis.includeIntersectionEdges = true;\n\n\t}\n\n\tgenerateAsync( geometry, options = {} ) {\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tconst { signal } = options;\n\t\t\tconst task = this.generate( geometry, options );\n\t\t\trun();\n\n\t\t\tfunction run() {\n\n\t\t\t\tif ( signal && signal.aborted ) {\n\n\t\t\t\t\treject( new Error( 'ProjectionGenerator: Process aborted via AbortSignal.' ) );\n\n\t\t\t\t}\n\n\t\t\t\tconst result = task.next();\n\t\t\t\tif ( result.done ) {\n\n\t\t\t\t\tresolve( result.value );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trequestAnimationFrame( run );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t} );\n\n\t}\n\n\t*generate( bvh, options = {} ) {\n\n\t\tconst { onProgress } = options;\n\t\tconst { sortEdges, iterationTime, angleThreshold, includeIntersectionEdges } = this;\n\n\t\tif ( bvh instanceof BufferGeometry ) {\n\n\t\t\tbvh = new MeshBVH( bvh, { maxLeafTris: 1 } );\n\n\t\t}\n\n\t\tconst geometry = bvh.geometry;\n\t\tlet edges = generateEdges( geometry, UP_VECTOR, angleThreshold );\n\t\tif ( includeIntersectionEdges ) {\n\n\t\t\tconst results = yield* generateIntersectionEdges( bvh, iterationTime );\n\t\t\tedges = edges.concat( results );\n\n\t\t}\n\n\t\tif ( sortEdges ) {\n\n\t\t\tedges.sort( ( a, b ) => {\n\n\t\t\t\treturn Math.min( a.start.y, a.end.y ) - Math.min( b.start.y, b.end.y );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tyield;\n\n\t\t// trim the candidate edges\n\t\tconst finalEdges = new EdgeSet();\n\t\tlet time = performance.now();\n\t\tfor ( let i = 0, l = edges.length; i < l; i ++ ) {\n\n\t\t\tconst line = edges[ i ];\n\t\t\tif ( isYProjectedLineDegenerate( line ) ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst lowestLineY = Math.min( line.start.y, line.end.y );\n\t\t\tconst highestLineY = Math.max( line.start.y, line.end.y );\n\t\t\tconst hiddenOverlaps = [];\n\t\t\tbvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => {\n\n\t\t\t\t\t// expand the bounding box to the bottom height of the line\n\t\t\t\t\tbox.min.y = Math.min( lowestLineY - 1e-6, box.min.y );\n\n\t\t\t\t\t// get the line as a ray\n\t\t\t\t\tconst { origin, direction } = _ray;\n\t\t\t\t\torigin.copy( line.start );\n\t\t\t\t\tline.delta( direction ).normalize();\n\n\t\t\t\t\t// if the ray is inside the box then we intersect it\n\t\t\t\t\tif ( box.containsPoint( origin ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// check if the line segment intersects the box\n\t\t\t\t\tif ( _ray.intersectBox( box, _vec ) ) {\n\n\t\t\t\t\t\treturn origin.distanceToSquared( _vec ) < line.distanceSq();\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\t// skip the triangle if the triangle is completely below the line\n\t\t\t\t\tconst highestTriangleY = Math.max( tri.a.y, tri.b.y, tri.c.y );\n\t\t\t\t\tif ( highestTriangleY <= lowestLineY ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if the projected triangle is just a line then don't check it\n\t\t\t\t\tif ( isYProjectedTriangleDegenerate( tri ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if this line lies on a triangle edge then don't check for visual overlaps\n\t\t\t\t\t// with this triangle\n\t\t\t\t\tif ( isLineTriangleEdge( tri, line ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Retrieve the portion of line that is below the plane - and skip the triangle if none\n\t\t\t\t\t// of it is\n\t\t\t\t\tconst lowestTriangleY = Math.min( tri.a.y, tri.b.y, tri.c.y );\n\t\t\t\t\tif ( highestLineY < lowestTriangleY ) {\n\n\t\t\t\t\t\t_beneathLine.copy( line );\n\n\t\t\t\t\t} else if ( ! trimToBeneathTriPlane( tri, line, _beneathLine ) ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( _beneathLine.distance() < DIST_THRESHOLD ) {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// compress the edge overlaps so we can easily tell if the whole edge is hidden already\n\t\t\t\t\t// and exit early\n\t\t\t\t\tif (\n\t\t\t\t\t\tgetProjectedLineOverlap( _beneathLine, tri, _overlapLine ) &&\n\t\t\t\t\t\tappendOverlapRange( line, _overlapLine, hiddenOverlaps )\n\t\t\t\t\t) {\n\n\t\t\t\t\t\tcompressEdgeOverlaps( hiddenOverlaps );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if we're hiding the edge entirely now then skip further checks\n\t\t\t\t\tif ( hiddenOverlaps.length !== 0 ) {\n\n\t\t\t\t\t\tconst [ d0, d1 ] = hiddenOverlaps[ hiddenOverlaps.length - 1 ];\n\t\t\t\t\t\treturn d0 === 0.0 && d1 === 1.0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t\t// convert the overlap points to proper lines\n\t\t\toverlapsToLines( line, hiddenOverlaps, finalEdges.edges );\n\n\t\t\tconst delta = performance.now() - time;\n\t\t\tif ( delta > iterationTime ) {\n\n\t\t\t\tif ( onProgress ) {\n\n\t\t\t\t\tconst progress = i / edges.length;\n\t\t\t\t\tonProgress( progress, finalEdges );\n\n\t\t\t\t}\n\n\t\t\t\tyield;\n\t\t\t\ttime = performance.now();\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn finalEdges.getLineGeometry( 0 );\n\n\t}\n\n}\n","import { BufferAttribute, Box3, FrontSide } from 'three';\nimport { CENTER, BYTES_PER_NODE, IS_LEAFNODE_FLAG, SKIP_GENERATION } from './Constants.js';\nimport { buildPackedTree } from './build/buildTree.js';\nimport { OrientedBox } from '../math/OrientedBox.js';\nimport { arrayToBox } from '../utils/ArrayBoxUtilities.js';\nimport { ExtendedTrianglePool } from '../utils/ExtendedTrianglePool.js';\nimport { shapecast } from './cast/shapecast.js';\nimport { closestPointToPoint } from './cast/closestPointToPoint.js';\n\nimport { iterateOverTriangles } from './utils/iterationUtils.generated.js';\nimport { refit } from './cast/refit.generated.js';\nimport { raycast } from './cast/raycast.generated.js';\nimport { raycastFirst } from './cast/raycastFirst.generated.js';\nimport { intersectsGeometry } from './cast/intersectsGeometry.generated.js';\nimport { closestPointToGeometry } from './cast/closestPointToGeometry.generated.js';\nimport { bvhcast } from './cast/bvhcast.generated.js';\n\nimport { iterateOverTriangles_indirect } from './utils/iterationUtils_indirect.generated.js';\nimport { refit_indirect } from './cast/refit_indirect.generated.js';\nimport { raycast_indirect } from './cast/raycast_indirect.generated.js';\nimport { raycastFirst_indirect } from './cast/raycastFirst_indirect.generated.js';\nimport { intersectsGeometry_indirect } from './cast/intersectsGeometry_indirect.generated.js';\nimport { closestPointToGeometry_indirect } from './cast/closestPointToGeometry_indirect.generated.js';\nimport { bvhcast_indirect } from './cast/bvhcast_indirect.generated.js';\nimport { isSharedArrayBufferSupported } from '../utils/BufferUtils.js';\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst tempBox = /* @__PURE__ */ new Box3();\n\nexport class MeshBVH {\n\n\tstatic serialize( bvh, options = {} ) {\n\n\t\toptions = {\n\t\t\tcloneBuffers: true,\n\t\t\t...options,\n\t\t};\n\n\t\tconst geometry = bvh.geometry;\n\t\tconst rootData = bvh._roots;\n\t\tconst indirectBuffer = bvh._indirectBuffer;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tlet result;\n\t\tif ( options.cloneBuffers ) {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData.map( root => root.slice() ),\n\t\t\t\tindex: indexAttribute.array.slice(),\n\t\t\t\tindirectBuffer: indirectBuffer ? indirectBuffer.slice() : null,\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData,\n\t\t\t\tindex: indexAttribute.array,\n\t\t\t\tindirectBuffer: indirectBuffer,\n\t\t\t};\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, options = {} ) {\n\n\t\toptions = {\n\t\t\tsetIndex: true,\n\t\t\tindirect: Boolean( data.indirectBuffer ),\n\t\t\t...options,\n\t\t};\n\n\t\tconst { index, roots, indirectBuffer } = data;\n\t\tconst bvh = new MeshBVH( geometry, { ...options, [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\t\tbvh._indirectBuffer = indirectBuffer || null;\n\n\t\tif ( options.setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tget indirect() {\n\n\t\treturn ! ! this._indirectBuffer;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\t\t\tuseSharedArrayBuffer: false,\n\t\t\tsetBoundingBox: true,\n\t\t\tonProgress: null,\n\t\t\tindirect: false,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false,\n\n\t\t}, options );\n\n\t\tif ( options.useSharedArrayBuffer && ! isSharedArrayBufferSupported() ) {\n\n\t\t\tthrow new Error( 'MeshBVH: SharedArrayBuffer is not available.' );\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\t\tthis._roots = null;\n\t\tthis._indirectBuffer = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tbuildPackedTree( this, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst { _indirectBuffer } = this;\n\t\tthis.resolveTriangleIndex = options.indirect ? i => _indirectBuffer[ i ] : i => i;\n\n\t}\n\n\trefit( nodeIndices = null ) {\n\n\t\tconst refitFunc = this.indirect ? refit_indirect : refit;\n\t\treturn refitFunc( this, nodeIndices );\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\t// TODO: use node functions here\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( ray, materialOrSide = FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst intersects = [];\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tconst raycastFunc = this.indirect ? raycast_indirect : raycast;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\t\t\tconst startCount = intersects.length;\n\n\t\t\traycastFunc( this, i, materialSide, ray, intersects );\n\n\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\tconst materialIndex = groups[ i ].materialIndex;\n\t\t\t\tfor ( let j = startCount, jl = intersects.length; j < jl; j ++ ) {\n\n\t\t\t\t\tintersects[ j ].face.materialIndex = materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn intersects;\n\n\t}\n\n\traycastFirst( ray, materialOrSide = FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tlet closestResult = null;\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tconst raycastFirstFunc = this.indirect ? raycastFirst_indirect : raycastFirst;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\t\t\tconst result = raycastFirstFunc( this, i, materialSide, ray );\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\t\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\t\tresult.face.materialIndex = groups[ i ].materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( otherGeometry, geomToMesh ) {\n\n\t\tlet result = false;\n\t\tconst roots = this._roots;\n\t\tconst intersectsGeometryFunc = this.indirect ? intersectsGeometry_indirect : intersectsGeometry;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tresult = intersectsGeometryFunc( this, i, otherGeometry, geomToMesh );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( callbacks ) {\n\n\t\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\t\tconst iterateFunc = this.indirect ? iterateOverTriangles_indirect : iterateOverTriangles;\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\t// wrap the intersectsRange function\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateFunc( offset, count, this, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateFunc( offset, count, this, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// run shapecast\n\t\tlet result = false;\n\t\tlet byteOffset = 0;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst root = roots[ i ];\n\t\t\tresult = shapecast( this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tbyteOffset += root.byteLength;\n\n\t\t}\n\n\t\tExtendedTrianglePool.releasePrimitive( triangle );\n\n\t\treturn result;\n\n\t}\n\n\tbvhcast( otherBvh, matrixToLocal, callbacks ) {\n\n\t\tconst bvhcastFunc = this.indirect ? bvhcast_indirect : bvhcast;\n\t\treturn bvhcastFunc( this, otherBvh, matrixToLocal, callbacks );\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.needsUpdate = true;\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( otherGeometry, geometryToBvh, target1 = { }, target2 = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tconst closestPointToGeometryFunc = this.indirect ? closestPointToGeometry_indirect : closestPointToGeometry;\n\t\treturn closestPointToGeometryFunc(\n\t\t\tthis,\n\t\t\totherGeometry,\n\t\t\tgeometryToBvh,\n\t\t\ttarget1,\n\t\t\ttarget2,\n\t\t\tminThreshold,\n\t\t\tmaxThreshold,\n\t\t);\n\n\t}\n\n\tclosestPointToPoint( point, target = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\treturn closestPointToPoint(\n\t\t\tthis,\n\t\t\tpoint,\n\t\t\ttarget,\n\t\t\tminThreshold,\n\t\t\tmaxThreshold,\n\t\t);\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","// Split strategy constants\nexport const CENTER = 0;\nexport const AVERAGE = 1;\nexport const SAH = 2;\n\n// Traversal constants\nexport const NOT_INTERSECTED = 0;\nexport const INTERSECTED = 1;\nexport const CONTAINED = 2;\n\n// SAH cost constants\n// TODO: hone these costs more. The relative difference between them should be the\n// difference in measured time to perform a triangle intersection vs traversing\n// bounds.\nexport const TRIANGLE_INTERSECT_COST = 1.25;\nexport const TRAVERSAL_COST = 1;\n\n\n// Build constants\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\n\n// EPSILON for computing floating point error during build\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\nexport const FLOAT32_EPSILON = Math.pow( 2, - 24 );\n\nexport const SKIP_GENERATION = Symbol( 'SKIP_GENERATION' );\n","import { ensureIndex, getFullGeometryRange, getRootIndexRanges, getTriCount, hasGroupGaps, } from './geometryUtils.js';\nimport { getBounds, getCentroidBounds, computeTriangleBounds } from './computeBoundsUtils.js';\nimport { getOptimalSplit } from './splitUtils.js';\nimport { MeshBVHNode } from '../MeshBVHNode.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG } from '../Constants.js';\n\nimport { partition } from './sortUtils.generated.js';\nimport { partition_indirect } from './sortUtils_indirect.generated.js';\n\nfunction generateIndirectBuffer( geometry, useSharedArrayBuffer ) {\n\n\tconst triCount = ( geometry.index ? geometry.index.count : geometry.attributes.position.count ) / 3;\n\tconst useUint32 = triCount > 2 ** 16;\n\tconst byteCount = useUint32 ? 4 : 2;\n\n\tconst buffer = useSharedArrayBuffer ? new SharedArrayBuffer( triCount * byteCount ) : new ArrayBuffer( triCount * byteCount );\n\tconst indirectBuffer = useUint32 ? new Uint32Array( buffer ) : new Uint16Array( buffer );\n\tfor ( let i = 0, l = indirectBuffer.length; i < l; i ++ ) {\n\n\t\tindirectBuffer[ i ] = i;\n\n\t}\n\n\treturn indirectBuffer;\n\n}\n\nfunction buildTree( bvh, options ) {\n\n\t// Compute the full bounds of the geometry at the same time as triangle bounds because\n\t// we'll need it for the root bounds in the case with no groups and it should be fast here.\n\t// We can't use the geometry bounding box if it's available because it may be out of date.\n\tconst geometry = bvh.geometry;\n\tconst indexArray = geometry.index ? geometry.index.array : null;\n\tconst maxDepth = options.maxDepth;\n\tconst verbose = options.verbose;\n\tconst maxLeafTris = options.maxLeafTris;\n\tconst strategy = options.strategy;\n\tconst onProgress = options.onProgress;\n\tconst totalTriangles = getTriCount( geometry );\n\tconst indirectBuffer = bvh._indirectBuffer;\n\tlet reachedMaxDepth = false;\n\n\tconst fullBounds = new Float32Array( 6 );\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\n\tconst triangleBounds = computeTriangleBounds( geometry, fullBounds );\n\tconst partionFunc = options.indirect ? partition_indirect : partition;\n\n\tconst roots = [];\n\tconst ranges = options.indirect ? getFullGeometryRange( geometry ) : getRootIndexRanges( geometry );\n\n\tif ( ranges.length === 1 ) {\n\n\t\tconst range = ranges[ 0 ];\n\t\tconst root = new MeshBVHNode();\n\t\troot.boundingData = fullBounds;\n\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\n\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\troots.push( root );\n\n\t} else {\n\n\t\tfor ( let range of ranges ) {\n\n\t\t\tconst root = new MeshBVHNode();\n\t\t\troot.boundingData = new Float32Array( 6 );\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\n\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\t\troots.push( root );\n\n\t\t}\n\n\t}\n\n\treturn roots;\n\n\tfunction triggerProgress( trianglesProcessed ) {\n\n\t\tif ( onProgress ) {\n\n\t\t\tonProgress( trianglesProcessed / totalTriangles );\n\n\t\t}\n\n\t}\n\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\n\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\n\n\t\t\treachedMaxDepth = true;\n\t\t\tif ( verbose ) {\n\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\n\t\t\t\tconsole.warn( geometry );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// early out if we've met our capacity\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\t// Find where to split the volume\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, offset, count, strategy );\n\t\tif ( split.axis === - 1 ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\tconst splitOffset = partionFunc( indirectBuffer, indexArray, triangleBounds, offset, count, split );\n\n\t\t// create the two new child nodes\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\n\t\t} else {\n\n\t\t\tnode.splitAxis = split.axis;\n\n\t\t\t// create the left child and compute its bounding box\n\t\t\tconst left = new MeshBVHNode();\n\t\t\tconst lstart = offset;\n\t\t\tconst lcount = splitOffset - offset;\n\t\t\tnode.left = left;\n\t\t\tleft.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t\t// repeat for right\n\t\t\tconst right = new MeshBVHNode();\n\t\t\tconst rstart = splitOffset;\n\t\t\tconst rcount = count - lcount;\n\t\t\tnode.right = right;\n\t\t\tright.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n}\n\nexport function buildPackedTree( bvh, options ) {\n\n\tconst geometry = bvh.geometry;\n\tif ( options.indirect ) {\n\n\t\tbvh._indirectBuffer = generateIndirectBuffer( geometry, options.useSharedArrayBuffer );\n\n\t\tif ( hasGroupGaps( geometry ) && ! options.verbose ) {\n\n\t\t\tconsole.warn(\n\t\t\t\t'MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the \"indirect\" option. ' +\n\t\t\t\t'BVH may incorrectly report intersections on unrendered portions of the geometry.'\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tif ( ! bvh._indirectBuffer ) {\n\n\t\tensureIndex( geometry, options );\n\n\t}\n\n\t// boundingData \t\t\t\t: 6 float32\n\t// right / offset \t\t\t\t: 1 uint32\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\n\tconst roots = buildTree( bvh, options );\n\n\tlet float32Array;\n\tlet uint32Array;\n\tlet uint16Array;\n\tconst packedRoots = [];\n\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\tfor ( let i = 0; i < roots.length; i ++ ) {\n\n\t\tconst root = roots[ i ];\n\t\tlet nodeCount = countNodes( root );\n\n\t\tconst buffer = new BufferConstructor( BYTES_PER_NODE * nodeCount );\n\t\tfloat32Array = new Float32Array( buffer );\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tpopulateBuffer( 0, root );\n\t\tpackedRoots.push( buffer );\n\n\t}\n\n\tbvh._roots = packedRoots;\n\treturn;\n\n\tfunction countNodes( node ) {\n\n\t\tif ( node.count ) {\n\n\t\t\treturn 1;\n\n\t\t} else {\n\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\n\n\t\t}\n\n\t}\n\n\tfunction populateBuffer( byteOffset, node ) {\n\n\t\tconst stride4Offset = byteOffset / 4;\n\t\tconst stride2Offset = byteOffset / 2;\n\t\tconst isLeaf = ! ! node.count;\n\t\tconst boundingData = node.boundingData;\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\n\n\t\t}\n\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = node.offset;\n\t\t\tconst count = node.count;\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\n\t\t\treturn byteOffset + BYTES_PER_NODE;\n\n\t\t} else {\n\n\t\t\tconst left = node.left;\n\t\t\tconst right = node.right;\n\t\t\tconst splitAxis = node.splitAxis;\n\n\t\t\tlet nextUnusedPointer;\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\n\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\n\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\n\n\t\t\t}\n\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\n\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\n\t\t\treturn nextUnusedPointer;\n\n\t\t}\n\n\t}\n\n}\n","import { BufferAttribute } from 'three';\n\nexport function getVertexCount( geo ) {\n\n\treturn geo.index ? geo.index.count : geo.attributes.position.count;\n\n}\n\nexport function getTriCount( geo ) {\n\n\treturn getVertexCount( geo ) / 3;\n\n}\n\nexport function getIndexArray( vertexCount, BufferConstructor = ArrayBuffer ) {\n\n\tif ( vertexCount > 65535 ) {\n\n\t\treturn new Uint32Array( new BufferConstructor( 4 * vertexCount ) );\n\n\t} else {\n\n\t\treturn new Uint16Array( new BufferConstructor( 2 * vertexCount ) );\n\n\t}\n\n}\n\n// ensures that an index is present on the geometry\nexport function ensureIndex( geo, options ) {\n\n\tif ( ! geo.index ) {\n\n\t\tconst vertexCount = geo.attributes.position.count;\n\t\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\t\tconst index = getIndexArray( vertexCount, BufferConstructor );\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\n\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tindex[ i ] = i;\n\n\t\t}\n\n\t}\n\n}\n\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\n// region in the geometry index that belongs to a different set of material groups requires\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\n// with triangle indices belongs to another group. For example, if the groups were like this:\n//\n// [-------------------------------------------------------------]\n// |__________________|\n// g0 = [0, 20] |______________________||_____________________|\n// g1 = [16, 40] g2 = [41, 60]\n//\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\nexport function getFullGeometryRange( geo ) {\n\n\tconst triCount = getTriCount( geo );\n\tconst drawRange = geo.drawRange;\n\tconst start = drawRange.start / 3;\n\tconst end = ( drawRange.start + drawRange.count ) / 3;\n\n\tconst offset = Math.max( 0, start );\n\tconst count = Math.min( triCount, end ) - offset;\n\treturn [ {\n\t\toffset: Math.floor( offset ),\n\t\tcount: Math.floor( count ),\n\t} ];\n\n}\n\nexport function getRootIndexRanges( geo ) {\n\n\tif ( ! geo.groups || ! geo.groups.length ) {\n\n\t\treturn getFullGeometryRange( geo );\n\n\t}\n\n\tconst ranges = [];\n\tconst rangeBoundaries = new Set();\n\n\tconst drawRange = geo.drawRange;\n\tconst drawRangeStart = drawRange.start / 3;\n\tconst drawRangeEnd = ( drawRange.start + drawRange.count ) / 3;\n\tfor ( const group of geo.groups ) {\n\n\t\tconst groupStart = group.start / 3;\n\t\tconst groupEnd = ( group.start + group.count ) / 3;\n\t\trangeBoundaries.add( Math.max( drawRangeStart, groupStart ) );\n\t\trangeBoundaries.add( Math.min( drawRangeEnd, groupEnd ) );\n\n\t}\n\n\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\n\n\t\tconst start = sortedBoundaries[ i ];\n\t\tconst end = sortedBoundaries[ i + 1 ];\n\n\t\tranges.push( {\n\t\t\toffset: Math.floor( start ),\n\t\t\tcount: Math.floor( end - start ),\n\t\t} );\n\n\t}\n\n\treturn ranges;\n\n}\n\nexport function hasGroupGaps( geometry ) {\n\n\tif ( geometry.groups.length === 0 ) {\n\n\t\treturn false;\n\n\t}\n\n\tconst vertexCount = getTriCount( geometry );\n\tconst groups = getRootIndexRanges( geometry )\n\t\t.sort( ( a, b ) => a.offset - b.offset );\n\n\tconst finalGroup = groups[ groups.length - 1 ];\n\tfinalGroup.count = Math.min( vertexCount - finalGroup.offset, finalGroup.count );\n\n\tlet total = 0;\n\tgroups.forEach( ( { count } ) => total += count );\n\treturn vertexCount !== total;\n\n}\n","import { FLOAT32_EPSILON } from '../Constants.js';\nimport { makeEmptyBounds } from '../../utils/ArrayBoxUtilities.js';\nimport { getTriCount } from './geometryUtils.js';\n\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\n// These are computed together to avoid redundant accesses to bounds array.\nexport function getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\n\n\tlet minx = Infinity;\n\tlet miny = Infinity;\n\tlet minz = Infinity;\n\tlet maxx = - Infinity;\n\tlet maxy = - Infinity;\n\tlet maxz = - Infinity;\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tconst includeCentroid = centroidTarget !== null;\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tconst hx = triangleBounds[ i + 1 ];\n\t\tconst lx = cx - hx;\n\t\tconst rx = cx + hx;\n\t\tif ( lx < minx ) minx = lx;\n\t\tif ( rx > maxx ) maxx = rx;\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tconst hy = triangleBounds[ i + 3 ];\n\t\tconst ly = cy - hy;\n\t\tconst ry = cy + hy;\n\t\tif ( ly < miny ) miny = ly;\n\t\tif ( ry > maxy ) maxy = ry;\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tconst hz = triangleBounds[ i + 5 ];\n\t\tconst lz = cz - hz;\n\t\tconst rz = cz + hz;\n\t\tif ( lz < minz ) minz = lz;\n\t\tif ( rz > maxz ) maxz = rz;\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\ttarget[ 0 ] = minx;\n\ttarget[ 1 ] = miny;\n\ttarget[ 2 ] = minz;\n\n\ttarget[ 3 ] = maxx;\n\ttarget[ 4 ] = maxy;\n\ttarget[ 5 ] = maxz;\n\n\tif ( includeCentroid ) {\n\n\t\tcentroidTarget[ 0 ] = cminx;\n\t\tcentroidTarget[ 1 ] = cminy;\n\t\tcentroidTarget[ 2 ] = cminz;\n\n\t\tcentroidTarget[ 3 ] = cmaxx;\n\t\tcentroidTarget[ 4 ] = cmaxy;\n\t\tcentroidTarget[ 5 ] = cmaxz;\n\n\t}\n\n}\n\n// A stand alone function for retrieving the centroid bounds.\nexport function getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tif ( cx < cminx ) cminx = cx;\n\t\tif ( cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tif ( cy < cminy ) cminy = cy;\n\t\tif ( cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tif ( cz < cminz ) cminz = cz;\n\t\tif ( cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\tcentroidTarget[ 0 ] = cminx;\n\tcentroidTarget[ 1 ] = cminy;\n\tcentroidTarget[ 2 ] = cminz;\n\n\tcentroidTarget[ 3 ] = cmaxx;\n\tcentroidTarget[ 4 ] = cmaxy;\n\tcentroidTarget[ 5 ] = cmaxz;\n\n}\n\n\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\n// result is an array of size tris.length * 6 where triangle i maps to a\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\n// representing the center and half-extent in each dimension of triangle i\nexport function computeTriangleBounds( geo, fullBounds ) {\n\n\t// clear the bounds to empty\n\tmakeEmptyBounds( fullBounds );\n\n\tconst posAttr = geo.attributes.position;\n\tconst index = geo.index ? geo.index.array : null;\n\tconst triCount = getTriCount( geo );\n\tconst triangleBounds = new Float32Array( triCount * 6 );\n\tconst normalized = posAttr.normalized;\n\n\t// used for non-normalized positions\n\tconst posArr = posAttr.array;\n\n\t// support for an interleaved position buffer\n\tconst bufferOffset = posAttr.offset || 0;\n\tlet stride = 3;\n\tif ( posAttr.isInterleavedBufferAttribute ) {\n\n\t\tstride = posAttr.data.stride;\n\n\t}\n\n\t// used for normalized positions\n\tconst getters = [ 'getX', 'getY', 'getZ' ];\n\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\n\n\t\tconst tri3 = tri * 3;\n\t\tconst tri6 = tri * 6;\n\n\t\tlet ai = tri3 + 0;\n\t\tlet bi = tri3 + 1;\n\t\tlet ci = tri3 + 2;\n\n\t\tif ( index ) {\n\n\t\t\tai = index[ ai ];\n\t\t\tbi = index[ bi ];\n\t\t\tci = index[ ci ];\n\n\t\t}\n\n\t\t// we add the stride and offset here since we access the array directly\n\t\t// below for the sake of performance\n\t\tif ( ! normalized ) {\n\n\t\t\tai = ai * stride + bufferOffset;\n\t\t\tbi = bi * stride + bufferOffset;\n\t\t\tci = ci * stride + bufferOffset;\n\n\t\t}\n\n\t\tfor ( let el = 0; el < 3; el ++ ) {\n\n\t\t\tlet a, b, c;\n\n\t\t\tif ( normalized ) {\n\n\t\t\t\ta = posAttr[ getters[ el ] ]( ai );\n\t\t\t\tb = posAttr[ getters[ el ] ]( bi );\n\t\t\t\tc = posAttr[ getters[ el ] ]( ci );\n\n\t\t\t} else {\n\n\t\t\t\ta = posArr[ ai + el ];\n\t\t\t\tb = posArr[ bi + el ];\n\t\t\t\tc = posArr[ ci + el ];\n\n\t\t\t}\n\n\t\t\tlet min = a;\n\t\t\tif ( b < min ) min = b;\n\t\t\tif ( c < min ) min = c;\n\n\t\t\tlet max = a;\n\t\t\tif ( b > max ) max = b;\n\t\t\tif ( c > max ) max = c;\n\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\n\t\t\t// worked with.\n\t\t\tconst halfExtents = ( max - min ) / 2;\n\t\t\tconst el2 = el * 2;\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\n\n\t\t\tif ( min < fullBounds[ el ] ) fullBounds[ el ] = min;\n\t\t\tif ( max > fullBounds[ el + 3 ] ) fullBounds[ el + 3 ] = max;\n\n\t\t}\n\n\t}\n\n\treturn triangleBounds;\n\n}\n","export function arrayToBox( nodeIndex32, array, target ) {\n\n\ttarget.min.x = array[ nodeIndex32 ];\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\n\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\n\n\treturn target;\n\n}\n\nexport function makeEmptyBounds( target ) {\n\n\ttarget[ 0 ] = target[ 1 ] = target[ 2 ] = Infinity;\n\ttarget[ 3 ] = target[ 4 ] = target[ 5 ] = - Infinity;\n\n}\n\nexport function getLongestEdgeIndex( bounds ) {\n\n\tlet splitDimIdx = - 1;\n\tlet splitDist = - Infinity;\n\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\n\t\tif ( dist > splitDist ) {\n\n\t\t\tsplitDist = dist;\n\t\t\tsplitDimIdx = i;\n\n\t\t}\n\n\t}\n\n\treturn splitDimIdx;\n\n}\n\n// copies bounds a into bounds b\nexport function copyBounds( source, target ) {\n\n\ttarget.set( source );\n\n}\n\n// sets bounds target to the union of bounds a and b\nexport function unionBounds( a, b, target ) {\n\n\tlet aVal, bVal;\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst d3 = d + 3;\n\n\t\t// set the minimum values\n\t\taVal = a[ d ];\n\t\tbVal = b[ d ];\n\t\ttarget[ d ] = aVal < bVal ? aVal : bVal;\n\n\t\t// set the max values\n\t\taVal = a[ d3 ];\n\t\tbVal = b[ d3 ];\n\t\ttarget[ d3 ] = aVal > bVal ? aVal : bVal;\n\n\t}\n\n}\n\n// expands the given bounds by the provided triangle bounds\nexport function expandByTriangleBounds( startIndex, triangleBounds, bounds ) {\n\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst tCenter = triangleBounds[ startIndex + 2 * d ];\n\t\tconst tHalf = triangleBounds[ startIndex + 2 * d + 1 ];\n\n\t\tconst tMin = tCenter - tHalf;\n\t\tconst tMax = tCenter + tHalf;\n\n\t\tif ( tMin < bounds[ d ] ) {\n\n\t\t\tbounds[ d ] = tMin;\n\n\t\t}\n\n\t\tif ( tMax > bounds[ d + 3 ] ) {\n\n\t\t\tbounds[ d + 3 ] = tMax;\n\n\t\t}\n\n\t}\n\n}\n\n// compute bounds surface area\nexport function computeSurfaceArea( bounds ) {\n\n\tconst d0 = bounds[ 3 ] - bounds[ 0 ];\n\tconst d1 = bounds[ 4 ] - bounds[ 1 ];\n\tconst d2 = bounds[ 5 ] - bounds[ 2 ];\n\n\treturn 2 * ( d0 * d1 + d1 * d2 + d2 * d0 );\n\n}\n","import { getLongestEdgeIndex, computeSurfaceArea, copyBounds, unionBounds, expandByTriangleBounds } from '../../utils/ArrayBoxUtilities.js';\nimport { CENTER, AVERAGE, SAH, TRIANGLE_INTERSECT_COST, TRAVERSAL_COST } from '../Constants.js';\n\nconst BIN_COUNT = 32;\nconst binsSort = ( a, b ) => a.candidate - b.candidate;\nconst sahBins = new Array( BIN_COUNT ).fill().map( () => {\n\n\treturn {\n\n\t\tcount: 0,\n\t\tbounds: new Float32Array( 6 ),\n\t\trightCacheBounds: new Float32Array( 6 ),\n\t\tleftCacheBounds: new Float32Array( 6 ),\n\t\tcandidate: 0,\n\n\t};\n\n} );\nconst leftBounds = new Float32Array( 6 );\n\nexport function getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, offset, count, strategy ) {\n\n\tlet axis = - 1;\n\tlet pos = 0;\n\n\t// Center\n\tif ( strategy === CENTER ) {\n\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\n\n\t\t}\n\n\t} else if ( strategy === AVERAGE ) {\n\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\n\n\t\t}\n\n\t} else if ( strategy === SAH ) {\n\n\t\tconst rootSurfaceArea = computeSurfaceArea( nodeBoundingData );\n\t\tlet bestCost = TRIANGLE_INTERSECT_COST * count;\n\n\t\t// iterate over all axes\n\t\tconst cStart = offset * 6;\n\t\tconst cEnd = ( offset + count ) * 6;\n\t\tfor ( let a = 0; a < 3; a ++ ) {\n\n\t\t\tconst axisLeft = centroidBoundingData[ a ];\n\t\t\tconst axisRight = centroidBoundingData[ a + 3 ];\n\t\t\tconst axisLength = axisRight - axisLeft;\n\t\t\tconst binWidth = axisLength / BIN_COUNT;\n\n\t\t\t// If we have fewer triangles than we're planning to split then just check all\n\t\t\t// the triangle positions because it will be faster.\n\t\t\tif ( count < BIN_COUNT / 4 ) {\n\n\t\t\t\t// initialize the bin candidates\n\t\t\t\tconst truncatedBins = [ ...sahBins ];\n\t\t\t\ttruncatedBins.length = count;\n\n\t\t\t\t// set the candidates\n\t\t\t\tlet b = 0;\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6, b ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ b ];\n\t\t\t\t\tbin.candidate = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tbin.count = 0;\n\n\t\t\t\t\tconst {\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\tleftCacheBounds,\n\t\t\t\t\t\trightCacheBounds,\n\t\t\t\t\t} = bin;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\trightCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\trightCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tleftCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\tleftCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bounds );\n\n\t\t\t\t}\n\n\t\t\t\ttruncatedBins.sort( binsSort );\n\n\t\t\t\t// remove redundant splits\n\t\t\t\tlet splitCount = count;\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\twhile ( bi + 1 < splitCount && truncatedBins[ bi + 1 ].candidate === bin.candidate ) {\n\n\t\t\t\t\t\ttruncatedBins.splice( bi + 1, 1 );\n\t\t\t\t\t\tsplitCount --;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// find the appropriate bin for each triangle and expand the bounds.\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst center = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\t\tif ( center >= bin.candidate ) {\n\n\t\t\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.rightCacheBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.leftCacheBounds );\n\t\t\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// expand all the bounds\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\tconst leftCount = bin.count;\n\t\t\t\t\tconst rightCount = count - bin.count;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tconst leftBounds = bin.leftCacheBounds;\n\t\t\t\t\tconst rightBounds = bin.rightCacheBounds;\n\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = computeSurfaceArea( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet rightProb = 0;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = computeSurfaceArea( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = TRAVERSAL_COST + TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// reset the bins\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tbin.count = 0;\n\t\t\t\t\tbin.candidate = axisLeft + binWidth + i * binWidth;\n\n\t\t\t\t\tconst bounds = bin.bounds;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over all center positions\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst triCenter = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tconst relativeCenter = triCenter - axisLeft;\n\n\t\t\t\t\t// in the partition function if the centroid lies on the split plane then it is\n\t\t\t\t\t// considered to be on the right side of the split\n\t\t\t\t\tlet binIndex = ~ ~ ( relativeCenter / binWidth );\n\t\t\t\t\tif ( binIndex >= BIN_COUNT ) binIndex = BIN_COUNT - 1;\n\n\t\t\t\t\tconst bin = sahBins[ binIndex ];\n\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\texpandByTriangleBounds( c, triangleBounds, bin.bounds );\n\n\t\t\t\t}\n\n\t\t\t\t// cache the unioned bounds from right to left so we don't have to regenerate them each time\n\t\t\t\tconst lastBin = sahBins[ BIN_COUNT - 1 ];\n\t\t\t\tcopyBounds( lastBin.bounds, lastBin.rightCacheBounds );\n\t\t\t\tfor ( let i = BIN_COUNT - 2; i >= 0; i -- ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\tunionBounds( bin.bounds, nextBin.rightCacheBounds, bin.rightCacheBounds );\n\n\t\t\t\t}\n\n\t\t\t\tlet leftCount = 0;\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT - 1; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst binCount = bin.count;\n\t\t\t\t\tconst bounds = bin.bounds;\n\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\tconst rightBounds = nextBin.rightCacheBounds;\n\n\t\t\t\t\t// don't do anything with the bounds if the new bounds have no triangles\n\t\t\t\t\tif ( binCount !== 0 ) {\n\n\t\t\t\t\t\tif ( leftCount === 0 ) {\n\n\t\t\t\t\t\t\tcopyBounds( bounds, leftBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tunionBounds( bounds, leftBounds, leftBounds );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tleftCount += binCount;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tlet rightProb = 0;\n\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = computeSurfaceArea( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst rightCount = count - leftCount;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = computeSurfaceArea( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = TRAVERSAL_COST + TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\tconsole.warn( `MeshBVH: Invalid build strategy value ${ strategy } used.` );\n\n\t}\n\n\treturn { axis, pos };\n\n}\n\n// returns the average coordinate on the specified axis of the all the provided triangles\nfunction getAverage( triangleBounds, offset, count, axis ) {\n\n\tlet avg = 0;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\n\n\t}\n\n\treturn avg / count;\n\n}\n","export class MeshBVHNode {\n\n\tconstructor() {\n\n\t\t// internal nodes have boundingData, left, right, and splitAxis\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\n\n\t}\n\n}\n","/********************************************************/\n/* This file is generated from \"sortUtils.template.js\". */\n/********************************************************/\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction partition( indirectBuffer, index, triangleBounds, offset, count, split ) {\n\n\tlet left = offset;\n\tlet right = offset + count - 1;\n\tconst pos = split.pos;\n\tconst axisOffset = split.axis * 2;\n\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n\twhile ( true ) {\n\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\n\n\t\t\tleft ++;\n\n\t\t}\n\n\t\t// if a triangle center lies on the partition plane it is considered to be on the right side\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\n\n\t\t\tright --;\n\n\t\t}\n\n\t\tif ( left < right ) {\n\n\t\t\t// we need to swap all of the information associated with the triangles at index\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\n\t\t\t// and perhaps the SAH planes\n\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\tlet t0 = index[ left * 3 + i ];\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\n\t\t\t\tindex[ right * 3 + i ] = t0;\n\n\t\t\t}\n\n\n\t\t\t// swap bounds\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tlet tb = triangleBounds[ left * 6 + i ];\n\t\t\t\ttriangleBounds[ left * 6 + i ] = triangleBounds[ right * 6 + i ];\n\t\t\t\ttriangleBounds[ right * 6 + i ] = tb;\n\n\t\t\t}\n\n\t\t\tleft ++;\n\t\t\tright --;\n\n\t\t} else {\n\n\t\t\treturn left;\n\n\t\t}\n\n\t}\n\n}\n\nexport { partition };\n","/********************************************************/\n/* This file is generated from \"sortUtils.template.js\". */\n/********************************************************/\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction partition_indirect( indirectBuffer, index, triangleBounds, offset, count, split ) {\n\n\tlet left = offset;\n\tlet right = offset + count - 1;\n\tconst pos = split.pos;\n\tconst axisOffset = split.axis * 2;\n\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n\twhile ( true ) {\n\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\n\n\t\t\tleft ++;\n\n\t\t}\n\n\t\t// if a triangle center lies on the partition plane it is considered to be on the right side\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\n\n\t\t\tright --;\n\n\t\t}\n\n\t\tif ( left < right ) {\n\n\t\t\t// we need to swap all of the information associated with the triangles at index\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\n\t\t\t// and perhaps the SAH planes\n\t\t\tlet t = indirectBuffer[ left ];\n\t\t\tindirectBuffer[ left ] = indirectBuffer[ right ];\n\t\t\tindirectBuffer[ right ] = t;\n\n\n\t\t\t// swap bounds\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tlet tb = triangleBounds[ left * 6 + i ];\n\t\t\t\ttriangleBounds[ left * 6 + i ] = triangleBounds[ right * 6 + i ];\n\t\t\t\ttriangleBounds[ right * 6 + i ] = tb;\n\n\t\t\t}\n\n\t\t\tleft ++;\n\t\t\tright --;\n\n\t\t} else {\n\n\t\t\treturn left;\n\n\t\t}\n\n\t}\n\n}\n\nexport { partition_indirect };\n","import { Vector3, Matrix4, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { ExtendedTriangle } from './ExtendedTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox {\n\n\tconstructor( min, max, matrix ) {\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.min = new Vector3();\n\t\tthis.max = new Vector3();\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.needsUpdate = false;\n\n\t\tif ( min ) this.min.copy( min );\n\t\tif ( max ) this.max.copy( max );\n\t\tif ( matrix ) this.matrix.copy( matrix );\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\t\tthis.matrix.copy( matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.min.copy( other.min );\n\t\tthis.max.copy( other.max );\n\t\tthis.matrix.copy( other.matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\t\tthis.needsUpdate = false;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\t// TODO: should this be doing SAT against the AABB?\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new ExtendedTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! triangle.isExtendedTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\t// early out if we find a value below threshold\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","import { Vector3 } from 'three';\n\nexport class SeparatingAxisBounds {\n\n\tconstructor() {\n\n\t\tthis.min = Infinity;\n\t\tthis.max = - Infinity;\n\n\t}\n\n\tsetFromPointsField( points, field ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = p[ field ];\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tsetFromPoints( axis, points ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = axis.dot( p );\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tisSeparated( other ) {\n\n\t\treturn this.min > other.max || other.min > this.max;\n\n\t}\n\n}\n\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\n\n\tconst p = new Vector3();\n\treturn function setFromBox( axis, box ) {\n\n\t\tconst boxMin = box.min;\n\t\tconst boxMax = box.max;\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\n\n\t\t\t\t\tconst val = axis.dot( p );\n\t\t\t\t\tmin = Math.min( val, min );\n\t\t\t\t\tmax = Math.max( val, max );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t};\n\n} )();\n\nexport const areIntersecting = ( function () {\n\n\tconst cacheSatBounds = new SeparatingAxisBounds();\n\treturn function areIntersecting( shape1, shape2 ) {\n\n\t\tconst points1 = shape1.points;\n\t\tconst satAxes1 = shape1.satAxes;\n\t\tconst satBounds1 = shape1.satBounds;\n\n\t\tconst points2 = shape2.points;\n\t\tconst satAxes2 = shape2.satAxes;\n\t\tconst satBounds2 = shape2.satBounds;\n\n\t\t// check axes of the first shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds1[ i ];\n\t\t\tconst sa = satAxes1[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check axes of the second shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds2[ i ];\n\t\t\tconst sa = satAxes2[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere, Plane } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\n\nconst ZERO_EPSILON = 1e-15;\nfunction isNearZero( value ) {\n\n\treturn Math.abs( value ) < ZERO_EPSILON;\n\n}\n\nexport class ExtendedTriangle extends Triangle {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isExtendedTriangle = true;\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.points = [ this.a, this.b, this.c ];\n\t\tthis.sphere = new Sphere();\n\t\tthis.plane = new Plane();\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphereIntersectTriangle( sphere, this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst a = this.a;\n\t\tconst b = this.b;\n\t\tconst c = this.c;\n\t\tconst points = this.points;\n\n\t\tconst satAxes = this.satAxes;\n\t\tconst satBounds = this.satBounds;\n\n\t\tconst axis0 = satAxes[ 0 ];\n\t\tconst sab0 = satBounds[ 0 ];\n\t\tthis.getNormal( axis0 );\n\t\tsab0.setFromPoints( axis0, points );\n\n\t\tconst axis1 = satAxes[ 1 ];\n\t\tconst sab1 = satBounds[ 1 ];\n\t\taxis1.subVectors( a, b );\n\t\tsab1.setFromPoints( axis1, points );\n\n\t\tconst axis2 = satAxes[ 2 ];\n\t\tconst sab2 = satBounds[ 2 ];\n\t\taxis2.subVectors( b, c );\n\t\tsab2.setFromPoints( axis2, points );\n\n\t\tconst axis3 = satAxes[ 3 ];\n\t\tconst sab3 = satBounds[ 3 ];\n\t\taxis3.subVectors( c, a );\n\t\tsab3.setFromPoints( axis3, points );\n\n\t\tthis.sphere.setFromPoints( this.points );\n\t\tthis.plane.setFromNormalAndCoplanarPoint( axis0, a );\n\t\tthis.needsUpdate = false;\n\n\t}\n\n}\n\nExtendedTriangle.prototype.closestPointToSegment = ( function () {\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\tconst edge = new Line3();\n\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\n\n\t\tconst { start, end } = segment;\n\t\tconst points = this.points;\n\t\tlet distSq;\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check the triangle edges\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst nexti = ( i + 1 ) % 3;\n\t\t\tedge.start.copy( points[ i ] );\n\t\t\tedge.end.copy( points[ nexti ] );\n\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\n\n\t\t\tdistSq = point1.distanceToSquared( point2 );\n\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check end points\n\t\tthis.closestPointToPoint( start, point1 );\n\t\tdistSq = start.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( start );\n\n\t\t}\n\n\t\tthis.closestPointToPoint( end, point1 );\n\t\tdistSq = end.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( end );\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n\nExtendedTriangle.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri2 = new ExtendedTriangle();\n\tconst arr1 = new Array( 3 );\n\tconst arr2 = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\tconst dir = new Vector3();\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst tempDir = new Vector3();\n\tconst edge = new Line3();\n\tconst edge1 = new Line3();\n\tconst edge2 = new Line3();\n\tconst tempPoint = new Vector3();\n\n\tfunction triIntersectPlane( tri, plane, targetEdge ) {\n\n\t\t// find the edge that intersects the other triangle plane\n\t\tconst points = tri.points;\n\t\tlet count = 0;\n\t\tlet startPointIntersection = - 1;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst { start, end } = edge;\n\t\t\tstart.copy( points[ i ] );\n\t\t\tend.copy( points[ ( i + 1 ) % 3 ] );\n\t\t\tedge.delta( dir );\n\n\t\t\tconst startIntersects = isNearZero( plane.distanceToPoint( start ) );\n\t\t\tif ( isNearZero( plane.normal.dot( dir ) ) && startIntersects ) {\n\n\t\t\t\t// if the edge lies on the plane then take the line\n\t\t\t\ttargetEdge.copy( edge );\n\t\t\t\tcount = 2;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\t// check if the start point is near the plane because \"intersectLine\" is not robust to that case\n\t\t\tconst doesIntersect = plane.intersectLine( edge, tempPoint );\n\t\t\tif ( ! doesIntersect && startIntersects ) {\n\n\t\t\t\ttempPoint.copy( start );\n\n\t\t\t}\n\n\t\t\t// ignore the end point\n\t\t\tif ( ( doesIntersect || startIntersects ) && ! isNearZero( tempPoint.distanceTo( end ) ) ) {\n\n\t\t\t\tif ( count <= 1 ) {\n\n\t\t\t\t\t// assign to the start or end point and save which index was snapped to\n\t\t\t\t\t// the start point if necessary\n\t\t\t\t\tconst point = count === 1 ? targetEdge.start : targetEdge.end;\n\t\t\t\t\tpoint.copy( tempPoint );\n\t\t\t\t\tif ( startIntersects ) {\n\n\t\t\t\t\t\tstartPointIntersection = count;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( count >= 2 ) {\n\n\t\t\t\t\t// if we're here that means that there must have been one point that had\n\t\t\t\t\t// snapped to the start point so replace it here\n\t\t\t\t\tconst point = startPointIntersection === 1 ? targetEdge.start : targetEdge.end;\n\t\t\t\t\tpoint.copy( tempPoint );\n\t\t\t\t\tcount = 2;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tcount ++;\n\t\t\t\tif ( count === 2 && startPointIntersection === - 1 ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn count;\n\n\t}\n\n\t// TODO: If the triangles are coplanar and intersecting the target is nonsensical. It should at least\n\t// be a line contained by both triangles if not a different special case somehow represented in the return result.\n\treturn function intersectsTriangle( other, target = null, suppressLog = false ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! other.isExtendedTriangle ) {\n\n\t\t\tsaTri2.copy( other );\n\t\t\tsaTri2.update();\n\t\t\tother = saTri2;\n\n\t\t} else if ( other.needsUpdate ) {\n\n\t\t\tother.update();\n\n\t\t}\n\n\t\tconst plane1 = this.plane;\n\t\tconst plane2 = other.plane;\n\n\t\tif ( Math.abs( plane1.normal.dot( plane2.normal ) ) > 1.0 - 1e-10 ) {\n\n\t\t\t// perform separating axis intersection test only for coplanar triangles\n\t\t\tconst satBounds1 = this.satBounds;\n\t\t\tconst satAxes1 = this.satAxes;\n\t\t\tarr2[ 0 ] = other.a;\n\t\t\tarr2[ 1 ] = other.b;\n\t\t\tarr2[ 2 ] = other.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds1[ i ];\n\t\t\t\tconst sa = satAxes1[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\tconst satBounds2 = other.satBounds;\n\t\t\tconst satAxes2 = other.satAxes;\n\t\t\tarr1[ 0 ] = this.a;\n\t\t\tarr1[ 1 ] = this.b;\n\t\t\tarr1[ 2 ] = this.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds2[ i ];\n\t\t\t\tconst sa = satAxes2[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\t// check crossed axes\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sa1 = satAxes1[ i ];\n\t\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\t\tconst sa2 = satAxes2[ i2 ];\n\t\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\n\t\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\n\t\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( target ) {\n\n\t\t\t\t// TODO find two points that intersect on the edges and make that the result\n\t\t\t\tif ( ! suppressLog ) {\n\n\t\t\t\t\tconsole.warn( 'ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.' );\n\n\t\t\t\t}\n\n\t\t\t\ttarget.start.set( 0, 0, 0 );\n\t\t\t\ttarget.end.set( 0, 0, 0 );\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// find the edge that intersects the other triangle plane\n\t\t\tconst count1 = triIntersectPlane( this, plane2, edge1 );\n\t\t\tif ( count1 === 1 && other.containsPoint( edge1.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.end );\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count1 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find the other triangles edge that intersects this plane\n\t\t\tconst count2 = triIntersectPlane( other, plane1, edge2 );\n\t\t\tif ( count2 === 1 && this.containsPoint( edge2.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge2.end );\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count2 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find swap the second edge so both lines are running the same direction\n\t\t\tedge1.delta( dir1 );\n\t\t\tedge2.delta( dir2 );\n\n\t\t\tif ( dir1.dot( dir2 ) < 0 ) {\n\n\t\t\t\tlet tmp = edge2.start;\n\t\t\t\tedge2.start = edge2.end;\n\t\t\t\tedge2.end = tmp;\n\n\t\t\t}\n\n\t\t\t// check if the edges are overlapping\n\t\t\tconst s1 = edge1.start.dot( dir1 );\n\t\t\tconst e1 = edge1.end.dot( dir1 );\n\t\t\tconst s2 = edge2.start.dot( dir1 );\n\t\t\tconst e2 = edge2.end.dot( dir1 );\n\t\t\tconst separated1 = e1 < s2;\n\t\t\tconst separated2 = s1 < e2;\n\n\t\t\tif ( s1 !== e2 && s2 !== e1 && separated1 === separated2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// assign the target output\n\t\t\tif ( target ) {\n\n\t\t\t\ttempDir.subVectors( edge1.start, edge2.start );\n\t\t\t\tif ( tempDir.dot( dir1 ) > 0 ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.start );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.start.copy( edge2.start );\n\n\t\t\t\t}\n\n\t\t\t\ttempDir.subVectors( edge1.end, edge2.end );\n\t\t\t\tif ( tempDir.dot( dir1 ) < 0 ) {\n\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToTriangle = ( function () {\n\n\tconst point = new Vector3();\n\tconst point2 = new Vector3();\n\tconst cornerFields = [ 'a', 'b', 'c' ];\n\tconst line1 = new Line3();\n\tconst line2 = new Line3();\n\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\n\n\t\tconst lineTarget = target1 || target2 ? line1 : null;\n\t\tif ( this.intersectsTriangle( other, lineTarget ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tif ( target1 ) lineTarget.getCenter( target1 );\n\t\t\t\tif ( target2 ) lineTarget.getCenter( target2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check all point distances\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tlet dist;\n\t\t\tconst field = cornerFields[ i ];\n\t\t\tconst otherVec = other[ field ];\n\t\t\tthis.closestPointToPoint( otherVec, point );\n\n\t\t\tdist = otherVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\n\n\t\t\t}\n\n\n\t\t\tconst thisVec = this[ field ];\n\t\t\tother.closestPointToPoint( thisVec, point );\n\n\t\t\tdist = thisVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\n\t\t\t\tif ( target2 ) target2.copy( point );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst f11 = cornerFields[ i ];\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\n\n\t\t\t\tconst f21 = cornerFields[ i2 ];\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\n\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\n\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\n\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l1.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { ExtendedTriangle } from '../math/ExtendedTriangle.js';\nimport { PrimitivePool } from './PrimitivePool.js';\n\nclass ExtendedTrianglePoolBase extends PrimitivePool {\n\n\tconstructor() {\n\n\t\tsuper( () => new ExtendedTriangle() );\n\n\t}\n\n}\n\nexport const ExtendedTrianglePool = /* @__PURE__ */ new ExtendedTrianglePoolBase();\n","export class PrimitivePool {\n\n\tconstructor( getNewPrimitive ) {\n\n\t\tthis._getNewPrimitive = getNewPrimitive;\n\t\tthis._primitives = [];\n\n\t}\n\n\tgetPrimitive() {\n\n\t\tconst primitives = this._primitives;\n\t\tif ( primitives.length === 0 ) {\n\n\t\t\treturn this._getNewPrimitive();\n\n\t\t} else {\n\n\t\t\treturn primitives.pop();\n\n\t\t}\n\n\t}\n\n\treleasePrimitive( primitive ) {\n\n\t\tthis._primitives.push( primitive );\n\n\t}\n\n}\n","import { Box3 } from 'three';\nimport { CONTAINED } from '../Constants.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { PrimitivePool } from '../../utils/PrimitivePool.js';\nimport { COUNT, OFFSET, LEFT_NODE, RIGHT_NODE, IS_LEAF, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\nlet _box1, _box2;\nconst boxStack = [];\nconst boxPool = /* @__PURE__ */ new PrimitivePool( () => new Box3() );\n\nexport function shapecast( bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ) {\n\n\t// setup\n\t_box1 = boxPool.getPrimitive();\n\t_box2 = boxPool.getPrimitive();\n\tboxStack.push( _box1, _box2 );\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\n\tconst result = shapecastTraverse( 0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\n\t// cleanup\n\tBufferStack.clearBuffer();\n\tboxPool.releasePrimitive( _box1 );\n\tboxPool.releasePrimitive( _box2 );\n\tboxStack.pop();\n\tboxStack.pop();\n\n\tconst length = boxStack.length;\n\tif ( length > 0 ) {\n\n\t\t_box2 = boxStack[ length - 1 ];\n\t\t_box1 = boxStack[ length - 2 ];\n\n\t}\n\n\treturn result;\n\n}\n\nfunction shapecastTraverse(\n\tnodeIndex32,\n\tgeometry,\n\tintersectsBoundsFunc,\n\tintersectsRangeFunc,\n\tnodeScoreFunc = null,\n\tnodeIndexByteOffset = 0, // offset for unique node identifier\n\tdepth = 0\n) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, _box1 );\n\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndexByteOffset + nodeIndex32, _box1 );\n\n\t} else {\n\n\t\tconst left = LEFT_NODE( nodeIndex32 );\n\t\tconst right = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tlet c1 = left;\n\t\tlet c2 = right;\n\n\t\tlet score1, score2;\n\t\tlet box1, box2;\n\t\tif ( nodeScoreFunc ) {\n\n\t\t\tbox1 = _box1;\n\t\t\tbox2 = _box2;\n\n\t\t\t// bounding data is not offset\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 );\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 );\n\n\t\t\tscore1 = nodeScoreFunc( box1 );\n\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\tc1 = right;\n\t\t\t\tc2 = left;\n\n\t\t\t\tconst temp = score1;\n\t\t\t\tscore1 = score2;\n\t\t\t\tscore2 = temp;\n\n\t\t\t\tbox1 = box2;\n\t\t\t\t// box2 is always set before use below\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Check box 1 intersection\n\t\tif ( ! box1 ) {\n\n\t\t\tbox1 = _box1;\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 );\n\n\t\t}\n\n\t\tconst isC1Leaf = IS_LEAF( c1 * 2, uint16Array );\n\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\n\n\t\tlet c1StopTraversal;\n\t\tif ( c1Intersection === CONTAINED ) {\n\n\t\t\tconst offset = getLeftOffset( c1 );\n\t\t\tconst end = getRightEndOffset( c1 );\n\t\t\tconst count = end - offset;\n\n\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1, box1 );\n\n\t\t} else {\n\n\t\t\tc1StopTraversal =\n\t\t\t\tc1Intersection &&\n\t\t\t\tshapecastTraverse(\n\t\t\t\t\tc1,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\tdepth + 1\n\t\t\t\t);\n\n\t\t}\n\n\t\tif ( c1StopTraversal ) return true;\n\n\t\t// Check box 2 intersection\n\t\t// cached box2 will have been overwritten by previous traversal\n\t\tbox2 = _box2;\n\t\tarrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 );\n\n\t\tconst isC2Leaf = IS_LEAF( c2 * 2, uint16Array );\n\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\n\n\t\tlet c2StopTraversal;\n\t\tif ( c2Intersection === CONTAINED ) {\n\n\t\t\tconst offset = getLeftOffset( c2 );\n\t\t\tconst end = getRightEndOffset( c2 );\n\t\t\tconst count = end - offset;\n\n\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2, box2 );\n\n\t\t} else {\n\n\t\t\tc2StopTraversal =\n\t\t\t\tc2Intersection &&\n\t\t\t\tshapecastTraverse(\n\t\t\t\t\tc2,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\tdepth + 1\n\t\t\t\t);\n\n\t\t}\n\n\t\tif ( c2StopTraversal ) return true;\n\n\t\treturn false;\n\n\t\t// Define these inside the function so it has access to the local variables needed\n\t\t// when converting to the buffer equivalents\n\t\tfunction getLeftOffset( nodeIndex32 ) {\n\n\t\t\tconst { uint16Array, uint32Array } = BufferStack;\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! IS_LEAF( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\tnodeIndex32 = LEFT_NODE( nodeIndex32 );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\treturn OFFSET( nodeIndex32, uint32Array );\n\n\t\t}\n\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\n\n\t\t\tconst { uint16Array, uint32Array } = BufferStack;\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! IS_LEAF( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\t// adjust offset to point to the right node\n\t\t\t\tnodeIndex32 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\t// return the end offset of the triangle range\n\t\t\treturn OFFSET( nodeIndex32, uint32Array ) + COUNT( nodeIndex16, uint16Array );\n\n\t\t}\n\n\t}\n\n}\n","export function IS_LEAF( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 15 ] === 0xFFFF;\n\n}\n\nexport function OFFSET( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nexport function COUNT( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 14 ];\n\n}\n\nexport function LEFT_NODE( n32 ) {\n\n\treturn n32 + 8;\n\n}\n\nexport function RIGHT_NODE( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nexport function SPLIT_AXIS( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 7 ];\n\n}\n\nexport function BOUNDING_DATA_INDEX( n32 ) {\n\n\treturn n32;\n\n}\n","class _BufferStack {\n\n\tconstructor() {\n\n\t\tthis.float32Array = null;\n\t\tthis.uint16Array = null;\n\t\tthis.uint32Array = null;\n\n\t\tconst stack = [];\n\t\tlet prevBuffer = null;\n\t\tthis.setBuffer = buffer => {\n\n\t\t\tif ( prevBuffer ) {\n\n\t\t\t\tstack.push( prevBuffer );\n\n\t\t\t}\n\n\t\t\tprevBuffer = buffer;\n\t\t\tthis.float32Array = new Float32Array( buffer );\n\t\t\tthis.uint16Array = new Uint16Array( buffer );\n\t\t\tthis.uint32Array = new Uint32Array( buffer );\n\n\t\t};\n\n\t\tthis.clearBuffer = () => {\n\n\t\t\tprevBuffer = null;\n\t\t\tthis.float32Array = null;\n\t\t\tthis.uint16Array = null;\n\t\t\tthis.uint32Array = null;\n\n\t\t\tif ( stack.length !== 0 ) {\n\n\t\t\t\tthis.setBuffer( stack.pop() );\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n}\n\nexport const BufferStack = new _BufferStack();\n","import { Vector3 } from 'three';\n\nconst temp = /* @__PURE__ */ new Vector3();\nconst temp1 = /* @__PURE__ */ new Vector3();\n\nexport function closestPointToPoint(\n\tbvh,\n\tpoint,\n\ttarget = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\t// early out if under minThreshold\n\t// skip checking if over maxThreshold\n\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t// returns Infinity if no value found\n\tconst minThresholdSq = minThreshold * minThreshold;\n\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\tlet closestDistanceSq = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tbvh.shapecast(\n\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t},\n\n\t\t\tintersectsTriangle: ( tri, triIndex ) => {\n\n\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\ttemp1.copy( temp );\n\t\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\t\tclosestDistanceTriIndex = triIndex;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tif ( closestDistanceSq === Infinity ) return null;\n\n\tconst closestDistance = Math.sqrt( closestDistanceSq );\n\n\tif ( ! target.point ) target.point = temp1.clone();\n\telse target.point.copy( temp1 );\n\ttarget.distance = closestDistance,\n\ttarget.faceIndex = closestDistanceTriIndex;\n\n\treturn target;\n\n}\n","import { intersectTri } from '../../utils/ThreeRayIntersectUtilities.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\n\n/*************************************************************/\n/* This file is generated from \"iterationUtils.template.js\". */\n/*************************************************************/\n/* eslint-disable indent */\n\nfunction intersectTris( bvh, side, ray, offset, count, intersections ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\n\t\tintersectTri( geometry, side, ray, i, intersections );\n\n\n\t}\n\n}\n\nfunction intersectClosestTri( bvh, side, ray, offset, count ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tlet dist = Infinity;\n\tlet res = null;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet intersection;\n\n\t\tintersection = intersectTri( geometry, side, ray, i );\n\n\n\t\tif ( intersection && intersection.distance < dist ) {\n\n\t\t\tres = intersection;\n\t\t\tdist = intersection.distance;\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\nfunction iterateOverTriangles(\n\toffset,\n\tcount,\n\tbvh,\n\tintersectsTriangleFunc,\n\tcontained,\n\tdepth,\n\ttriangle\n) {\n\n\tconst { geometry } = bvh;\n\tconst { index } = geometry;\n\tconst pos = geometry.attributes.position;\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\tlet tri;\n\n\t\ttri = i;\n\n\t\tsetTriangle( triangle, tri * 3, index, pos );\n\t\ttriangle.needsUpdate = true;\n\n\t\tif ( intersectsTriangleFunc( triangle, tri, contained, depth ) ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n\nexport { intersectClosestTri, intersectTris, iterateOverTriangles };\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\n\n// Ripped and modified From THREE.js Mesh raycast\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\nconst _vA = /* @__PURE__ */ new Vector3();\nconst _vB = /* @__PURE__ */ new Vector3();\nconst _vC = /* @__PURE__ */ new Vector3();\n\nconst _uvA = /* @__PURE__ */ new Vector2();\nconst _uvB = /* @__PURE__ */ new Vector2();\nconst _uvC = /* @__PURE__ */ new Vector2();\n\nconst _normalA = /* @__PURE__ */ new Vector3();\nconst _normalB = /* @__PURE__ */ new Vector3();\nconst _normalC = /* @__PURE__ */ new Vector3();\n\nconst _intersectionPoint = /* @__PURE__ */ new Vector3();\nfunction checkIntersection( ray, pA, pB, pC, point, side ) {\n\n\tlet intersect;\n\tif ( side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, side !== DoubleSide, point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\tconst distance = ray.origin.distanceTo( point );\n\n\treturn {\n\n\t\tdistance: distance,\n\t\tpoint: point.clone(),\n\n\t};\n\n}\n\nfunction checkBufferGeometryIntersection( ray, position, normal, uv, uv1, a, b, c, side ) {\n\n\t_vA.fromBufferAttribute( position, a );\n\t_vB.fromBufferAttribute( position, b );\n\t_vC.fromBufferAttribute( position, c );\n\n\tconst intersection = checkIntersection( ray, _vA, _vB, _vC, _intersectionPoint, side );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv, a );\n\t\t\t_uvB.fromBufferAttribute( uv, b );\n\t\t\t_uvC.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv1, a );\n\t\t\t_uvB.fromBufferAttribute( uv1, b );\n\t\t\t_uvC.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _normalA, _normalB, _normalC, new Vector3() );\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA, _vB, _vC, face.normal );\n\n\t\tintersection.face = face;\n\t\tintersection.faceIndex = a;\n\n\t}\n\n\treturn intersection;\n\n}\n\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\nfunction intersectTri( geo, side, ray, tri, intersections ) {\n\n\tconst triOffset = tri * 3;\n\tlet a = triOffset + 0;\n\tlet b = triOffset + 1;\n\tlet c = triOffset + 2;\n\n\tconst index = geo.index;\n\tif ( geo.index ) {\n\n\t\ta = index.getX( a );\n\t\tb = index.getX( b );\n\t\tc = index.getX( c );\n\n\t}\n\n\tconst { position, normal, uv, uv1 } = geo.attributes;\n\tconst intersection = checkBufferGeometryIntersection( ray, position, normal, uv, uv1, a, b, c, side );\n\n\tif ( intersection ) {\n\n\t\tintersection.faceIndex = tri;\n\t\tif ( intersections ) intersections.push( intersection );\n\t\treturn intersection;\n\n\t}\n\n\treturn null;\n\n}\n\nexport { intersectTri };\n","\nimport { Vector2, Vector3, Triangle } from 'three';\n\n// sets the vertices of triangle `tri` with the 3 vertices after i\nexport function setTriangle( tri, i, index, pos ) {\n\n\tconst ta = tri.a;\n\tconst tb = tri.b;\n\tconst tc = tri.c;\n\n\tlet i0 = i;\n\tlet i1 = i + 1;\n\tlet i2 = i + 2;\n\tif ( index ) {\n\n\t\ti0 = index.getX( i0 );\n\t\ti1 = index.getX( i1 );\n\t\ti2 = index.getX( i2 );\n\n\t}\n\n\tta.x = pos.getX( i0 );\n\tta.y = pos.getY( i0 );\n\tta.z = pos.getZ( i0 );\n\n\ttb.x = pos.getX( i1 );\n\ttb.y = pos.getY( i1 );\n\ttb.z = pos.getZ( i1 );\n\n\ttc.x = pos.getX( i2 );\n\ttc.y = pos.getY( i2 );\n\ttc.z = pos.getZ( i2 );\n\n}\n\nconst tempV1 = /* @__PURE__ */ new Vector3();\nconst tempV2 = /* @__PURE__ */ new Vector3();\nconst tempV3 = /* @__PURE__ */ new Vector3();\nconst tempUV1 = /* @__PURE__ */ new Vector2();\nconst tempUV2 = /* @__PURE__ */ new Vector2();\nconst tempUV3 = /* @__PURE__ */ new Vector2();\n\nexport function getTriangleHitPointInfo( point, geometry, triangleIndex, target ) {\n\n\tconst indices = geometry.getIndex().array;\n\tconst positions = geometry.getAttribute( 'position' );\n\tconst uvs = geometry.getAttribute( 'uv' );\n\n\tconst a = indices[ triangleIndex * 3 ];\n\tconst b = indices[ triangleIndex * 3 + 1 ];\n\tconst c = indices[ triangleIndex * 3 + 2 ];\n\n\ttempV1.fromBufferAttribute( positions, a );\n\ttempV2.fromBufferAttribute( positions, b );\n\ttempV3.fromBufferAttribute( positions, c );\n\n\t// find the associated material index\n\tlet materialIndex = 0;\n\tconst groups = geometry.groups;\n\tconst firstVertexIndex = triangleIndex * 3;\n\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\t\tconst { start, count } = group;\n\t\tif ( firstVertexIndex >= start && firstVertexIndex < start + count ) {\n\n\t\t\tmaterialIndex = group.materialIndex;\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\t// extract uvs\n\tlet uv = null;\n\tif ( uvs ) {\n\n\t\ttempUV1.fromBufferAttribute( uvs, a );\n\t\ttempUV2.fromBufferAttribute( uvs, b );\n\t\ttempUV3.fromBufferAttribute( uvs, c );\n\n\t\tif ( target && target.uv ) uv = target.uv;\n\t\telse uv = new Vector2();\n\n\t\tTriangle.getInterpolation( point, tempV1, tempV2, tempV3, tempUV1, tempUV2, tempUV3, uv );\n\n\t}\n\n\t// adjust the provided target or create a new one\n\tif ( target ) {\n\n\t\tif ( ! target.face ) target.face = { };\n\t\ttarget.face.a = a;\n\t\ttarget.face.b = b;\n\t\ttarget.face.c = c;\n\t\ttarget.face.materialIndex = materialIndex;\n\t\tif ( ! target.face.normal ) target.face.normal = new Vector3();\n\t\tTriangle.getNormal( tempV1, tempV2, tempV3, target.face.normal );\n\n\t\tif ( uv ) target.uv = uv;\n\n\t\treturn target;\n\n\t} else {\n\n\t\treturn {\n\t\t\tface: {\n\t\t\t\ta: a,\n\t\t\t\tb: b,\n\t\t\t\tc: c,\n\t\t\t\tmaterialIndex: materialIndex,\n\t\t\t\tnormal: Triangle.getNormal( tempV1, tempV2, tempV3, new Vector3() )\n\t\t\t},\n\t\t\tuv: uv\n\t\t};\n\n\t}\n\n}\n","import { IS_LEAFNODE_FLAG } from '../Constants.js';\n\n/****************************************************/\n/* This file is generated from \"refit.template.js\". */\n/****************************************************/\n\nfunction refit( bvh, nodeIndices = null ) {\n\n\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\tnodeIndices = new Set( nodeIndices );\n\n\t}\n\n\tconst geometry = bvh.geometry;\n\tconst indexArr = geometry.index ? geometry.index.array : null;\n\tconst posAttr = geometry.attributes.position;\n\n\tlet buffer, uint32Array, uint16Array, float32Array;\n\tlet byteOffset = 0;\n\tconst roots = bvh._roots;\n\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\tbuffer = roots[ i ];\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t_traverse( 0, byteOffset );\n\t\tbyteOffset += buffer.byteLength;\n\n\t}\n\n\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\tconst node16Index = node32Index * 2;\n\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\tlet minx = Infinity;\n\t\t\tlet miny = Infinity;\n\t\t\tlet minz = Infinity;\n\t\t\tlet maxx = - Infinity;\n\t\t\tlet maxy = - Infinity;\n\t\t\tlet maxz = - Infinity;\n\n\n\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\tlet index = indexArr[ i ];\n\t\t\t\tconst x = posAttr.getX( index );\n\t\t\t\tconst y = posAttr.getY( index );\n\t\t\t\tconst z = posAttr.getZ( index );\n\n\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t}\n\n\n\t\t\tif (\n\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t) {\n\n\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = node32Index + 8;\n\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t// the identifying node indices provided by the shapecast function include offsets of all\n\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\tconst offsetRight = right + byteOffset;\n\t\t\tlet forceChildren = force;\n\t\t\tlet includesLeft = false;\n\t\t\tlet includesRight = false;\n\n\t\t\tif ( nodeIndices ) {\n\n\t\t\t\t// if we see that neither the left or right child are included in the set that need to be updated\n\t\t\t\t// then we assume that all children need to be updated.\n\t\t\t\tif ( ! forceChildren ) {\n\n\t\t\t\t\tincludesLeft = nodeIndices.has( offsetLeft );\n\t\t\t\t\tincludesRight = nodeIndices.has( offsetRight );\n\t\t\t\t\tforceChildren = ! includesLeft && ! includesRight;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tincludesLeft = true;\n\t\t\t\tincludesRight = true;\n\n\t\t\t}\n\n\t\t\tconst traverseLeft = forceChildren || includesLeft;\n\t\t\tconst traverseRight = forceChildren || includesRight;\n\n\t\t\tlet leftChange = false;\n\t\t\tif ( traverseLeft ) {\n\n\t\t\t\tleftChange = _traverse( left, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tlet rightChange = false;\n\t\t\tif ( traverseRight ) {\n\n\t\t\t\trightChange = _traverse( right, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tconst didChange = leftChange || rightChange;\n\t\t\tif ( didChange ) {\n\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn didChange;\n\n\t\t}\n\n\t}\n\n}\n\nexport { refit };\n","import { Vector3 } from 'three';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { IS_LEAF, OFFSET, COUNT, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectTris } from '../utils/iterationUtils.generated.js';\nimport '../utils/iterationUtils_indirect.generated.js';\n\n/******************************************************/\n/* This file is generated from \"raycast.template.js\". */\n/******************************************************/\n\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nfunction raycast( bvh, root, side, ray, intersects ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\t_raycast( 0, bvh, side, ray, intersects );\n\tBufferStack.clearBuffer();\n\n}\n\nfunction _raycast( nodeIndex32, bvh, side, ray, intersects ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tconst nodeIndex16 = nodeIndex32 * 2;\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\n\t\tintersectTris( bvh, side, ray, offset, count, intersects );\n\n\n\t} else {\n\n\t\tconst leftIndex = LEFT_NODE( nodeIndex32 );\n\t\tif ( intersectRay( leftIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( leftIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tif ( intersectRay( rightIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( rightIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycast };\n","import { Box3 } from 'three';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\n\nconst _boundingBox = /* @__PURE__ */ new Box3();\nexport function intersectRay( nodeIndex32, array, ray, target ) {\n\n\tarrayToBox( nodeIndex32, array, _boundingBox );\n\treturn ray.intersectBox( _boundingBox, target );\n\n}\n","import { Vector3 } from 'three';\nimport { IS_LEAF, OFFSET, COUNT, SPLIT_AXIS, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { intersectClosestTri } from '../utils/iterationUtils.generated.js';\nimport '../utils/iterationUtils_indirect.generated.js';\n\n/***********************************************************/\n/* This file is generated from \"raycastFirst.template.js\". */\n/***********************************************************/\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nconst _xyzFields = [ 'x', 'y', 'z' ];\nfunction raycastFirst( bvh, root, side, ray ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _raycastFirst( 0, bvh, side, ray );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _raycastFirst( nodeIndex32, bvh, side, ray ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\n\t\treturn intersectClosestTri( bvh, side, ray, offset, count );\n\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = SPLIT_AXIS( nodeIndex32, uint32Array );\n\t\tconst xyzAxis = _xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = LEFT_NODE( nodeIndex32 );\n\t\t\tc2 = RIGHT_NODE( nodeIndex32, uint32Array );\n\n\t\t} else {\n\n\t\t\tc1 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\tc2 = LEFT_NODE( nodeIndex32 );\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, _boxIntersection );\n\t\tconst c1Result = c1Intersection ? _raycastFirst( c1, bvh, side, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\t// \"point\" is in the local frame of the bvh\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, _boxIntersection );\n\t\tconst c2Result = c2Intersection ? _raycastFirst( c2, bvh, side, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycastFirst };\n","import { Box3, Matrix4 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { ExtendedTriangle } from '../../math/ExtendedTriangle.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { IS_LEAF, OFFSET, COUNT, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\n/*****************************************************************/\n/* This file is generated from \"intersectsGeometry.template.js\". */\n/*****************************************************************/\n/* eslint-disable indent */\n\nconst boundingBox = /* @__PURE__ */ new Box3();\nconst triangle = /* @__PURE__ */ new ExtendedTriangle();\nconst triangle2 = /* @__PURE__ */ new ExtendedTriangle();\nconst invertedMat = /* @__PURE__ */ new Matrix4();\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\n\nfunction intersectsGeometry( bvh, root, otherGeometry, geometryToBvh ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _intersectsGeometry( 0, bvh, otherGeometry, geometryToBvh );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _intersectsGeometry( nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tif ( cachedObb === null ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tcachedObb = obb;\n\n\t}\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst thisGeometry = bvh.geometry;\n\t\tconst thisIndex = thisGeometry.index;\n\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\tconst index = otherGeometry.index;\n\t\tconst pos = otherGeometry.attributes.position;\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t// here.\n\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t// if there's a bounds tree\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 );\n\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\tobb2.needsUpdate = true;\n\n\t\t\t// TODO: use a triangle iteration function here\n\t\t\tconst res = otherGeometry.boundsTree.shapecast( {\n\n\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.needsUpdate = true;\n\n\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\treturn res;\n\n\t\t} else {\n\n\t\t\t// if we're just dealing with raw geometry\n\n\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\n\n\n\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\n\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\n\t\t}\n\n\t} else {\n\n\t\tconst left = nodeIndex32 + 8;\n\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox );\n\t\tconst leftIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( left, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( leftIntersection ) return true;\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox );\n\t\tconst rightIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( right, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( rightIntersection ) return true;\n\n\t\treturn false;\n\n\t}\n\n}\n\nexport { intersectsGeometry };\n","import { Matrix4, Vector3 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { getTriCount } from '../build/geometryUtils.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/*********************************************************************/\n/* This file is generated from \"closestPointToGeometry.template.js\". */\n/*********************************************************************/\n\nconst tempMatrix = /* @__PURE__ */ new Matrix4();\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\nconst temp1 = /* @__PURE__ */ new Vector3();\nconst temp2 = /* @__PURE__ */ new Vector3();\nconst temp3 = /* @__PURE__ */ new Vector3();\nconst temp4 = /* @__PURE__ */ new Vector3();\n\nfunction closestPointToGeometry(\n\tbvh,\n\totherGeometry,\n\tgeometryToBvh,\n\ttarget1 = { },\n\ttarget2 = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\tif ( ! otherGeometry.boundingBox ) {\n\n\t\totherGeometry.computeBoundingBox();\n\n\t}\n\n\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\tobb.needsUpdate = true;\n\n\tconst geometry = bvh.geometry;\n\tconst pos = geometry.attributes.position;\n\tconst index = geometry.index;\n\tconst otherPos = otherGeometry.attributes.position;\n\tconst otherIndex = otherGeometry.index;\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tlet tempTarget1 = temp1;\n\tlet tempTargetDest1 = temp2;\n\tlet tempTarget2 = null;\n\tlet tempTargetDest2 = null;\n\n\tif ( target2 ) {\n\n\t\ttempTarget2 = temp3;\n\t\ttempTargetDest2 = temp4;\n\n\t}\n\n\tlet closestDistance = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tlet closestDistanceOtherTriIndex = null;\n\ttempMatrix.copy( geometryToBvh ).invert();\n\tobb2.matrix.copy( tempMatrix );\n\tbvh.shapecast(\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\treturn obb.distanceToBox( box );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\tif ( score < closestDistance && score < maxThreshold ) {\n\n\t\t\t\t\t// if we know the triangles of this bounds will be intersected next then\n\t\t\t\t\t// save the bounds to use during triangle checks.\n\t\t\t\t\tif ( isLeaf ) {\n\n\t\t\t\t\t\tobb2.min.copy( box.min );\n\t\t\t\t\t\tobb2.max.copy( box.max );\n\t\t\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\n\t\t\tintersectsRange: ( offset, count ) => {\n\n\t\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t\t// if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n\t\t\t\t\t// the closest bounds in the other geometry to check.\n\t\t\t\t\tconst otherBvh = otherGeometry.boundsTree;\n\t\t\t\t\treturn otherBvh.shapecast( {\n\t\t\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\t\t\treturn obb2.distanceToBox( box );\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsRange: ( otherOffset, otherCount ) => {\n\n\t\t\t\t\t\t\tfor ( let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2 ++ ) {\n\n\n\t\t\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\n\t\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\n\t\t\t\t\t\t\t\t\tsetTriangle( triangle, 3 * i, index, pos );\n\n\t\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// If no bounds tree then we'll just check every triangle.\n\t\t\t\t\tconst triCount = getTriCount( otherGeometry );\n\t\t\t\t\tfor ( let i2 = 0, l2 = triCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\n\t\t\t\t\t\t\tsetTriangle( triangle, 3 * i, index, pos );\n\n\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\n\tif ( closestDistance === Infinity ) {\n\n\t\treturn null;\n\n\t}\n\n\tif ( ! target1.point ) {\n\n\t\ttarget1.point = tempTargetDest1.clone();\n\n\t} else {\n\n\t\ttarget1.point.copy( tempTargetDest1 );\n\n\t}\n\n\ttarget1.distance = closestDistance,\n\ttarget1.faceIndex = closestDistanceTriIndex;\n\n\tif ( target2 ) {\n\n\t\tif ( ! target2.point ) target2.point = tempTargetDest2.clone();\n\t\telse target2.point.copy( tempTargetDest2 );\n\t\ttarget2.point.applyMatrix4( tempMatrix );\n\t\ttempTargetDest1.applyMatrix4( tempMatrix );\n\t\ttarget2.distance = tempTargetDest1.sub( target2.point ).length();\n\t\ttarget2.faceIndex = closestDistanceOtherTriIndex;\n\n\t}\n\n\treturn target1;\n\n}\n\nexport { closestPointToGeometry };\n","import { Matrix4, Box3 } from 'three';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/******************************************************/\n/* This file is generated from \"bvhcast.template.js\". */\n/******************************************************/\n\nconst tempMatrix = new Matrix4();\nconst aabb = /* @__PURE__ */ new Box3();\nconst aabb2 = /* @__PURE__ */ new Box3();\nfunction bvhcast( bvh, otherBvh, matrixToLocal, callbacks ) {\n\n\t// BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n\t// than an approach that walks down the tree (see bvhcast.js file for more info).\n\n\tlet {\n\t\tintersectsRanges,\n\t\tintersectsTriangles,\n\t} = callbacks;\n\n\tconst indexAttr = bvh.geometry.index;\n\tconst positionAttr = bvh.geometry.attributes.position;\n\n\tconst otherIndexAttr = otherBvh.geometry.index;\n\tconst otherPositionAttr = otherBvh.geometry.attributes.position;\n\n\ttempMatrix.copy( matrixToLocal ).invert();\n\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tif ( intersectsTriangles ) {\n\n\t\tconst iterateOverDoubleTriangles = ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) => {\n\n\t\t\tfor ( let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2 ++ ) {\n\n\n\t\t\t\tsetTriangle( triangle2, i2 * 3, otherIndexAttr, otherPositionAttr );\n\n\n\t\t\t\ttriangle2.a.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.b.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.c.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\tfor ( let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1 ++ ) {\n\n\n\t\t\t\t\tsetTriangle( triangle, i1 * 3, indexAttr, positionAttr );\n\n\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\tif ( intersectsTriangles( triangle, triangle2, i1, i2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t\tif ( intersectsRanges ) {\n\n\t\t\tconst originalIntersectsRanges = intersectsRanges;\n\t\t\tintersectsRanges = function ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\tif ( ! originalIntersectsRanges( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\treturn iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tintersectsRanges = iterateOverDoubleTriangles;\n\n\t\t}\n\n\t}\n\n\totherBvh.getBoundingBox( aabb2 );\n\taabb2.applyMatrix4( matrixToLocal );\n\tconst result = bvh.shapecast( {\n\n\t\tintersectsBounds: box => aabb2.intersectsBox( box ),\n\n\t\tintersectsRange: ( offset1, count1, contained, depth1, nodeIndex1, box ) => {\n\n\t\t\taabb.copy( box );\n\t\t\taabb.applyMatrix4( tempMatrix );\n\t\t\treturn otherBvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => aabb.intersectsBox( box ),\n\n\t\t\t\tintersectsRange: ( offset2, count2, contained, depth2, nodeIndex2 ) => {\n\n\t\t\t\t\treturn intersectsRanges( offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2 );\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t}\n\n\t} );\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\treturn result;\n\n}\n\nexport { bvhcast };\n","import { intersectTri } from '../../utils/ThreeRayIntersectUtilities.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\n\n/*************************************************************/\n/* This file is generated from \"iterationUtils.template.js\". */\n/*************************************************************/\n/* eslint-disable indent */\n\nfunction intersectTris_indirect( bvh, side, ray, offset, count, intersections ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet vi = _indirectBuffer ? _indirectBuffer[ i ] : i;\n\t\tintersectTri( geometry, side, ray, vi, intersections );\n\n\n\t}\n\n}\n\nfunction intersectClosestTri_indirect( bvh, side, ray, offset, count ) {\n\n\tconst { geometry, _indirectBuffer } = bvh;\n\tlet dist = Infinity;\n\tlet res = null;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tlet intersection;\n\t\tintersection = intersectTri( geometry, side, ray, _indirectBuffer ? _indirectBuffer[ i ] : i );\n\n\n\t\tif ( intersection && intersection.distance < dist ) {\n\n\t\t\tres = intersection;\n\t\t\tdist = intersection.distance;\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\nfunction iterateOverTriangles_indirect(\n\toffset,\n\tcount,\n\tbvh,\n\tintersectsTriangleFunc,\n\tcontained,\n\tdepth,\n\ttriangle\n) {\n\n\tconst { geometry } = bvh;\n\tconst { index } = geometry;\n\tconst pos = geometry.attributes.position;\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\tlet tri;\n\t\ttri = bvh.resolveTriangleIndex( i );\n\n\t\tsetTriangle( triangle, tri * 3, index, pos );\n\t\ttriangle.needsUpdate = true;\n\n\t\tif ( intersectsTriangleFunc( triangle, tri, contained, depth ) ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n\nexport { intersectClosestTri_indirect, intersectTris_indirect, iterateOverTriangles_indirect };\n","import { IS_LEAFNODE_FLAG } from '../Constants.js';\n\n/****************************************************/\n/* This file is generated from \"refit.template.js\". */\n/****************************************************/\n\nfunction refit_indirect( bvh, nodeIndices = null ) {\n\n\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\tnodeIndices = new Set( nodeIndices );\n\n\t}\n\n\tconst geometry = bvh.geometry;\n\tconst indexArr = geometry.index ? geometry.index.array : null;\n\tconst posAttr = geometry.attributes.position;\n\n\tlet buffer, uint32Array, uint16Array, float32Array;\n\tlet byteOffset = 0;\n\tconst roots = bvh._roots;\n\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\tbuffer = roots[ i ];\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t_traverse( 0, byteOffset );\n\t\tbyteOffset += buffer.byteLength;\n\n\t}\n\n\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\tconst node16Index = node32Index * 2;\n\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\tlet minx = Infinity;\n\t\t\tlet miny = Infinity;\n\t\t\tlet minz = Infinity;\n\t\t\tlet maxx = - Infinity;\n\t\t\tlet maxy = - Infinity;\n\t\t\tlet maxz = - Infinity;\n\n\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\tconst t = 3 * bvh.resolveTriangleIndex( i );\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\tlet index = t + j;\n\t\t\t\t\tindex = indexArr ? indexArr[ index ] : index;\n\n\t\t\t\t\tconst x = posAttr.getX( index );\n\t\t\t\t\tconst y = posAttr.getY( index );\n\t\t\t\t\tconst z = posAttr.getZ( index );\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tif (\n\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t) {\n\n\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = node32Index + 8;\n\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t// the identifying node indices provided by the shapecast function include offsets of all\n\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\tconst offsetRight = right + byteOffset;\n\t\t\tlet forceChildren = force;\n\t\t\tlet includesLeft = false;\n\t\t\tlet includesRight = false;\n\n\t\t\tif ( nodeIndices ) {\n\n\t\t\t\t// if we see that neither the left or right child are included in the set that need to be updated\n\t\t\t\t// then we assume that all children need to be updated.\n\t\t\t\tif ( ! forceChildren ) {\n\n\t\t\t\t\tincludesLeft = nodeIndices.has( offsetLeft );\n\t\t\t\t\tincludesRight = nodeIndices.has( offsetRight );\n\t\t\t\t\tforceChildren = ! includesLeft && ! includesRight;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tincludesLeft = true;\n\t\t\t\tincludesRight = true;\n\n\t\t\t}\n\n\t\t\tconst traverseLeft = forceChildren || includesLeft;\n\t\t\tconst traverseRight = forceChildren || includesRight;\n\n\t\t\tlet leftChange = false;\n\t\t\tif ( traverseLeft ) {\n\n\t\t\t\tleftChange = _traverse( left, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tlet rightChange = false;\n\t\t\tif ( traverseRight ) {\n\n\t\t\t\trightChange = _traverse( right, byteOffset, forceChildren );\n\n\t\t\t}\n\n\t\t\tconst didChange = leftChange || rightChange;\n\t\t\tif ( didChange ) {\n\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn didChange;\n\n\t\t}\n\n\t}\n\n}\n\nexport { refit_indirect };\n","import { Vector3 } from 'three';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport { IS_LEAF, OFFSET, COUNT, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport '../utils/iterationUtils.generated.js';\nimport { intersectTris_indirect } from '../utils/iterationUtils_indirect.generated.js';\n\n/******************************************************/\n/* This file is generated from \"raycast.template.js\". */\n/******************************************************/\n\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nfunction raycast_indirect( bvh, root, side, ray, intersects ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\t_raycast( 0, bvh, side, ray, intersects );\n\tBufferStack.clearBuffer();\n\n}\n\nfunction _raycast( nodeIndex32, bvh, side, ray, intersects ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tconst nodeIndex16 = nodeIndex32 * 2;\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\tintersectTris_indirect( bvh, side, ray, offset, count, intersects );\n\n\n\t} else {\n\n\t\tconst leftIndex = LEFT_NODE( nodeIndex32 );\n\t\tif ( intersectRay( leftIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( leftIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\tif ( intersectRay( rightIndex, float32Array, ray, _boxIntersection ) ) {\n\n\t\t\t_raycast( rightIndex, bvh, side, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycast_indirect };\n","import { Vector3 } from 'three';\nimport { IS_LEAF, OFFSET, COUNT, SPLIT_AXIS, LEFT_NODE, RIGHT_NODE } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\nimport { intersectRay } from '../utils/intersectUtils.js';\nimport '../utils/iterationUtils.generated.js';\nimport { intersectClosestTri_indirect } from '../utils/iterationUtils_indirect.generated.js';\n\n/***********************************************************/\n/* This file is generated from \"raycastFirst.template.js\". */\n/***********************************************************/\nconst _boxIntersection = /* @__PURE__ */ new Vector3();\nconst _xyzFields = [ 'x', 'y', 'z' ];\nfunction raycastFirst_indirect( bvh, root, side, ray ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _raycastFirst( 0, bvh, side, ray );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _raycastFirst( nodeIndex32, bvh, side, ray ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\treturn intersectClosestTri_indirect( bvh, side, ray, offset, count );\n\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = SPLIT_AXIS( nodeIndex32, uint32Array );\n\t\tconst xyzAxis = _xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = LEFT_NODE( nodeIndex32 );\n\t\t\tc2 = RIGHT_NODE( nodeIndex32, uint32Array );\n\n\t\t} else {\n\n\t\t\tc1 = RIGHT_NODE( nodeIndex32, uint32Array );\n\t\t\tc2 = LEFT_NODE( nodeIndex32 );\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, _boxIntersection );\n\t\tconst c1Result = c1Intersection ? _raycastFirst( c1, bvh, side, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\t// \"point\" is in the local frame of the bvh\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, _boxIntersection );\n\t\tconst c2Result = c2Intersection ? _raycastFirst( c2, bvh, side, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport { raycastFirst_indirect };\n","import { Box3, Matrix4 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { ExtendedTriangle } from '../../math/ExtendedTriangle.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { arrayToBox } from '../../utils/ArrayBoxUtilities.js';\nimport { IS_LEAF, OFFSET, COUNT, BOUNDING_DATA_INDEX } from '../utils/nodeBufferUtils.js';\nimport { BufferStack } from '../utils/BufferStack.js';\n\n/*****************************************************************/\n/* This file is generated from \"intersectsGeometry.template.js\". */\n/*****************************************************************/\n/* eslint-disable indent */\n\nconst boundingBox = /* @__PURE__ */ new Box3();\nconst triangle = /* @__PURE__ */ new ExtendedTriangle();\nconst triangle2 = /* @__PURE__ */ new ExtendedTriangle();\nconst invertedMat = /* @__PURE__ */ new Matrix4();\n\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\n\nfunction intersectsGeometry_indirect( bvh, root, otherGeometry, geometryToBvh ) {\n\n\tBufferStack.setBuffer( bvh._roots[ root ] );\n\tconst result = _intersectsGeometry( 0, bvh, otherGeometry, geometryToBvh );\n\tBufferStack.clearBuffer();\n\n\treturn result;\n\n}\n\nfunction _intersectsGeometry( nodeIndex32, bvh, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\tconst { float32Array, uint16Array, uint32Array } = BufferStack;\n\tlet nodeIndex16 = nodeIndex32 * 2;\n\n\tif ( cachedObb === null ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tcachedObb = obb;\n\n\t}\n\n\tconst isLeaf = IS_LEAF( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst thisGeometry = bvh.geometry;\n\t\tconst thisIndex = thisGeometry.index;\n\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\tconst index = otherGeometry.index;\n\t\tconst pos = otherGeometry.attributes.position;\n\n\t\tconst offset = OFFSET( nodeIndex32, uint32Array );\n\t\tconst count = COUNT( nodeIndex16, uint16Array );\n\n\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t// here.\n\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t// if there's a bounds tree\n\t\t\tarrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 );\n\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\tobb2.needsUpdate = true;\n\n\t\t\t// TODO: use a triangle iteration function here\n\t\t\tconst res = otherGeometry.boundsTree.shapecast( {\n\n\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri.needsUpdate = true;\n\n\t\t\t\t\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * bvh.resolveTriangleIndex( i ), thisIndex, thisPos );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\treturn res;\n\n\t\t} else {\n\n\t\t\t// if we're just dealing with raw geometry\n\t\t\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\tsetTriangle( triangle, 3 * ti, thisIndex, thisPos );\n\n\n\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\n\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t} else {\n\n\t\tconst left = nodeIndex32 + 8;\n\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox );\n\t\tconst leftIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( left, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( leftIntersection ) return true;\n\n\t\tarrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox );\n\t\tconst rightIntersection =\n\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t_intersectsGeometry( right, bvh, otherGeometry, geometryToBvh, cachedObb );\n\n\t\tif ( rightIntersection ) return true;\n\n\t\treturn false;\n\n\t}\n\n}\n\nexport { intersectsGeometry_indirect };\n","import { Matrix4, Vector3 } from 'three';\nimport { OrientedBox } from '../../math/OrientedBox.js';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { getTriCount } from '../build/geometryUtils.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/*********************************************************************/\n/* This file is generated from \"closestPointToGeometry.template.js\". */\n/*********************************************************************/\n\nconst tempMatrix = /* @__PURE__ */ new Matrix4();\nconst obb = /* @__PURE__ */ new OrientedBox();\nconst obb2 = /* @__PURE__ */ new OrientedBox();\nconst temp1 = /* @__PURE__ */ new Vector3();\nconst temp2 = /* @__PURE__ */ new Vector3();\nconst temp3 = /* @__PURE__ */ new Vector3();\nconst temp4 = /* @__PURE__ */ new Vector3();\n\nfunction closestPointToGeometry_indirect(\n\tbvh,\n\totherGeometry,\n\tgeometryToBvh,\n\ttarget1 = { },\n\ttarget2 = { },\n\tminThreshold = 0,\n\tmaxThreshold = Infinity,\n) {\n\n\tif ( ! otherGeometry.boundingBox ) {\n\n\t\totherGeometry.computeBoundingBox();\n\n\t}\n\n\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\tobb.needsUpdate = true;\n\n\tconst geometry = bvh.geometry;\n\tconst pos = geometry.attributes.position;\n\tconst index = geometry.index;\n\tconst otherPos = otherGeometry.attributes.position;\n\tconst otherIndex = otherGeometry.index;\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tlet tempTarget1 = temp1;\n\tlet tempTargetDest1 = temp2;\n\tlet tempTarget2 = null;\n\tlet tempTargetDest2 = null;\n\n\tif ( target2 ) {\n\n\t\ttempTarget2 = temp3;\n\t\ttempTargetDest2 = temp4;\n\n\t}\n\n\tlet closestDistance = Infinity;\n\tlet closestDistanceTriIndex = null;\n\tlet closestDistanceOtherTriIndex = null;\n\ttempMatrix.copy( geometryToBvh ).invert();\n\tobb2.matrix.copy( tempMatrix );\n\tbvh.shapecast(\n\t\t{\n\n\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\treturn obb.distanceToBox( box );\n\n\t\t\t},\n\n\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\tif ( score < closestDistance && score < maxThreshold ) {\n\n\t\t\t\t\t// if we know the triangles of this bounds will be intersected next then\n\t\t\t\t\t// save the bounds to use during triangle checks.\n\t\t\t\t\tif ( isLeaf ) {\n\n\t\t\t\t\t\tobb2.min.copy( box.min );\n\t\t\t\t\t\tobb2.max.copy( box.max );\n\t\t\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\n\t\t\tintersectsRange: ( offset, count ) => {\n\n\t\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t\t// if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n\t\t\t\t\t// the closest bounds in the other geometry to check.\n\t\t\t\t\tconst otherBvh = otherGeometry.boundsTree;\n\t\t\t\t\treturn otherBvh.shapecast( {\n\t\t\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\t\t\treturn obb2.distanceToBox( box );\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tintersectsRange: ( otherOffset, otherCount ) => {\n\n\t\t\t\t\t\t\tfor ( let i2 = otherOffset, l2 = otherOffset + otherCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\t\t\tconst ti2 = otherBvh.resolveTriangleIndex( i2 );\n\t\t\t\t\t\t\t\tsetTriangle( triangle2, 3 * ti2, otherIndex, otherPos );\n\n\t\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\t\t\t\t\t\tsetTriangle( triangle, 3 * ti, index, pos );\n\n\t\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// If no bounds tree then we'll just check every triangle.\n\t\t\t\t\tconst triCount = getTriCount( otherGeometry );\n\t\t\t\t\tfor ( let i2 = 0, l2 = triCount; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, 3 * i2, otherIndex, otherPos );\n\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\tfor ( let i = offset, l = offset + count; i < l; i ++ ) {\n\n\t\t\t\t\t\t\tconst ti = bvh.resolveTriangleIndex( i );\n\t\t\t\t\t\t\tsetTriangle( triangle, 3 * ti, index, pos );\n\n\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i;\n\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t}\n\n\t);\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\n\tif ( closestDistance === Infinity ) {\n\n\t\treturn null;\n\n\t}\n\n\tif ( ! target1.point ) {\n\n\t\ttarget1.point = tempTargetDest1.clone();\n\n\t} else {\n\n\t\ttarget1.point.copy( tempTargetDest1 );\n\n\t}\n\n\ttarget1.distance = closestDistance,\n\ttarget1.faceIndex = closestDistanceTriIndex;\n\n\tif ( target2 ) {\n\n\t\tif ( ! target2.point ) target2.point = tempTargetDest2.clone();\n\t\telse target2.point.copy( tempTargetDest2 );\n\t\ttarget2.point.applyMatrix4( tempMatrix );\n\t\ttempTargetDest1.applyMatrix4( tempMatrix );\n\t\ttarget2.distance = tempTargetDest1.sub( target2.point ).length();\n\t\ttarget2.faceIndex = closestDistanceOtherTriIndex;\n\n\t}\n\n\treturn target1;\n\n}\n\nexport { closestPointToGeometry_indirect };\n","import { Matrix4, Box3 } from 'three';\nimport { setTriangle } from '../../utils/TriangleUtilities.js';\nimport { ExtendedTrianglePool } from '../../utils/ExtendedTrianglePool.js';\n\n/******************************************************/\n/* This file is generated from \"bvhcast.template.js\". */\n/******************************************************/\n\nconst tempMatrix = new Matrix4();\nconst aabb = /* @__PURE__ */ new Box3();\nconst aabb2 = /* @__PURE__ */ new Box3();\nfunction bvhcast_indirect( bvh, otherBvh, matrixToLocal, callbacks ) {\n\n\t// BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n\t// than an approach that walks down the tree (see bvhcast.js file for more info).\n\n\tlet {\n\t\tintersectsRanges,\n\t\tintersectsTriangles,\n\t} = callbacks;\n\n\tconst indexAttr = bvh.geometry.index;\n\tconst positionAttr = bvh.geometry.attributes.position;\n\n\tconst otherIndexAttr = otherBvh.geometry.index;\n\tconst otherPositionAttr = otherBvh.geometry.attributes.position;\n\n\ttempMatrix.copy( matrixToLocal ).invert();\n\n\tconst triangle = ExtendedTrianglePool.getPrimitive();\n\tconst triangle2 = ExtendedTrianglePool.getPrimitive();\n\n\tif ( intersectsTriangles ) {\n\n\t\tconst iterateOverDoubleTriangles = ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) => {\n\n\t\t\tfor ( let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2 ++ ) {\n\n\t\t\t\tconst ti2 = otherBvh.resolveTriangleIndex( i2 );\n\t\t\t\tsetTriangle( triangle2, ti2 * 3, otherIndexAttr, otherPositionAttr );\n\n\n\t\t\t\ttriangle2.a.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.b.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.c.applyMatrix4( matrixToLocal );\n\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\tfor ( let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1 ++ ) {\n\n\t\t\t\t\tconst ti1 = bvh.resolveTriangleIndex( i1 );\n\t\t\t\t\tsetTriangle( triangle, ti1 * 3, indexAttr, positionAttr );\n\n\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\tif ( intersectsTriangles( triangle, triangle2, i1, i2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t\tif ( intersectsRanges ) {\n\n\t\t\tconst originalIntersectsRanges = intersectsRanges;\n\t\t\tintersectsRanges = function ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\tif ( ! originalIntersectsRanges( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\treturn iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tintersectsRanges = iterateOverDoubleTriangles;\n\n\t\t}\n\n\t}\n\n\totherBvh.getBoundingBox( aabb2 );\n\taabb2.applyMatrix4( matrixToLocal );\n\tconst result = bvh.shapecast( {\n\n\t\tintersectsBounds: box => aabb2.intersectsBox( box ),\n\n\t\tintersectsRange: ( offset1, count1, contained, depth1, nodeIndex1, box ) => {\n\n\t\t\taabb.copy( box );\n\t\t\taabb.applyMatrix4( tempMatrix );\n\t\t\treturn otherBvh.shapecast( {\n\n\t\t\t\tintersectsBounds: box => aabb.intersectsBox( box ),\n\n\t\t\t\tintersectsRange: ( offset2, count2, contained, depth2, nodeIndex2 ) => {\n\n\t\t\t\t\treturn intersectsRanges( offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2 );\n\n\t\t\t\t},\n\n\t\t\t} );\n\n\t\t}\n\n\t} );\n\n\tExtendedTrianglePool.releasePrimitive( triangle );\n\tExtendedTrianglePool.releasePrimitive( triangle2 );\n\treturn result;\n\n}\n\nexport { bvhcast_indirect };\n","export function isSharedArrayBufferSupported() {\n\n\treturn typeof SharedArrayBuffer !== 'undefined';\n\n}\n","import { Vector3 } from 'three';\n\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _dir = new Vector3();\n\nexport function isYProjectedLineDegenerate( line ) {\n\n\tline.delta( _dir ).normalize();\n\treturn Math.abs( _dir.dot( UP_VECTOR ) ) >= 1.0 - EPSILON;\n\n}\n\n// checks whether the y-projected triangle will be degenerate\nexport function isYProjectedTriangleDegenerate( tri ) {\n\n\tif ( tri.needsUpdate ) {\n\n\t\ttri.update();\n\n\t}\n\n\treturn Math.abs( tri.plane.normal.dot( UP_VECTOR ) ) <= EPSILON;\n\n}\n\n// Is the provided line exactly an edge on the triangle\nexport function isLineTriangleEdge( tri, line ) {\n\n\t// if this is the same line as on the triangle\n\tconst { start, end } = line;\n\tconst triPoints = tri.points;\n\tlet startMatches = false;\n\tlet endMatches = false;\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst tp = triPoints[ i ];\n\t\tif ( ! startMatches && start.distanceToSquared( tp ) <= EPSILON ) {\n\n\t\t\tstartMatches = true;\n\n\t\t}\n\n\t\tif ( ! endMatches && end.distanceToSquared( tp ) <= EPSILON ) {\n\n\t\t\tendMatches = true;\n\n\t\t}\n\n\t\tif ( startMatches && endMatches ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn startMatches && endMatches;\n\n}\n","import { Vector3, Triangle, Line3, MathUtils } from 'three';\n\n// Modified version of js EdgesGeometry logic to handle silhouette edges\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _v0 = /* @__PURE__ */ new Vector3();\nconst _v1 = /* @__PURE__ */ new Vector3();\nconst _normal = /* @__PURE__ */ new Vector3();\nconst _triangle = /* @__PURE__ */ new Triangle();\n\nexport function generateEdges( geometry, projectionDir = UP_VECTOR, thresholdAngle = 1 ) {\n\n\tconst edges = [];\n\n\tconst precisionPoints = 4;\n\tconst precision = Math.pow( 10, precisionPoints );\n\tconst thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle );\n\n\tconst indexAttr = geometry.getIndex();\n\tconst positionAttr = geometry.getAttribute( 'position' );\n\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\tconst indexArr = [ 0, 0, 0 ];\n\tconst vertKeys = [ 'a', 'b', 'c' ];\n\tconst hashes = new Array( 3 );\n\n\tconst edgeData = {};\n\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\tif ( indexAttr ) {\n\n\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t} else {\n\n\t\t\tindexArr[ 0 ] = i;\n\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t}\n\n\t\tconst { a, b, c } = _triangle;\n\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t_triangle.getNormal( _normal );\n\n\t\t// create hashes for the edge from the vertices\n\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t// skip degenerate triangles\n\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\t// iterate over every edge\n\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t// get the first and next vertex making up the edge\n\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\tconst otherNormal = edgeData[ reverseHash ].normal;\n\t\t\t\tconst meetsThreshold = _normal.dot( otherNormal ) <= thresholdDot;\n\n\t\t\t\t// get the dot product relative to the projection angle and\n\t\t\t\t// add an epsilon for nearly vertical triangles\n\t\t\t\tlet normDot = projectionDir.dot( _normal );\n\t\t\t\tnormDot = Math.abs( normDot ) < EPSILON ? 0 : normDot;\n\n\t\t\t\tlet otherDot = projectionDir.dot( otherNormal );\n\t\t\t\totherDot = Math.abs( otherDot ) < EPSILON ? 0 : otherDot;\n\n\t\t\t\tconst projectionThreshold = Math.sign( normDot ) !== Math.sign( otherDot );\n\t\t\t\tif ( meetsThreshold || projectionThreshold ) {\n\n\t\t\t\t\tconst line = new Line3();\n\t\t\t\t\tline.start.copy( v0 );\n\t\t\t\t\tline.end.copy( v1 );\n\t\t\t\t\tedges.push( line );\n\n\t\t\t\t}\n\n\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\tfor ( const key in edgeData ) {\n\n\t\tif ( edgeData[ key ] ) {\n\n\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t_v1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\tconst line = new Line3();\n\t\t\tline.start.copy( _v0 );\n\t\t\tline.end.copy( _v1 );\n\t\t\tedges.push( line );\n\n\t\t}\n\n\t}\n\n\treturn edges;\n\n}\n","import { Line3 } from 'three';\n\nconst _line = /* @__PURE__ */ new Line3();\n\n// compresses the given edge overlaps into a minimal set of representative objects\nexport function compressEdgeOverlaps( overlaps ) {\n\n\toverlaps.sort( ( a, b ) => {\n\n\t\treturn a[ 0 ] - b[ 0 ];\n\n\t} );\n\n\tfor ( let i = 1; i < overlaps.length; i ++ ) {\n\n\t\tconst overlap = overlaps[ i ];\n\t\tconst prevOverlap = overlaps[ i - 1 ];\n\t\tif ( prevOverlap[ 1 ] >= overlap[ 0 ] ) {\n\n\t\t\tprevOverlap[ 1 ] = Math.max( prevOverlap[ 1 ], overlap[ 1 ] );\n\t\t\toverlaps.splice( i, 1 );\n\t\t\ti --;\n\n\t\t}\n\n\t}\n\n}\n\n\n// Converts the given array of overlaps into line segments\nexport function overlapsToLines( line, overlaps, target = [] ) {\n\n\tcompressEdgeOverlaps( overlaps );\n\n\tconst invOverlaps = [[ 0, 1 ]];\n\tfor ( let i = 0, l = overlaps.length; i < l; i ++ ) {\n\n\t\tconst invOverlap = invOverlaps[ i ];\n\t\tconst overlap = overlaps[ i ];\n\t\tinvOverlap[ 1 ] = overlap[ 0 ];\n\t\tinvOverlaps.push( new Float32Array( [ overlap[ 1 ], 1 ] ) );\n\n\t}\n\n\tfor ( let i = 0, l = invOverlaps.length; i < l; i ++ ) {\n\n\t\tconst { start, end } = line;\n\t\t_line.start.lerpVectors( start, end, invOverlaps[ i ][ 0 ] );\n\t\t_line.end.lerpVectors( start, end, invOverlaps[ i ][ 1 ] );\n\n\t\ttarget.push( new Float32Array( [\n\t\t\t_line.start.x,\n\t\t\t_line.start.y,\n\t\t\t_line.start.z,\n\n\t\t\t_line.end.x,\n\t\t\t_line.end.y,\n\t\t\t_line.end.z,\n\t\t] ) );\n\n\t}\n\n\treturn target;\n\n}\n","import { Plane, Vector3 } from 'three';\nimport { isYProjectedTriangleDegenerate } from './triangleLineUtils.js';\n\nconst EPSILON = 1e-16;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _plane = /* @__PURE__ */ new Plane();\nconst _planeHit = /* @__PURE__ */ new Vector3();\nconst _lineDirection = /* @__PURE__ */ new Vector3();\nexport function trimToBeneathTriPlane( tri, line, lineTarget ) {\n\n\t// if the triangle is insignificant then skip it\n\tif ( isYProjectedTriangleDegenerate( tri ) ) {\n\n\t\treturn false;\n\n\t}\n\n\t// update triangle if needed\n\tif ( tri.needsUpdate ) {\n\n\t\ttri.update();\n\n\t}\n\n\t// if the plane is not facing up then flip the direction\n\t_plane.copy( tri.plane );\n\tif ( _plane.normal.dot( UP_VECTOR ) < 0 ) {\n\n\t\t_plane.normal.multiplyScalar( - 1 );\n\t\t_plane.constant *= - 1;\n\n\t}\n\n\tconst startDist = _plane.distanceToPoint( line.start );\n\tconst endDist = _plane.distanceToPoint( line.end );\n\tconst isStartOnPlane = Math.abs( startDist ) < EPSILON;\n\tconst isEndOnPlane = Math.abs( endDist ) < EPSILON;\n\tconst isStartBelow = startDist < 0;\n\tconst isEndBelow = endDist < 0;\n\n\t// if the line and plane are coplanar then return that we can't trim\n\tline.delta( _lineDirection ).normalize();\n\tif ( Math.abs( _plane.normal.dot( _lineDirection ) ) < EPSILON ) {\n\n\t\tif ( isStartOnPlane || ! isStartBelow ) {\n\n\t\t\treturn false;\n\n\t\t} else {\n\n\t\t\tlineTarget.copy( line );\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\t// find the point that's below the plane. If both points are below the plane\n\t// then we assume we're dealing with floating point error\n\tif ( isStartBelow && isEndBelow ) {\n\n\t\t// if the whole line is below then just copy that\n\t\tlineTarget.copy( line );\n\t\treturn true;\n\n\t} else if ( ! isStartBelow && ! isEndBelow ) {\n\n\t\t// if it's wholly above then skip it\n\t\treturn false;\n\n\t} else {\n\n\t\tlet didHit = _plane.intersectLine( line, _planeHit );\n\t\tif ( ! didHit ) {\n\n\t\t\tif ( isStartOnPlane ) {\n\n\t\t\t\t_planeHit.copy( line.start );\n\t\t\t\tdidHit = true;\n\n\t\t\t}\n\n\t\t\tif ( isEndOnPlane ) {\n\n\t\t\t\t_planeHit.copy( line.end );\n\t\t\t\tdidHit = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( didHit ) {\n\n\t\t\tif ( isStartBelow ) {\n\n\t\t\t\tlineTarget.start.copy( line.start );\n\t\t\t\tlineTarget.end.copy( _planeHit );\n\t\t\t\treturn true;\n\n\t\t\t} else if ( isEndBelow ) {\n\n\t\t\t\tlineTarget.end.copy( line.end );\n\t\t\t\tlineTarget.start.copy( _planeHit );\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n","import { Vector3, Line3, Plane } from 'three';\nimport { ExtendedTriangle } from 'three-mesh-bvh';\n\nconst AREA_EPSILON = 1e-16;\nconst DIST_EPSILON = 1e-16;\nconst _orthoPlane = /* @__PURE__ */ new Plane();\nconst _edgeLine = /* @__PURE__ */ new Line3();\nconst _point = /* @__PURE__ */ new Vector3();\nconst _vec = /* @__PURE__ */ new Vector3();\nconst _tri = /* @__PURE__ */ new ExtendedTriangle();\nconst _line = /* @__PURE__ */ new Line3();\nconst _triLine = /* @__PURE__ */ new Line3();\nconst _dir = /* @__PURE__ */ new Vector3();\nconst _triDir = /* @__PURE__ */ new Vector3();\n\n// Returns the portion of the line that is overlapping the triangle when projected\n// TODO: rename this, remove need for tri update, plane\nexport function getProjectedLineOverlap( line, triangle, lineTarget = new Line3() ) {\n\n\t// flatten the shapes\n\t_tri.copy( triangle );\n\t_tri.a.y = 0;\n\t_tri.b.y = 0;\n\t_tri.c.y = 0;\n\t_tri.update();\n\n\t_line.copy( line );\n\t_line.start.y = 0;\n\t_line.end.y = 0;\n\n\t// if the triangle is degenerate then return no overlap\n\tif ( _tri.getArea() <= AREA_EPSILON ) {\n\n\t\treturn null;\n\n\t}\n\n\t_line.delta( _dir ).normalize();\n\t_dir.cross( _tri.plane.normal ).normalize();\n\t_orthoPlane.setFromNormalAndCoplanarPoint( _dir, _line.start );\n\n\t// find the line of intersection of the triangle along the plane if it exists\n\tlet intersectCount = 0;\n\tconst { points } = _tri;\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst p1 = points[ i ];\n\t\tconst p2 = points[ ( i + 1 ) % 3 ];\n\n\t\t_edgeLine.start.copy( p1 );\n\t\t_edgeLine.end.copy( p2 );\n\t\tconst startIntersects = Math.abs( _orthoPlane.distanceToPoint( _edgeLine.start ) ) < DIST_EPSILON;\n\t\tconst endIntersects = Math.abs( _orthoPlane.distanceToPoint( _edgeLine.end ) ) < DIST_EPSILON;\n\t\tconst edgeIntersects = _orthoPlane.intersectLine( _edgeLine, _point );\n\t\tif ( edgeIntersects && ! endIntersects || startIntersects ) {\n\n\t\t\tif ( startIntersects && ! edgeIntersects ) {\n\n\t\t\t\t_point.copy( _edgeLine.start );\n\n\t\t\t}\n\n\t\t\tif ( intersectCount === 0 ) {\n\n\t\t\t\t_triLine.start.copy( _point );\n\n\t\t\t} else {\n\n\t\t\t\t_triLine.end.copy( _point );\n\n\t\t\t}\n\n\t\t\tintersectCount ++;\n\t\t\tif ( intersectCount === 2 ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif ( intersectCount === 2 ) {\n\n\t\t// find the intersect line if any\n\t\t_line.delta( _dir ).normalize();\n\t\t_triLine.delta( _triDir ).normalize();\n\n\t\t// swap edges so they're facing in the same direction\n\t\tif ( _dir.dot( _triDir ) < 0 ) {\n\n\t\t\tlet tmp = _triLine.start;\n\t\t\t_triLine.start = _triLine.end;\n\t\t\t_triLine.end = tmp;\n\n\t\t}\n\n\t\t// check if the edges are overlapping\n\t\tconst s1 = 0;\n\t\tconst e1 = _vec.subVectors( _line.end, _line.start ).dot( _dir );\n\t\tconst s2 = _vec.subVectors( _triLine.start, _line.start ).dot( _dir );\n\t\tconst e2 = _vec.subVectors( _triLine.end, _line.start ).dot( _dir );\n\t\tconst separated1 = e1 <= s2;\n\t\tconst separated2 = e2 <= s1;\n\n\t\tif ( separated1 || separated2 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tline.at(\n\t\t\tMath.max( s1, s2 ) / _line.distance(),\n\t\t\tlineTarget.start,\n\t\t);\n\n\t\tline.at(\n\t\t\tMath.min( e1, e2 ) / _line.distance(),\n\t\t\tlineTarget.end,\n\t\t);\n\n\t\treturn lineTarget;\n\n\t}\n\n\treturn null;\n\n}\n","import { Vector3 } from 'three';\n\nconst DIST_EPSILON = 1e-16;\nconst _dir = /* @__PURE__ */ new Vector3();\nconst _v0 = /* @__PURE__ */ new Vector3();\nconst _v1 = /* @__PURE__ */ new Vector3();\nexport function appendOverlapRange( line, overlapLine, overlapsTarget ) {\n\n\tline.delta( _dir );\n\t_v0.subVectors( overlapLine.start, line.start );\n\t_v1.subVectors( overlapLine.end, line.start );\n\n\tconst length = _dir.length();\n\tlet d0 = _v0.length() / length;\n\tlet d1 = _v1.length() / length;\n\n\td0 = Math.min( Math.max( d0, 0 ), 1 );\n\td1 = Math.min( Math.max( d1, 0 ), 1 );\n\n\tif ( ! ( Math.abs( d0 - d1 ) <= DIST_EPSILON ) ) {\n\n\t\toverlapsTarget.push( new Float32Array( [ d0, d1 ] ) );\n\t\treturn true;\n\n\t}\n\n\treturn false;\n\n}\n","import { Line3 } from 'three';\nimport { ExtendedTriangle } from 'three-mesh-bvh';\nimport { isLineTriangleEdge } from './triangleLineUtils.js';\n\nconst OFFSET_EPSILON = 1e-6;\nconst _tri = new ExtendedTriangle();\nconst _line = new Line3();\nexport function* generateIntersectionEdges( bvh, iterationTime = 30 ) {\n\n\tconst edges = [];\n\tconst geometry = bvh.geometry;\n\tconst index = geometry.index;\n\tconst posAttr = geometry.attributes.position;\n\tconst vertCount = index ? index.count : posAttr;\n\n\tlet time = performance.now();\n\tfor ( let i = 0; i < vertCount; i += 3 ) {\n\n\t\tlet i0 = i + 0;\n\t\tlet i1 = i + 1;\n\t\tlet i2 = i + 2;\n\t\tif ( index ) {\n\n\t\t\ti0 = index.getX( i0 );\n\t\t\ti1 = index.getX( i1 );\n\t\t\ti2 = index.getX( i2 );\n\n\t\t}\n\n\t\tconst { a, b, c } = _tri;\n\t\ta.fromBufferAttribute( posAttr, i0 );\n\t\tb.fromBufferAttribute( posAttr, i1 );\n\t\tc.fromBufferAttribute( posAttr, i2 );\n\t\t_tri.needsUpdate = true;\n\t\t_tri.update();\n\n\t\tbvh.shapecast( {\n\n\t\t\tintersectsBounds: box => {\n\n\t\t\t\treturn box.intersectsTriangle( _tri );\n\n\t\t\t},\n\n\t\t\tintersectsTriangle: tri2 => {\n\n\t\t\t\tif ( _tri.equals( tri2 ) ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tri2.needsUpdate ) {\n\n\t\t\t\t\ttri2.update();\n\n\t\t\t\t}\n\n\t\t\t\tif ( Math.abs( _tri.plane.normal.dot( tri2.plane.normal ) ) > 1 - 1e-6 ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t_tri.intersectsTriangle( tri2, _line, true ) &&\n\t\t\t\t\t! isLineTriangleEdge( _tri, _line ) &&\n\t\t\t\t\t! isLineTriangleEdge( tri2, _line )\n\t\t\t\t) {\n\n\t\t\t\t\t_line.start.y += OFFSET_EPSILON;\n\t\t\t\t\t_line.end.y += OFFSET_EPSILON;\n\t\t\t\t\tedges.push( _line.clone() );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t} );\n\n\t\tconst delta = performance.now() - time;\n\t\tif ( delta > iterationTime ) {\n\n\t\t\tyield;\n\t\t\ttime = performance.now();\n\n\t\t}\n\n\t}\n\n\treturn edges;\n\n}\n","import { Path64, Clipper, FillRule } from 'clipper2-js';\nimport { ShapeGeometry, Vector3, Shape, Vector2, Triangle, ShapeUtils, BufferGeometry } from 'three';\nimport { compressPoints } from './utils/compressPoints.js';\nimport { triangleIsInsidePaths } from './utils/triangleIsInsidePaths.js';\nimport { getSizeSortedTriList } from './utils/getSizeSortedTriList.js';\nimport { getTriCount } from './utils/geometryUtils.js';\n\nconst AREA_EPSILON = 1e-8;\nconst UP_VECTOR = /* @__PURE__ */ new Vector3( 0, 1, 0 );\nconst _tri = /* @__PURE__ */ new Triangle();\nconst _normal = /* @__PURE__ */ new Vector3();\nconst _center = /* @__PURE__ */ new Vector3();\nconst _vec = /* @__PURE__ */ new Vector3();\n\nfunction convertPathToGeometry( path, scale ) {\n\n\tconst vector2s = path.map( points => {\n\n\t\treturn points.flatMap( v => new Vector2( v.x / scale, v.y / scale ) );\n\n\t} );\n\n\tconst holesShapes = vector2s\n\t\t.filter( p => ShapeUtils.isClockWise( p ) )\n\t\t.map( p => new Shape( p ) );\n\n\tconst solidShapes = vector2s\n\t\t.filter( p => ! ShapeUtils.isClockWise( p ) )\n\t\t.map( p => {\n\n\t\t\tconst shape = new Shape( p );\n\t\t\tshape.holes = holesShapes;\n\t\t\treturn shape;\n\n\t\t} );\n\n\t// flip the triangles so they're facing in the right direction\n\tconst result = new ShapeGeometry( solidShapes ).rotateX( Math.PI / 2 );\n\tresult.index.array.reverse();\n\treturn result;\n\n}\n\nfunction convertPathToLineSegments( path, scale ) {\n\n\tconst arr = [];\n\tpath.forEach( points => {\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst i1 = ( i + 1 ) % points.length;\n\t\t\tconst p0 = points[ i ];\n\t\t\tconst p1 = points[ i1 ];\n\t\t\tarr.push(\n\t\t\t\tnew Vector3( p0.x / scale, 0, p0.y / scale ),\n\t\t\t\tnew Vector3( p1.x / scale, 0, p1.y / scale )\n\t\t\t);\n\n\t\t}\n\n\t} );\n\n\tconst result = new BufferGeometry();\n\tresult.setFromPoints( arr );\n\treturn result;\n\n}\n\nexport const OUTPUT_MESH = 0;\nexport const OUTPUT_LINE_SEGMENTS = 1;\nexport const OUTPUT_BOTH = 2;\nexport class SilhouetteGenerator {\n\n\tconstructor() {\n\n\t\tthis.iterationTime = 30;\n\t\tthis.intScalar = 1e9;\n\t\tthis.doubleSided = false;\n\t\tthis.sortTriangles = false;\n\t\tthis.output = OUTPUT_MESH;\n\n\t}\n\n\tgenerateAsync( geometry, options = {} ) {\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tconst { signal } = options;\n\t\t\tconst task = this.generate( geometry, options );\n\t\t\trun();\n\n\t\t\tfunction run() {\n\n\t\t\t\tif ( signal && signal.aborted ) {\n\n\t\t\t\t\treject( new Error( 'SilhouetteGenerator: Process aborted via AbortSignal.' ) );\n\n\t\t\t\t}\n\n\t\t\t\tconst result = task.next();\n\t\t\t\tif ( result.done ) {\n\n\t\t\t\t\tresolve( result.value );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trequestAnimationFrame( run );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t} );\n\n\t}\n\n\t*generate( geometry, options = {} ) {\n\n\t\tconst { iterationTime, intScalar, doubleSided, output, sortTriangles } = this;\n\t\tconst { onProgress } = options;\n\t\tconst power = Math.log10( intScalar );\n\t\tconst extendMultiplier = Math.pow( 10, - ( power - 2 ) );\n\n\t\tconst index = geometry.index;\n\t\tconst posAttr = geometry.attributes.position;\n\t\tconst triCount = getTriCount( geometry );\n\t\tlet overallPath = null;\n\n\t\tconst triList = sortTriangles ?\n\t\t\tgetSizeSortedTriList( geometry ) :\n\t\t\tnew Array( triCount ).fill().map( ( v, i ) => i );\n\n\t\tconst handle = {\n\n\t\t\tgetGeometry() {\n\n\t\t\t\tif ( output === OUTPUT_MESH ) {\n\n\t\t\t\t\treturn convertPathToGeometry( overallPath, intScalar );\n\n\t\t\t\t} else if ( output === OUTPUT_LINE_SEGMENTS ) {\n\n\t\t\t\t\treturn convertPathToLineSegments( overallPath, intScalar );\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn [\n\t\t\t\t\t\tconvertPathToGeometry( overallPath, intScalar ),\n\t\t\t\t\t\tconvertPathToLineSegments( overallPath, intScalar ),\n\t\t\t\t\t];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tlet time = performance.now();\n\t\tfor ( let ti = 0; ti < triCount; ti ++ ) {\n\n\t\t\tconst i = triList[ ti ] * 3;\n\t\t\tlet i0 = i + 0;\n\t\t\tlet i1 = i + 1;\n\t\t\tlet i2 = i + 2;\n\t\t\tif ( index ) {\n\n\t\t\t\ti0 = index.getX( i0 );\n\t\t\t\ti1 = index.getX( i1 );\n\t\t\t\ti2 = index.getX( i2 );\n\n\t\t\t}\n\n\t\t\t// get the triangle\n\t\t\tconst { a, b, c } = _tri;\n\t\t\ta.fromBufferAttribute( posAttr, i0 );\n\t\t\tb.fromBufferAttribute( posAttr, i1 );\n\t\t\tc.fromBufferAttribute( posAttr, i2 );\n\t\t\tif ( ! doubleSided ) {\n\n\t\t\t\t_tri.getNormal( _normal );\n\t\t\t\tif ( _normal.dot( UP_VECTOR ) < 0 ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// flatten the triangle\n\t\t\ta.y = 0;\n\t\t\tb.y = 0;\n\t\t\tc.y = 0;\n\n\t\t\tif ( _tri.getArea() < AREA_EPSILON ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// expand the triangle by a small degree to ensure overlap\n\t\t\t_center\n\t\t\t\t.copy( a )\n\t\t\t\t.add( b )\n\t\t\t\t.add( c )\n\t\t\t\t.multiplyScalar( 1 / 3 );\n\n\t\t\t_vec.subVectors( a, _center ).normalize();\n\t\t\ta.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t_vec.subVectors( b, _center ).normalize();\n\t\t\tb.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t_vec.subVectors( c, _center ).normalize();\n\t\t\tc.addScaledVector( _vec, extendMultiplier );\n\n\t\t\t// create the path\n\t\t\tconst path = new Path64();\n\t\t\tpath.push( Clipper.makePath( [\n\t\t\t\ta.x * intScalar, a.z * intScalar,\n\t\t\t\tb.x * intScalar, b.z * intScalar,\n\t\t\t\tc.x * intScalar, c.z * intScalar,\n\t\t\t] ) );\n\n\t\t\ta.multiplyScalar( intScalar );\n\t\t\tb.multiplyScalar( intScalar );\n\t\t\tc.multiplyScalar( intScalar );\n\t\t\tif ( overallPath && triangleIsInsidePaths( _tri, overallPath ) ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// perform union\n\t\t\tif ( overallPath === null ) {\n\n\t\t\t\toverallPath = path;\n\n\t\t\t} else {\n\n\t\t\t\toverallPath = Clipper.Union( overallPath, path, FillRule.NonZero );\n\t\t\t\toverallPath.forEach( path => compressPoints( path ) );\n\n\t\t\t}\n\n\t\t\tconst delta = performance.now() - time;\n\t\t\tif ( delta > iterationTime ) {\n\n\t\t\t\tif ( onProgress ) {\n\n\t\t\t\t\tconst progress = ti / triCount;\n\t\t\t\t\tonProgress( progress, handle );\n\n\t\t\t\t}\n\n\t\t\t\tyield;\n\t\t\t\ttime = performance.now();\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn handle.getGeometry();\n\n\t}\n\n}\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass Minkowski {\r\n static minkowskiInternal(pattern, path, isSum, isClosed) {\r\n const delta = isClosed ? 0 : 1;\r\n const patLen = pattern.length;\r\n const pathLen = path.length;\r\n const tmp = [];\r\n for (const pathPt of path) {\r\n const path2 = [];\r\n if (isSum) {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x + basePt.x, y: pathPt.y + basePt.y });\r\n }\r\n else {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x - basePt.x, y: pathPt.y - basePt.y });\r\n }\r\n tmp.push(path2);\r\n }\r\n const result = [];\r\n let g = isClosed ? pathLen - 1 : 0;\r\n let h = patLen - 1;\r\n for (let i = delta; i < pathLen; i++) {\r\n for (let j = 0; j < patLen; j++) {\r\n const quad = [tmp[g][h], tmp[i][h], tmp[i][j], tmp[g][j]];\r\n if (!Clipper.isPositive(quad))\r\n result.push(Clipper.reversePath(quad));\r\n else\r\n result.push(quad);\r\n h = j;\r\n }\r\n g = i;\r\n }\r\n return result;\r\n }\r\n static sum(pattern, path, isClosed) {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, FillRule.NonZero);\r\n }\r\n static diff(pattern, path, isClosed) {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, FillRule.NonZero);\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nvar JoinType;\r\n(function (JoinType) {\r\n JoinType[JoinType[\"Square\"] = 0] = \"Square\";\r\n JoinType[JoinType[\"Round\"] = 1] = \"Round\";\r\n JoinType[JoinType[\"Miter\"] = 2] = \"Miter\";\r\n})(JoinType || (JoinType = {}));\r\nvar EndType;\r\n(function (EndType) {\r\n EndType[EndType[\"Polygon\"] = 0] = \"Polygon\";\r\n EndType[EndType[\"Joined\"] = 1] = \"Joined\";\r\n EndType[EndType[\"Butt\"] = 2] = \"Butt\";\r\n EndType[EndType[\"Square\"] = 3] = \"Square\";\r\n EndType[EndType[\"Round\"] = 4] = \"Round\";\r\n})(EndType || (EndType = {}));\r\nclass Group {\r\n constructor(paths, joinType, endType = EndType.Polygon) {\r\n this.inPaths = [...paths]; // creates a shallow copy of paths\r\n this.joinType = joinType;\r\n this.endType = endType;\r\n this.outPath = [];\r\n this.outPaths = [];\r\n this.pathsReversed = false;\r\n }\r\n}\r\nclass PointD {\r\n constructor(xOrPt, yOrScale) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = xOrPt;\r\n this.y = yOrScale;\r\n }\r\n else if (xOrPt instanceof PointD) {\r\n if (yOrScale !== undefined) {\r\n this.x = xOrPt.x * yOrScale;\r\n this.y = xOrPt.y * yOrScale;\r\n }\r\n else {\r\n this.x = xOrPt.x;\r\n this.y = xOrPt.y;\r\n }\r\n }\r\n else {\r\n this.x = xOrPt.x * (yOrScale || 1);\r\n this.y = xOrPt.y * (yOrScale || 1);\r\n }\r\n }\r\n toString(precision = 2) {\r\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\r\n }\r\n static equals(lhs, rhs) {\r\n return InternalClipper.isAlmostZero(lhs.x - rhs.x) &&\r\n InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n static notEquals(lhs, rhs) {\r\n return !InternalClipper.isAlmostZero(lhs.x - rhs.x) ||\r\n !InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n equals(obj) {\r\n if (obj instanceof PointD) {\r\n return PointD.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n negate() {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n }\r\n}\r\nclass ClipperOffset {\r\n constructor(miterLimit = 2.0, arcTolerance = 0.0, preserveCollinear = false, reverseSolution = false) {\r\n this._groupList = [];\r\n this._normals = [];\r\n this._solution = [];\r\n this.MiterLimit = miterLimit;\r\n this.ArcTolerance = arcTolerance;\r\n this.MergeGroups = true;\r\n this.PreserveCollinear = preserveCollinear;\r\n this.ReverseSolution = reverseSolution;\r\n }\r\n clear() {\r\n this._groupList = [];\r\n }\r\n addPath(path, joinType, endType) {\r\n if (path.length === 0)\r\n return;\r\n const pp = [path];\r\n this.addPaths(pp, joinType, endType);\r\n }\r\n addPaths(paths, joinType, endType) {\r\n if (paths.length === 0)\r\n return;\r\n this._groupList.push(new Group(paths, joinType, endType));\r\n }\r\n executeInternal(delta) {\r\n this._solution = [];\r\n if (this._groupList.length === 0)\r\n return;\r\n if (Math.abs(delta) < 0.5) {\r\n for (const group of this._groupList) {\r\n for (const path of group.inPaths) {\r\n this._solution.push(path);\r\n }\r\n }\r\n }\r\n else {\r\n this._delta = delta;\r\n this._mitLimSqr = (this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit));\r\n for (const group of this._groupList) {\r\n this.doGroupOffset(group);\r\n }\r\n }\r\n }\r\n sqr(value) {\r\n return value * value;\r\n }\r\n execute(delta, solution) {\r\n solution.length = 0;\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0)\r\n return;\r\n // clean up self-intersections ...\r\n const c = new Clipper64();\r\n c.preserveCollinear = this.PreserveCollinear;\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.execute(ClipType.Union, FillRule.Negative, solution);\r\n else\r\n c.execute(ClipType.Union, FillRule.Positive, solution);\r\n }\r\n executePolytree(delta, polytree) {\r\n polytree.clear();\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0)\r\n return;\r\n // clean up self-intersections ...\r\n const c = new Clipper64();\r\n c.preserveCollinear = this.PreserveCollinear;\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed;\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.executePolyTree(ClipType.Union, FillRule.Negative, polytree);\r\n else\r\n c.executePolyTree(ClipType.Union, FillRule.Positive, polytree);\r\n }\r\n static getUnitNormal(pt1, pt2) {\r\n let dx = pt2.x - pt1.x;\r\n let dy = pt2.y - pt1.y;\r\n if (dx === 0 && dy === 0)\r\n return new PointD(0, 0);\r\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\r\n dx *= f;\r\n dy *= f;\r\n return new PointD(dy, -dx);\r\n }\r\n executeCallback(deltaCallback, solution) {\r\n this.DeltaCallback = deltaCallback;\r\n this.execute(1.0, solution);\r\n }\r\n static getBoundsAndLowestPolyIdx(paths) {\r\n const rec = new Rect64(false); // ie invalid rect\r\n let lpX = Number.MIN_SAFE_INTEGER;\r\n let index = -1;\r\n for (let i = 0; i < paths.length; i++) {\r\n for (const pt of paths[i]) {\r\n if (pt.y >= rec.bottom) {\r\n if (pt.y > rec.bottom || pt.x < lpX) {\r\n index = i;\r\n lpX = pt.x;\r\n rec.bottom = pt.y;\r\n }\r\n }\r\n else if (pt.y < rec.top)\r\n rec.top = pt.y;\r\n if (pt.x > rec.right)\r\n rec.right = pt.x;\r\n else if (pt.x < rec.left)\r\n rec.left = pt.x;\r\n }\r\n }\r\n return { index, rec };\r\n }\r\n static translatePoint(pt, dx, dy) {\r\n return new PointD(pt.x + dx, pt.y + dy);\r\n }\r\n static reflectPoint(pt, pivot) {\r\n return new PointD(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\r\n }\r\n static almostZero(value, epsilon = 0.001) {\r\n return Math.abs(value) < epsilon;\r\n }\r\n static hypotenuse(x, y) {\r\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\r\n }\r\n static normalizeVector(vec) {\r\n const h = this.hypotenuse(vec.x, vec.y);\r\n if (this.almostZero(h))\r\n return new PointD(0, 0);\r\n const inverseHypot = 1 / h;\r\n return new PointD(vec.x * inverseHypot, vec.y * inverseHypot);\r\n }\r\n static getAvgUnitVector(vec1, vec2) {\r\n return this.normalizeVector(new PointD(vec1.x + vec2.x, vec1.y + vec2.y));\r\n }\r\n static intersectPoint(pt1a, pt1b, pt2a, pt2b) {\r\n if (InternalClipper.isAlmostZero(pt1a.x - pt1b.x)) { //vertical\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x))\r\n return new PointD(0, 0);\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n return new PointD(pt1a.x, m2 * pt1a.x + b2);\r\n }\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) { //vertical\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n return new PointD(pt2a.x, m1 * pt2a.x + b1);\r\n }\r\n else {\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n if (InternalClipper.isAlmostZero(m1 - m2))\r\n return new PointD(0, 0);\r\n const x = (b2 - b1) / (m1 - m2);\r\n return new PointD(x, m1 * x + b1);\r\n }\r\n }\r\n getPerpendic(pt, norm) {\r\n return new Point64(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n getPerpendicD(pt, norm) {\r\n return new PointD(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n doSquare(group, path, j, k) {\r\n let vec;\r\n if (j === k) {\r\n vec = new PointD(this._normals[j].y, -this._normals[j].x);\r\n }\r\n else {\r\n vec = ClipperOffset.getAvgUnitVector(new PointD(-this._normals[k].y, this._normals[k].x), new PointD(this._normals[j].y, -this._normals[j].x));\r\n }\r\n const absDelta = Math.abs(this._groupDelta);\r\n // now offset the original vertex delta units along unit vector\r\n let ptQ = new PointD(path[j].x, path[j].y);\r\n ptQ = ClipperOffset.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\r\n // get perpendicular vertices\r\n const pt1 = ClipperOffset.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\r\n const pt2 = ClipperOffset.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\r\n // get 2 vertices along one edge offset\r\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\r\n if (j === k) {\r\n const pt4 = new PointD(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n }\r\n else {\r\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n }\r\n }\r\n doMiter(group, path, j, k, cosA) {\r\n const q = this._groupDelta / (cosA + 1);\r\n group.outPath.push(new Point64(path[j].x + (this._normals[k].x + this._normals[j].x) * q, path[j].y + (this._normals[k].y + this._normals[j].y) * q));\r\n }\r\n doRound(group, path, j, k, angle) {\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n const absDelta = Math.abs(this._groupDelta);\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0)\r\n this._stepSin = -this._stepSin;\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n const pt = path[j];\r\n let offsetVec = new PointD(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\r\n if (j === k)\r\n offsetVec.negate();\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n if (angle > -Math.PI + 0.01) {\r\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\r\n for (let i = 1; i < steps; i++) {\r\n offsetVec = new PointD(offsetVec.x * this._stepCos - this._stepSin * offsetVec.y, offsetVec.x * this._stepSin + offsetVec.y * this._stepCos);\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n }\r\n }\r\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\r\n }\r\n buildNormals(path) {\r\n const cnt = path.length;\r\n this._normals = [];\r\n this._normals.length = cnt;\r\n for (let i = 0; i < cnt - 1; i++) {\r\n this._normals.push(ClipperOffset.getUnitNormal(path[i], path[i + 1]));\r\n }\r\n this._normals.push(ClipperOffset.getUnitNormal(path[cnt - 1], path[0]));\r\n }\r\n crossProduct(vec1, vec2) {\r\n return (vec1.y * vec2.x - vec2.y * vec1.x);\r\n }\r\n dotProduct(vec1, vec2) {\r\n return (vec1.x * vec2.x + vec1.y * vec2.y);\r\n }\r\n offsetPoint(group, path, j, k) {\r\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\r\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\r\n if (sinA > 1.0)\r\n cosA = 1.0;\r\n else if (sinA < -1.0)\r\n cosA = -1.0;\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\r\n if (group.pathsReversed)\r\n this._groupDelta = -this._groupDelta;\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[j]);\r\n return;\r\n }\r\n if (cosA > 0.999) {\r\n this.doMiter(group, path, j, k, cosA);\r\n }\r\n else if (cosA > -0.99 && (sinA * this._groupDelta < 0)) {\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\r\n group.outPath.push(path[j]);\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\r\n }\r\n else if (this._joinType === JoinType.Miter) {\r\n if (cosA > this._mitLimSqr - 1) {\r\n this.doMiter(group, path, j, k, cosA);\r\n }\r\n else {\r\n this.doSquare(group, path, j, k);\r\n }\r\n }\r\n else if (cosA > 0.99 || this._joinType === JoinType.Square) {\r\n this.doSquare(group, path, j, k);\r\n }\r\n else {\r\n this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\r\n }\r\n k = j;\r\n }\r\n offsetPolygon(group, path) {\r\n const area = Clipper.area(path);\r\n if ((area < 0) !== (this._groupDelta < 0)) {\r\n const rect = Clipper.getBounds(path);\r\n if (Math.abs(this._groupDelta) * 2 > rect.width)\r\n return;\r\n }\r\n group.outPath = [];\r\n const cnt = path.length;\r\n const prev = cnt - 1;\r\n for (let i = 0; i < cnt; i++) {\r\n this.offsetPoint(group, path, i, prev);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n offsetOpenJoined(group, path) {\r\n this.offsetPolygon(group, path);\r\n path = Clipper.reversePath(path);\r\n this.buildNormals(path);\r\n this.offsetPolygon(group, path);\r\n }\r\n offsetOpenPath(group, path) {\r\n group.outPath = [];\r\n const highI = path.length - 1;\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[0]);\r\n }\r\n else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(path[0].x - this._normals[0].x * this._groupDelta, path[0].y - this._normals[0].y * this._groupDelta));\r\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, 0, 0, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, 0, 0);\r\n break;\r\n }\r\n }\r\n for (let i = 1, k = 0; i < highI; i++) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n for (let i = highI; i > 0; i--) {\r\n this._normals[i] = new PointD(-this._normals[i - 1].x, -this._normals[i - 1].y);\r\n }\r\n this._normals[0] = this._normals[highI];\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\r\n }\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[highI]);\r\n }\r\n else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(path[highI].x - this._normals[highI].x * this._groupDelta, path[highI].y - this._normals[highI].y * this._groupDelta));\r\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, highI, highI, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, highI, highI);\r\n break;\r\n }\r\n }\r\n for (let i = highI, k = 0; i > 0; i--) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n doGroupOffset(group) {\r\n if (group.endType == EndType.Polygon) {\r\n const { index } = ClipperOffset.getBoundsAndLowestPolyIdx(group.inPaths);\r\n if (index < 0)\r\n return;\r\n const area = Clipper.area(group.inPaths[index]);\r\n group.pathsReversed = area < 0;\r\n if (group.pathsReversed) {\r\n this._groupDelta = -this._delta;\r\n }\r\n else {\r\n this._groupDelta = this._delta;\r\n }\r\n }\r\n else {\r\n group.pathsReversed = false;\r\n this._groupDelta = Math.abs(this._delta) * 0.5;\r\n }\r\n const absDelta = Math.abs(this._groupDelta);\r\n this._joinType = group.joinType;\r\n this._endType = group.endType;\r\n if (!this.DeltaCallback &&\r\n (group.joinType == JoinType.Round || group.endType == EndType.Round)) {\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0) {\r\n this._stepSin = -this._stepSin;\r\n }\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n const isJoined = group.endType == EndType.Joined || group.endType == EndType.Polygon;\r\n for (const p of group.inPaths) {\r\n const path = Clipper.stripDuplicates(p, isJoined);\r\n const cnt = path.length;\r\n if (cnt === 0 || (cnt < 3 && this._endType == EndType.Polygon)) {\r\n continue;\r\n }\r\n if (cnt == 1) {\r\n group.outPath = [];\r\n if (group.endType == EndType.Round) {\r\n const r = absDelta;\r\n group.outPath = Clipper.ellipse(path[0], r, r);\r\n }\r\n else {\r\n const d = Math.ceil(this._groupDelta);\r\n const r = new Rect64(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\r\n group.outPath = r.asPath();\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n else {\r\n if (cnt == 2 && group.endType == EndType.Joined) {\r\n if (group.joinType == JoinType.Round) {\r\n this._endType = EndType.Round;\r\n }\r\n else {\r\n this._endType = EndType.Square;\r\n }\r\n }\r\n this.buildNormals(path);\r\n if (this._endType == EndType.Polygon) {\r\n this.offsetPolygon(group, path);\r\n }\r\n else if (this._endType == EndType.Joined) {\r\n this.offsetOpenJoined(group, path);\r\n }\r\n else {\r\n this.offsetOpenPath(group, path);\r\n }\r\n }\r\n }\r\n this._solution.push(...group.outPaths);\r\n group.outPaths = [];\r\n }\r\n}\r\nClipperOffset.Tolerance = 1.0E-12;\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass OutPt2 {\r\n constructor(pt) {\r\n this.pt = pt;\r\n this.ownerIdx = 0;\r\n }\r\n}\r\nvar Location;\r\n(function (Location) {\r\n Location[Location[\"left\"] = 0] = \"left\";\r\n Location[Location[\"top\"] = 1] = \"top\";\r\n Location[Location[\"right\"] = 2] = \"right\";\r\n Location[Location[\"bottom\"] = 3] = \"bottom\";\r\n Location[Location[\"inside\"] = 4] = \"inside\";\r\n})(Location || (Location = {}));\r\nclass RectClip64 {\r\n constructor(rect) {\r\n this.currIdx = -1;\r\n this.rect = rect;\r\n this.mp = rect.midPoint();\r\n this.rectPath = rect.asPath();\r\n this.results = [];\r\n this.edges = Array(8).fill(undefined).map(() => []);\r\n }\r\n add(pt, startingNewPath = false) {\r\n let currIdx = this.results.length;\r\n let result;\r\n if (currIdx === 0 || startingNewPath) {\r\n result = new OutPt2(pt);\r\n this.results.push(result);\r\n result.ownerIdx = currIdx;\r\n result.prev = result;\r\n result.next = result;\r\n }\r\n else {\r\n currIdx--;\r\n const prevOp = this.results[currIdx];\r\n if (prevOp.pt === pt)\r\n return prevOp;\r\n result = new OutPt2(pt);\r\n result.ownerIdx = currIdx;\r\n result.next = prevOp.next;\r\n prevOp.next.prev = result;\r\n prevOp.next = result;\r\n result.prev = prevOp;\r\n this.results[currIdx] = result;\r\n }\r\n return result;\r\n }\r\n static path1ContainsPath2(path1, path2) {\r\n let ioCount = 0;\r\n for (const pt of path2) {\r\n const pip = InternalClipper.pointInPolygon(pt, path1);\r\n switch (pip) {\r\n case PointInPolygonResult.IsInside:\r\n ioCount--;\r\n break;\r\n case PointInPolygonResult.IsOutside:\r\n ioCount++;\r\n break;\r\n }\r\n if (Math.abs(ioCount) > 1)\r\n break;\r\n }\r\n return ioCount <= 0;\r\n }\r\n static isClockwise(prev, curr, prevPt, currPt, rectMidPoint) {\r\n if (this.areOpposites(prev, curr))\r\n return InternalClipper.crossProduct(prevPt, rectMidPoint, currPt) < 0;\r\n else\r\n return this.headingClockwise(prev, curr);\r\n }\r\n static areOpposites(prev, curr) {\r\n return Math.abs(prev - curr) === 2;\r\n }\r\n static headingClockwise(prev, curr) {\r\n return (prev + 1) % 4 === curr;\r\n }\r\n static getAdjacentLocation(loc, isClockwise) {\r\n const delta = isClockwise ? 1 : 3;\r\n return (loc + delta) % 4;\r\n }\r\n static unlinkOp(op) {\r\n if (op.next === op)\r\n return undefined;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return op.next;\r\n }\r\n static unlinkOpBack(op) {\r\n if (op.next === op)\r\n return undefined;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return op.prev;\r\n }\r\n static getEdgesForPt(pt, rec) {\r\n let result = 0;\r\n if (pt.x === rec.left)\r\n result = 1;\r\n else if (pt.x === rec.right)\r\n result = 4;\r\n if (pt.y === rec.top)\r\n result += 2;\r\n else if (pt.y === rec.bottom)\r\n result += 8;\r\n return result;\r\n }\r\n static isHeadingClockwise(pt1, pt2, edgeIdx) {\r\n switch (edgeIdx) {\r\n case 0: return pt2.y < pt1.y;\r\n case 1: return pt2.x > pt1.x;\r\n case 2: return pt2.y > pt1.y;\r\n default: return pt2.x < pt1.x;\r\n }\r\n }\r\n static hasHorzOverlap(left1, right1, left2, right2) {\r\n return (left1.x < right2.x) && (right1.x > left2.x);\r\n }\r\n static hasVertOverlap(top1, bottom1, top2, bottom2) {\r\n return (top1.y < bottom2.y) && (bottom1.y > top2.y);\r\n }\r\n static addToEdge(edge, op) {\r\n if (op.edge)\r\n return;\r\n op.edge = edge;\r\n edge.push(op);\r\n }\r\n static uncoupleEdge(op) {\r\n if (!op.edge)\r\n return;\r\n for (let i = 0; i < op.edge.length; i++) {\r\n const op2 = op.edge[i];\r\n if (op2 === op) {\r\n op.edge[i] = undefined;\r\n break;\r\n }\r\n }\r\n op.edge = undefined;\r\n }\r\n static setNewOwner(op, newIdx) {\r\n op.ownerIdx = newIdx;\r\n let op2 = op.next;\r\n while (op2 !== op) {\r\n op2.ownerIdx = newIdx;\r\n op2 = op2.next;\r\n }\r\n }\r\n addCorner(prev, curr) {\r\n if (RectClip64.headingClockwise(prev, curr))\r\n this.add(this.rectPath[prev]);\r\n else\r\n this.add(this.rectPath[curr]);\r\n }\r\n addCornerByRef(loc, isClockwise) {\r\n if (isClockwise) {\r\n this.add(this.rectPath[loc]);\r\n loc = RectClip64.getAdjacentLocation(loc, true);\r\n }\r\n else {\r\n loc = RectClip64.getAdjacentLocation(loc, false);\r\n this.add(this.rectPath[loc]);\r\n }\r\n }\r\n static getLocation(rec, pt) {\r\n let loc;\r\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.left; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.right; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.top; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.bottom; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x < rec.left)\r\n loc = Location.left;\r\n else if (pt.x > rec.right)\r\n loc = Location.right;\r\n else if (pt.y < rec.top)\r\n loc = Location.top;\r\n else if (pt.y > rec.bottom)\r\n loc = Location.bottom;\r\n else\r\n loc = Location.inside;\r\n return { success: true, loc };\r\n }\r\n static getIntersection(rectPath, p, p2, loc) {\r\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\r\n // when result == false, loc will remain unchanged\r\n let ip = new Point64();\r\n switch (loc) {\r\n case Location.left:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n }\r\n else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.right:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n }\r\n else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.top:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n }\r\n else if (p.x < rectPath[0].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (p.x > rectPath[1].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.bottom:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n }\r\n else if (p.x < rectPath[3].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (p.x > rectPath[2].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n case Location.inside:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n }\r\n else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip };\r\n }\r\n break;\r\n }\r\n return { success: true, loc, ip };\r\n }\r\n getNextLocation(path, context) {\r\n switch (context.loc) {\r\n case Location.left:\r\n while (context.i <= context.highI && path[context.i].x <= this.rect.left)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.top:\r\n while (context.i <= context.highI && path[context.i].y <= this.rect.top)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.right:\r\n while (context.i <= context.highI && path[context.i].x >= this.rect.right)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.bottom:\r\n while (context.i <= context.highI && path[context.i].y >= this.rect.bottom)\r\n context.i++;\r\n if (context.i > context.highI)\r\n break;\r\n if (path[context.i].y <= this.rect.top)\r\n context.loc = Location.top;\r\n else if (path[context.i].x <= this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right)\r\n context.loc = Location.right;\r\n else\r\n context.loc = Location.inside;\r\n break;\r\n case Location.inside:\r\n while (context.i <= context.highI) {\r\n if (path[context.i].x < this.rect.left)\r\n context.loc = Location.left;\r\n else if (path[context.i].x > this.rect.right)\r\n context.loc = Location.right;\r\n else if (path[context.i].y > this.rect.bottom)\r\n context.loc = Location.bottom;\r\n else if (path[context.i].y < this.rect.top)\r\n context.loc = Location.top;\r\n else {\r\n this.add(path[context.i]);\r\n context.i++;\r\n continue;\r\n }\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n executeInternal(path) {\r\n if (path.length < 3 || this.rect.isEmpty())\r\n return;\r\n const startLocs = [];\r\n let firstCross = Location.inside;\r\n let crossingLoc = firstCross, prev = firstCross;\r\n let i;\r\n const highI = path.length - 1;\r\n let result = RectClip64.getLocation(this.rect, path[highI]);\r\n let loc = result.loc;\r\n if (!result.success) {\r\n i = highI - 1;\r\n while (i >= 0 && !result.success) {\r\n i--;\r\n result = RectClip64.getLocation(this.rect, path[i]);\r\n prev = result.loc;\r\n }\r\n if (i < 0) {\r\n for (const pt of path) {\r\n this.add(pt);\r\n }\r\n return;\r\n }\r\n if (prev == Location.inside)\r\n loc = Location.inside;\r\n }\r\n const startingLoc = loc;\r\n ///////////////////////////////////////////////////\r\n i = 0;\r\n while (i <= highI) {\r\n prev = loc;\r\n const prevCrossLoc = crossingLoc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI)\r\n break;\r\n const prevPt = (i == 0) ? path[highI] : path[i - 1];\r\n crossingLoc = loc;\r\n let result = RectClip64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\r\n const ip = result.ip;\r\n if (!result.success) {\r\n if (prevCrossLoc == Location.inside) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n startLocs.push(prev);\r\n prev = RectClip64.getAdjacentLocation(prev, isClockw);\r\n } while (prev != loc);\r\n crossingLoc = prevCrossLoc;\r\n }\r\n else if (prev != Location.inside && prev != loc) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != loc);\r\n }\r\n ++i;\r\n continue;\r\n }\r\n ////////////////////////////////////////////////////\r\n // we must be crossing the rect boundary to get here\r\n ////////////////////////////////////////////////////\r\n if (loc == Location.inside) {\r\n if (firstCross == Location.inside) {\r\n firstCross = crossingLoc;\r\n startLocs.push(prev);\r\n }\r\n else if (prev != crossingLoc) {\r\n const isClockw = RectClip64.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != crossingLoc);\r\n }\r\n }\r\n else if (prev != Location.inside) {\r\n // passing right through rect. 'ip' here will be the second\r\n // intersect pt but we'll also need the first intersect pt (ip2)\r\n loc = prev;\r\n result = RectClip64.getIntersection(this.rectPath, prevPt, path[i], loc);\r\n const ip2 = result.ip;\r\n if (prevCrossLoc != Location.inside && prevCrossLoc != loc)\r\n this.addCorner(prevCrossLoc, loc);\r\n if (firstCross == Location.inside) {\r\n firstCross = loc;\r\n startLocs.push(prev);\r\n }\r\n loc = crossingLoc;\r\n this.add(ip2);\r\n if (ip == ip2) {\r\n loc = RectClip64.getLocation(this.rect, path[i]).loc;\r\n this.addCorner(crossingLoc, loc);\r\n crossingLoc = loc;\r\n continue;\r\n }\r\n }\r\n else {\r\n loc = crossingLoc;\r\n if (firstCross == Location.inside)\r\n firstCross = crossingLoc;\r\n }\r\n this.add(ip);\r\n } //while i <= highI\r\n ///////////////////////////////////////////////////\r\n if (firstCross == Location.inside) {\r\n if (startingLoc != Location.inside) {\r\n if (this.pathBounds.containsRect(this.rect) && RectClip64.path1ContainsPath2(path, this.rectPath)) {\r\n for (let j = 0; j < 4; j++) {\r\n this.add(this.rectPath[j]);\r\n RectClip64.addToEdge(this.edges[j * 2], this.results[0]);\r\n }\r\n }\r\n }\r\n }\r\n else if (loc != Location.inside && (loc != firstCross || startLocs.length > 2)) {\r\n if (startLocs.length > 0) {\r\n prev = loc;\r\n for (const loc2 of startLocs) {\r\n if (prev == loc2)\r\n continue;\r\n this.addCornerByRef(prev, RectClip64.headingClockwise(prev, loc2));\r\n prev = loc2;\r\n }\r\n loc = prev;\r\n }\r\n if (loc != firstCross)\r\n this.addCornerByRef(loc, RectClip64.headingClockwise(loc, firstCross));\r\n }\r\n }\r\n execute(paths) {\r\n const result = [];\r\n if (this.rect.isEmpty())\r\n return result;\r\n for (const path of paths) {\r\n if (path.length < 3)\r\n continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds))\r\n continue;\r\n else if (this.rect.containsRect(this.pathBounds)) {\r\n result.push(path);\r\n continue;\r\n }\r\n this.executeInternal(path);\r\n this.checkEdges();\r\n for (let i = 0; i < 4; ++i)\r\n this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0)\r\n result.push(tmp);\r\n }\r\n this.results.length = 0;\r\n for (let i = 0; i < 8; i++)\r\n this.edges[i].length = 0;\r\n }\r\n return result;\r\n }\r\n checkEdges() {\r\n for (let i = 0; i < this.results.length; i++) {\r\n let op = this.results[i];\r\n let op2 = op;\r\n if (op === undefined)\r\n continue;\r\n do {\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\r\n if (op2 === op) {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined)\r\n break;\r\n op = op2.prev;\r\n }\r\n else {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined)\r\n break;\r\n }\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n } while (op2 !== op);\r\n if (op2 === undefined) {\r\n this.results[i] = undefined;\r\n continue;\r\n }\r\n this.results[i] = op2;\r\n let edgeSet1 = RectClip64.getEdgesForPt(op.prev.pt, this.rect);\r\n op2 = op;\r\n do {\r\n const edgeSet2 = RectClip64.getEdgesForPt(op2.pt, this.rect);\r\n if (edgeSet2 !== 0 && op2.edge === undefined) {\r\n const combinedSet = (edgeSet1 & edgeSet2);\r\n for (let j = 0; j < 4; ++j) {\r\n if ((combinedSet & (1 << j)) !== 0) {\r\n if (RectClip64.isHeadingClockwise(op2.prev.pt, op2.pt, j))\r\n RectClip64.addToEdge(this.edges[j * 2], op2);\r\n else\r\n RectClip64.addToEdge(this.edges[j * 2 + 1], op2);\r\n }\r\n }\r\n }\r\n edgeSet1 = edgeSet2;\r\n op2 = op2.next;\r\n } while (op2 !== op);\r\n }\r\n }\r\n tidyEdgePair(idx, cw, ccw) {\r\n if (ccw.length === 0)\r\n return;\r\n const isHorz = (idx === 1 || idx === 3);\r\n const cwIsTowardLarger = (idx === 1 || idx === 2);\r\n let i = 0, j = 0;\r\n let p1, p2, p1a, p2a, op, op2;\r\n while (i < cw.length) {\r\n p1 = cw[i];\r\n if (!p1 || p1.next === p1.prev) {\r\n cw[i++] = undefined;\r\n j = 0;\r\n continue;\r\n }\r\n const jLim = ccw.length;\r\n while (j < jLim && (!ccw[j] || ccw[j].next === ccw[j].prev))\r\n ++j;\r\n if (j === jLim) {\r\n ++i;\r\n j = 0;\r\n continue;\r\n }\r\n if (cwIsTowardLarger) {\r\n p1 = cw[i].prev;\r\n p1a = cw[i];\r\n p2 = ccw[j];\r\n p2a = ccw[j].prev;\r\n }\r\n else {\r\n p1 = cw[i];\r\n p1a = cw[i].prev;\r\n p2 = ccw[j].prev;\r\n p2a = ccw[j];\r\n }\r\n if ((isHorz && !RectClip64.hasHorzOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt)) ||\r\n (!isHorz && !RectClip64.hasVertOverlap(p1.pt, p1a.pt, p2.pt, p2a.pt))) {\r\n ++j;\r\n continue;\r\n }\r\n const isRejoining = cw[i].ownerIdx !== ccw[j].ownerIdx;\r\n if (isRejoining) {\r\n this.results[p2.ownerIdx] = undefined;\r\n RectClip64.setNewOwner(p2, p1.ownerIdx);\r\n }\r\n if (cwIsTowardLarger) {\r\n // p1 >> | >> p1a;\r\n // p2 << | << p2a;\r\n p1.next = p2;\r\n p2.prev = p1;\r\n p1a.prev = p2a;\r\n p2a.next = p1a;\r\n }\r\n else {\r\n // p1 << | << p1a;\r\n // p2 >> | >> p2a;\r\n p1.prev = p2;\r\n p2.next = p1;\r\n p1a.next = p2a;\r\n p2a.prev = p1a;\r\n }\r\n if (!isRejoining) {\r\n const new_idx = this.results.length;\r\n this.results.push(p1a);\r\n RectClip64.setNewOwner(p1a, new_idx);\r\n }\r\n if (cwIsTowardLarger) {\r\n op = p2;\r\n op2 = p1a;\r\n }\r\n else {\r\n op = p1;\r\n op2 = p2a;\r\n }\r\n this.results[op.ownerIdx] = op;\r\n this.results[op2.ownerIdx] = op2;\r\n // and now lots of work to get ready for the next loop\r\n let opIsLarger, op2IsLarger;\r\n if (isHorz) { // X\r\n opIsLarger = op.pt.x > op.prev.pt.x;\r\n op2IsLarger = op2.pt.x > op2.prev.pt.x;\r\n }\r\n else { // Y\r\n opIsLarger = op.pt.y > op.prev.pt.y;\r\n op2IsLarger = op2.pt.y > op2.prev.pt.y;\r\n }\r\n if ((op.next === op.prev) || (op.pt === op.prev.pt)) {\r\n if (op2IsLarger === cwIsTowardLarger) {\r\n cw[i] = op2;\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n ccw[j] = op2;\r\n cw[i++] = undefined;\r\n }\r\n }\r\n else if ((op2.next === op2.prev) || (op2.pt === op2.prev.pt)) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n ccw[j] = op;\r\n cw[i++] = undefined;\r\n }\r\n }\r\n else if (opIsLarger === op2IsLarger) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n RectClip64.uncoupleEdge(op2);\r\n RectClip64.addToEdge(cw, op2);\r\n ccw[j++] = undefined;\r\n }\r\n else {\r\n cw[i++] = undefined;\r\n ccw[j] = op2;\r\n RectClip64.uncoupleEdge(op);\r\n RectClip64.addToEdge(ccw, op);\r\n j = 0;\r\n }\r\n }\r\n else {\r\n if (opIsLarger === cwIsTowardLarger)\r\n cw[i] = op;\r\n else\r\n ccw[j] = op;\r\n if (op2IsLarger === cwIsTowardLarger)\r\n cw[i] = op2;\r\n else\r\n ccw[j] = op2;\r\n }\r\n }\r\n }\r\n getPath(op) {\r\n const result = new Path64();\r\n if (!op || op.prev === op.next)\r\n return result;\r\n let op2 = op.next;\r\n while (op2 && op2 !== op) {\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0) {\r\n op = op2.prev;\r\n op2 = RectClip64.unlinkOp(op2);\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n }\r\n if (!op2)\r\n return new Path64();\r\n result.push(op.pt);\r\n op2 = op.next;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n}\r\nclass RectClipLines64 extends RectClip64 {\r\n constructor(rect) {\r\n super(rect);\r\n }\r\n execute(paths) {\r\n const result = new Paths64();\r\n if (this.rect.isEmpty())\r\n return result;\r\n for (const path of paths) {\r\n if (path.length < 2)\r\n continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds))\r\n continue;\r\n this.executeInternal(path);\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0)\r\n result.push(tmp);\r\n }\r\n // Clean up after every loop\r\n this.results.length = 0; // Clear the array\r\n for (let i = 0; i < 8; i++) {\r\n this.edges[i].length = 0; // Clear each array\r\n }\r\n }\r\n return result;\r\n }\r\n getPath(op) {\r\n const result = new Path64();\r\n if (!op || op === op.next)\r\n return result;\r\n op = op.next; // starting at path beginning \r\n result.push(op.pt);\r\n let op2 = op.next;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n executeInternal(path) {\r\n this.results = [];\r\n if (path.length < 2 || this.rect.isEmpty())\r\n return;\r\n let prev = Location.inside;\r\n let i = 1;\r\n const highI = path.length - 1;\r\n let result = RectClipLines64.getLocation(this.rect, path[0]);\r\n let loc = result.loc;\r\n if (!result.success) {\r\n while (i <= highI && !result.success) {\r\n i++;\r\n result = RectClipLines64.getLocation(this.rect, path[i]);\r\n prev = result.loc;\r\n }\r\n if (i > highI) {\r\n for (const pt of path)\r\n this.add(pt);\r\n }\r\n if (prev == Location.inside)\r\n loc = Location.inside;\r\n i = 1;\r\n }\r\n if (loc == Location.inside)\r\n this.add(path[0]);\r\n while (i <= highI) {\r\n prev = loc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI)\r\n break;\r\n const prevPt = path[i - 1];\r\n let crossingLoc = loc;\r\n let result = RectClipLines64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc);\r\n const ip = result.ip;\r\n crossingLoc = result.loc;\r\n if (!result.success) {\r\n i++;\r\n continue;\r\n }\r\n if (loc == Location.inside) {\r\n this.add(ip, true);\r\n }\r\n else if (prev !== Location.inside) {\r\n crossingLoc = prev;\r\n result = RectClipLines64.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\r\n const ip2 = result.ip;\r\n crossingLoc = result.loc;\r\n this.add(ip2);\r\n this.add(ip);\r\n }\r\n else {\r\n this.add(ip);\r\n }\r\n }\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nclass Clipper {\r\n static get InvalidRect64() {\r\n if (!Clipper.invalidRect64)\r\n Clipper.invalidRect64 = new Rect64(false);\r\n return this.invalidRect64;\r\n }\r\n static Intersect(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Intersection, subject, clip, fillRule);\r\n }\r\n static Union(subject, clip, fillRule = FillRule.EvenOdd) {\r\n return this.BooleanOp(ClipType.Union, subject, clip, fillRule);\r\n }\r\n static Difference(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Difference, subject, clip, fillRule);\r\n }\r\n static Xor(subject, clip, fillRule) {\r\n return this.BooleanOp(ClipType.Xor, subject, clip, fillRule);\r\n }\r\n static BooleanOp(clipType, subject, clip, fillRule = FillRule.EvenOdd) {\r\n const solution = new Paths64();\r\n if (!subject)\r\n return solution;\r\n const c = new Clipper64();\r\n c.addPaths(subject, PathType.Subject);\r\n if (clip)\r\n c.addPaths(clip, PathType.Clip);\r\n c.execute(clipType, fillRule, solution);\r\n return solution;\r\n }\r\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\r\n // if (!subject) return;\r\n // const c: Clipper64 = new Clipper64();\r\n // c.addPaths(subject, PathType.Subject);\r\n // if (clip)\r\n // c.addPaths(clip, PathType.Clip);\r\n // c.execute(clipType, fillRule, polytree);\r\n //}\r\n static InflatePaths(paths, delta, joinType, endType, miterLimit = 2.0) {\r\n const co = new ClipperOffset(miterLimit);\r\n co.addPaths(paths, joinType, endType);\r\n const solution = new Paths64();\r\n co.execute(delta, solution);\r\n return solution;\r\n }\r\n static RectClipPaths(rect, paths) {\r\n if (rect.isEmpty() || paths.length === 0)\r\n return new Paths64();\r\n const rc = new RectClip64(rect);\r\n return rc.execute(paths);\r\n }\r\n static RectClip(rect, path) {\r\n if (rect.isEmpty() || path.length === 0)\r\n return new Paths64();\r\n const tmp = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipPaths(rect, tmp);\r\n }\r\n static RectClipLinesPaths(rect, paths) {\r\n if (rect.isEmpty() || paths.length === 0)\r\n return new Paths64();\r\n const rc = new RectClipLines64(rect);\r\n return rc.execute(paths);\r\n }\r\n static RectClipLines(rect, path) {\r\n if (rect.isEmpty() || path.length === 0)\r\n return new Paths64();\r\n const tmp = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipLinesPaths(rect, tmp);\r\n }\r\n static MinkowskiSum(pattern, path, isClosed) {\r\n return Minkowski.sum(pattern, path, isClosed);\r\n }\r\n static MinkowskiDiff(pattern, path, isClosed) {\r\n return Minkowski.diff(pattern, path, isClosed);\r\n }\r\n static area(path) {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let a = 0.0;\r\n const cnt = path.length;\r\n if (cnt < 3)\r\n return 0.0;\r\n let prevPt = path[cnt - 1];\r\n for (const pt of path) {\r\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\r\n prevPt = pt;\r\n }\r\n return a * 0.5;\r\n }\r\n static areaPaths(paths) {\r\n let a = 0.0;\r\n for (const path of paths)\r\n a += this.area(path);\r\n return a;\r\n }\r\n static isPositive(poly) {\r\n return this.area(poly) >= 0;\r\n }\r\n static path64ToString(path) {\r\n let result = \"\";\r\n for (const pt of path)\r\n result += pt.toString();\r\n return result + '\\n';\r\n }\r\n static paths64ToString(paths) {\r\n let result = \"\";\r\n for (const path of paths)\r\n result += this.path64ToString(path);\r\n return result;\r\n }\r\n static offsetPath(path, dx, dy) {\r\n const result = new Path64();\r\n for (const pt of path)\r\n result.push(new Point64(pt.x + dx, pt.y + dy));\r\n return result;\r\n }\r\n static scalePoint64(pt, scale) {\r\n const result = new Point64(Math.round(pt.x * scale), Math.round(pt.y * scale));\r\n return result;\r\n }\r\n static scalePath(path, scale) {\r\n if (InternalClipper.isAlmostZero(scale - 1))\r\n return path;\r\n const result = [];\r\n for (const pt of path)\r\n result.push({ x: pt.x * scale, y: pt.y * scale });\r\n return result;\r\n }\r\n static scalePaths(paths, scale) {\r\n if (InternalClipper.isAlmostZero(scale - 1))\r\n return paths;\r\n const result = [];\r\n for (const path of paths)\r\n result.push(this.scalePath(path, scale));\r\n return result;\r\n }\r\n static translatePath(path, dx, dy) {\r\n const result = [];\r\n for (const pt of path) {\r\n result.push({ x: pt.x + dx, y: pt.y + dy });\r\n }\r\n return result;\r\n }\r\n static translatePaths(paths, dx, dy) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(this.translatePath(path, dx, dy));\r\n }\r\n return result;\r\n }\r\n static reversePath(path) {\r\n return [...path].reverse();\r\n }\r\n static reversePaths(paths) {\r\n const result = [];\r\n for (const t of paths) {\r\n result.push(this.reversePath(t));\r\n }\r\n return result;\r\n }\r\n static getBounds(path) {\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n static getBoundsPaths(paths) {\r\n const result = Clipper.InvalidRect64;\r\n for (const path of paths) {\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n static makePath(arr) {\r\n const len = arr.length / 2;\r\n const p = new Path64();\r\n for (let i = 0; i < len; i++)\r\n p.push(new Point64(arr[i * 2], arr[i * 2 + 1]));\r\n return p;\r\n }\r\n static stripDuplicates(path, isClosedPath) {\r\n const cnt = path.length;\r\n const result = new Path64();\r\n if (cnt === 0)\r\n return result;\r\n let lastPt = path[0];\r\n result.push(lastPt);\r\n for (let i = 1; i < cnt; i++)\r\n if (lastPt !== path[i]) {\r\n lastPt = path[i];\r\n result.push(lastPt);\r\n }\r\n if (isClosedPath && lastPt === result[0])\r\n result.pop();\r\n return result;\r\n }\r\n static addPolyNodeToPaths(polyPath, paths) {\r\n if (polyPath.polygon && polyPath.polygon.length > 0)\r\n paths.push(polyPath.polygon);\r\n for (let i = 0; i < polyPath.count; i++)\r\n this.addPolyNodeToPaths(polyPath.children[i], paths);\r\n }\r\n static polyTreeToPaths64(polyTree) {\r\n const result = new Paths64();\r\n for (let i = 0; i < polyTree.count; i++) {\r\n Clipper.addPolyNodeToPaths(polyTree.children[i], result);\r\n }\r\n return result;\r\n }\r\n static perpendicDistFromLineSqrd(pt, line1, line2) {\r\n const a = pt.x - line1.x;\r\n const b = pt.y - line1.y;\r\n const c = line2.x - line1.x;\r\n const d = line2.y - line1.y;\r\n if (c === 0 && d === 0)\r\n return 0;\r\n return Clipper.sqr(a * d - c * b) / (c * c + d * d);\r\n }\r\n static rdp(path, begin, end, epsSqrd, flags) {\r\n let idx = 0;\r\n let max_d = 0;\r\n while (end > begin && path[begin] === path[end]) {\r\n flags[end--] = false;\r\n }\r\n for (let i = begin + 1; i < end; i++) {\r\n const d = Clipper.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\r\n if (d <= max_d)\r\n continue;\r\n max_d = d;\r\n idx = i;\r\n }\r\n if (max_d <= epsSqrd)\r\n return;\r\n flags[idx] = true;\r\n if (idx > begin + 1)\r\n Clipper.rdp(path, begin, idx, epsSqrd, flags);\r\n if (idx < end - 1)\r\n Clipper.rdp(path, idx, end, epsSqrd, flags);\r\n }\r\n static ramerDouglasPeucker(path, epsilon) {\r\n const len = path.length;\r\n if (len < 5)\r\n return path;\r\n const flags = new Array(len).fill(false);\r\n flags[0] = true;\r\n flags[len - 1] = true;\r\n Clipper.rdp(path, 0, len - 1, Clipper.sqr(epsilon), flags);\r\n const result = [];\r\n for (let i = 0; i < len; i++) {\r\n if (flags[i])\r\n result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n static ramerDouglasPeuckerPaths(paths, epsilon) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(Clipper.ramerDouglasPeucker(path, epsilon));\r\n }\r\n return result;\r\n }\r\n static getNext(current, high, flags) {\r\n current++;\r\n while (current <= high && flags[current])\r\n current++;\r\n if (current <= high)\r\n return current;\r\n current = 0;\r\n while (flags[current])\r\n current++;\r\n return current;\r\n }\r\n static getPrior(current, high, flags) {\r\n if (current === 0)\r\n current = high;\r\n else\r\n current--;\r\n while (current > 0 && flags[current])\r\n current--;\r\n if (!flags[current])\r\n return current;\r\n current = high;\r\n while (flags[current])\r\n current--;\r\n return current;\r\n }\r\n static sqr(value) {\r\n return value * value;\r\n }\r\n static simplifyPath(path, epsilon, isClosedPath = false) {\r\n const len = path.length;\r\n const high = len - 1;\r\n const epsSqr = this.sqr(epsilon);\r\n if (len < 4)\r\n return path;\r\n const flags = new Array(len).fill(false);\r\n const dsq = new Array(len).fill(0);\r\n let prev = high;\r\n let curr = 0;\r\n let start, next, prior2, next2;\r\n if (isClosedPath) {\r\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\r\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\r\n }\r\n else {\r\n dsq[0] = Number.MAX_VALUE;\r\n dsq[high] = Number.MAX_VALUE;\r\n }\r\n for (let i = 1; i < high; i++) {\r\n dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\r\n }\r\n for (;;) {\r\n if (dsq[curr] > epsSqr) {\r\n start = curr;\r\n do {\r\n curr = this.getNext(curr, high, flags);\r\n } while (curr !== start && dsq[curr] > epsSqr);\r\n if (curr === start)\r\n break;\r\n }\r\n prev = this.getPrior(curr, high, flags);\r\n next = this.getNext(curr, high, flags);\r\n if (next === prev)\r\n break;\r\n if (dsq[next] < dsq[curr]) {\r\n flags[next] = true;\r\n next = this.getNext(next, high, flags);\r\n next2 = this.getNext(next, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (next !== high || isClosedPath) {\r\n dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\r\n }\r\n curr = next;\r\n }\r\n else {\r\n flags[curr] = true;\r\n curr = next;\r\n next = this.getNext(next, high, flags);\r\n prior2 = this.getPrior(prev, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (prev !== 0 || isClosedPath) {\r\n dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\r\n }\r\n }\r\n }\r\n const result = [];\r\n for (let i = 0; i < len; i++) {\r\n if (!flags[i])\r\n result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n static simplifyPaths(paths, epsilon, isClosedPaths = false) {\r\n const result = [];\r\n for (const path of paths) {\r\n result.push(this.simplifyPath(path, epsilon, isClosedPaths));\r\n }\r\n return result;\r\n }\r\n //private static getNext(current: number, high: number, flags: boolean[]): number {\r\n // current++;\r\n // while (current <= high && flags[current]) current++;\r\n // return current;\r\n //}\r\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n // if (current === 0) return high;\r\n // current--;\r\n // while (current > 0 && flags[current]) current--;\r\n // return current;\r\n //}\r\n static trimCollinear(path, isOpen = false) {\r\n let len = path.length;\r\n let i = 0;\r\n if (!isOpen) {\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 1], path[i], path[i + 1]) === 0)\r\n i++;\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 2], path[len - 1], path[i]) === 0)\r\n len--;\r\n }\r\n if (len - i < 3) {\r\n if (!isOpen || len < 2 || path[0] === path[1]) {\r\n return [];\r\n }\r\n return path;\r\n }\r\n const result = [];\r\n let last = path[i];\r\n result.push(last);\r\n for (i++; i < len - 1; i++) {\r\n if (InternalClipper.crossProduct(last, path[i], path[i + 1]) === 0)\r\n continue;\r\n last = path[i];\r\n result.push(last);\r\n }\r\n if (isOpen) {\r\n result.push(path[len - 1]);\r\n }\r\n else if (InternalClipper.crossProduct(last, path[len - 1], result[0]) !== 0) {\r\n result.push(path[len - 1]);\r\n }\r\n else {\r\n while (result.length > 2 && InternalClipper.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0) {\r\n result.pop();\r\n }\r\n if (result.length < 3)\r\n result.splice(0, result.length);\r\n }\r\n return result;\r\n }\r\n static pointInPolygon(pt, polygon) {\r\n return InternalClipper.pointInPolygon(pt, polygon);\r\n }\r\n static ellipse(center, radiusX, radiusY = 0, steps = 0) {\r\n if (radiusX <= 0)\r\n return [];\r\n if (radiusY <= 0)\r\n radiusY = radiusX;\r\n if (steps <= 2)\r\n steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\r\n const si = Math.sin(2 * Math.PI / steps);\r\n const co = Math.cos(2 * Math.PI / steps);\r\n let dx = co, dy = si;\r\n const result = [{ x: center.x + radiusX, y: center.y }];\r\n for (let i = 1; i < steps; ++i) {\r\n result.push({ x: center.x + radiusX * dx, y: center.y + radiusY * dy });\r\n const x = dx * co - dy * si;\r\n dy = dy * co + dx * si;\r\n dx = x;\r\n }\r\n return result;\r\n }\r\n static showPolyPathStructure(pp, level) {\r\n const spaces = ' '.repeat(level * 2);\r\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\r\n if (pp.count === 0) {\r\n console.log(spaces + caption);\r\n }\r\n else {\r\n console.log(spaces + caption + `(${pp.count})`);\r\n pp.forEach(child => this.showPolyPathStructure(child, level + 1));\r\n }\r\n }\r\n static showPolyTreeStructure(polytree) {\r\n console.log(\"Polytree Root\");\r\n polytree.forEach(child => this.showPolyPathStructure(child, 1));\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\nvar PointInPolygonResult;\r\n(function (PointInPolygonResult) {\r\n PointInPolygonResult[PointInPolygonResult[\"IsOn\"] = 0] = \"IsOn\";\r\n PointInPolygonResult[PointInPolygonResult[\"IsInside\"] = 1] = \"IsInside\";\r\n PointInPolygonResult[PointInPolygonResult[\"IsOutside\"] = 2] = \"IsOutside\";\r\n})(PointInPolygonResult || (PointInPolygonResult = {}));\r\nvar VertexFlags;\r\n(function (VertexFlags) {\r\n VertexFlags[VertexFlags[\"None\"] = 0] = \"None\";\r\n VertexFlags[VertexFlags[\"OpenStart\"] = 1] = \"OpenStart\";\r\n VertexFlags[VertexFlags[\"OpenEnd\"] = 2] = \"OpenEnd\";\r\n VertexFlags[VertexFlags[\"LocalMax\"] = 4] = \"LocalMax\";\r\n VertexFlags[VertexFlags[\"LocalMin\"] = 8] = \"LocalMin\";\r\n})(VertexFlags || (VertexFlags = {}));\r\nclass Vertex {\r\n constructor(pt, flags, prev) {\r\n this.pt = pt;\r\n this.flags = flags;\r\n this.next = undefined;\r\n this.prev = prev;\r\n }\r\n}\r\nclass LocalMinima {\r\n constructor(vertex, polytype, isOpen = false) {\r\n this.vertex = vertex;\r\n this.polytype = polytype;\r\n this.isOpen = isOpen;\r\n }\r\n static equals(lm1, lm2) {\r\n return lm1.vertex === lm2.vertex;\r\n }\r\n static notEquals(lm1, lm2) {\r\n return lm1.vertex !== lm2.vertex;\r\n }\r\n}\r\nclass IntersectNode {\r\n constructor(pt, edge1, edge2) {\r\n this.pt = pt;\r\n this.edge1 = edge1;\r\n this.edge2 = edge2;\r\n }\r\n}\r\nclass OutPt {\r\n constructor(pt, outrec) {\r\n this.pt = pt;\r\n this.outrec = outrec;\r\n this.next = this;\r\n this.prev = this;\r\n this.horz = undefined;\r\n }\r\n}\r\nvar JoinWith;\r\n(function (JoinWith) {\r\n JoinWith[JoinWith[\"None\"] = 0] = \"None\";\r\n JoinWith[JoinWith[\"Left\"] = 1] = \"Left\";\r\n JoinWith[JoinWith[\"Right\"] = 2] = \"Right\";\r\n})(JoinWith || (JoinWith = {}));\r\nvar HorzPosition;\r\n(function (HorzPosition) {\r\n HorzPosition[HorzPosition[\"Bottom\"] = 0] = \"Bottom\";\r\n HorzPosition[HorzPosition[\"Middle\"] = 1] = \"Middle\";\r\n HorzPosition[HorzPosition[\"Top\"] = 2] = \"Top\";\r\n})(HorzPosition || (HorzPosition = {}));\r\nclass OutRec {\r\n constructor(idx) {\r\n this.idx = idx;\r\n this.isOpen = false;\r\n }\r\n}\r\nclass HorzSegment {\r\n constructor(op) {\r\n this.leftOp = op;\r\n this.rightOp = undefined;\r\n this.leftToRight = true;\r\n }\r\n}\r\nclass HorzJoin {\r\n constructor(ltor, rtol) {\r\n this.op1 = ltor;\r\n this.op2 = rtol;\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////\r\n// Important: UP and DOWN here are premised on Y-axis positive down\r\n// displays, which is the orientation used in Clipper's development.\r\n///////////////////////////////////////////////////////////////////\r\nclass Active {\r\n constructor() {\r\n this.dx = this.windCount = this.windCount2 = 0;\r\n this.isLeftBound = false;\r\n this.joinWith = JoinWith.None;\r\n }\r\n}\r\nclass ClipperEngine {\r\n static addLocMin(vert, polytype, isOpen, minimaList) {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) !== VertexFlags.None)\r\n return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n minimaList.push(lm);\r\n }\r\n static addPathsToVertexList(paths, polytype, isOpen, minimaList, vertexList) {\r\n let totalVertCnt = 0;\r\n for (const path of paths)\r\n totalVertCnt += path.length;\r\n for (const path of paths) {\r\n let v0 = undefined;\r\n let prev_v = undefined;\r\n let curr_v = undefined;\r\n for (const pt of path) {\r\n if (!v0) {\r\n v0 = new Vertex(pt, VertexFlags.None, undefined);\r\n vertexList.push(v0);\r\n prev_v = v0;\r\n }\r\n else if (prev_v.pt !== pt) { // i.e., skips duplicates\r\n curr_v = new Vertex(pt, VertexFlags.None, prev_v);\r\n vertexList.push(curr_v);\r\n prev_v.next = curr_v;\r\n prev_v = curr_v;\r\n }\r\n }\r\n if (!prev_v || !prev_v.prev)\r\n continue;\r\n if (!isOpen && prev_v.pt === v0.pt)\r\n prev_v = prev_v.prev;\r\n prev_v.next = v0;\r\n v0.prev = prev_v;\r\n if (!isOpen && prev_v.next === prev_v)\r\n continue;\r\n // OK, we have a valid path\r\n let going_up = false;\r\n if (isOpen) {\r\n curr_v = v0.next;\r\n let count = 0;\r\n while (curr_v !== v0 && curr_v.pt.y === v0.pt.y) {\r\n curr_v = curr_v.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n going_up = curr_v.pt.y <= v0.pt.y;\r\n if (going_up) {\r\n v0.flags = VertexFlags.OpenStart;\r\n this.addLocMin(v0, polytype, true, minimaList);\r\n }\r\n else {\r\n v0.flags = VertexFlags.OpenStart | VertexFlags.LocalMax;\r\n }\r\n }\r\n else { // closed path\r\n prev_v = v0.prev;\r\n let count = 0;\r\n while (prev_v !== v0 && prev_v.pt.y === v0.pt.y) {\r\n prev_v = prev_v.prev;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n if (prev_v === v0) {\r\n continue; // only open paths can be completely flat\r\n }\r\n going_up = prev_v.pt.y > v0.pt.y;\r\n }\r\n const going_up0 = going_up;\r\n prev_v = v0;\r\n curr_v = v0.next;\r\n let count = 0;\r\n while (curr_v !== v0) {\r\n if (curr_v.pt.y > prev_v.pt.y && going_up) {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n going_up = false;\r\n }\r\n else if (curr_v.pt.y < prev_v.pt.y && !going_up) {\r\n going_up = true;\r\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\r\n }\r\n prev_v = curr_v;\r\n curr_v = curr_v.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected');\r\n break;\r\n }\r\n }\r\n if (isOpen) {\r\n prev_v.flags |= VertexFlags.OpenEnd;\r\n if (going_up) {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n }\r\n else {\r\n this.addLocMin(prev_v, polytype, isOpen, minimaList);\r\n }\r\n }\r\n else if (going_up !== going_up0) {\r\n if (going_up0) {\r\n this.addLocMin(prev_v, polytype, false, minimaList);\r\n }\r\n else {\r\n prev_v.flags |= VertexFlags.LocalMax;\r\n }\r\n }\r\n }\r\n }\r\n}\r\nclass ReuseableDataContainer64 {\r\n constructor() {\r\n this._minimaList = [];\r\n this._vertexList = [];\r\n }\r\n clear() {\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n }\r\n addPaths(paths, pt, isOpen) {\r\n ClipperEngine.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\r\n }\r\n}\r\nclass SimpleNavigableSet {\r\n constructor() {\r\n this.items = [];\r\n this.items = [];\r\n }\r\n clear() { this.items.length = 0; }\r\n isEmpty() { return this.items.length == 0; }\r\n pollLast() {\r\n return this.items.pop();\r\n }\r\n add(item) {\r\n if (!this.items.includes(item)) {\r\n this.items.push(item);\r\n this.items.sort((a, b) => a - b);\r\n }\r\n }\r\n}\r\nclass ClipperBase {\r\n constructor() {\r\n this._cliptype = ClipType.None;\r\n this._fillrule = FillRule.EvenOdd;\r\n this._currentLocMin = 0;\r\n this._currentBotY = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n this._using_polytree = false;\r\n this._succeeded = false;\r\n this.reverseSolution = false;\r\n this._minimaList = [];\r\n this._intersectList = [];\r\n this._vertexList = [];\r\n this._outrecList = [];\r\n this._scanlineList = new SimpleNavigableSet();\r\n this._horzSegList = [];\r\n this._horzJoinList = [];\r\n this.preserveCollinear = true;\r\n }\r\n static isOdd(val) {\r\n return ((val & 1) !== 0);\r\n }\r\n static isHotEdgeActive(ae) {\r\n return ae.outrec !== undefined;\r\n }\r\n static isOpen(ae) {\r\n return ae.localMin.isOpen;\r\n }\r\n static isOpenEndActive(ae) {\r\n return ae.localMin.isOpen && ClipperBase.isOpenEnd(ae.vertexTop);\r\n }\r\n static isOpenEnd(v) {\r\n return (v.flags & (VertexFlags.OpenStart | VertexFlags.OpenEnd)) !== VertexFlags.None;\r\n }\r\n static getPrevHotEdge(ae) {\r\n let prev = ae.prevInAEL;\r\n while (prev && (ClipperBase.isOpen(prev) || !ClipperBase.isHotEdgeActive(prev)))\r\n prev = prev.prevInAEL;\r\n return prev;\r\n }\r\n static isFront(ae) {\r\n return ae === ae.outrec.frontEdge;\r\n }\r\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/\r\n static getDx(pt1, pt2) {\r\n const dy = pt2.y - pt1.y;\r\n if (dy !== 0)\r\n return (pt2.x - pt1.x) / dy;\r\n if (pt2.x > pt1.x)\r\n return Number.NEGATIVE_INFINITY;\r\n return Number.POSITIVE_INFINITY;\r\n }\r\n static topX(ae, currentY) {\r\n if ((currentY === ae.top.y) || (ae.top.x === ae.bot.x))\r\n return ae.top.x;\r\n if (currentY === ae.bot.y)\r\n return ae.bot.x;\r\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\r\n }\r\n static isHorizontal(ae) {\r\n return (ae.top.y === ae.bot.y);\r\n }\r\n static isHeadingRightHorz(ae) {\r\n return (Number.NEGATIVE_INFINITY === ae.dx);\r\n }\r\n static isHeadingLeftHorz(ae) {\r\n return (Number.POSITIVE_INFINITY === ae.dx);\r\n }\r\n static swapActives(ae1, ae2) {\r\n [ae2, ae1] = [ae1, ae2];\r\n }\r\n static getPolyType(ae) {\r\n return ae.localMin.polytype;\r\n }\r\n static isSamePolyType(ae1, ae2) {\r\n return ae1.localMin.polytype === ae2.localMin.polytype;\r\n }\r\n static setDx(ae) {\r\n ae.dx = ClipperBase.getDx(ae.bot, ae.top);\r\n }\r\n static nextVertex(ae) {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop.next;\r\n return ae.vertexTop.prev;\r\n }\r\n static prevPrevVertex(ae) {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop.prev.prev;\r\n return ae.vertexTop.next.next;\r\n }\r\n static isMaxima(vertex) {\r\n return (vertex.flags & VertexFlags.LocalMax) !== VertexFlags.None;\r\n }\r\n static isMaximaActive(ae) {\r\n return ClipperBase.isMaxima(ae.vertexTop);\r\n }\r\n static getMaximaPair(ae) {\r\n let ae2 = ae.nextInAEL;\r\n while (ae2) {\r\n if (ae2.vertexTop === ae.vertexTop)\r\n return ae2; // Found!\r\n ae2 = ae2.nextInAEL;\r\n }\r\n return undefined;\r\n }\r\n static getCurrYMaximaVertex_Open(ae) {\r\n let result = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result.next.pt.y === result.pt.y &&\r\n ((result.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result.next;\r\n }\r\n else {\r\n while (result.prev.pt.y === result.pt.y &&\r\n ((result.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result))\r\n result = undefined; // not a maxima\r\n return result;\r\n }\r\n static getCurrYMaximaVertex(ae) {\r\n let result = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result.next.pt.y === result.pt.y)\r\n result = result.next;\r\n }\r\n else {\r\n while (result.prev.pt.y === result.pt.y)\r\n result = result.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result))\r\n result = undefined; // not a maxima\r\n return result;\r\n }\r\n static setSides(outrec, startEdge, endEdge) {\r\n outrec.frontEdge = startEdge;\r\n outrec.backEdge = endEdge;\r\n }\r\n static swapOutrecs(ae1, ae2) {\r\n const or1 = ae1.outrec;\r\n const or2 = ae2.outrec;\r\n if (or1 === or2) {\r\n const ae = or1.frontEdge;\r\n or1.frontEdge = or1.backEdge;\r\n or1.backEdge = ae;\r\n return;\r\n }\r\n if (or1) {\r\n if (ae1 === or1.frontEdge)\r\n or1.frontEdge = ae2;\r\n else\r\n or1.backEdge = ae2;\r\n }\r\n if (or2) {\r\n if (ae2 === or2.frontEdge)\r\n or2.frontEdge = ae1;\r\n else\r\n or2.backEdge = ae1;\r\n }\r\n ae1.outrec = or2;\r\n ae2.outrec = or1;\r\n }\r\n static setOwner(outrec, newOwner) {\r\n while (newOwner.owner && !newOwner.owner.pts) {\r\n newOwner.owner = newOwner.owner.owner;\r\n }\r\n //make sure that outrec isn't an owner of newOwner\r\n let tmp = newOwner;\r\n while (tmp && tmp !== outrec)\r\n tmp = tmp.owner;\r\n if (tmp)\r\n newOwner.owner = outrec.owner;\r\n outrec.owner = newOwner;\r\n }\r\n static area(op) {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let area = 0.0;\r\n let op2 = op;\r\n do {\r\n area += (op2.prev.pt.y + op2.pt.y) *\r\n (op2.prev.pt.x - op2.pt.x);\r\n op2 = op2.next;\r\n } while (op2 !== op);\r\n return area * 0.5;\r\n }\r\n static areaTriangle(pt1, pt2, pt3) {\r\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) +\r\n (pt1.y + pt2.y) * (pt1.x - pt2.x) +\r\n (pt2.y + pt3.y) * (pt2.x - pt3.x);\r\n }\r\n static getRealOutRec(outRec) {\r\n while (outRec !== undefined && outRec.pts === undefined) {\r\n outRec = outRec.owner;\r\n }\r\n return outRec;\r\n }\r\n static isValidOwner(outRec, testOwner) {\r\n while (testOwner !== undefined && testOwner !== outRec)\r\n testOwner = testOwner.owner;\r\n return testOwner === undefined;\r\n }\r\n static uncoupleOutRec(ae) {\r\n const outrec = ae.outrec;\r\n if (outrec === undefined)\r\n return;\r\n outrec.frontEdge.outrec = undefined;\r\n outrec.backEdge.outrec = undefined;\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = undefined;\r\n }\r\n static outrecIsAscending(hotEdge) {\r\n return (hotEdge === hotEdge.outrec.frontEdge);\r\n }\r\n static swapFrontBackSides(outrec) {\r\n // while this proc. is needed for open paths\r\n // it's almost never needed for closed paths\r\n const ae2 = outrec.frontEdge;\r\n outrec.frontEdge = outrec.backEdge;\r\n outrec.backEdge = ae2;\r\n outrec.pts = outrec.pts.next;\r\n }\r\n static edgesAdjacentInAEL(inode) {\r\n return (inode.edge1.nextInAEL === inode.edge2) || (inode.edge1.prevInAEL === inode.edge2);\r\n }\r\n clearSolutionOnly() {\r\n while (this._actives)\r\n this.deleteFromAEL(this._actives);\r\n this._scanlineList.clear();\r\n this.disposeIntersectNodes();\r\n this._outrecList.length = 0;\r\n this._horzSegList.length = 0;\r\n this._horzJoinList.length = 0;\r\n }\r\n clear() {\r\n this.clearSolutionOnly();\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n this._currentLocMin = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n }\r\n reset() {\r\n if (!this._isSortedMinimaList) {\r\n this._minimaList.sort((locMin1, locMin2) => locMin2.vertex.pt.y - locMin1.vertex.pt.y);\r\n this._isSortedMinimaList = true;\r\n }\r\n for (let i = this._minimaList.length - 1; i >= 0; i--) {\r\n this._scanlineList.add(this._minimaList[i].vertex.pt.y);\r\n }\r\n this._currentBotY = 0;\r\n this._currentLocMin = 0;\r\n this._actives = undefined;\r\n this._sel = undefined;\r\n this._succeeded = true;\r\n }\r\n insertScanline(y) {\r\n this._scanlineList.add(y);\r\n }\r\n popScanline() {\r\n return this._scanlineList.pollLast();\r\n }\r\n hasLocMinAtY(y) {\r\n return (this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y);\r\n }\r\n popLocalMinima() {\r\n return this._minimaList[this._currentLocMin++];\r\n }\r\n addLocMin(vert, polytype, isOpen) {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) != VertexFlags.None)\r\n return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n this._minimaList.push(lm);\r\n }\r\n addSubject(path) {\r\n this.addPath(path, PathType.Subject);\r\n }\r\n addOpenSubject(path) {\r\n this.addPath(path, PathType.Subject, true);\r\n }\r\n addClip(path) {\r\n this.addPath(path, PathType.Clip);\r\n }\r\n addPath(path, polytype, isOpen = false) {\r\n const tmp = [path];\r\n this.addPaths(tmp, polytype, isOpen);\r\n }\r\n addPaths(paths, polytype, isOpen = false) {\r\n if (isOpen)\r\n this._hasOpenPaths = true;\r\n this._isSortedMinimaList = false;\r\n ClipperEngine.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\r\n }\r\n addReuseableData(reuseableData) {\r\n if (reuseableData._minimaList.length === 0)\r\n return;\r\n this._isSortedMinimaList = false;\r\n for (const lm of reuseableData._minimaList) {\r\n this._minimaList.push(new LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\r\n if (lm.isOpen)\r\n this._hasOpenPaths = true;\r\n }\r\n }\r\n isContributingClosed(ae) {\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae.windCount !== 1)\r\n return false;\r\n break;\r\n case FillRule.Negative:\r\n if (ae.windCount !== -1)\r\n return false;\r\n break;\r\n case FillRule.NonZero:\r\n if (Math.abs(ae.windCount) !== 1)\r\n return false;\r\n break;\r\n }\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 > 0;\r\n case FillRule.Negative: return ae.windCount2 < 0;\r\n default: return ae.windCount2 !== 0;\r\n }\r\n case ClipType.Union:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 <= 0;\r\n case FillRule.Negative: return ae.windCount2 >= 0;\r\n default: return ae.windCount2 === 0;\r\n }\r\n case ClipType.Difference:\r\n const result = this._fillrule === FillRule.Positive ? (ae.windCount2 <= 0) :\r\n this._fillrule === FillRule.Negative ? (ae.windCount2 >= 0) :\r\n (ae.windCount2 === 0);\r\n return ClipperBase.getPolyType(ae) === PathType.Subject ? result : !result;\r\n case ClipType.Xor:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n isContributingOpen(ae) {\r\n let isInClip, isInSubj;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n isInSubj = ae.windCount > 0;\r\n isInClip = ae.windCount2 > 0;\r\n break;\r\n case FillRule.Negative:\r\n isInSubj = ae.windCount < 0;\r\n isInClip = ae.windCount2 < 0;\r\n break;\r\n default:\r\n isInSubj = ae.windCount !== 0;\r\n isInClip = ae.windCount2 !== 0;\r\n break;\r\n }\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n return isInClip;\r\n case ClipType.Union:\r\n return !isInSubj && !isInClip;\r\n default:\r\n return !isInClip;\r\n }\r\n }\r\n setWindCountForClosedPathEdge(ae) {\r\n let ae2 = ae.prevInAEL;\r\n const pt = ClipperBase.getPolyType(ae);\r\n while (ae2 !== undefined && (ClipperBase.getPolyType(ae2) !== pt || ClipperBase.isOpen(ae2))) {\r\n ae2 = ae2.prevInAEL;\r\n }\r\n if (ae2 === undefined) {\r\n ae.windCount = ae.windDx;\r\n ae2 = this._actives;\r\n }\r\n else if (this._fillrule === FillRule.EvenOdd) {\r\n ae.windCount = ae.windDx;\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n else {\r\n // NonZero, positive, or negative filling here ...\r\n // when e2's WindCnt is in the SAME direction as its WindDx,\r\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\r\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\r\n if (ae2.windCount * ae2.windDx < 0) {\r\n // opposite directions so 'ae' is outside 'ae2' ...\r\n if (Math.abs(ae2.windCount) > 1) {\r\n // outside prev poly but still inside another.\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n else {\r\n // now outside all polys of same polytype so set own WC ...\r\n ae.windCount = (ClipperBase.isOpen(ae) ? 1 : ae.windDx);\r\n }\r\n }\r\n else {\r\n // 'ae' must be inside 'ae2'\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\r\n }\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) !== pt && !ClipperBase.isOpen(ae2)) {\r\n ae.windCount2 = (ae.windCount2 === 0 ? 1 : 0);\r\n }\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) !== pt && !ClipperBase.isOpen(ae2)) {\r\n ae.windCount2 += ae2.windDx;\r\n }\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n }\r\n setWindCountForOpenPathEdge(ae) {\r\n let ae2 = this._actives;\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n let cnt1 = 0, cnt2 = 0;\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) === PathType.Clip)\r\n cnt2++;\r\n else if (!ClipperBase.isOpen(ae2))\r\n cnt1++;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n ae.windCount = (ClipperBase.isOdd(cnt1) ? 1 : 0);\r\n ae.windCount2 = (ClipperBase.isOdd(cnt2) ? 1 : 0);\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2) === PathType.Clip)\r\n ae.windCount2 += ae2.windDx;\r\n else if (!ClipperBase.isOpen(ae2))\r\n ae.windCount += ae2.windDx;\r\n ae2 = ae2.nextInAEL;\r\n }\r\n }\r\n }\r\n static isValidAelOrder(resident, newcomer) {\r\n if (newcomer.curX !== resident.curX)\r\n return newcomer.curX > resident.curX;\r\n // get the turning direction a1.top, a2.bot, a2.top\r\n const d = InternalClipper.crossProduct(resident.top, newcomer.bot, newcomer.top);\r\n if (d !== 0.0)\r\n return (d < 0);\r\n // edges must be collinear to get here\r\n // for starting open paths, place them according to\r\n // the direction they're about to turn\r\n if (!this.isMaximaActive(resident) && (resident.top.y > newcomer.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot, resident.top, this.nextVertex(resident).pt) <= 0;\r\n }\r\n if (!this.isMaximaActive(newcomer) && (newcomer.top.y > resident.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot, newcomer.top, this.nextVertex(newcomer).pt) >= 0;\r\n }\r\n const y = newcomer.bot.y;\r\n const newcomerIsLeft = newcomer.isLeftBound;\r\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y)\r\n return newcomer.isLeftBound;\r\n // resident must also have just been inserted\r\n if (resident.isLeftBound !== newcomerIsLeft)\r\n return newcomerIsLeft;\r\n if (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt, resident.bot, resident.top) === 0)\r\n return true;\r\n // compare turning direction of the alternate bound\r\n return (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt, newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0) === newcomerIsLeft;\r\n }\r\n insertLeftEdge(ae) {\r\n let ae2;\r\n if (!this._actives) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = undefined;\r\n this._actives = ae;\r\n }\r\n else if (!ClipperBase.isValidAelOrder(this._actives, ae)) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = this._actives;\r\n this._actives.prevInAEL = ae;\r\n this._actives = ae;\r\n }\r\n else {\r\n ae2 = this._actives;\r\n while (ae2.nextInAEL && ClipperBase.isValidAelOrder(ae2.nextInAEL, ae))\r\n ae2 = ae2.nextInAEL;\r\n //don't separate joined edges\r\n if (ae2.joinWith === JoinWith.Right)\r\n ae2 = ae2.nextInAEL;\r\n ae.nextInAEL = ae2.nextInAEL;\r\n if (ae2.nextInAEL)\r\n ae2.nextInAEL.prevInAEL = ae;\r\n ae.prevInAEL = ae2;\r\n ae2.nextInAEL = ae;\r\n }\r\n }\r\n static insertRightEdge(ae, ae2) {\r\n ae2.nextInAEL = ae.nextInAEL;\r\n if (ae.nextInAEL)\r\n ae.nextInAEL.prevInAEL = ae2;\r\n ae2.prevInAEL = ae;\r\n ae.nextInAEL = ae2;\r\n }\r\n insertLocalMinimaIntoAEL(botY) {\r\n let localMinima;\r\n let leftBound;\r\n let rightBound;\r\n // Add any local minima (if any) at BotY ...\r\n // NB horizontal local minima edges should contain locMin.vertex.prev\r\n while (this.hasLocMinAtY(botY)) {\r\n localMinima = this.popLocalMinima();\r\n if ((localMinima.vertex.flags & VertexFlags.OpenStart) !== VertexFlags.None) {\r\n leftBound = undefined;\r\n }\r\n else {\r\n leftBound = new Active();\r\n leftBound.bot = localMinima.vertex.pt;\r\n leftBound.curX = localMinima.vertex.pt.x;\r\n leftBound.windDx = -1;\r\n leftBound.vertexTop = localMinima.vertex.prev;\r\n leftBound.top = localMinima.vertex.prev.pt;\r\n leftBound.outrec = undefined;\r\n leftBound.localMin = localMinima;\r\n ClipperBase.setDx(leftBound);\r\n }\r\n if ((localMinima.vertex.flags & VertexFlags.OpenEnd) !== VertexFlags.None) {\r\n rightBound = undefined;\r\n }\r\n else {\r\n rightBound = new Active();\r\n rightBound.bot = localMinima.vertex.pt;\r\n rightBound.curX = localMinima.vertex.pt.x;\r\n rightBound.windDx = 1;\r\n rightBound.vertexTop = localMinima.vertex.next;\r\n rightBound.top = localMinima.vertex.next.pt;\r\n rightBound.outrec = undefined;\r\n rightBound.localMin = localMinima;\r\n ClipperBase.setDx(rightBound);\r\n }\r\n if (leftBound && rightBound) {\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n if (ClipperBase.isHeadingRightHorz(leftBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n }\r\n else if (ClipperBase.isHorizontal(rightBound)) {\r\n if (ClipperBase.isHeadingLeftHorz(rightBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n }\r\n else if (leftBound.dx < rightBound.dx) {\r\n [rightBound, leftBound] = [leftBound, rightBound];\r\n }\r\n //so when leftBound has windDx == 1, the polygon will be oriented\r\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\r\n }\r\n else if (leftBound === undefined) {\r\n leftBound = rightBound;\r\n rightBound = undefined;\r\n }\r\n let contributing = false;\r\n leftBound.isLeftBound = true;\r\n this.insertLeftEdge(leftBound);\r\n if (ClipperBase.isOpen(leftBound)) {\r\n this.setWindCountForOpenPathEdge(leftBound);\r\n contributing = this.isContributingOpen(leftBound);\r\n }\r\n else {\r\n this.setWindCountForClosedPathEdge(leftBound);\r\n contributing = this.isContributingClosed(leftBound);\r\n }\r\n if (rightBound) {\r\n rightBound.windCount = leftBound.windCount;\r\n rightBound.windCount2 = leftBound.windCount2;\r\n ClipperBase.insertRightEdge(leftBound, rightBound);\r\n if (contributing) {\r\n this.addLocalMinPoly(leftBound, rightBound, leftBound.bot, true);\r\n if (!ClipperBase.isHorizontal(leftBound)) {\r\n this.checkJoinLeft(leftBound, leftBound.bot);\r\n }\r\n }\r\n while (rightBound.nextInAEL &&\r\n ClipperBase.isValidAelOrder(rightBound.nextInAEL, rightBound)) {\r\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\r\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\r\n }\r\n if (ClipperBase.isHorizontal(rightBound)) {\r\n this.pushHorz(rightBound);\r\n }\r\n else {\r\n this.checkJoinRight(rightBound, rightBound.bot);\r\n this.insertScanline(rightBound.top.y);\r\n }\r\n }\r\n else if (contributing) {\r\n this.startOpenPath(leftBound, leftBound.bot);\r\n }\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n this.pushHorz(leftBound);\r\n }\r\n else {\r\n this.insertScanline(leftBound.top.y);\r\n }\r\n }\r\n }\r\n pushHorz(ae) {\r\n ae.nextInSEL = this._sel;\r\n this._sel = ae;\r\n }\r\n popHorz() {\r\n const ae = this._sel;\r\n if (this._sel === undefined)\r\n return undefined;\r\n this._sel = this._sel.nextInSEL;\r\n return ae;\r\n }\r\n addLocalMinPoly(ae1, ae2, pt, isNew = false) {\r\n const outrec = this.newOutRec();\r\n ae1.outrec = outrec;\r\n ae2.outrec = outrec;\r\n if (ClipperBase.isOpen(ae1)) {\r\n outrec.owner = undefined;\r\n outrec.isOpen = true;\r\n if (ae1.windDx > 0)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n else {\r\n outrec.isOpen = false;\r\n const prevHotEdge = ClipperBase.getPrevHotEdge(ae1);\r\n // e.windDx is the winding direction of the **input** paths\r\n // and unrelated to the winding direction of output polygons.\r\n // Output orientation is determined by e.outrec.frontE which is\r\n // the ascending edge (see AddLocalMinPoly).\r\n if (prevHotEdge) {\r\n if (this._using_polytree)\r\n ClipperBase.setOwner(outrec, prevHotEdge.outrec);\r\n outrec.owner = prevHotEdge.outrec;\r\n if (ClipperBase.outrecIsAscending(prevHotEdge) === isNew)\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n else\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n }\r\n else {\r\n outrec.owner = undefined;\r\n if (isNew)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n }\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n addLocalMaxPoly(ae1, ae2, pt) {\r\n if (ClipperBase.isJoined(ae1))\r\n this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n if (ClipperBase.isFront(ae1) === ClipperBase.isFront(ae2)) {\r\n if (ClipperBase.isOpenEndActive(ae1))\r\n ClipperBase.swapFrontBackSides(ae1.outrec);\r\n else if (ClipperBase.isOpenEndActive(ae2))\r\n ClipperBase.swapFrontBackSides(ae2.outrec);\r\n else {\r\n this._succeeded = false;\r\n return undefined;\r\n }\r\n }\r\n const result = ClipperBase.addOutPt(ae1, pt);\r\n if (ae1.outrec === ae2.outrec) {\r\n const outrec = ae1.outrec;\r\n outrec.pts = result;\r\n if (this._using_polytree) {\r\n const e = ClipperBase.getPrevHotEdge(ae1);\r\n if (e === undefined)\r\n outrec.owner = undefined;\r\n else\r\n ClipperBase.setOwner(outrec, e.outrec);\r\n }\r\n ClipperBase.uncoupleOutRec(ae1);\r\n }\r\n else if (ClipperBase.isOpen(ae1)) {\r\n if (ae1.windDx < 0)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n }\r\n else if (ae1.outrec.idx < ae2.outrec.idx)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n return result;\r\n }\r\n static joinOutrecPaths(ae1, ae2) {\r\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\r\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\r\n const p1Start = ae1.outrec.pts;\r\n const p2Start = ae2.outrec.pts;\r\n const p1End = p1Start.next;\r\n const p2End = p2Start.next;\r\n if (ClipperBase.isFront(ae1)) {\r\n p2End.prev = p1Start;\r\n p1Start.next = p2End;\r\n p2Start.next = p1End;\r\n p1End.prev = p2Start;\r\n ae1.outrec.pts = p2Start;\r\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\r\n ae1.outrec.frontEdge = ae2.outrec.frontEdge;\r\n if (ae1.outrec.frontEdge)\r\n ae1.outrec.frontEdge.outrec = ae1.outrec;\r\n }\r\n else {\r\n p1End.prev = p2Start;\r\n p2Start.next = p1End;\r\n p1Start.next = p2End;\r\n p2End.prev = p1Start;\r\n ae1.outrec.backEdge = ae2.outrec.backEdge;\r\n if (ae1.outrec.backEdge)\r\n ae1.outrec.backEdge.outrec = ae1.outrec;\r\n }\r\n // after joining, the ae2.OutRec must contains no vertices ...\r\n ae2.outrec.frontEdge = undefined;\r\n ae2.outrec.backEdge = undefined;\r\n ae2.outrec.pts = undefined;\r\n ClipperBase.setOwner(ae2.outrec, ae1.outrec);\r\n if (ClipperBase.isOpenEndActive(ae1)) {\r\n ae2.outrec.pts = ae1.outrec.pts;\r\n ae1.outrec.pts = undefined;\r\n }\r\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\r\n ae1.outrec = undefined;\r\n ae2.outrec = undefined;\r\n }\r\n static addOutPt(ae, pt) {\r\n const outrec = ae.outrec;\r\n const toFront = ClipperBase.isFront(ae);\r\n const opFront = outrec.pts;\r\n const opBack = opFront.next;\r\n if (toFront && (pt == opFront.pt))\r\n return opFront;\r\n else if (!toFront && (pt == opBack.pt))\r\n return opBack;\r\n const newOp = new OutPt(pt, outrec);\r\n opBack.prev = newOp;\r\n newOp.prev = opFront;\r\n newOp.next = opBack;\r\n opFront.next = newOp;\r\n if (toFront)\r\n outrec.pts = newOp;\r\n return newOp;\r\n }\r\n newOutRec() {\r\n const result = new OutRec(this._outrecList.length);\r\n this._outrecList.push(result);\r\n return result;\r\n }\r\n startOpenPath(ae, pt) {\r\n const outrec = this.newOutRec();\r\n outrec.isOpen = true;\r\n if (ae.windDx > 0) {\r\n outrec.frontEdge = ae;\r\n outrec.backEdge = undefined;\r\n }\r\n else {\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = ae;\r\n }\r\n ae.outrec = outrec;\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n updateEdgeIntoAEL(ae) {\r\n ae.bot = ae.top;\r\n ae.vertexTop = ClipperBase.nextVertex(ae);\r\n ae.top = ae.vertexTop.pt;\r\n ae.curX = ae.bot.x;\r\n ClipperBase.setDx(ae);\r\n if (ClipperBase.isJoined(ae))\r\n this.split(ae, ae.bot);\r\n if (ClipperBase.isHorizontal(ae))\r\n return;\r\n this.insertScanline(ae.top.y);\r\n this.checkJoinLeft(ae, ae.bot);\r\n this.checkJoinRight(ae, ae.bot, true);\r\n }\r\n static findEdgeWithMatchingLocMin(e) {\r\n let result = e.nextInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin)\r\n return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot)\r\n result = undefined;\r\n else\r\n result = result.nextInAEL;\r\n }\r\n result = e.prevInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin)\r\n return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot)\r\n return undefined;\r\n result = result.prevInAEL;\r\n }\r\n return result;\r\n }\r\n intersectEdges(ae1, ae2, pt) {\r\n let resultOp = undefined;\r\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\r\n if (this._hasOpenPaths && (ClipperBase.isOpen(ae1) || ClipperBase.isOpen(ae2))) {\r\n if (ClipperBase.isOpen(ae1) && ClipperBase.isOpen(ae2))\r\n return undefined;\r\n // the following line avoids duplicating quite a bit of code\r\n if (ClipperBase.isOpen(ae2))\r\n ClipperBase.swapActives(ae1, ae2);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n if (this._cliptype === ClipType.Union) {\r\n if (!ClipperBase.isHotEdgeActive(ae2))\r\n return undefined;\r\n }\r\n else if (ae2.localMin.polytype === PathType.Subject)\r\n return undefined;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae2.windCount !== 1)\r\n return undefined;\r\n break;\r\n case FillRule.Negative:\r\n if (ae2.windCount !== -1)\r\n return undefined;\r\n break;\r\n default:\r\n if (Math.abs(ae2.windCount) !== 1)\r\n return undefined;\r\n break;\r\n }\r\n // toggle contribution ...\r\n if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n if (ClipperBase.isFront(ae1)) {\r\n ae1.outrec.frontEdge = undefined;\r\n }\r\n else {\r\n ae1.outrec.backEdge = undefined;\r\n }\r\n ae1.outrec = undefined;\r\n // horizontal edges can pass under open paths at a LocMins\r\n }\r\n else if (pt === ae1.localMin.vertex.pt && !ClipperBase.isOpenEnd(ae1.localMin.vertex)) {\r\n // find the other side of the LocMin and\r\n // if it's 'hot' join up with it ...\r\n const ae3 = ClipperBase.findEdgeWithMatchingLocMin(ae1);\r\n if (ae3 && ClipperBase.isHotEdgeActive(ae3)) {\r\n ae1.outrec = ae3.outrec;\r\n if (ae1.windDx > 0) {\r\n ClipperBase.setSides(ae3.outrec, ae1, ae3);\r\n }\r\n else {\r\n ClipperBase.setSides(ae3.outrec, ae3, ae1);\r\n }\r\n return ae3.outrec.pts;\r\n }\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n else {\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n return resultOp;\r\n }\r\n // MANAGING CLOSED PATHS FROM HERE ON\r\n if (ClipperBase.isJoined(ae1))\r\n this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2))\r\n this.split(ae2, pt);\r\n // UPDATE WINDING COUNTS...\r\n let oldE1WindCount;\r\n let oldE2WindCount;\r\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n oldE1WindCount = ae1.windCount;\r\n ae1.windCount = ae2.windCount;\r\n ae2.windCount = oldE1WindCount;\r\n }\r\n else {\r\n if (ae1.windCount + ae2.windDx === 0)\r\n ae1.windCount = -ae1.windCount;\r\n else\r\n ae1.windCount += ae2.windDx;\r\n if (ae2.windCount - ae1.windDx === 0)\r\n ae2.windCount = -ae2.windCount;\r\n else\r\n ae2.windCount -= ae1.windDx;\r\n }\r\n }\r\n else {\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae1.windCount2 += ae2.windDx;\r\n else\r\n ae1.windCount2 = (ae1.windCount2 === 0 ? 1 : 0);\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae2.windCount2 -= ae1.windDx;\r\n else\r\n ae2.windCount2 = (ae2.windCount2 === 0 ? 1 : 0);\r\n }\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n oldE1WindCount = ae1.windCount;\r\n oldE2WindCount = ae2.windCount;\r\n break;\r\n case FillRule.Negative:\r\n oldE1WindCount = -ae1.windCount;\r\n oldE2WindCount = -ae2.windCount;\r\n break;\r\n default:\r\n oldE1WindCount = Math.abs(ae1.windCount);\r\n oldE2WindCount = Math.abs(ae2.windCount);\r\n break;\r\n }\r\n const e1WindCountIs0or1 = oldE1WindCount === 0 || oldE1WindCount === 1;\r\n const e2WindCountIs0or1 = oldE2WindCount === 0 || oldE2WindCount === 1;\r\n if ((!ClipperBase.isHotEdgeActive(ae1) && !e1WindCountIs0or1) || (!ClipperBase.isHotEdgeActive(ae2) && !e2WindCountIs0or1))\r\n return undefined;\r\n // NOW PROCESS THE INTERSECTION ...\r\n // if both edges are 'hot' ...\r\n if (ClipperBase.isHotEdgeActive(ae1) && ClipperBase.isHotEdgeActive(ae2)) {\r\n if ((oldE1WindCount !== 0 && oldE1WindCount !== 1) ||\r\n (oldE2WindCount !== 0 && oldE2WindCount !== 1) ||\r\n (ae1.localMin.polytype !== ae2.localMin.polytype &&\r\n this._cliptype !== ClipType.Xor)) {\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n }\r\n else if (ClipperBase.isFront(ae1) || (ae1.outrec === ae2.outrec)) {\r\n // this 'else if' condition isn't strictly needed but\r\n // it's sensible to split polygons that only touch at\r\n // a common vertex (not at common edges).\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n else {\r\n // can't treat as maxima & minima\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n }\r\n // if one or the other edge is 'hot' ...\r\n else if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n else if (ClipperBase.isHotEdgeActive(ae2)) {\r\n resultOp = ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n // neither edge is 'hot'\r\n else {\r\n let e1Wc2;\r\n let e2Wc2;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n e1Wc2 = ae1.windCount2;\r\n e2Wc2 = ae2.windCount2;\r\n break;\r\n case FillRule.Negative:\r\n e1Wc2 = -ae1.windCount2;\r\n e2Wc2 = -ae2.windCount2;\r\n break;\r\n default:\r\n e1Wc2 = Math.abs(ae1.windCount2);\r\n e2Wc2 = Math.abs(ae2.windCount2);\r\n break;\r\n }\r\n if (!ClipperBase.isSamePolyType(ae1, ae2)) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\r\n resultOp = undefined;\r\n switch (this._cliptype) {\r\n case ClipType.Union:\r\n if (e1Wc2 > 0 && e2Wc2 > 0)\r\n return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n case ClipType.Difference:\r\n if (((ClipperBase.getPolyType(ae1) === PathType.Clip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||\r\n ((ClipperBase.getPolyType(ae1) === PathType.Subject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n break;\r\n case ClipType.Xor:\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n default: // ClipType.Intersection:\r\n if (e1Wc2 <= 0 || e2Wc2 <= 0)\r\n return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n }\r\n }\r\n }\r\n return resultOp;\r\n }\r\n deleteFromAEL(ae) {\r\n const prev = ae.prevInAEL;\r\n const next = ae.nextInAEL;\r\n if (!prev && !next && ae !== this._actives)\r\n return; // already deleted\r\n if (prev)\r\n prev.nextInAEL = next;\r\n else\r\n this._actives = next;\r\n if (next)\r\n next.prevInAEL = prev;\r\n }\r\n adjustCurrXAndCopyToSEL(topY) {\r\n let ae = this._actives;\r\n this._sel = ae;\r\n while (ae) {\r\n ae.prevInSEL = ae.prevInAEL;\r\n ae.nextInSEL = ae.nextInAEL;\r\n ae.jump = ae.nextInSEL;\r\n if (ae.joinWith === JoinWith.Left)\r\n ae.curX = ae.prevInAEL.curX; // This also avoids complications\r\n else\r\n ae.curX = ClipperBase.topX(ae, topY);\r\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n executeInternal(ct, fillRule) {\r\n if (ct === ClipType.None)\r\n return;\r\n this._fillrule = fillRule;\r\n this._cliptype = ct;\r\n this.reset();\r\n let y = this.popScanline();\r\n if (y === undefined)\r\n return;\r\n while (this._succeeded) {\r\n this.insertLocalMinimaIntoAEL(y);\r\n let ae = this.popHorz();\r\n while (ae) {\r\n this.doHorizontal(ae);\r\n ae = this.popHorz();\r\n }\r\n if (this._horzSegList.length > 0) {\r\n this.convertHorzSegsToJoins();\r\n this._horzSegList.length = 0;\r\n }\r\n this._currentBotY = y; // bottom of scanbeam\r\n y = this.popScanline();\r\n if (y === undefined)\r\n break; // y new top of scanbeam\r\n this.doIntersections(y);\r\n this.doTopOfScanbeam(y);\r\n ae = this.popHorz();\r\n while (ae) {\r\n this.doHorizontal(ae);\r\n ae = this.popHorz();\r\n }\r\n }\r\n if (this._succeeded)\r\n this.processHorzJoins();\r\n }\r\n doIntersections(topY) {\r\n if (this.buildIntersectList(topY)) {\r\n this.processIntersectList();\r\n this.disposeIntersectNodes();\r\n }\r\n }\r\n disposeIntersectNodes() {\r\n this._intersectList.length = 0;\r\n }\r\n addNewIntersectNode(ae1, ae2, topY) {\r\n const result = InternalClipper.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top);\r\n let ip = result.ip;\r\n if (!result.success) {\r\n ip = new Point64(ae1.curX, topY);\r\n }\r\n if (ip.y > this._currentBotY || ip.y < topY) {\r\n const absDx1 = Math.abs(ae1.dx);\r\n const absDx2 = Math.abs(ae2.dx);\r\n if (absDx1 > 100 && absDx2 > 100) {\r\n if (absDx1 > absDx2) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n }\r\n else {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n }\r\n else if (absDx1 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n }\r\n else if (absDx2 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n else {\r\n if (ip.y < topY) {\r\n ip.y = topY;\r\n }\r\n else {\r\n ip.y = this._currentBotY;\r\n }\r\n if (absDx1 < absDx2) {\r\n ip.x = ClipperBase.topX(ae1, ip.y);\r\n }\r\n else {\r\n ip.x = ClipperBase.topX(ae2, ip.y);\r\n }\r\n }\r\n }\r\n const node = new IntersectNode(ip, ae1, ae2);\r\n this._intersectList.push(node);\r\n }\r\n static extractFromSEL(ae) {\r\n const res = ae.nextInSEL;\r\n if (res) {\r\n res.prevInSEL = ae.prevInSEL;\r\n }\r\n ae.prevInSEL.nextInSEL = res;\r\n return res;\r\n }\r\n static insert1Before2InSEL(ae1, ae2) {\r\n ae1.prevInSEL = ae2.prevInSEL;\r\n if (ae1.prevInSEL) {\r\n ae1.prevInSEL.nextInSEL = ae1;\r\n }\r\n ae1.nextInSEL = ae2;\r\n ae2.prevInSEL = ae1;\r\n }\r\n buildIntersectList(topY) {\r\n if (!this._actives || !this._actives.nextInAEL)\r\n return false;\r\n // Calculate edge positions at the top of the current scanbeam, and from this\r\n // we will determine the intersections required to reach these new positions.\r\n this.adjustCurrXAndCopyToSEL(topY);\r\n // Find all edge intersections in the current scanbeam using a stable merge\r\n // sort that ensures only adjacent edges are intersecting. Intersect info is\r\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\r\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\r\n let left = this._sel, right, lEnd, rEnd, currBase, prevBase, tmp;\r\n while (left.jump) {\r\n prevBase = undefined;\r\n while (left && left.jump) {\r\n currBase = left;\r\n right = left.jump;\r\n lEnd = right;\r\n rEnd = right.jump;\r\n left.jump = rEnd;\r\n while (left !== lEnd && right !== rEnd) {\r\n if (right.curX < left.curX) {\r\n tmp = right.prevInSEL;\r\n for (;;) {\r\n this.addNewIntersectNode(tmp, right, topY);\r\n if (tmp === left)\r\n break;\r\n tmp = tmp.prevInSEL;\r\n }\r\n tmp = right;\r\n right = ClipperBase.extractFromSEL(tmp);\r\n lEnd = right;\r\n ClipperBase.insert1Before2InSEL(tmp, left);\r\n if (left === currBase) {\r\n currBase = tmp;\r\n currBase.jump = rEnd;\r\n if (prevBase === undefined)\r\n this._sel = currBase;\r\n else\r\n prevBase.jump = currBase;\r\n }\r\n }\r\n else {\r\n left = left.nextInSEL;\r\n }\r\n }\r\n prevBase = currBase;\r\n left = rEnd;\r\n }\r\n left = this._sel;\r\n }\r\n return this._intersectList.length > 0;\r\n }\r\n processIntersectList() {\r\n // We now have a list of intersections required so that edges will be\r\n // correctly positioned at the top of the scanbeam. However, it's important\r\n // that edge intersections are processed from the bottom up, but it's also\r\n // crucial that intersections only occur between adjacent edges.\r\n // First we do a quicksort so intersections proceed in a bottom up order ...\r\n this._intersectList.sort((a, b) => {\r\n if (a.pt.y === b.pt.y) {\r\n if (a.pt.x === b.pt.x)\r\n return 0;\r\n return (a.pt.x < b.pt.x) ? -1 : 1;\r\n }\r\n return (a.pt.y > b.pt.y) ? -1 : 1;\r\n });\r\n // Now as we process these intersections, we must sometimes adjust the order\r\n // to ensure that intersecting edges are always adjacent ...\r\n for (let i = 0; i < this._intersectList.length; ++i) {\r\n if (!ClipperBase.edgesAdjacentInAEL(this._intersectList[i])) {\r\n let j = i + 1;\r\n while (!ClipperBase.edgesAdjacentInAEL(this._intersectList[j]))\r\n j++;\r\n // swap\r\n [this._intersectList[j], this._intersectList[i]] =\r\n [this._intersectList[i], this._intersectList[j]];\r\n }\r\n const node = this._intersectList[i];\r\n this.intersectEdges(node.edge1, node.edge2, node.pt);\r\n this.swapPositionsInAEL(node.edge1, node.edge2);\r\n node.edge1.curX = node.pt.x;\r\n node.edge2.curX = node.pt.x;\r\n this.checkJoinLeft(node.edge2, node.pt, true);\r\n this.checkJoinRight(node.edge1, node.pt, true);\r\n }\r\n }\r\n swapPositionsInAEL(ae1, ae2) {\r\n // preconditon: ae1 must be immediately to the left of ae2\r\n const next = ae2.nextInAEL;\r\n if (next)\r\n next.prevInAEL = ae1;\r\n const prev = ae1.prevInAEL;\r\n if (prev)\r\n prev.nextInAEL = ae2;\r\n ae2.prevInAEL = prev;\r\n ae2.nextInAEL = ae1;\r\n ae1.prevInAEL = ae2;\r\n ae1.nextInAEL = next;\r\n if (!ae2.prevInAEL)\r\n this._actives = ae2;\r\n }\r\n static resetHorzDirection(horz, vertexMax) {\r\n let leftX, rightX;\r\n if (horz.bot.x === horz.top.x) {\r\n // the horizontal edge is going nowhere ...\r\n leftX = horz.curX;\r\n rightX = horz.curX;\r\n let ae = horz.nextInAEL;\r\n while (ae && ae.vertexTop !== vertexMax)\r\n ae = ae.nextInAEL;\r\n return { isLeftToRight: ae !== undefined, leftX, rightX };\r\n }\r\n if (horz.curX < horz.top.x) {\r\n leftX = horz.curX;\r\n rightX = horz.top.x;\r\n return { isLeftToRight: true, leftX, rightX };\r\n }\r\n leftX = horz.top.x;\r\n rightX = horz.curX;\r\n return { isLeftToRight: false, leftX, rightX }; // right to left\r\n }\r\n static horzIsSpike(horz) {\r\n const nextPt = ClipperBase.nextVertex(horz).pt;\r\n return (horz.bot.x < horz.top.x) !== (horz.top.x < nextPt.x);\r\n }\r\n static trimHorz(horzEdge, preserveCollinear) {\r\n let wasTrimmed = false;\r\n let pt = ClipperBase.nextVertex(horzEdge).pt;\r\n while (pt.y === horzEdge.top.y) {\r\n // always trim 180 deg. spikes (in closed paths)\r\n // but otherwise break if preserveCollinear = true\r\n if (preserveCollinear &&\r\n (pt.x < horzEdge.top.x) !== (horzEdge.bot.x < horzEdge.top.x)) {\r\n break;\r\n }\r\n horzEdge.vertexTop = ClipperBase.nextVertex(horzEdge);\r\n horzEdge.top = pt;\r\n wasTrimmed = true;\r\n if (ClipperBase.isMaximaActive(horzEdge))\r\n break;\r\n pt = ClipperBase.nextVertex(horzEdge).pt;\r\n }\r\n if (wasTrimmed)\r\n ClipperBase.setDx(horzEdge); // +/-infinity\r\n }\r\n addToHorzSegList(op) {\r\n if (op.outrec.isOpen)\r\n return;\r\n this._horzSegList.push(new HorzSegment(op));\r\n }\r\n getLastOp(hotEdge) {\r\n const outrec = hotEdge.outrec;\r\n return (hotEdge === outrec.frontEdge) ?\r\n outrec.pts : outrec.pts.next;\r\n }\r\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/\r\n doHorizontal(horz) {\r\n let pt;\r\n const horzIsOpen = ClipperBase.isOpen(horz);\r\n const Y = horz.bot.y;\r\n const vertex_max = horzIsOpen ?\r\n ClipperBase.getCurrYMaximaVertex_Open(horz) :\r\n ClipperBase.getCurrYMaximaVertex(horz);\r\n // remove 180 deg.spikes and also simplify\r\n // consecutive horizontals when PreserveCollinear = true\r\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop)\r\n ClipperBase.trimHorz(horz, this.preserveCollinear);\r\n let { isLeftToRight, leftX, rightX } = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, new Point64(horz.curX, Y));\r\n this.addToHorzSegList(op);\r\n }\r\n for (;;) {\r\n // loops through consec. horizontal edges (if open)\r\n let ae = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\r\n while (ae) {\r\n if (ae.vertexTop === vertex_max) {\r\n // do this first!!\r\n if (ClipperBase.isHotEdgeActive(horz) && ClipperBase.isJoined(ae))\r\n this.split(ae, ae.top);\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n while (horz.vertexTop !== vertex_max) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n if (isLeftToRight)\r\n this.addLocalMaxPoly(horz, ae, horz.top);\r\n else\r\n this.addLocalMaxPoly(ae, horz, horz.top);\r\n }\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n // if horzEdge is a maxima, keep going until we reach\r\n // its maxima pair, otherwise check for break conditions\r\n if (vertex_max !== horz.vertexTop || ClipperBase.isOpenEndActive(horz)) {\r\n // otherwise stop when 'ae' is beyond the end of the horizontal line\r\n if ((isLeftToRight && ae.curX > rightX) || (!isLeftToRight && ae.curX < leftX))\r\n break;\r\n if (ae.curX === horz.top.x && !ClipperBase.isHorizontal(ae)) {\r\n pt = ClipperBase.nextVertex(horz).pt;\r\n // to maximize the possibility of putting open edges into\r\n // solutions, we'll only break if it's past HorzEdge's end\r\n if (ClipperBase.isOpen(ae) && !ClipperBase.isSamePolyType(ae, horz) && !ClipperBase.isHotEdgeActive(ae)) {\r\n if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) > pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) < pt.x)))\r\n break;\r\n }\r\n // otherwise for edges at horzEdge's end, only stop when horzEdge's\r\n // outslope is greater than e's slope when heading right or when\r\n // horzEdge's outslope is less than e's slope when heading left.\r\n else if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) >= pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) <= pt.x)))\r\n break;\r\n }\r\n }\r\n pt = new Point64(ae.curX, Y);\r\n if (isLeftToRight) {\r\n this.intersectEdges(horz, ae, pt);\r\n this.swapPositionsInAEL(horz, ae);\r\n horz.curX = ae.curX;\r\n ae = horz.nextInAEL;\r\n }\r\n else {\r\n this.intersectEdges(ae, horz, pt);\r\n this.swapPositionsInAEL(ae, horz);\r\n horz.curX = ae.curX;\r\n ae = horz.prevInAEL;\r\n }\r\n if (ClipperBase.isHotEdgeActive(horz))\r\n this.addToHorzSegList(this.getLastOp(horz));\r\n } // we've reached the end of this horizontal\r\n // check if we've finished looping\r\n // through consecutive horizontals\r\n if (horzIsOpen && ClipperBase.isOpenEndActive(horz)) { // ie open at top\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n if (ClipperBase.isFront(horz))\r\n horz.outrec.frontEdge = undefined;\r\n else\r\n horz.outrec.backEdge = undefined;\r\n horz.outrec = undefined;\r\n }\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n else if (ClipperBase.nextVertex(horz).pt.y !== horz.top.y)\r\n break;\r\n // still more horizontals in bound to process ...\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n }\r\n this.updateEdgeIntoAEL(horz);\r\n if (this.preserveCollinear && !horzIsOpen && ClipperBase.horzIsSpike(horz)) {\r\n ClipperBase.trimHorz(horz, true);\r\n }\r\n const result = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n isLeftToRight = result.isLeftToRight;\r\n leftX = result.leftX;\r\n rightX = result.rightX;\r\n }\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, horz.top);\r\n this.addToHorzSegList(op);\r\n }\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n doTopOfScanbeam(y) {\r\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\r\n let ae = this._actives;\r\n while (ae) {\r\n // NB 'ae' will never be horizontal here\r\n if (ae.top.y === y) {\r\n ae.curX = ae.top.x;\r\n if (ClipperBase.isMaximaActive(ae)) {\r\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\r\n continue;\r\n }\r\n // INTERMEDIATE VERTEX ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n this.updateEdgeIntoAEL(ae);\r\n if (ClipperBase.isHorizontal(ae))\r\n this.pushHorz(ae); // horizontals are processed later\r\n }\r\n else { // i.e. not the top of the edge\r\n ae.curX = ClipperBase.topX(ae, y);\r\n }\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n doMaxima(ae) {\r\n const prevE = ae.prevInAEL;\r\n let nextE = ae.nextInAEL;\r\n if (ClipperBase.isOpenEndActive(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n if (!ClipperBase.isHorizontal(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) {\r\n if (ClipperBase.isFront(ae))\r\n ae.outrec.frontEdge = undefined;\r\n else\r\n ae.outrec.backEdge = undefined;\r\n ae.outrec = undefined;\r\n }\r\n this.deleteFromAEL(ae);\r\n }\r\n return nextE;\r\n }\r\n const maxPair = ClipperBase.getMaximaPair(ae);\r\n if (!maxPair)\r\n return nextE; // eMaxPair is horizontal\r\n if (ClipperBase.isJoined(ae))\r\n this.split(ae, ae.top);\r\n if (ClipperBase.isJoined(maxPair))\r\n this.split(maxPair, maxPair.top);\r\n // only non-horizontal maxima here.\r\n // process any edges between maxima pair ...\r\n while (nextE !== maxPair) {\r\n this.intersectEdges(ae, nextE, ae.top);\r\n this.swapPositionsInAEL(ae, nextE);\r\n nextE = ae.nextInAEL;\r\n }\r\n if (ClipperBase.isOpen(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(maxPair);\r\n this.deleteFromAEL(ae);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n // here ae.nextInAel == ENext == EMaxPair ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(maxPair);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n static isJoined(e) {\r\n return e.joinWith !== JoinWith.None;\r\n }\r\n split(e, currPt) {\r\n if (e.joinWith === JoinWith.Right) {\r\n e.joinWith = JoinWith.None;\r\n e.nextInAEL.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e, e.nextInAEL, currPt, true);\r\n }\r\n else {\r\n e.joinWith = JoinWith.None;\r\n e.prevInAEL.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e.prevInAEL, e, currPt, true);\r\n }\r\n }\r\n checkJoinLeft(e, pt, checkCurrX = false) {\r\n const prev = e.prevInAEL;\r\n if (!prev || ClipperBase.isOpen(e) || ClipperBase.isOpen(prev) ||\r\n !ClipperBase.isHotEdgeActive(e) || !ClipperBase.isHotEdgeActive(prev))\r\n return;\r\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (prev.bot.y > pt.y)))\r\n return; // (#490)\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25)\r\n return;\r\n }\r\n else if (e.curX !== prev.curX)\r\n return;\r\n if (InternalClipper.crossProduct(e.top, pt, prev.top) !== 0)\r\n return;\r\n if (e.outrec.idx === prev.outrec.idx)\r\n this.addLocalMaxPoly(prev, e, pt);\r\n else if (e.outrec.idx < prev.outrec.idx)\r\n ClipperBase.joinOutrecPaths(e, prev);\r\n else\r\n ClipperBase.joinOutrecPaths(prev, e);\r\n prev.joinWith = JoinWith.Right;\r\n e.joinWith = JoinWith.Left;\r\n }\r\n checkJoinRight(e, pt, checkCurrX = false) {\r\n const next = e.nextInAEL;\r\n if (ClipperBase.isOpen(e) || !ClipperBase.isHotEdgeActive(e) || ClipperBase.isJoined(e) ||\r\n !next || ClipperBase.isOpen(next) || !ClipperBase.isHotEdgeActive(next))\r\n return;\r\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (next.bot.y > pt.y)))\r\n return; // (#490)\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25)\r\n return;\r\n }\r\n else if (e.curX !== next.curX)\r\n return;\r\n if (InternalClipper.crossProduct(e.top, pt, next.top) !== 0)\r\n return;\r\n if (e.outrec.idx === next.outrec.idx)\r\n this.addLocalMaxPoly(e, next, pt);\r\n else if (e.outrec.idx < next.outrec.idx)\r\n ClipperBase.joinOutrecPaths(e, next);\r\n else\r\n ClipperBase.joinOutrecPaths(next, e);\r\n e.joinWith = JoinWith.Right;\r\n next.joinWith = JoinWith.Left;\r\n }\r\n static fixOutRecPts(outrec) {\r\n let op = outrec.pts;\r\n do {\r\n op.outrec = outrec;\r\n op = op.next;\r\n } while (op !== outrec.pts);\r\n }\r\n static setHorzSegHeadingForward(hs, opP, opN) {\r\n if (opP.pt.x === opN.pt.x)\r\n return false;\r\n if (opP.pt.x < opN.pt.x) {\r\n hs.leftOp = opP;\r\n hs.rightOp = opN;\r\n hs.leftToRight = true;\r\n }\r\n else {\r\n hs.leftOp = opN;\r\n hs.rightOp = opP;\r\n hs.leftToRight = false;\r\n }\r\n return true;\r\n }\r\n static updateHorzSegment(hs) {\r\n const op = hs.leftOp;\r\n const outrec = this.getRealOutRec(op.outrec);\r\n const outrecHasEdges = outrec.frontEdge !== undefined;\r\n const curr_y = op.pt.y;\r\n let opP = op, opN = op;\r\n if (outrecHasEdges) {\r\n const opA = outrec.pts, opZ = opA.next;\r\n while (opP !== opZ && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN !== opA && opN.next.pt.y === curr_y)\r\n opN = opN.next;\r\n }\r\n else {\r\n while (opP.prev !== opN && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN.next !== opP && opN.next.pt.y === curr_y)\r\n opN = opN.next;\r\n }\r\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp.horz === undefined;\r\n if (result)\r\n hs.leftOp.horz = hs;\r\n else\r\n hs.rightOp = undefined; // (for sorting)\r\n return result;\r\n }\r\n static duplicateOp(op, insert_after) {\r\n const result = new OutPt(op.pt, op.outrec);\r\n if (insert_after) {\r\n result.next = op.next;\r\n result.next.prev = result;\r\n result.prev = op;\r\n op.next = result;\r\n }\r\n else {\r\n result.prev = op.prev;\r\n result.prev.next = result;\r\n result.next = op;\r\n op.prev = result;\r\n }\r\n return result;\r\n }\r\n convertHorzSegsToJoins() {\r\n let k = 0;\r\n for (const hs of this._horzSegList) {\r\n if (ClipperBase.updateHorzSegment(hs))\r\n k++;\r\n }\r\n if (k < 2)\r\n return;\r\n this._horzSegList.sort((hs1, hs2) => {\r\n if (!hs1 || !hs2)\r\n return 0;\r\n if (!hs1.rightOp) {\r\n return !hs2.rightOp ? 0 : 1;\r\n }\r\n else if (!hs2.rightOp)\r\n return -1;\r\n else\r\n return hs1.leftOp.pt.x - hs2.leftOp.pt.x;\r\n });\r\n for (let i = 0; i < k - 1; i++) {\r\n const hs1 = this._horzSegList[i];\r\n // for each HorzSegment, find others that overlap\r\n for (let j = i + 1; j < k; j++) {\r\n const hs2 = this._horzSegList[j];\r\n if (hs2.leftOp.pt.x >= hs1.rightOp.pt.x ||\r\n hs2.leftToRight === hs1.leftToRight ||\r\n hs2.rightOp.pt.x <= hs1.leftOp.pt.x)\r\n continue;\r\n const curr_y = hs1.leftOp.pt.y;\r\n if (hs1.leftToRight) {\r\n while (hs1.leftOp.next.pt.y === curr_y &&\r\n hs1.leftOp.next.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.next;\r\n }\r\n while (hs2.leftOp.prev.pt.y === curr_y &&\r\n hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.prev;\r\n }\r\n const join = new HorzJoin(ClipperBase.duplicateOp(hs1.leftOp, true), ClipperBase.duplicateOp(hs2.leftOp, false));\r\n this._horzJoinList.push(join);\r\n }\r\n else {\r\n while (hs1.leftOp.prev.pt.y === curr_y &&\r\n hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.prev;\r\n }\r\n while (hs2.leftOp.next.pt.y === curr_y &&\r\n hs2.leftOp.next.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.next;\r\n }\r\n const join = new HorzJoin(ClipperBase.duplicateOp(hs2.leftOp, true), ClipperBase.duplicateOp(hs1.leftOp, false));\r\n this._horzJoinList.push(join);\r\n }\r\n }\r\n }\r\n }\r\n static getCleanPath(op) {\r\n const result = new Path64();\r\n let op2 = op;\r\n while (op2.next !== op &&\r\n ((op2.pt.x === op2.next.pt.x && op2.pt.x === op2.prev.pt.x) ||\r\n (op2.pt.y === op2.next.pt.y && op2.pt.y === op2.prev.pt.y))) {\r\n op2 = op2.next;\r\n }\r\n result.push(op2.pt);\r\n let prevOp = op2;\r\n op2 = op2.next;\r\n while (op2 !== op) {\r\n if ((op2.pt.x !== op2.next.pt.x || op2.pt.x !== prevOp.pt.x) &&\r\n (op2.pt.y !== op2.next.pt.y || op2.pt.y !== prevOp.pt.y)) {\r\n result.push(op2.pt);\r\n prevOp = op2;\r\n }\r\n op2 = op2.next;\r\n }\r\n return result;\r\n }\r\n static pointInOpPolygon(pt, op) {\r\n if (op === op.next || op.prev === op.next)\r\n return PointInPolygonResult.IsOutside;\r\n let op2 = op;\r\n do {\r\n if (op.pt.y !== pt.y)\r\n break;\r\n op = op.next;\r\n } while (op !== op2);\r\n if (op.pt.y === pt.y) // not a proper polygon\r\n return PointInPolygonResult.IsOutside;\r\n let isAbove = op.pt.y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n op2 = op.next;\r\n while (op2 !== op) {\r\n if (isAbove)\r\n while (op2 !== op && op2.pt.y < pt.y)\r\n op2 = op2.next;\r\n else\r\n while (op2 !== op && op2.pt.y > pt.y)\r\n op2 = op2.next;\r\n if (op2 === op)\r\n break;\r\n if (op2.pt.y === pt.y) {\r\n if (op2.pt.x === pt.x || (op2.pt.y === op2.prev.pt.y &&\r\n (pt.x < op2.prev.pt.x) !== (pt.x < op2.pt.x)))\r\n return PointInPolygonResult.IsOn;\r\n op2 = op2.next;\r\n if (op2 === op)\r\n break;\r\n continue;\r\n }\r\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\r\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x)\r\n val = 1 - val;\r\n else {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n }\r\n isAbove = !isAbove;\r\n op2 = op2.next;\r\n }\r\n if (isAbove !== startingAbove) {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n if (val === 0)\r\n return PointInPolygonResult.IsOutside;\r\n else\r\n return PointInPolygonResult.IsInside;\r\n }\r\n static path1InsidePath2(op1, op2) {\r\n let result;\r\n let outside_cnt = 0;\r\n let op = op1;\r\n do {\r\n result = this.pointInOpPolygon(op.pt, op2);\r\n if (result === PointInPolygonResult.IsOutside)\r\n ++outside_cnt;\r\n else if (result === PointInPolygonResult.IsInside)\r\n --outside_cnt;\r\n op = op.next;\r\n } while (op !== op1 && Math.abs(outside_cnt) < 2);\r\n if (Math.abs(outside_cnt) > 1)\r\n return (outside_cnt < 0);\r\n const mp = ClipperBase.getBoundsPath(this.getCleanPath(op1)).midPoint();\r\n const path2 = this.getCleanPath(op2);\r\n return InternalClipper.pointInPolygon(mp, path2) !== PointInPolygonResult.IsOutside;\r\n }\r\n moveSplits(fromOr, toOr) {\r\n if (!fromOr.splits)\r\n return;\r\n toOr.splits = toOr.splits || [];\r\n for (const i of fromOr.splits) {\r\n toOr.splits.push(i);\r\n }\r\n fromOr.splits = undefined;\r\n }\r\n processHorzJoins() {\r\n for (const j of this._horzJoinList) {\r\n const or1 = ClipperBase.getRealOutRec(j.op1.outrec);\r\n let or2 = ClipperBase.getRealOutRec(j.op2.outrec);\r\n const op1b = j.op1.next;\r\n const op2b = j.op2.prev;\r\n j.op1.next = j.op2;\r\n j.op2.prev = j.op1;\r\n op1b.prev = op2b;\r\n op2b.next = op1b;\r\n if (or1 === or2) {\r\n or2 = this.newOutRec();\r\n or2.pts = op1b;\r\n ClipperBase.fixOutRecPts(or2);\r\n if (or1.pts.outrec === or2) {\r\n or1.pts = j.op1;\r\n or1.pts.outrec = or1;\r\n }\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(or1.pts, or2.pts)) {\r\n const tmp = or1.pts;\r\n or1.pts = or2.pts;\r\n or2.pts = tmp;\r\n ClipperBase.fixOutRecPts(or1);\r\n ClipperBase.fixOutRecPts(or2);\r\n or2.owner = or1.owner;\r\n }\r\n else if (ClipperBase.path1InsidePath2(or2.pts, or1.pts)) {\r\n or2.owner = or1;\r\n }\r\n else {\r\n or2.owner = or1.owner;\r\n }\r\n or1.splits = or1.splits || [];\r\n or1.splits.push(or2.idx);\r\n }\r\n else {\r\n or2.owner = or1;\r\n }\r\n }\r\n else {\r\n or2.pts = undefined;\r\n if (this._using_polytree) {\r\n ClipperBase.setOwner(or2, or1);\r\n this.moveSplits(or2, or1);\r\n }\r\n else {\r\n or2.owner = or1;\r\n }\r\n }\r\n }\r\n }\r\n static ptsReallyClose(pt1, pt2) {\r\n return (Math.abs(pt1.x - pt2.x) < 2) && (Math.abs(pt1.y - pt2.y) < 2);\r\n }\r\n static isVerySmallTriangle(op) {\r\n return op.next.next === op.prev &&\r\n (this.ptsReallyClose(op.prev.pt, op.next.pt) ||\r\n this.ptsReallyClose(op.pt, op.next.pt) ||\r\n this.ptsReallyClose(op.pt, op.prev.pt));\r\n }\r\n static isValidClosedPath(op) {\r\n return op !== undefined && op.next !== op &&\r\n (op.next !== op.prev || !this.isVerySmallTriangle(op));\r\n }\r\n static disposeOutPt(op) {\r\n const result = op.next === op ? undefined : op.next;\r\n op.prev.next = op.next;\r\n op.next.prev = op.prev;\r\n return result;\r\n }\r\n cleanCollinear(outrec) {\r\n outrec = ClipperBase.getRealOutRec(outrec);\r\n if (outrec === undefined || outrec.isOpen)\r\n return;\r\n if (!ClipperBase.isValidClosedPath(outrec.pts)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n let startOp = outrec.pts;\r\n let op2 = startOp;\r\n for (;;) {\r\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\r\n if (InternalClipper.crossProduct(op2.prev.pt, op2.pt, op2.next.pt) === 0 &&\r\n (op2.pt === op2.prev.pt || op2.pt === op2.next.pt || !this.preserveCollinear ||\r\n InternalClipper.dotProduct(op2.prev.pt, op2.pt, op2.next.pt) < 0)) {\r\n if (op2 === outrec.pts) {\r\n outrec.pts = op2.prev;\r\n }\r\n op2 = ClipperBase.disposeOutPt(op2);\r\n if (!ClipperBase.isValidClosedPath(op2)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n startOp = op2;\r\n continue;\r\n }\r\n op2 = op2.next;\r\n if (op2 === startOp)\r\n break;\r\n }\r\n this.fixSelfIntersects(outrec);\r\n }\r\n doSplitOp(outrec, splitOp) {\r\n // splitOp.prev <=> splitOp &&\r\n // splitOp.next <=> splitOp.next.next are intersecting\r\n const prevOp = splitOp.prev;\r\n const nextNextOp = splitOp.next.next;\r\n outrec.pts = prevOp;\r\n const ip = InternalClipper.getIntersectPoint(prevOp.pt, splitOp.pt, splitOp.next.pt, nextNextOp.pt).ip;\r\n const area1 = ClipperBase.area(prevOp);\r\n const absArea1 = Math.abs(area1);\r\n if (absArea1 < 2) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n const area2 = ClipperBase.areaTriangle(ip, splitOp.pt, splitOp.next.pt);\r\n const absArea2 = Math.abs(area2);\r\n // de-link splitOp and splitOp.next from the path\r\n // while inserting the intersection point\r\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\r\n nextNextOp.prev = prevOp;\r\n prevOp.next = nextNextOp;\r\n }\r\n else {\r\n const newOp2 = new OutPt(ip, outrec);\r\n newOp2.prev = prevOp;\r\n newOp2.next = nextNextOp;\r\n nextNextOp.prev = newOp2;\r\n prevOp.next = newOp2;\r\n }\r\n // nb: area1 is the path's area *before* splitting, whereas area2 is\r\n // the area of the triangle containing splitOp & splitOp.next.\r\n // So the only way for these areas to have the same sign is if\r\n // the split triangle is larger than the path containing prevOp or\r\n // if there's more than one self=intersection.\r\n if (absArea2 > 1 &&\r\n (absArea2 > absArea1 || (area2 > 0) === (area1 > 0))) {\r\n const newOutRec = this.newOutRec();\r\n newOutRec.owner = outrec.owner;\r\n splitOp.outrec = newOutRec;\r\n splitOp.next.outrec = newOutRec;\r\n const newOp = new OutPt(ip, newOutRec);\r\n newOp.prev = splitOp.next;\r\n newOp.next = splitOp;\r\n newOutRec.pts = newOp;\r\n splitOp.prev = newOp;\r\n splitOp.next.next = newOp;\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(prevOp, newOp)) {\r\n newOutRec.splits = newOutRec.splits || [];\r\n newOutRec.splits.push(outrec.idx);\r\n }\r\n else {\r\n outrec.splits = outrec.splits || [];\r\n outrec.splits.push(newOutRec.idx);\r\n }\r\n }\r\n }\r\n // else { splitOp = undefined; splitOp.next = undefined; }\r\n }\r\n fixSelfIntersects(outrec) {\r\n let op2 = outrec.pts;\r\n for (;;) {\r\n if (op2.prev === op2.next.next)\r\n break;\r\n if (InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt)) {\r\n this.doSplitOp(outrec, op2);\r\n if (!outrec.pts)\r\n return;\r\n op2 = outrec.pts;\r\n continue;\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n if (op2 === outrec.pts)\r\n break;\r\n }\r\n }\r\n static buildPath(op, reverse, isOpen, path) {\r\n if (op === undefined || op.next === op || (!isOpen && op.next === op.prev))\r\n return false;\r\n path.length = 0;\r\n let lastPt;\r\n let op2;\r\n if (reverse) {\r\n lastPt = op.pt;\r\n op2 = op.prev;\r\n }\r\n else {\r\n op = op.next;\r\n lastPt = op.pt;\r\n op2 = op.next;\r\n }\r\n path.push(lastPt);\r\n while (op2 !== op) {\r\n if (op2.pt !== lastPt) {\r\n lastPt = op2.pt;\r\n path.push(lastPt);\r\n }\r\n if (reverse) {\r\n op2 = op2.prev;\r\n }\r\n else {\r\n op2 = op2.next;\r\n }\r\n }\r\n if (path.length === 3 && this.isVerySmallTriangle(op2))\r\n return false;\r\n else\r\n return true;\r\n }\r\n buildPaths(solutionClosed, solutionOpen) {\r\n solutionClosed.length = 0;\r\n solutionOpen.length = 0;\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (!outrec.pts)\r\n continue;\r\n const path = new Path64();\r\n if (outrec.isOpen) {\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, path)) {\r\n solutionOpen.push(path);\r\n }\r\n }\r\n else {\r\n this.cleanCollinear(outrec);\r\n // closed paths should always return a Positive orientation\r\n // except when reverseSolution == true\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, path)) {\r\n solutionClosed.push(path);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n static getBoundsPath(path) {\r\n if (path.length === 0)\r\n return new Rect64();\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left)\r\n result.left = pt.x;\r\n if (pt.x > result.right)\r\n result.right = pt.x;\r\n if (pt.y < result.top)\r\n result.top = pt.y;\r\n if (pt.y > result.bottom)\r\n result.bottom = pt.y;\r\n }\r\n return result;\r\n }\r\n checkBounds(outrec) {\r\n if (outrec.pts === undefined)\r\n return false;\r\n if (!outrec.bounds.isEmpty())\r\n return true;\r\n this.cleanCollinear(outrec);\r\n if (outrec.pts === undefined || !ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, outrec.path))\r\n return false;\r\n outrec.bounds = ClipperBase.getBoundsPath(outrec.path);\r\n return true;\r\n }\r\n checkSplitOwner(outrec, splits) {\r\n for (const i of splits) {\r\n const split = ClipperBase.getRealOutRec(this._outrecList[i]);\r\n if (split === undefined || split === outrec || split.recursiveSplit === outrec)\r\n continue;\r\n split.recursiveSplit = outrec; //#599\r\n if (split.splits !== undefined && this.checkSplitOwner(outrec, split.splits))\r\n return true;\r\n if (ClipperBase.isValidOwner(outrec, split) &&\r\n this.checkBounds(split) &&\r\n split.bounds.containsRect(outrec.bounds) &&\r\n ClipperBase.path1InsidePath2(outrec.pts, split.pts)) {\r\n outrec.owner = split; //found in split\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n recursiveCheckOwners(outrec, polypath) {\r\n // pre-condition: outrec will have valid bounds\r\n // post-condition: if a valid path, outrec will have a polypath\r\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty())\r\n return;\r\n while (outrec.owner !== undefined) {\r\n if (outrec.owner.splits !== undefined &&\r\n this.checkSplitOwner(outrec, outrec.owner.splits))\r\n break;\r\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) &&\r\n ClipperBase.path1InsidePath2(outrec.pts, outrec.owner.pts))\r\n break;\r\n outrec.owner = outrec.owner.owner;\r\n }\r\n if (outrec.owner !== undefined) {\r\n if (outrec.owner.polypath === undefined)\r\n this.recursiveCheckOwners(outrec.owner, polypath);\r\n outrec.polypath = outrec.owner.polypath.addChild(outrec.path);\r\n }\r\n else {\r\n outrec.polypath = polypath.addChild(outrec.path);\r\n }\r\n }\r\n buildTree(polytree, solutionOpen) {\r\n polytree.clear();\r\n solutionOpen.length = 0;\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (outrec.pts === undefined)\r\n continue;\r\n if (outrec.isOpen) {\r\n const open_path = new Path64();\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, open_path))\r\n solutionOpen.push(open_path);\r\n continue;\r\n }\r\n if (this.checkBounds(outrec))\r\n this.recursiveCheckOwners(outrec, polytree);\r\n }\r\n }\r\n getBounds() {\r\n const bounds = Clipper.InvalidRect64;\r\n for (const t of this._vertexList) {\r\n let v = t;\r\n do {\r\n if (v.pt.x < bounds.left)\r\n bounds.left = v.pt.x;\r\n if (v.pt.x > bounds.right)\r\n bounds.right = v.pt.x;\r\n if (v.pt.y < bounds.top)\r\n bounds.top = v.pt.y;\r\n if (v.pt.y > bounds.bottom)\r\n bounds.bottom = v.pt.y;\r\n v = v.next;\r\n } while (v !== t);\r\n }\r\n return bounds.isEmpty() ? new Rect64(0, 0, 0, 0) : bounds;\r\n }\r\n}\r\nclass Clipper64 extends ClipperBase {\r\n addPath(path, polytype, isOpen = false) {\r\n super.addPath(path, polytype, isOpen);\r\n }\r\n addReusableData(reusableData) {\r\n super.addReuseableData(reusableData);\r\n }\r\n addPaths(paths, polytype, isOpen = false) {\r\n super.addPaths(paths, polytype, isOpen);\r\n }\r\n addSubjectPaths(paths) {\r\n this.addPaths(paths, PathType.Subject);\r\n }\r\n addOpenSubjectPaths(paths) {\r\n this.addPaths(paths, PathType.Subject, true);\r\n }\r\n addClipPaths(paths) {\r\n this.addPaths(paths, PathType.Clip);\r\n }\r\n execute(clipType, fillRule, solutionClosed, solutionOpen = new Paths64()) {\r\n solutionClosed.length = 0;\r\n solutionOpen.length = 0;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildPaths(solutionClosed, solutionOpen);\r\n }\r\n catch (error) {\r\n this._succeeded = false;\r\n }\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n executePolyTree(clipType, fillRule, polytree, openPaths = new Paths64()) {\r\n polytree.clear();\r\n openPaths.length = 0;\r\n this._using_polytree = true;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildTree(polytree, openPaths);\r\n }\r\n catch (error) {\r\n this._succeeded = false;\r\n }\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n}\r\nclass PolyPathBase {\r\n get isHole() {\r\n return this.getIsHole();\r\n }\r\n constructor(parent) {\r\n this.children = [];\r\n this.forEach = this.children.forEach;\r\n this._parent = parent;\r\n }\r\n getLevel() {\r\n let result = 0;\r\n let pp = this._parent;\r\n while (pp !== undefined) {\r\n ++result;\r\n pp = pp._parent;\r\n }\r\n return result;\r\n }\r\n get level() {\r\n return this.getLevel();\r\n }\r\n getIsHole() {\r\n const lvl = this.getLevel();\r\n return lvl !== 0 && (lvl & 1) === 0;\r\n }\r\n get count() {\r\n return this.children.length;\r\n }\r\n clear() {\r\n this.children.length = 0;\r\n }\r\n} // end of PolyPathBase class\r\nclass PolyPath64 extends PolyPathBase {\r\n constructor(parent) {\r\n super(parent);\r\n }\r\n addChild(p) {\r\n const newChild = new PolyPath64(this);\r\n newChild.polygon = p;\r\n this.children.push(newChild);\r\n return newChild;\r\n }\r\n get(index) {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index];\r\n }\r\n child(index) {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index];\r\n }\r\n area() {\r\n let result = this.polygon ? Clipper.area(this.polygon) : 0;\r\n for (const polyPathBase of this.children) {\r\n const child = polyPathBase;\r\n result += child.area();\r\n }\r\n return result;\r\n }\r\n}\r\nclass PolyTree64 extends PolyPath64 {\r\n}\r\nclass ClipperLibException extends Error {\r\n constructor(description) {\r\n super(description);\r\n }\r\n}\n\n/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n// Note: all clipping operations except for Difference are commutative.\r\nvar ClipType;\r\n(function (ClipType) {\r\n ClipType[ClipType[\"None\"] = 0] = \"None\";\r\n ClipType[ClipType[\"Intersection\"] = 1] = \"Intersection\";\r\n ClipType[ClipType[\"Union\"] = 2] = \"Union\";\r\n ClipType[ClipType[\"Difference\"] = 3] = \"Difference\";\r\n ClipType[ClipType[\"Xor\"] = 4] = \"Xor\";\r\n})(ClipType || (ClipType = {}));\r\nvar PathType;\r\n(function (PathType) {\r\n PathType[PathType[\"Subject\"] = 0] = \"Subject\";\r\n PathType[PathType[\"Clip\"] = 1] = \"Clip\";\r\n})(PathType || (PathType = {}));\r\n// By far the most widely used filling rules for polygons are EvenOdd\r\n// and NonZero, sometimes called Alternate and Winding respectively.\r\n// https://en.wikipedia.org/wiki/Nonzero-rule\r\nvar FillRule;\r\n(function (FillRule) {\r\n FillRule[FillRule[\"EvenOdd\"] = 0] = \"EvenOdd\";\r\n FillRule[FillRule[\"NonZero\"] = 1] = \"NonZero\";\r\n FillRule[FillRule[\"Positive\"] = 2] = \"Positive\";\r\n FillRule[FillRule[\"Negative\"] = 3] = \"Negative\";\r\n})(FillRule || (FillRule = {}));\r\n// PointInPolygon\r\nvar PipResult;\r\n(function (PipResult) {\r\n PipResult[PipResult[\"Inside\"] = 0] = \"Inside\";\r\n PipResult[PipResult[\"Outside\"] = 1] = \"Outside\";\r\n PipResult[PipResult[\"OnEdge\"] = 2] = \"OnEdge\";\r\n})(PipResult || (PipResult = {}));\r\nclass Path64 extends Array {\r\n}\r\nclass Paths64 extends Array {\r\n}\r\nclass Rect64 {\r\n constructor(lOrIsValidOrRec, t, r, b) {\r\n if (typeof lOrIsValidOrRec === 'boolean') {\r\n if (lOrIsValidOrRec) {\r\n this.left = 0;\r\n this.top = 0;\r\n this.right = 0;\r\n this.bottom = 0;\r\n }\r\n else {\r\n this.left = Number.MAX_SAFE_INTEGER;\r\n this.top = Number.MAX_SAFE_INTEGER;\r\n this.right = Number.MIN_SAFE_INTEGER;\r\n this.bottom = Number.MIN_SAFE_INTEGER;\r\n }\r\n }\r\n else if (typeof lOrIsValidOrRec === 'number') {\r\n this.left = lOrIsValidOrRec;\r\n this.top = t;\r\n this.right = r;\r\n this.bottom = b;\r\n }\r\n else {\r\n this.left = lOrIsValidOrRec.left;\r\n this.top = lOrIsValidOrRec.top;\r\n this.right = lOrIsValidOrRec.right;\r\n this.bottom = lOrIsValidOrRec.bottom;\r\n }\r\n }\r\n get width() {\r\n return this.right - this.left;\r\n }\r\n set width(value) {\r\n this.right = this.left + value;\r\n }\r\n get height() {\r\n return this.bottom - this.top;\r\n }\r\n set height(value) {\r\n this.bottom = this.top + value;\r\n }\r\n isEmpty() {\r\n return this.bottom <= this.top || this.right <= this.left;\r\n }\r\n midPoint() {\r\n return new Point64((this.left + this.right) / 2, (this.top + this.bottom) / 2);\r\n }\r\n contains(pt) {\r\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\r\n }\r\n containsRect(rec) {\r\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\r\n }\r\n intersects(rec) {\r\n return (Math.max(this.left, rec.left) <= Math.min(this.right, rec.right)) &&\r\n (Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom));\r\n }\r\n asPath() {\r\n const result = new Path64();\r\n result.push(new Point64(this.left, this.top));\r\n result.push(new Point64(this.right, this.top));\r\n result.push(new Point64(this.right, this.bottom));\r\n result.push(new Point64(this.left, this.bottom));\r\n return result;\r\n }\r\n}\r\nclass Point64 {\r\n constructor(xOrPt, yOrScale) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = Math.round(xOrPt);\r\n this.y = Math.round(yOrScale);\r\n }\r\n else {\r\n const pt = xOrPt;\r\n if (yOrScale !== undefined) {\r\n this.x = Math.round(pt.x * yOrScale);\r\n this.y = Math.round(pt.y * yOrScale);\r\n }\r\n else {\r\n this.x = pt.x;\r\n this.y = pt.y;\r\n }\r\n //} else {\r\n // const pt = xOrPt as Point64\r\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\r\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\r\n }\r\n }\r\n static equals(lhs, rhs) {\r\n return lhs.x === rhs.x && lhs.y === rhs.y;\r\n }\r\n static notEquals(lhs, rhs) {\r\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\r\n }\r\n static add(lhs, rhs) {\r\n return new Point64(lhs.x + rhs.x, lhs.y + rhs.y);\r\n }\r\n static subtract(lhs, rhs) {\r\n return new Point64(lhs.x - rhs.x, lhs.y - rhs.y);\r\n }\r\n toString() {\r\n return `${this.x},${this.y} `;\r\n }\r\n equals(obj) {\r\n if (obj instanceof Point64) {\r\n return Point64.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n}\r\nclass InternalClipper {\r\n static checkPrecision(precision) {\r\n if (precision < -8 || precision > 8)\r\n throw new Error(this.precision_range_error);\r\n }\r\n static isAlmostZero(value) {\r\n return (Math.abs(value) <= this.floatingPointTolerance);\r\n }\r\n static crossProduct(pt1, pt2, pt3) {\r\n return ((pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x));\r\n }\r\n static dotProduct(pt1, pt2, pt3) {\r\n return ((pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y));\r\n }\r\n static checkCastInt64(val) {\r\n if ((val >= this.max_coord) || (val <= this.min_coord))\r\n return this.Invalid64;\r\n return Math.round(val);\r\n }\r\n static getIntersectPt(ln1a, ln1b, ln2a, ln2b) {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n let ip;\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0)\r\n ip = ln1a;\r\n else if (t >= 1.0)\r\n ip = ln1b;\r\n else\r\n ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n static getIntersectPoint(ln1a, ln1b, ln2a, ln2b) {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n let ip;\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0)\r\n ip = ln1a;\r\n else if (t >= 1.0)\r\n ip = ln2a;\r\n else\r\n ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n static segsIntersect(seg1a, seg1b, seg2a, seg2b, inclusive = false) {\r\n if (inclusive) {\r\n const res1 = InternalClipper.crossProduct(seg1a, seg2a, seg2b);\r\n const res2 = InternalClipper.crossProduct(seg1b, seg2a, seg2b);\r\n if (res1 * res2 > 0)\r\n return false;\r\n const res3 = InternalClipper.crossProduct(seg2a, seg1a, seg1b);\r\n const res4 = InternalClipper.crossProduct(seg2b, seg1a, seg1b);\r\n if (res3 * res4 > 0)\r\n return false;\r\n return (res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0);\r\n }\r\n else {\r\n return (InternalClipper.crossProduct(seg1a, seg2a, seg2b) * InternalClipper.crossProduct(seg1b, seg2a, seg2b) < 0) &&\r\n (InternalClipper.crossProduct(seg2a, seg1a, seg1b) * InternalClipper.crossProduct(seg2b, seg1a, seg1b) < 0);\r\n }\r\n }\r\n static getClosestPtOnSegment(offPt, seg1, seg2) {\r\n if (seg1.x === seg2.x && seg1.y === seg2.y)\r\n return seg1;\r\n const dx = seg2.x - seg1.x;\r\n const dy = seg2.y - seg1.y;\r\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / ((dx * dx) + (dy * dy));\r\n if (q < 0)\r\n q = 0;\r\n else if (q > 1)\r\n q = 1;\r\n return new Point64(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\r\n }\r\n static pointInPolygon(pt, polygon) {\r\n const len = polygon.length;\r\n let start = 0;\r\n if (len < 3)\r\n return PointInPolygonResult.IsOutside;\r\n while (start < len && polygon[start].y === pt.y)\r\n start++;\r\n if (start === len)\r\n return PointInPolygonResult.IsOutside;\r\n let d = 0;\r\n let isAbove = polygon[start].y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n let i = start + 1;\r\n let end = len;\r\n for (;;) {\r\n if (i === end) {\r\n if (end === 0 || start === 0)\r\n break;\r\n end = start;\r\n i = 0;\r\n }\r\n if (isAbove) {\r\n while (i < end && polygon[i].y < pt.y)\r\n i++;\r\n if (i === end)\r\n continue;\r\n }\r\n else {\r\n while (i < end && polygon[i].y > pt.y)\r\n i++;\r\n if (i === end)\r\n continue;\r\n }\r\n const curr = polygon[i];\r\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\r\n if (curr.y === pt.y) {\r\n if (curr.x === pt.x || (curr.y === prev.y && (pt.x < prev.x !== pt.x < curr.x)))\r\n return PointInPolygonResult.IsOn;\r\n i++;\r\n if (i === start)\r\n break;\r\n continue;\r\n }\r\n if (pt.x < curr.x && pt.x < prev.x) {\r\n // we're only interested in edges crossing on the left\r\n }\r\n else if (pt.x > prev.x && pt.x > curr.x) {\r\n val = 1 - val; // toggle val\r\n }\r\n else {\r\n d = InternalClipper.crossProduct(prev, curr, pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n isAbove = !isAbove;\r\n i++;\r\n }\r\n if (isAbove !== startingAbove) {\r\n if (i === len)\r\n i = 0;\r\n else\r\n d = InternalClipper.crossProduct(polygon[i - 1], polygon[i], pt);\r\n if (d === 0)\r\n return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove)\r\n val = 1 - val;\r\n }\r\n if (val === 0)\r\n return PointInPolygonResult.IsOutside;\r\n return PointInPolygonResult.IsInside;\r\n }\r\n}\r\nInternalClipper.MaxInt64 = 9223372036854775807;\r\nInternalClipper.MaxCoord = InternalClipper.MaxInt64 / 4;\r\nInternalClipper.max_coord = InternalClipper.MaxCoord;\r\nInternalClipper.min_coord = -InternalClipper.MaxCoord;\r\nInternalClipper.Invalid64 = InternalClipper.MaxInt64;\r\nInternalClipper.defaultArcTolerance = 0.25;\r\nInternalClipper.floatingPointTolerance = 1E-12;\r\nInternalClipper.defaultMinimumEdgeLength = 0.1;\r\nInternalClipper.precision_range_error = \"Error: Precision is out of range.\";\n\n/*\r\n * Public API Surface of clipper2-js\r\n */\n\n/**\r\n * Generated bundle index. Do not edit.\r\n */\n\nexport { Active, ClipType, Clipper, Clipper64, ClipperBase, ClipperEngine, ClipperLibException, ClipperOffset, EndType, FillRule, HorzPosition, InternalClipper, JoinType, JoinWith, Minkowski, OutPt2, OutRec, Path64, PathType, Paths64, PipResult, Point64, PointD, PointInPolygonResult, PolyPath64, PolyPathBase, PolyTree64, Rect64, RectClip64, RectClipLines64, ReuseableDataContainer64, VertexFlags };\n//# sourceMappingURL=clipper2-js.mjs.map\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 15 October 2022 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2022 *\r\n* Purpose : Minkowski Sum and Difference *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { FillRule, IPoint64, Path64, Paths64 } from \"./core\";\r\n\r\n\r\nexport class Minkowski {\r\n private static minkowskiInternal(pattern: Path64, path: Path64, isSum: boolean, isClosed: boolean): Paths64 {\r\n const delta = isClosed ? 0 : 1;\r\n const patLen = pattern.length;\r\n const pathLen = path.length;\r\n const tmp: Array> = []\r\n\r\n for (const pathPt of path) {\r\n const path2: Array = []\r\n if (isSum) {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x + basePt.x, y: pathPt.y + basePt.y });\r\n } else {\r\n for (const basePt of pattern)\r\n path2.push({ x: pathPt.x - basePt.x, y: pathPt.y - basePt.y });\r\n }\r\n tmp.push(path2);\r\n }\r\n\r\n const result: Array> = []\r\n let g = isClosed ? pathLen - 1 : 0;\r\n\r\n let h = patLen - 1;\r\n for (let i = delta; i < pathLen; i++) {\r\n for (let j = 0; j < patLen; j++) {\r\n const quad: Path64 = [tmp[g][h], tmp[i][h], tmp[i][j], tmp[g][j]];\r\n if (!Clipper.isPositive(quad))\r\n result.push(Clipper.reversePath(quad));\r\n else\r\n result.push(quad);\r\n h = j;\r\n }\r\n g = i;\r\n }\r\n return result;\r\n }\r\n\r\n public static sum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, FillRule.NonZero);\r\n }\r\n\r\n public static diff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Clipper.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, FillRule.NonZero);\r\n }\r\n\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 7 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Path Offset (Inflate/Shrink) *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { Clipper64, PolyTree64 } from \"./engine\";\r\n\r\nexport enum JoinType {\r\n Square,\r\n Round,\r\n Miter\r\n}\r\n\r\nexport enum EndType {\r\n Polygon,\r\n Joined,\r\n Butt,\r\n Square,\r\n Round\r\n}\r\n\r\nclass Group {\r\n inPaths: Paths64;\r\n outPath: Path64;\r\n outPaths: Paths64;\r\n joinType: JoinType;\r\n endType: EndType;\r\n pathsReversed: boolean;\r\n\r\n constructor(paths: Paths64, joinType: JoinType, endType: EndType = EndType.Polygon) {\r\n this.inPaths = [...paths]; // creates a shallow copy of paths\r\n this.joinType = joinType;\r\n this.endType = endType;\r\n this.outPath = [];\r\n this.outPaths = [];\r\n this.pathsReversed = false;\r\n }\r\n}\r\n\r\nexport class PointD implements IPoint64 {\r\n public x: number;\r\n public y: number;\r\n\r\n constructor(xOrPt: number | PointD | Point64, yOrScale?: number) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = xOrPt;\r\n this.y = yOrScale;\r\n } else if (xOrPt instanceof PointD) {\r\n if (yOrScale !== undefined) {\r\n this.x = xOrPt.x * yOrScale;\r\n this.y = xOrPt.y * yOrScale;\r\n } else {\r\n this.x = xOrPt.x;\r\n this.y = xOrPt.y;\r\n }\r\n } else {\r\n this.x = (xOrPt).x * (yOrScale || 1);\r\n this.y = (xOrPt).y * (yOrScale || 1);\r\n }\r\n }\r\n\r\n public toString(precision: number = 2): string {\r\n return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`;\r\n }\r\n\r\n public static equals(lhs: PointD, rhs: PointD): boolean {\r\n return InternalClipper.isAlmostZero(lhs.x - rhs.x) &&\r\n InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n\r\n public static notEquals(lhs: PointD, rhs: PointD): boolean {\r\n return !InternalClipper.isAlmostZero(lhs.x - rhs.x) ||\r\n !InternalClipper.isAlmostZero(lhs.y - rhs.y);\r\n }\r\n\r\n public equals(obj: PointD): boolean {\r\n if (obj instanceof PointD) {\r\n return PointD.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n\r\n public negate(): void {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n }\r\n\r\n // public getHashCode(): number {\r\n // return this.x ^ this.y; // XOR-based hash combination. Adjust if needed.\r\n // }\r\n}\r\n\r\nexport class ClipperOffset {\r\n\r\n private static Tolerance: number = 1.0E-12;\r\n private _groupList: Array = [];\r\n private _normals: Array = [];\r\n private _solution: Paths64 = [];\r\n private _groupDelta!: number; //*0.5 for open paths; *-1.0 for negative areas\r\n private _delta!: number;\r\n private _mitLimSqr!: number;\r\n private _stepsPerRad!: number;\r\n private _stepSin!: number;\r\n private _stepCos!: number;\r\n private _joinType!: JoinType;\r\n private _endType!: EndType;\r\n public ArcTolerance: number;\r\n public MergeGroups: boolean;\r\n public MiterLimit: number;\r\n public PreserveCollinear: boolean;\r\n public ReverseSolution: boolean;\r\n\r\n public DeltaCallback?: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number;\r\n\r\n constructor(miterLimit: number = 2.0, arcTolerance: number = 0.0,\r\n preserveCollinear: boolean = false, reverseSolution: boolean = false) {\r\n this.MiterLimit = miterLimit;\r\n this.ArcTolerance = arcTolerance;\r\n this.MergeGroups = true;\r\n this.PreserveCollinear = preserveCollinear;\r\n this.ReverseSolution = reverseSolution;\r\n }\r\n\r\n public clear(): void {\r\n this._groupList = [];\r\n }\r\n\r\n public addPath(path: Point64[], joinType: JoinType, endType: EndType): void {\r\n if (path.length === 0) return;\r\n const pp: Point64[][] = [path];\r\n this.addPaths(pp, joinType, endType);\r\n }\r\n\r\n public addPaths(paths: Paths64, joinType: JoinType, endType: EndType): void {\r\n if (paths.length === 0) return;\r\n this._groupList.push(new Group(paths, joinType, endType));\r\n }\r\n\r\n private executeInternal(delta: number): void {\r\n this._solution = [];\r\n if (this._groupList.length === 0) return;\r\n\r\n if (Math.abs(delta) < 0.5) {\r\n for (const group of this._groupList) {\r\n for (const path of group.inPaths) {\r\n this._solution.push(path);\r\n }\r\n }\r\n } else {\r\n this._delta = delta;\r\n this._mitLimSqr = (this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit));\r\n for (const group of this._groupList) {\r\n this.doGroupOffset(group);\r\n }\r\n }\r\n }\r\n\r\n private sqr(value: number): number {\r\n return value * value;\r\n }\r\n\r\n\r\n public execute(delta: number, solution: Paths64): void {\r\n solution.length = 0;\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0) return;\r\n\r\n // clean up self-intersections ...\r\n const c = new Clipper64()\r\n c.preserveCollinear = this.PreserveCollinear\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed\r\n\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.execute(ClipType.Union, FillRule.Negative, solution);\r\n else\r\n c.execute(ClipType.Union, FillRule.Positive, solution);\r\n }\r\n\r\n public executePolytree(delta: number, polytree: PolyTree64): void {\r\n polytree.clear();\r\n this.executeInternal(delta);\r\n if (this._groupList.length === 0) return;\r\n\r\n // clean up self-intersections ...\r\n const c = new Clipper64()\r\n c.preserveCollinear = this.PreserveCollinear\r\n // the solution should retain the orientation of the input\r\n c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed\r\n\r\n c.addSubjectPaths(this._solution);\r\n if (this._groupList[0].pathsReversed)\r\n c.executePolyTree(ClipType.Union, FillRule.Negative, polytree);\r\n else\r\n c.executePolyTree(ClipType.Union, FillRule.Positive, polytree);\r\n }\r\n\r\n protected static getUnitNormal(pt1: IPoint64, pt2: IPoint64): PointD {\r\n let dx = pt2.x - pt1.x;\r\n let dy = pt2.y - pt1.y;\r\n if (dx === 0 && dy === 0) return new PointD(0, 0);\r\n\r\n const f = 1.0 / Math.sqrt(dx * dx + dy * dy);\r\n dx *= f;\r\n dy *= f;\r\n\r\n return new PointD(dy, -dx);\r\n }\r\n\r\n public executeCallback(deltaCallback: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number, solution: Point64[][]): void {\r\n this.DeltaCallback = deltaCallback;\r\n this.execute(1.0, solution);\r\n }\r\n\r\n private static getBoundsAndLowestPolyIdx(paths: Paths64): { index: number, rec: Rect64 } {\r\n const rec = new Rect64(false); // ie invalid rect\r\n let lpX: number = Number.MIN_SAFE_INTEGER;\r\n let index = -1;\r\n for (let i = 0; i < paths.length; i++) {\r\n for (const pt of paths[i]) {\r\n if (pt.y >= rec.bottom) {\r\n if (pt.y > rec.bottom || pt.x < lpX) {\r\n index = i;\r\n lpX = pt.x;\r\n rec.bottom = pt.y;\r\n }\r\n } else if (pt.y < rec.top) rec.top = pt.y;\r\n if (pt.x > rec.right) rec.right = pt.x;\r\n else if (pt.x < rec.left) rec.left = pt.x;\r\n }\r\n }\r\n return { index, rec }\r\n }\r\n\r\n private static translatePoint(pt: PointD, dx: number, dy: number): PointD {\r\n return new PointD(pt.x + dx, pt.y + dy);\r\n }\r\n\r\n private static reflectPoint(pt: PointD, pivot: PointD): PointD {\r\n return new PointD(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y));\r\n }\r\n\r\n private static almostZero(value: number, epsilon: number = 0.001): boolean {\r\n return Math.abs(value) < epsilon;\r\n }\r\n\r\n private static hypotenuse(x: number, y: number): number {\r\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\r\n }\r\n\r\n private static normalizeVector(vec: PointD): PointD {\r\n const h = this.hypotenuse(vec.x, vec.y);\r\n if (this.almostZero(h)) return new PointD(0, 0);\r\n const inverseHypot = 1 / h;\r\n return new PointD(vec.x * inverseHypot, vec.y * inverseHypot);\r\n }\r\n\r\n private static getAvgUnitVector(vec1: PointD, vec2: PointD): PointD {\r\n return this.normalizeVector(new PointD(vec1.x + vec2.x, vec1.y + vec2.y));\r\n }\r\n\r\n private static intersectPoint(pt1a: PointD, pt1b: PointD, pt2a: PointD, pt2b: PointD): PointD {\r\n if (InternalClipper.isAlmostZero(pt1a.x - pt1b.x)) { //vertical\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) return new PointD(0, 0);\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n return new PointD(pt1a.x, m2 * pt1a.x + b2);\r\n }\r\n\r\n if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) { //vertical\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n return new PointD(pt2a.x, m1 * pt2a.x + b1);\r\n } else {\r\n const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x);\r\n const b1 = pt1a.y - m1 * pt1a.x;\r\n const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x);\r\n const b2 = pt2a.y - m2 * pt2a.x;\r\n if (InternalClipper.isAlmostZero(m1 - m2)) return new PointD(0, 0);\r\n const x = (b2 - b1) / (m1 - m2);\r\n return new PointD(x, m1 * x + b1);\r\n }\r\n }\r\n\r\n private getPerpendic(pt: IPoint64, norm: PointD): Point64 {\r\n return new Point64(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n\r\n private getPerpendicD(pt: IPoint64, norm: PointD): PointD {\r\n return new PointD(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta);\r\n }\r\n\r\n private doSquare(group: Group, path: Path64, j: number, k: number): void {\r\n let vec: PointD;\r\n if (j === k) {\r\n vec = new PointD(this._normals[j].y, -this._normals[j].x);\r\n } else {\r\n vec = ClipperOffset.getAvgUnitVector(\r\n new PointD(-this._normals[k].y, this._normals[k].x),\r\n new PointD(this._normals[j].y, -this._normals[j].x)\r\n );\r\n }\r\n\r\n const absDelta = Math.abs(this._groupDelta);\r\n // now offset the original vertex delta units along unit vector\r\n let ptQ = new PointD(path[j].x, path[j].y); \r\n ptQ = ClipperOffset.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y);\r\n\r\n // get perpendicular vertices\r\n const pt1 = ClipperOffset.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x);\r\n const pt2 = ClipperOffset.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x);\r\n // get 2 vertices along one edge offset\r\n const pt3 = this.getPerpendicD(path[k], this._normals[k]);\r\n\r\n if (j === k) {\r\n const pt4 = new PointD(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n } else {\r\n const pt4 = this.getPerpendicD(path[j], this._normals[k]);\r\n const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4);\r\n group.outPath.push(new Point64(pt.x, pt.y));\r\n //get the second intersect point through reflection\r\n group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y));\r\n }\r\n }\r\n\r\n private doMiter(group: Group, path: Path64, j: number, k: number, cosA: number): void {\r\n const q = this._groupDelta / (cosA + 1);\r\n group.outPath.push(new Point64(\r\n path[j].x + (this._normals[k].x + this._normals[j].x) * q,\r\n path[j].y + (this._normals[k].y + this._normals[j].y) * q\r\n ));\r\n }\r\n\r\n private doRound(group: Group, path: Path64, j: number, k: number, angle: number): void {\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n const absDelta = Math.abs(this._groupDelta);\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n if (this._groupDelta < 0.0) this._stepSin = -this._stepSin;\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n\r\n const pt = path[j];\r\n let offsetVec = new PointD(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta);\r\n if (j === k) offsetVec.negate();\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n if (angle > -Math.PI + 0.01) {\r\n const steps = Math.ceil(this._stepsPerRad * Math.abs(angle));\r\n for (let i = 1; i < steps; i++) {\r\n offsetVec = new PointD(\r\n offsetVec.x * this._stepCos - this._stepSin * offsetVec.y,\r\n offsetVec.x * this._stepSin + offsetVec.y * this._stepCos\r\n );\r\n group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y));\r\n }\r\n }\r\n group.outPath.push(this.getPerpendic(pt, this._normals[j]));\r\n }\r\n\r\n private buildNormals(path: Path64): void {\r\n const cnt = path.length;\r\n this._normals = [];\r\n this._normals.length = cnt;\r\n\r\n for (let i = 0; i < cnt - 1; i++) {\r\n this._normals.push(ClipperOffset.getUnitNormal(path[i], path[i + 1]));\r\n }\r\n this._normals.push(ClipperOffset.getUnitNormal(path[cnt - 1], path[0]));\r\n }\r\n\r\n crossProduct(vec1: PointD, vec2: PointD): number {\r\n return (vec1.y * vec2.x - vec2.y * vec1.x);\r\n }\r\n\r\n dotProduct(vec1: PointD, vec2: PointD): number {\r\n return (vec1.x * vec2.x + vec1.y * vec2.y);\r\n }\r\n\r\n private offsetPoint(group: Group, path: Path64, j: number, k: number): void {\r\n const sinA = this.crossProduct(this._normals[j], this._normals[k]);\r\n let cosA = this.dotProduct(this._normals[j], this._normals[k]);\r\n if (sinA > 1.0) cosA = 1.0;\r\n else if (sinA < -1.0) cosA = -1.0;\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, j, k);\r\n if (group.pathsReversed) this._groupDelta = -this._groupDelta;\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[j]);\r\n return;\r\n }\r\n\r\n if (cosA > 0.999) {\r\n this.doMiter(group, path, j, k, cosA);\r\n } else if (cosA > -0.99 && (sinA * this._groupDelta < 0)) {\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[k]));\r\n group.outPath.push(path[j]);\r\n group.outPath.push(this.getPerpendic(path[j], this._normals[j]));\r\n } else if (this._joinType === JoinType.Miter) {\r\n if (cosA > this._mitLimSqr - 1) {\r\n this.doMiter(group, path, j, k, cosA);\r\n } else {\r\n this.doSquare(group, path, j, k);\r\n }\r\n } else if (cosA > 0.99 || this._joinType === JoinType.Square) {\r\n this.doSquare(group, path, j, k);\r\n } else {\r\n this.doRound(group, path, j, k, Math.atan2(sinA, cosA));\r\n }\r\n\r\n k = j;\r\n }\r\n\r\n private offsetPolygon(group: Group, path: Path64): void {\r\n const area = Clipper.area(path);\r\n if ((area < 0) !== (this._groupDelta < 0)) {\r\n const rect = Clipper.getBounds(path);\r\n if (Math.abs(this._groupDelta) * 2 > rect.width) return;\r\n }\r\n\r\n group.outPath = [];\r\n const cnt = path.length;\r\n const prev = cnt - 1;\r\n for (let i = 0; i < cnt; i++) {\r\n this.offsetPoint(group, path, i, prev);\r\n }\r\n group.outPaths.push(group.outPath);\r\n }\r\n\r\n private offsetOpenJoined(group: Group, path: Path64): void {\r\n this.offsetPolygon(group, path);\r\n path = Clipper.reversePath(path);\r\n this.buildNormals(path);\r\n this.offsetPolygon(group, path);\r\n }\r\n\r\n private offsetOpenPath(group: Group, path: Path64): void {\r\n group.outPath = [];\r\n const highI = path.length - 1;\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0);\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[0]);\r\n } else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(\r\n path[0].x - this._normals[0].x * this._groupDelta,\r\n path[0].y - this._normals[0].y * this._groupDelta\r\n ));\r\n group.outPath.push(this.getPerpendic(path[0], this._normals[0]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, 0, 0, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, 0, 0);\r\n break;\r\n }\r\n }\r\n\r\n for (let i = 1, k = 0; i < highI; i++) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n\r\n for (let i = highI; i > 0; i--) {\r\n this._normals[i] = new PointD(-this._normals[i - 1].x, -this._normals[i - 1].y);\r\n }\r\n this._normals[0] = this._normals[highI];\r\n\r\n if (typeof this.DeltaCallback !== \"undefined\") {\r\n this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI);\r\n }\r\n\r\n if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) {\r\n group.outPath.push(path[highI]);\r\n } else {\r\n switch (this._endType) {\r\n case EndType.Butt:\r\n group.outPath.push(new Point64(\r\n path[highI].x - this._normals[highI].x * this._groupDelta,\r\n path[highI].y - this._normals[highI].y * this._groupDelta\r\n ));\r\n group.outPath.push(this.getPerpendic(path[highI], this._normals[highI]));\r\n break;\r\n case EndType.Round:\r\n this.doRound(group, path, highI, highI, Math.PI);\r\n break;\r\n default:\r\n this.doSquare(group, path, highI, highI);\r\n break;\r\n }\r\n }\r\n\r\n for (let i = highI, k = 0; i > 0; i--) {\r\n this.offsetPoint(group, path, i, k);\r\n }\r\n\r\n group.outPaths.push(group.outPath);\r\n }\r\n\r\n private doGroupOffset(group: Group): void {\r\n if (group.endType == EndType.Polygon) {\r\n\r\n const { index } = ClipperOffset.getBoundsAndLowestPolyIdx(group.inPaths);\r\n\r\n if (index < 0) return;\r\n\r\n const area = Clipper.area(group.inPaths[index]);\r\n group.pathsReversed = area < 0;\r\n\r\n if (group.pathsReversed) {\r\n this._groupDelta = -this._delta;\r\n } else {\r\n this._groupDelta = this._delta;\r\n }\r\n } else {\r\n group.pathsReversed = false;\r\n this._groupDelta = Math.abs(this._delta) * 0.5;\r\n }\r\n\r\n const absDelta = Math.abs(this._groupDelta);\r\n this._joinType = group.joinType;\r\n this._endType = group.endType;\r\n\r\n if (!this.DeltaCallback &&\r\n (group.joinType == JoinType.Round || group.endType == EndType.Round)) {\r\n const arcTol = this.ArcTolerance > 0.01\r\n ? this.ArcTolerance\r\n : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance;\r\n\r\n const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta);\r\n this._stepSin = Math.sin((2 * Math.PI) / stepsPer360);\r\n this._stepCos = Math.cos((2 * Math.PI) / stepsPer360);\r\n\r\n if (this._groupDelta < 0.0) {\r\n this._stepSin = -this._stepSin;\r\n }\r\n\r\n this._stepsPerRad = stepsPer360 / (2 * Math.PI);\r\n }\r\n\r\n const isJoined = group.endType == EndType.Joined || group.endType == EndType.Polygon;\r\n\r\n for (const p of group.inPaths) {\r\n const path = Clipper.stripDuplicates(p, isJoined);\r\n const cnt = path.length;\r\n\r\n if (cnt === 0 || (cnt < 3 && this._endType == EndType.Polygon)) {\r\n continue;\r\n }\r\n\r\n if (cnt == 1) {\r\n group.outPath = [];\r\n\r\n if (group.endType == EndType.Round) {\r\n const r = absDelta;\r\n group.outPath = Clipper.ellipse(path[0], r, r);\r\n } else {\r\n const d = Math.ceil(this._groupDelta);\r\n const r = new Rect64(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d);\r\n group.outPath = r.asPath();\r\n }\r\n\r\n group.outPaths.push(group.outPath);\r\n } else {\r\n if (cnt == 2 && group.endType == EndType.Joined) {\r\n if (group.joinType == JoinType.Round) {\r\n this._endType = EndType.Round;\r\n } else {\r\n this._endType = EndType.Square;\r\n }\r\n }\r\n\r\n this.buildNormals(path);\r\n\r\n if (this._endType == EndType.Polygon) {\r\n this.offsetPolygon(group, path);\r\n } else if (this._endType == EndType.Joined) {\r\n this.offsetOpenJoined(group, path);\r\n } else {\r\n this.offsetOpenPath(group, path);\r\n }\r\n }\r\n }\r\n\r\n this._solution.push(...group.outPaths);\r\n group.outPaths = [];\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 6 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : FAST rectangular clipping *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { PointInPolygonResult } from \"./engine\";\r\n\r\nexport class OutPt2 {\r\n next?: OutPt2;\r\n prev?: OutPt2;\r\n\r\n pt: IPoint64;\r\n ownerIdx: number;\r\n edge?: Array;\r\n\r\n constructor(pt: IPoint64) {\r\n this.pt = pt;\r\n this.ownerIdx = 0\r\n }\r\n}\r\n\r\nenum Location {\r\n left, top, right, bottom, inside\r\n}\r\n\r\nexport class RectClip64 {\r\n protected rect: Rect64;\r\n protected mp: Point64;\r\n protected rectPath: Path64;\r\n protected pathBounds!: Rect64;\r\n protected results: Array\r\n protected edges: Array[];\r\n protected currIdx = -1;\r\n\r\n constructor(rect: Rect64) {\r\n this.rect = rect;\r\n this.mp = rect.midPoint();\r\n this.rectPath = rect.asPath();\r\n this.results = [];\r\n this.edges = Array(8).fill(undefined).map(() => []);\r\n }\r\n\r\n protected add(pt: IPoint64, startingNewPath: boolean = false): OutPt2 {\r\n let currIdx = this.results.length;\r\n let result: OutPt2;\r\n if (currIdx === 0 || startingNewPath) {\r\n result = new OutPt2(pt);\r\n this.results.push(result);\r\n result.ownerIdx = currIdx;\r\n result.prev = result;\r\n result.next = result;\r\n } else {\r\n currIdx--;\r\n const prevOp = this.results[currIdx];\r\n if (prevOp!.pt === pt) return prevOp!;\r\n result = new OutPt2(pt);\r\n result.ownerIdx = currIdx;\r\n result.next = prevOp!.next;\r\n prevOp!.next!.prev = result;\r\n prevOp!.next = result;\r\n result.prev = prevOp!;\r\n this.results[currIdx] = result;\r\n }\r\n return result;\r\n }\r\n\r\n private static path1ContainsPath2(path1: Path64, path2: Path64): boolean {\r\n let ioCount = 0;\r\n for (const pt of path2) {\r\n const pip = InternalClipper.pointInPolygon(pt, path1);\r\n switch (pip) {\r\n case PointInPolygonResult.IsInside:\r\n ioCount--; break;\r\n case PointInPolygonResult.IsOutside:\r\n ioCount++; break;\r\n }\r\n if (Math.abs(ioCount) > 1) break;\r\n }\r\n return ioCount <= 0;\r\n }\r\n\r\n private static isClockwise(prev: Location, curr: Location, prevPt: IPoint64, currPt: IPoint64, rectMidPoint: Point64): boolean {\r\n if (this.areOpposites(prev, curr))\r\n return InternalClipper.crossProduct(prevPt, rectMidPoint, currPt) < 0;\r\n else\r\n return this.headingClockwise(prev, curr);\r\n }\r\n\r\n private static areOpposites(prev: Location, curr: Location): boolean {\r\n return Math.abs(prev - curr) === 2;\r\n }\r\n\r\n private static headingClockwise(prev: Location, curr: Location): boolean {\r\n return (prev + 1) % 4 === curr;\r\n }\r\n\r\n private static getAdjacentLocation(loc: Location, isClockwise: boolean): Location {\r\n const delta = isClockwise ? 1 : 3;\r\n return (loc + delta) % 4;\r\n }\r\n\r\n private static unlinkOp(op: OutPt2 | undefined): OutPt2 | undefined {\r\n if (op!.next === op) return undefined;\r\n op!.prev!.next = op!.next;\r\n op!.next!.prev = op!.prev;\r\n return op!.next;\r\n }\r\n\r\n private static unlinkOpBack(op: OutPt2 | undefined): OutPt2 | undefined {\r\n if (op!.next === op) return undefined;\r\n op!.prev!.next = op!.next;\r\n op!.next!.prev = op!.prev;\r\n return op!.prev;\r\n }\r\n\r\n private static getEdgesForPt(pt: IPoint64, rec: Rect64): number {\r\n let result = 0;\r\n if (pt.x === rec.left) result = 1;\r\n else if (pt.x === rec.right) result = 4;\r\n if (pt.y === rec.top) result += 2;\r\n else if (pt.y === rec.bottom) result += 8;\r\n return result;\r\n }\r\n\r\n private static isHeadingClockwise(pt1: IPoint64, pt2: IPoint64, edgeIdx: number): boolean {\r\n switch (edgeIdx) {\r\n case 0: return pt2.y < pt1.y;\r\n case 1: return pt2.x > pt1.x;\r\n case 2: return pt2.y > pt1.y;\r\n default: return pt2.x < pt1.x;\r\n }\r\n }\r\n\r\n private static hasHorzOverlap(left1: IPoint64, right1: IPoint64, left2: IPoint64, right2: IPoint64): boolean {\r\n return (left1.x < right2.x) && (right1.x > left2.x);\r\n }\r\n\r\n private static hasVertOverlap(top1: IPoint64, bottom1: IPoint64, top2: IPoint64, bottom2: IPoint64): boolean {\r\n return (top1.y < bottom2.y) && (bottom1.y > top2.y);\r\n }\r\n\r\n private static addToEdge(edge: (OutPt2 | undefined)[], op: OutPt2): void {\r\n if (op.edge) return;\r\n op.edge = edge;\r\n edge.push(op);\r\n }\r\n\r\n private static uncoupleEdge(op: OutPt2): void {\r\n if (!op.edge) return;\r\n for (let i = 0; i < op.edge.length; i++) {\r\n const op2 = op.edge[i];\r\n if (op2 === op) {\r\n op.edge[i] = undefined;\r\n break;\r\n }\r\n }\r\n op.edge = undefined;\r\n }\r\n\r\n private static setNewOwner(op: OutPt2, newIdx: number): void {\r\n op.ownerIdx = newIdx;\r\n let op2 = op.next!;\r\n while (op2 !== op) {\r\n op2.ownerIdx = newIdx;\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n private addCorner(prev: Location, curr: Location): void {\r\n if (RectClip64.headingClockwise(prev, curr))\r\n this.add(this.rectPath[prev]);\r\n else\r\n this.add(this.rectPath[curr]);\r\n }\r\n\r\n private addCornerByRef(loc: Location, isClockwise: boolean): void {\r\n if (isClockwise) {\r\n this.add(this.rectPath[loc]);\r\n loc = RectClip64.getAdjacentLocation(loc, true);\r\n } else {\r\n loc = RectClip64.getAdjacentLocation(loc, false);\r\n this.add(this.rectPath[loc]);\r\n }\r\n }\r\n\r\n protected static getLocation(rec: Rect64, pt: IPoint64): { success: boolean, loc: Location } {\r\n let loc: Location;\r\n\r\n if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.left; // pt on rec\r\n return { success: false, loc }\r\n }\r\n if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) {\r\n loc = Location.right; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.top; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) {\r\n loc = Location.bottom; // pt on rec\r\n return { success: false, loc };\r\n }\r\n if (pt.x < rec.left) loc = Location.left;\r\n else if (pt.x > rec.right) loc = Location.right;\r\n else if (pt.y < rec.top) loc = Location.top;\r\n else if (pt.y > rec.bottom) loc = Location.bottom;\r\n else loc = Location.inside;\r\n\r\n return { success: true, loc };\r\n }\r\n\r\n protected static getIntersection(rectPath: Path64, p: IPoint64, p2: IPoint64, loc: Location): { success: boolean, loc: Location, ip: IPoint64 } {\r\n // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p'\r\n // when result == false, loc will remain unchanged\r\n let ip: IPoint64 = new Point64();\r\n switch (loc) {\r\n case Location.left:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n } else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n }\r\n else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.right:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n } else if (p.y < rectPath[0].y && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n case Location.top:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n } else if (p.x < rectPath[0].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (p.x > rectPath[1].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.bottom:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n } else if (p.x < rectPath[3].x && InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (p.x > rectPath[2].x && InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n case Location.inside:\r\n if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[3]).ip;\r\n loc = Location.left;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[0], rectPath[1], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[0], rectPath[1]).ip;\r\n loc = Location.top;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[1], rectPath[2], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[1], rectPath[2]).ip;\r\n loc = Location.right;\r\n } else if (InternalClipper.segsIntersect(p, p2, rectPath[2], rectPath[3], true)) {\r\n ip = InternalClipper.getIntersectPt(p, p2, rectPath[2], rectPath[3]).ip;\r\n loc = Location.bottom;\r\n } else {\r\n return { success: false, loc, ip }\r\n }\r\n break;\r\n\r\n }\r\n return { success:true, loc, ip };\r\n }\r\n\r\n protected getNextLocation(path: Path64, context: { loc: Location, i: number, highI: number }): void {\r\n\r\n switch (context.loc) {\r\n case Location.left:\r\n while (context.i <= context.highI && path[context.i].x <= this.rect.left) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.top:\r\n while (context.i <= context.highI && path[context.i].y <= this.rect.top) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.right:\r\n while (context.i <= context.highI && path[context.i].x >= this.rect.right) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.bottom:\r\n while (context.i <= context.highI && path[context.i].y >= this.rect.bottom) context.i++;\r\n if (context.i > context.highI) break;\r\n if (path[context.i].y <= this.rect.top) context.loc = Location.top;\r\n else if (path[context.i].x <= this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x >= this.rect.right) context.loc = Location.right;\r\n else context.loc = Location.inside;\r\n break;\r\n\r\n case Location.inside:\r\n while (context.i <= context.highI) {\r\n if (path[context.i].x < this.rect.left) context.loc = Location.left;\r\n else if (path[context.i].x > this.rect.right) context.loc = Location.right;\r\n else if (path[context.i].y > this.rect.bottom) context.loc = Location.bottom;\r\n else if (path[context.i].y < this.rect.top) context.loc = Location.top;\r\n else {\r\n this.add(path[context.i]); \r\n context.i++;\r\n continue;\r\n }\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n protected executeInternal(path: Path64): void {\r\n if (path.length < 3 || this.rect.isEmpty()) return;\r\n const startLocs: Location[] = [];\r\n\r\n let firstCross: Location = Location.inside;\r\n let crossingLoc: Location = firstCross, prev: Location = firstCross;\r\n\r\n let i: number\r\n const highI = path.length - 1;\r\n let result = RectClip64.getLocation(this.rect, path[highI])\r\n let loc: Location = result.loc\r\n if (!result.success) {\r\n i = highI - 1;\r\n while (i >= 0 && !result.success) {\r\n i--\r\n result = RectClip64.getLocation(this.rect, path[i])\r\n prev = result.loc\r\n }\r\n if (i < 0) {\r\n for (const pt of path) {\r\n this.add(pt);\r\n }\r\n return;\r\n }\r\n if (prev == Location.inside) loc = Location.inside;\r\n }\r\n const startingLoc = loc;\r\n\r\n ///////////////////////////////////////////////////\r\n i = 0;\r\n while (i <= highI) {\r\n prev = loc;\r\n const prevCrossLoc: Location = crossingLoc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n if (i > highI) break;\r\n\r\n const prevPt = (i == 0) ? path[highI] : path[i - 1];\r\n crossingLoc = loc;\r\n\r\n let result = RectClip64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc)\r\n const ip: IPoint64 = result.ip\r\n\r\n if (!result.success) {\r\n if (prevCrossLoc == Location.inside) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp); \r\n do {\r\n startLocs.push(prev);\r\n prev = RectClip64.getAdjacentLocation(prev, isClockw);\r\n } while (prev != loc);\r\n crossingLoc = prevCrossLoc;\r\n } else if (prev != Location.inside && prev != loc) {\r\n const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != loc);\r\n }\r\n ++i;\r\n continue;\r\n }\r\n\r\n ////////////////////////////////////////////////////\r\n // we must be crossing the rect boundary to get here\r\n ////////////////////////////////////////////////////\r\n if (loc == Location.inside) {\r\n if (firstCross == Location.inside) {\r\n firstCross = crossingLoc;\r\n startLocs.push(prev);\r\n } else if (prev != crossingLoc) {\r\n const isClockw = RectClip64.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp);\r\n do {\r\n this.addCornerByRef(prev, isClockw);\r\n } while (prev != crossingLoc);\r\n }\r\n } else if (prev != Location.inside) {\r\n // passing right through rect. 'ip' here will be the second\r\n // intersect pt but we'll also need the first intersect pt (ip2)\r\n\r\n loc = prev;\r\n result = RectClip64.getIntersection(this.rectPath, prevPt, path[i], loc);\r\n const ip2: IPoint64 = result.ip\r\n\r\n if (prevCrossLoc != Location.inside && prevCrossLoc != loc)\r\n this.addCorner(prevCrossLoc, loc);\r\n\r\n if (firstCross == Location.inside) {\r\n firstCross = loc;\r\n startLocs.push(prev);\r\n }\r\n\r\n loc = crossingLoc;\r\n this.add(ip2);\r\n if (ip == ip2) {\r\n loc = RectClip64.getLocation(this.rect, path[i]).loc;\r\n this.addCorner(crossingLoc, loc);\r\n crossingLoc = loc;\r\n continue;\r\n }\r\n } else {\r\n loc = crossingLoc;\r\n if (firstCross == Location.inside)\r\n firstCross = crossingLoc;\r\n }\r\n\r\n this.add(ip);\r\n }//while i <= highI\r\n ///////////////////////////////////////////////////\r\n\r\n if (firstCross == Location.inside) {\r\n if (startingLoc != Location.inside) {\r\n if (this.pathBounds.containsRect(this.rect) && RectClip64.path1ContainsPath2(path, this.rectPath)) {\r\n for (let j = 0; j < 4; j++) {\r\n this.add(this.rectPath[j]);\r\n RectClip64.addToEdge(this.edges[j * 2], this.results[0]!);\r\n }\r\n }\r\n }\r\n } else if (loc != Location.inside && (loc != firstCross || startLocs.length > 2)) {\r\n if (startLocs.length > 0) {\r\n prev = loc;\r\n for (const loc2 of startLocs) {\r\n if (prev == loc2) continue;\r\n this.addCornerByRef(prev, RectClip64.headingClockwise(prev, loc2));\r\n prev = loc2;\r\n }\r\n loc = prev;\r\n }\r\n if (loc != firstCross)\r\n this.addCornerByRef(loc, RectClip64.headingClockwise(loc, firstCross));\r\n }\r\n }\r\n\r\n public execute(paths: Paths64): Paths64 { \r\n const result: Paths64 = []; \r\n if (this.rect.isEmpty()) return result;\r\n\r\n for (const path of paths) {\r\n if (path.length < 3) continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n\r\n if (!this.rect.intersects(this.pathBounds)) continue;\r\n else if (this.rect.containsRect(this.pathBounds)) {\r\n result.push(path);\r\n continue;\r\n }\r\n this.executeInternal(path);\r\n this.checkEdges();\r\n for (let i = 0; i < 4; ++i)\r\n this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]);\r\n\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op); \r\n if (tmp.length > 0) result.push(tmp);\r\n }\r\n\r\n this.results.length = 0\r\n for (let i = 0; i < 8; i++)\r\n this.edges[i].length = 0\r\n }\r\n return result;\r\n }\r\n\r\n private checkEdges(): void {\r\n for (let i = 0; i < this.results.length; i++) {\r\n let op = this.results[i];\r\n let op2 = op;\r\n\r\n if (op === undefined) continue;\r\n\r\n do {\r\n if (InternalClipper.crossProduct(op2!.prev!.pt, op2!.pt, op2!.next!.pt) === 0) { \r\n if (op2 === op) {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined) break;\r\n op = op2.prev;\r\n } else {\r\n op2 = RectClip64.unlinkOpBack(op2);\r\n if (op2 === undefined) break;\r\n }\r\n } else {\r\n op2 = op2!.next;\r\n }\r\n } while (op2 !== op);\r\n\r\n if (op2 === undefined) {\r\n this.results[i] = undefined;\r\n continue;\r\n }\r\n this.results[i] = op2;\r\n\r\n let edgeSet1 = RectClip64.getEdgesForPt(op!.prev!.pt, this.rect);\r\n op2 = op;\r\n do {\r\n const edgeSet2 = RectClip64.getEdgesForPt(op2!.pt, this.rect);\r\n if (edgeSet2 !== 0 && op2!.edge === undefined) {\r\n const combinedSet = (edgeSet1 & edgeSet2);\r\n for (let j = 0; j < 4; ++j) {\r\n if ((combinedSet & (1 << j)) !== 0) {\r\n if (RectClip64.isHeadingClockwise(op2!.prev!.pt, op2!.pt, j))\r\n RectClip64.addToEdge(this.edges[j * 2], op2!);\r\n else\r\n RectClip64.addToEdge(this.edges[j * 2 + 1], op2!);\r\n }\r\n }\r\n }\r\n edgeSet1 = edgeSet2;\r\n op2 = op2!.next;\r\n } while (op2 !== op);\r\n }\r\n }\r\n\r\n private tidyEdgePair(idx: number, cw: Array, ccw: Array): void {\r\n if (ccw.length === 0) return;\r\n const isHorz = (idx === 1 || idx === 3);\r\n const cwIsTowardLarger = (idx === 1 || idx === 2);\r\n let i = 0, j = 0;\r\n let p1: OutPt2 | undefined, p2: OutPt2 | undefined, p1a: OutPt2 | undefined, p2a: OutPt2 | undefined, op: OutPt2 | undefined, op2: OutPt2 | undefined;\r\n\r\n while (i < cw.length) {\r\n p1 = cw[i];\r\n if (!p1 || p1.next === p1.prev) {\r\n cw[i++] = undefined;\r\n j = 0;\r\n continue;\r\n }\r\n\r\n const jLim = ccw.length;\r\n while (j < jLim && (!ccw[j] || ccw[j]!.next === ccw[j]!.prev)) ++j;\r\n\r\n if (j === jLim) {\r\n ++i;\r\n j = 0;\r\n continue;\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n p1 = cw[i]!.prev!;\r\n p1a = cw[i];\r\n p2 = ccw[j];\r\n p2a = ccw[j]!.prev!;\r\n } else {\r\n p1 = cw[i];\r\n p1a = cw[i]!.prev!;\r\n p2 = ccw[j]!.prev!;\r\n p2a = ccw[j];\r\n }\r\n\r\n if ((isHorz && !RectClip64.hasHorzOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt)) ||\r\n (!isHorz && !RectClip64.hasVertOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt))) {\r\n ++j;\r\n continue;\r\n }\r\n\r\n const isRejoining = cw[i]!.ownerIdx !== ccw[j]!.ownerIdx;\r\n\r\n if (isRejoining) {\r\n this.results[p2!.ownerIdx] = undefined;\r\n RectClip64.setNewOwner(p2!, p1!.ownerIdx);\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n // p1 >> | >> p1a;\r\n // p2 << | << p2a;\r\n p1!.next = p2;\r\n p2!.prev = p1;\r\n p1a!.prev = p2a;\r\n p2a!.next = p1a;\r\n } else {\r\n // p1 << | << p1a;\r\n // p2 >> | >> p2a;\r\n p1!.prev = p2;\r\n p2!.next = p1;\r\n p1a!.next = p2a;\r\n p2a!.prev = p1a;\r\n }\r\n\r\n if (!isRejoining) {\r\n const new_idx = this.results.length;\r\n this.results.push(p1a);\r\n RectClip64.setNewOwner(p1a!, new_idx);\r\n }\r\n\r\n if (cwIsTowardLarger) {\r\n op = p2;\r\n op2 = p1a;\r\n } else {\r\n op = p1;\r\n op2 = p2a;\r\n }\r\n this.results[op!.ownerIdx] = op;\r\n this.results[op2!.ownerIdx] = op2;\r\n\r\n // and now lots of work to get ready for the next loop\r\n\r\n let opIsLarger: boolean, op2IsLarger: boolean;\r\n if (isHorz) { // X\r\n opIsLarger = op!.pt.x > op!.prev!.pt.x;\r\n op2IsLarger = op2!.pt.x > op2!.prev!.pt.x;\r\n } else { // Y\r\n opIsLarger = op!.pt.y > op!.prev!.pt.y;\r\n op2IsLarger = op2!.pt.y > op2!.prev!.pt.y;\r\n }\r\n\r\n if ((op!.next === op!.prev) || (op!.pt === op!.prev!.pt)) {\r\n if (op2IsLarger === cwIsTowardLarger) {\r\n cw[i] = op2;\r\n ccw[j++] = undefined;\r\n } else {\r\n ccw[j] = op2;\r\n cw[i++] = undefined;\r\n }\r\n } else if ((op2!.next === op2!.prev) || (op2!.pt === op2!.prev!.pt)) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n ccw[j++] = undefined;\r\n } else {\r\n ccw[j] = op;\r\n cw[i++] = undefined;\r\n }\r\n } else if (opIsLarger === op2IsLarger) {\r\n if (opIsLarger === cwIsTowardLarger) {\r\n cw[i] = op;\r\n RectClip64.uncoupleEdge(op2!);\r\n RectClip64.addToEdge(cw, op2!);\r\n ccw[j++] = undefined;\r\n } else {\r\n cw[i++] = undefined;\r\n ccw[j] = op2;\r\n RectClip64.uncoupleEdge(op!);\r\n RectClip64.addToEdge(ccw, op!);\r\n j = 0;\r\n }\r\n } else {\r\n if (opIsLarger === cwIsTowardLarger)\r\n cw[i] = op;\r\n else\r\n ccw[j] = op;\r\n\r\n if (op2IsLarger === cwIsTowardLarger)\r\n cw[i] = op2;\r\n else\r\n ccw[j] = op2;\r\n }\r\n }\r\n }\r\n\r\n protected getPath(op: OutPt2 | undefined): Path64 {\r\n const result = new Path64();\r\n if (!op || op.prev === op.next) return result;\r\n\r\n let op2: OutPt2 | undefined = op.next;\r\n while (op2 && op2 !== op) {\r\n if (InternalClipper.crossProduct(op2.prev!.pt, op2.pt, op2.next!.pt) === 0) {\r\n op = op2.prev!;\r\n op2 = RectClip64.unlinkOp(op2);\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n if (!op2) return new Path64();\r\n\r\n result.push(op.pt);\r\n op2 = op.next!;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next!;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nexport class RectClipLines64 extends RectClip64 {\r\n\r\n constructor(rect: Rect64) {\r\n super(rect);\r\n }\r\n\r\n public override execute(paths: Paths64): Paths64 {\r\n const result = new Paths64();\r\n if (this.rect.isEmpty()) return result; \r\n for (const path of paths) {\r\n if (path.length < 2) continue;\r\n this.pathBounds = Clipper.getBounds(path);\r\n if (!this.rect.intersects(this.pathBounds)) continue; \r\n\r\n this.executeInternal(path);\r\n\r\n for (const op of this.results) {\r\n const tmp = this.getPath(op);\r\n if (tmp.length > 0) result.push(tmp);\r\n }\r\n\r\n // Clean up after every loop\r\n this.results.length = 0; // Clear the array\r\n for (let i = 0; i < 8; i++) {\r\n this.edges[i].length = 0; // Clear each array\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n protected override getPath(op: OutPt2 | undefined): Path64 {\r\n const result = new Path64();\r\n if (!op || op === op.next) return result;\r\n op = op.next; // starting at path beginning \r\n result.push(op!.pt);\r\n let op2 = op!.next!;\r\n while (op2 !== op) {\r\n result.push(op2.pt);\r\n op2 = op2.next!;\r\n }\r\n return result;\r\n }\r\n\r\n protected override executeInternal(path: Path64): void {\r\n this.results = [];\r\n if (path.length < 2 || this.rect.isEmpty()) return; \r\n\r\n let prev: Location = Location.inside;\r\n let i = 1;\r\n const highI = path.length - 1;\r\n\r\n let result = RectClipLines64.getLocation(this.rect, path[0])\r\n let loc: Location = result.loc\r\n if (!result.success) {\r\n while (i <= highI && !result.success) {\r\n i++\r\n result = RectClipLines64.getLocation(this.rect, path[i])\r\n prev = result.loc\r\n }\r\n if (i > highI) {\r\n for (const pt of path) this.add(pt);\r\n }\r\n if (prev == Location.inside) loc = Location.inside;\r\n i = 1;\r\n }\r\n if (loc == Location.inside) this.add(path[0]);\r\n\r\n while (i <= highI) {\r\n prev = loc;\r\n this.getNextLocation(path, { loc, i, highI });\r\n\r\n if (i > highI) break;\r\n\r\n const prevPt: IPoint64 = path[i - 1];\r\n let crossingLoc: Location = loc;\r\n\r\n let result = RectClipLines64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc)\r\n const ip: IPoint64 = result.ip\r\n crossingLoc = result.loc\r\n\r\n if (!result.success) {\r\n i++;\r\n continue;\r\n }\r\n\r\n if (loc == Location.inside) {\r\n this.add(ip, true);\r\n } else if (prev !== Location.inside) {\r\n crossingLoc = prev;\r\n\r\n result = RectClipLines64.getIntersection(this.rectPath, prevPt, path[i], crossingLoc);\r\n const ip2: IPoint64 = result.ip\r\n crossingLoc = result.loc\r\n\r\n this.add(ip2);\r\n this.add(ip);\r\n } else {\r\n this.add(ip);\r\n }\r\n }\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 16 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This module contains simple functions that will likely cover *\r\n* most polygon boolean and offsetting needs, while also avoiding *\r\n* the inherent complexities of the other modules. *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, PathType, Paths64, Point64, Rect64 } from \"./core\";\r\nimport { Clipper64, PointInPolygonResult, PolyPath64, PolyPathBase, PolyTree64 } from \"./engine\";\r\nimport { Minkowski } from \"./minkowski\";\r\nimport { ClipperOffset, EndType, JoinType } from \"./offset\";\r\nimport { RectClip64, RectClipLines64 } from \"./rectclip\";\r\n\r\nexport class Clipper {\r\n\r\n private static invalidRect64: Rect64\r\n public static get InvalidRect64(): Rect64 {\r\n if (!Clipper.invalidRect64) Clipper.invalidRect64 = new Rect64(false);\r\n return this.invalidRect64;\r\n }\r\n\r\n public static Intersect(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Intersection, subject, clip, fillRule);\r\n }\r\n\r\n public static Union(subject: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 {\r\n return this.BooleanOp(ClipType.Union, subject, clip, fillRule);\r\n }\r\n\r\n public static Difference(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Difference, subject, clip, fillRule);\r\n }\r\n\r\n public static Xor(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 {\r\n return this.BooleanOp(ClipType.Xor, subject, clip, fillRule);\r\n }\r\n\r\n public static BooleanOp(clipType: ClipType, subject?: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 {\r\n const solution: Paths64 = new Paths64();\r\n if (!subject) return solution;\r\n const c: Clipper64 = new Clipper64();\r\n c.addPaths(subject, PathType.Subject);\r\n if (clip)\r\n c.addPaths(clip, PathType.Clip);\r\n c.execute(clipType, fillRule, solution);\r\n return solution;\r\n }\r\n\r\n //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void {\r\n // if (!subject) return;\r\n // const c: Clipper64 = new Clipper64();\r\n // c.addPaths(subject, PathType.Subject);\r\n // if (clip)\r\n // c.addPaths(clip, PathType.Clip);\r\n // c.execute(clipType, fillRule, polytree);\r\n //}\r\n\r\n public static InflatePaths(paths: Paths64, delta: number, joinType: JoinType, endType: EndType, miterLimit: number = 2.0): Paths64 {\r\n const co: ClipperOffset = new ClipperOffset(miterLimit);\r\n co.addPaths(paths, joinType, endType);\r\n const solution: Paths64 = new Paths64();\r\n co.execute(delta, solution);\r\n return solution;\r\n }\r\n\r\n public static RectClipPaths(rect: Rect64, paths: Paths64): Paths64 {\r\n if (rect.isEmpty() || paths.length === 0) return new Paths64();\r\n const rc = new RectClip64(rect);\r\n return rc.execute(paths);\r\n }\r\n\r\n public static RectClip(rect: Rect64, path: Path64): Paths64 {\r\n if (rect.isEmpty() || path.length === 0) return new Paths64();\r\n const tmp: Paths64 = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipPaths(rect, tmp);\r\n }\r\n\r\n public static RectClipLinesPaths(rect: Rect64, paths: Paths64): Paths64 {\r\n if (rect.isEmpty() || paths.length === 0) return new Paths64();\r\n const rc = new RectClipLines64(rect);\r\n return rc.execute(paths);\r\n }\r\n\r\n public static RectClipLines(rect: Rect64, path: Path64): Paths64 {\r\n if (rect.isEmpty() || path.length === 0) return new Paths64();\r\n const tmp: Paths64 = new Paths64();\r\n tmp.push(path);\r\n return this.RectClipLinesPaths(rect, tmp);\r\n }\r\n\r\n public static MinkowskiSum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Minkowski.sum(pattern, path, isClosed);\r\n }\r\n\r\n public static MinkowskiDiff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 {\r\n return Minkowski.diff(pattern, path, isClosed);\r\n }\r\n\r\n public static area(path: Path64): number {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let a = 0.0;\r\n const cnt = path.length;\r\n if (cnt < 3) return 0.0;\r\n let prevPt = path[cnt - 1];\r\n for (const pt of path) {\r\n a += (prevPt.y + pt.y) * (prevPt.x - pt.x);\r\n prevPt = pt;\r\n }\r\n return a * 0.5;\r\n }\r\n\r\n public static areaPaths(paths: Paths64): number {\r\n let a = 0.0;\r\n for (const path of paths)\r\n a += this.area(path);\r\n return a;\r\n }\r\n\r\n public static isPositive(poly: Path64): boolean {\r\n return this.area(poly) >= 0;\r\n }\r\n\r\n public static path64ToString(path: Path64): string {\r\n let result = \"\";\r\n for (const pt of path)\r\n result += pt.toString();\r\n return result + '\\n';\r\n }\r\n\r\n public static paths64ToString(paths: Paths64): string {\r\n let result = \"\";\r\n for (const path of paths)\r\n result += this.path64ToString(path);\r\n return result;\r\n }\r\n\r\n public static offsetPath(path: Path64, dx: number, dy: number): Path64 {\r\n const result = new Path64();\r\n for (const pt of path)\r\n result.push(new Point64(pt.x + dx, pt.y + dy));\r\n return result;\r\n }\r\n\r\n public static scalePoint64(pt: Point64, scale: number): Point64 {\r\n const result = new Point64(\r\n Math.round(pt.x * scale),\r\n Math.round(pt.y * scale)\r\n )\r\n return result;\r\n }\r\n\r\n public static scalePath(path: Path64, scale: number): Path64 {\r\n if (InternalClipper.isAlmostZero(scale - 1)) return path;\r\n const result: Path64 = [];\r\n for (const pt of path)\r\n result.push({ x: pt.x * scale, y: pt.y * scale });\r\n return result;\r\n }\r\n\r\n public static scalePaths(paths: Paths64, scale: number): Paths64 {\r\n if (InternalClipper.isAlmostZero(scale - 1)) return paths;\r\n const result: Paths64 = [];\r\n for (const path of paths)\r\n result.push(this.scalePath(path, scale));\r\n return result;\r\n }\r\n\r\n public static translatePath(path: Path64, dx: number, dy: number): Path64 {\r\n const result: Path64 = [];\r\n for (const pt of path) {\r\n result.push({ x: pt.x + dx, y: pt.y + dy });\r\n }\r\n return result;\r\n }\r\n\r\n public static translatePaths(paths: Paths64, dx: number, dy: number): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(this.translatePath(path, dx, dy));\r\n }\r\n return result;\r\n }\r\n\r\n public static reversePath(path: Path64): Path64 {\r\n return [...path].reverse();\r\n }\r\n\r\n public static reversePaths(paths: Paths64): Paths64 {\r\n const result: Paths64 = [];\r\n for (const t of paths) {\r\n result.push(this.reversePath(t));\r\n }\r\n return result;\r\n }\r\n\r\n public static getBounds(path: Path64): Rect64 {\r\n const result: Rect64 = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n\r\n public static getBoundsPaths(paths: Paths64): Rect64 {\r\n const result: Rect64 = Clipper.InvalidRect64;\r\n for (const path of paths) {\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n }\r\n return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result;\r\n }\r\n\r\n static makePath(arr: number[]): Path64 {\r\n const len = arr.length / 2;\r\n const p = new Path64();\r\n for (let i = 0; i < len; i++)\r\n p.push(new Point64(arr[i * 2], arr[i * 2 + 1]));\r\n return p;\r\n }\r\n\r\n static stripDuplicates(path: Path64, isClosedPath: boolean): Path64 {\r\n const cnt = path.length;\r\n const result = new Path64();\r\n if (cnt === 0) return result;\r\n let lastPt = path[0];\r\n result.push(lastPt);\r\n for (let i = 1; i < cnt; i++)\r\n if (lastPt !== path[i]) {\r\n lastPt = path[i];\r\n result.push(lastPt);\r\n }\r\n if (isClosedPath && lastPt === result[0])\r\n result.pop();\r\n return result;\r\n }\r\n\r\n private static addPolyNodeToPaths(polyPath: PolyPathBase, paths: Paths64): void {\r\n if (polyPath.polygon && polyPath.polygon.length > 0)\r\n paths.push(polyPath.polygon);\r\n for (let i = 0; i < polyPath.count; i++)\r\n this.addPolyNodeToPaths(polyPath.children[i], paths);\r\n }\r\n\r\n public static polyTreeToPaths64(polyTree: PolyTree64): Paths64 {\r\n const result: Paths64 = new Paths64();\r\n for (let i = 0; i < polyTree.count; i++) {\r\n Clipper.addPolyNodeToPaths(polyTree.children[i] as PolyPath64, result);\r\n }\r\n return result;\r\n }\r\n\r\n public static perpendicDistFromLineSqrd(pt: IPoint64, line1: IPoint64, line2: IPoint64): number {\r\n const a = pt.x - line1.x;\r\n const b = pt.y - line1.y;\r\n const c = line2.x - line1.x;\r\n const d = line2.y - line1.y;\r\n if (c === 0 && d === 0) return 0;\r\n return Clipper.sqr(a * d - c * b) / (c * c + d * d);\r\n }\r\n\r\n static rdp(path: Path64, begin: number, end: number, epsSqrd: number, flags: boolean[]): void {\r\n let idx = 0;\r\n let max_d = 0;\r\n\r\n while (end > begin && path[begin] === path[end]) {\r\n flags[end--] = false;\r\n }\r\n for (let i = begin + 1; i < end; i++) {\r\n const d = Clipper.perpendicDistFromLineSqrd(path[i], path[begin], path[end]);\r\n if (d <= max_d) continue;\r\n max_d = d;\r\n idx = i;\r\n }\r\n\r\n if (max_d <= epsSqrd) return;\r\n\r\n flags[idx] = true;\r\n if (idx > begin + 1) Clipper.rdp(path, begin, idx, epsSqrd, flags);\r\n if (idx < end - 1) Clipper.rdp(path, idx, end, epsSqrd, flags);\r\n }\r\n\r\n public static ramerDouglasPeucker(path: Path64, epsilon: number): Path64 {\r\n const len = path.length;\r\n if (len < 5) return path;\r\n\r\n const flags = new Array(len).fill(false);\r\n flags[0] = true;\r\n flags[len - 1] = true;\r\n Clipper.rdp(path, 0, len - 1, Clipper.sqr(epsilon), flags);\r\n\r\n const result: Path64 = [];\r\n for (let i = 0; i < len; i++) {\r\n if (flags[i]) result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n\r\n public static ramerDouglasPeuckerPaths(paths: Paths64, epsilon: number): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(Clipper.ramerDouglasPeucker(path, epsilon));\r\n }\r\n return result;\r\n }\r\n\r\n private static getNext(current: number, high: number, flags: boolean[]): number {\r\n current++;\r\n while (current <= high && flags[current]) current++;\r\n if (current <= high) return current;\r\n current = 0;\r\n while (flags[current]) current++;\r\n return current;\r\n }\r\n\r\n private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n if (current === 0) current = high;\r\n else current--;\r\n while (current > 0 && flags[current]) current--;\r\n if (!flags[current]) return current;\r\n current = high;\r\n while (flags[current]) current--;\r\n return current;\r\n }\r\n\r\n private static sqr(value: number): number {\r\n return value * value;\r\n }\r\n\r\n public static simplifyPath(path: Path64, epsilon: number, isClosedPath: boolean = false): Path64 {\r\n const len = path.length;\r\n const high = len - 1;\r\n const epsSqr = this.sqr(epsilon);\r\n if (len < 4) return path;\r\n\r\n const flags: boolean[] = new Array(len).fill(false);\r\n const dsq: number[] = new Array(len).fill(0);\r\n let prev = high;\r\n let curr = 0;\r\n let start: number, next: number, prior2: number, next2: number;\r\n\r\n if (isClosedPath) {\r\n dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]);\r\n dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]);\r\n } else {\r\n dsq[0] = Number.MAX_VALUE;\r\n dsq[high] = Number.MAX_VALUE;\r\n }\r\n\r\n for (let i = 1; i < high; i++) {\r\n dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]);\r\n }\r\n\r\n for (; ;) {\r\n if (dsq[curr] > epsSqr) {\r\n start = curr;\r\n do {\r\n curr = this.getNext(curr, high, flags);\r\n } while (curr !== start && dsq[curr] > epsSqr);\r\n if (curr === start) break;\r\n }\r\n\r\n prev = this.getPrior(curr, high, flags);\r\n next = this.getNext(curr, high, flags);\r\n if (next === prev) break;\r\n\r\n if (dsq[next] < dsq[curr]) {\r\n flags[next] = true;\r\n next = this.getNext(next, high, flags);\r\n next2 = this.getNext(next, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (next !== high || isClosedPath) {\r\n dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]);\r\n }\r\n curr = next;\r\n } else {\r\n flags[curr] = true;\r\n curr = next;\r\n next = this.getNext(next, high, flags);\r\n prior2 = this.getPrior(prev, high, flags);\r\n dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]);\r\n if (prev !== 0 || isClosedPath) {\r\n dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]);\r\n }\r\n }\r\n }\r\n\r\n const result: Path64 = [];\r\n for (let i = 0; i < len; i++) {\r\n if (!flags[i]) result.push(path[i]);\r\n }\r\n return result;\r\n }\r\n\r\n public static simplifyPaths(paths: Paths64, epsilon: number, isClosedPaths: boolean = false): Paths64 {\r\n const result: Paths64 = [];\r\n for (const path of paths) {\r\n result.push(this.simplifyPath(path, epsilon, isClosedPaths));\r\n }\r\n return result;\r\n }\r\n\r\n //private static getNext(current: number, high: number, flags: boolean[]): number {\r\n // current++;\r\n // while (current <= high && flags[current]) current++;\r\n // return current;\r\n //}\r\n\r\n //private static getPrior(current: number, high: number, flags: boolean[]): number {\r\n // if (current === 0) return high;\r\n // current--;\r\n // while (current > 0 && flags[current]) current--;\r\n // return current;\r\n //}\r\n\r\n\r\n public static trimCollinear(path: Path64, isOpen: boolean = false): Path64 {\r\n let len = path.length;\r\n let i = 0;\r\n\r\n if (!isOpen) {\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 1], path[i], path[i + 1]) === 0) i++;\r\n while (i < len - 1 && InternalClipper.crossProduct(path[len - 2], path[len - 1], path[i]) === 0) len--;\r\n }\r\n\r\n if (len - i < 3) {\r\n if (!isOpen || len < 2 || path[0] === path[1]) {\r\n return [];\r\n }\r\n return path;\r\n }\r\n\r\n const result: Path64 = [];\r\n let last = path[i];\r\n result.push(last);\r\n\r\n for (i++; i < len - 1; i++) {\r\n if (InternalClipper.crossProduct(last, path[i], path[i + 1]) === 0) continue;\r\n last = path[i];\r\n result.push(last);\r\n }\r\n\r\n if (isOpen) {\r\n result.push(path[len - 1]);\r\n } else if (InternalClipper.crossProduct(last, path[len - 1], result[0]) !== 0) {\r\n result.push(path[len - 1]);\r\n } else {\r\n while (result.length > 2 && InternalClipper.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0) {\r\n result.pop();\r\n }\r\n if (result.length < 3) result.splice(0, result.length);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public static pointInPolygon(pt: Point64, polygon: Path64): PointInPolygonResult {\r\n return InternalClipper.pointInPolygon(pt, polygon);\r\n }\r\n\r\n public static ellipse(center: IPoint64, radiusX: number, radiusY: number = 0, steps: number = 0): Path64 {\r\n if (radiusX <= 0) return [];\r\n if (radiusY <= 0) radiusY = radiusX;\r\n if (steps <= 2) steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2));\r\n\r\n const si = Math.sin(2 * Math.PI / steps);\r\n const co = Math.cos(2 * Math.PI / steps);\r\n let dx = co, dy = si;\r\n const result: Path64 = [{ x: center.x + radiusX, y: center.y }];\r\n for (let i = 1; i < steps; ++i) {\r\n result.push({ x: center.x + radiusX * dx, y: center.y + radiusY * dy });\r\n const x = dx * co - dy * si;\r\n dy = dy * co + dx * si;\r\n dx = x;\r\n }\r\n return result;\r\n }\r\n\r\n private static showPolyPathStructure(pp: PolyPathBase, level: number): void {\r\n const spaces = ' '.repeat(level * 2);\r\n const caption = pp.isHole ? \"Hole \" : \"Outer \";\r\n if (pp.count === 0) {\r\n console.log(spaces + caption);\r\n } else {\r\n console.log(spaces + caption + `(${pp.count})`);\r\n pp.forEach(child => this.showPolyPathStructure(child, level + 1));\r\n }\r\n }\r\n\r\n public static showPolyTreeStructure(polytree: PolyTree64): void {\r\n console.log(\"Polytree Root\");\r\n polytree.forEach(child => this.showPolyPathStructure(child, 1));\r\n }\r\n\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 27 August 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : This is the main polygon clipping module *\r\n* Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, *\r\n* : and Daniel Gosnell for their invaluable assistance with C#. *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\nimport { Clipper } from \"./clipper\";\r\nimport { ClipType, FillRule, IPoint64, InternalClipper, Path64, PathType, Paths64, Point64, Rect64 } from \"./core\";\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Engine.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\nexport enum PointInPolygonResult {\r\n IsOn = 0,\r\n IsInside = 1,\r\n IsOutside = 2\r\n}\r\n\r\nexport enum VertexFlags {\r\n None = 0,\r\n OpenStart = 1,\r\n OpenEnd = 2,\r\n LocalMax = 4,\r\n LocalMin = 8\r\n}\r\n\r\nclass Vertex {\r\n readonly pt: IPoint64;\r\n next: Vertex | undefined;\r\n prev: Vertex | undefined;\r\n flags: VertexFlags;\r\n\r\n constructor(pt: IPoint64, flags: VertexFlags, prev: Vertex | undefined) {\r\n this.pt = pt;\r\n this.flags = flags;\r\n this.next = undefined;\r\n this.prev = prev;\r\n }\r\n}\r\n\r\n\r\nclass LocalMinima {\r\n readonly vertex: Vertex;\r\n readonly polytype: PathType;\r\n readonly isOpen: boolean;\r\n\r\n constructor(vertex: Vertex, polytype: PathType, isOpen: boolean = false) {\r\n this.vertex = vertex;\r\n this.polytype = polytype;\r\n this.isOpen = isOpen;\r\n }\r\n\r\n static equals(lm1: LocalMinima, lm2: LocalMinima): boolean {\r\n return lm1.vertex === lm2.vertex;\r\n }\r\n\r\n static notEquals(lm1: LocalMinima, lm2: LocalMinima): boolean {\r\n return lm1.vertex !== lm2.vertex;\r\n }\r\n\r\n //hashCode(): number {\r\n // return this.vertex.hashCode();\r\n //}\r\n}\r\n\r\nclass IntersectNode {\r\n readonly pt: IPoint64;\r\n readonly edge1: Active;\r\n readonly edge2: Active;\r\n\r\n constructor(pt: IPoint64, edge1: Active, edge2: Active) {\r\n this.pt = pt;\r\n this.edge1 = edge1;\r\n this.edge2 = edge2;\r\n }\r\n}\r\n\r\nclass OutPt {\r\n pt: IPoint64;\r\n next: OutPt | undefined;\r\n prev: OutPt;\r\n outrec: OutRec;\r\n horz: HorzSegment | undefined;\r\n\r\n constructor(pt: IPoint64, outrec: OutRec) {\r\n this.pt = pt;\r\n this.outrec = outrec;\r\n this.next = this;\r\n this.prev = this;\r\n this.horz = undefined;\r\n }\r\n}\r\n\r\nexport enum JoinWith {\r\n None,\r\n Left,\r\n Right\r\n}\r\n\r\nexport enum HorzPosition {\r\n Bottom,\r\n Middle,\r\n Top\r\n}\r\n\r\n\r\nexport class OutRec {\r\n idx: number;\r\n owner: OutRec | undefined;\r\n frontEdge: Active | undefined;\r\n backEdge: Active | undefined;\r\n pts: OutPt | undefined;\r\n polypath: PolyPathBase | undefined;\r\n bounds!: Rect64;\r\n path!: Path64;\r\n isOpen: boolean;\r\n splits: number[] | undefined;\r\n recursiveSplit: OutRec | undefined;\r\n constructor(idx: number) {\r\n this.idx = idx\r\n this.isOpen = false\r\n }\r\n}\r\n\r\nclass HorzSegment {\r\n leftOp: OutPt //| undefined;\r\n rightOp: OutPt | undefined;\r\n leftToRight: boolean;\r\n\r\n constructor(op: OutPt) {\r\n this.leftOp = op;\r\n this.rightOp = undefined;\r\n this.leftToRight = true;\r\n }\r\n}\r\n\r\nclass HorzJoin {\r\n op1: OutPt | undefined;\r\n op2: OutPt | undefined;\r\n\r\n constructor(ltor: OutPt, rtol: OutPt) {\r\n this.op1 = ltor;\r\n this.op2 = rtol;\r\n }\r\n}\r\n\r\n///////////////////////////////////////////////////////////////////\r\n// Important: UP and DOWN here are premised on Y-axis positive down\r\n// displays, which is the orientation used in Clipper's development.\r\n///////////////////////////////////////////////////////////////////\r\n\r\nexport class Active {\r\n bot!: IPoint64\r\n top!: IPoint64\r\n curX!: number;// current (updated at every new scanline)\r\n dx: number;\r\n windDx!: number;// 1 or -1 depending on winding direction\r\n windCount: number;\r\n windCount2: number;// winding count of the opposite polytype\r\n outrec: OutRec | undefined;\r\n\r\n // AEL: 'active edge list' (Vatti's AET - active edge table)\r\n // a linked list of all edges (from left to right) that are present\r\n // (or 'active') within the current scanbeam (a horizontal 'beam' that\r\n // sweeps from bottom to top over the paths in the clipping operation).\r\n prevInAEL: Active | undefined;\r\n nextInAEL: Active | undefined;\r\n\r\n // SEL: 'sorted edge list' (Vatti's ST - sorted table)\r\n // linked list used when sorting edges into their new positions at the\r\n // top of scanbeams, but also (re)used to process horizontals.\r\n prevInSEL: Active | undefined;\r\n nextInSEL: Active | undefined;\r\n jump: Active | undefined;\r\n vertexTop: Vertex | undefined\r\n localMin!: LocalMinima // the bottom of an edge 'bound' (also Vatti)\r\n isLeftBound: boolean\r\n joinWith: JoinWith\r\n\r\n constructor() {\r\n this.dx = this.windCount = this.windCount2 = 0\r\n this.isLeftBound = false\r\n this.joinWith = JoinWith.None\r\n }\r\n}\r\n\r\nexport class ClipperEngine {\r\n static addLocMin(vert: Vertex, polytype: PathType, isOpen: boolean, minimaList: LocalMinima[]): void {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) !== VertexFlags.None) return;\r\n vert.flags |= VertexFlags.LocalMin;\r\n\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n minimaList.push(lm);\r\n }\r\n\r\n static addPathsToVertexList(paths: Path64[], polytype: PathType, isOpen: boolean, minimaList: LocalMinima[], vertexList: Vertex[]): void {\r\n let totalVertCnt = 0;\r\n for (const path of paths)\r\n totalVertCnt += path.length;\r\n\r\n for (const path of paths) {\r\n let v0: Vertex | undefined = undefined;\r\n let prev_v: Vertex | undefined = undefined;\r\n let curr_v: Vertex | undefined = undefined;\r\n for (const pt of path) {\r\n if (!v0) {\r\n v0 = new Vertex(pt, VertexFlags.None, undefined);\r\n vertexList.push(v0);\r\n prev_v = v0;\r\n } else if (prev_v!.pt !== pt) { // i.e., skips duplicates\r\n curr_v = new Vertex(pt, VertexFlags.None, prev_v);\r\n vertexList.push(curr_v);\r\n prev_v!.next = curr_v;\r\n prev_v = curr_v;\r\n }\r\n }\r\n if (!prev_v || !prev_v.prev) continue;\r\n if (!isOpen && prev_v.pt === v0!.pt) prev_v = prev_v.prev;\r\n prev_v.next = v0;\r\n v0!.prev = prev_v;\r\n if (!isOpen && prev_v.next === prev_v) continue;\r\n\r\n // OK, we have a valid path\r\n let going_up = false\r\n\r\n if (isOpen) {\r\n curr_v = v0!.next;\r\n let count = 0\r\n while (curr_v !== v0 && curr_v!.pt.y === v0!.pt.y) {\r\n curr_v = curr_v!.next;\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n }\r\n going_up = curr_v!.pt.y <= v0!.pt.y;\r\n if (going_up) {\r\n v0!.flags = VertexFlags.OpenStart;\r\n this.addLocMin(v0!, polytype, true, minimaList);\r\n } else {\r\n v0!.flags = VertexFlags.OpenStart | VertexFlags.LocalMax;\r\n }\r\n } else { // closed path\r\n prev_v = v0!.prev;\r\n let count = 0\r\n while (prev_v !== v0 && prev_v!.pt.y === v0!.pt.y) {\r\n prev_v = prev_v!.prev;\r\n\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n }\r\n if (prev_v === v0) {\r\n continue; // only open paths can be completely flat\r\n }\r\n going_up = prev_v!.pt.y > v0!.pt.y;\r\n }\r\n\r\n const going_up0 = going_up;\r\n prev_v = v0;\r\n curr_v = v0!.next;\r\n\r\n let count = 0\r\n while (curr_v !== v0) {\r\n if (curr_v!.pt.y > prev_v!.pt.y && going_up) {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n going_up = false;\r\n } else if (curr_v!.pt.y < prev_v!.pt.y && !going_up) {\r\n going_up = true;\r\n this.addLocMin(prev_v!, polytype, isOpen, minimaList);\r\n }\r\n prev_v = curr_v;\r\n curr_v = curr_v!.next;\r\n\r\n if (count++ > totalVertCnt) {\r\n console.warn('infinite loop detected')\r\n break;\r\n }\r\n\r\n }\r\n\r\n if (isOpen) {\r\n prev_v!.flags |= VertexFlags.OpenEnd;\r\n if (going_up) {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n } else {\r\n this.addLocMin(prev_v!, polytype, isOpen, minimaList);\r\n }\r\n } else if (going_up !== going_up0) {\r\n if (going_up0) {\r\n this.addLocMin(prev_v!, polytype, false, minimaList);\r\n } else {\r\n prev_v!.flags |= VertexFlags.LocalMax;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport class ReuseableDataContainer64 {\r\n readonly _minimaList: LocalMinima[];\r\n private readonly _vertexList: Vertex[];\r\n\r\n constructor() {\r\n this._minimaList = [];\r\n this._vertexList = [];\r\n }\r\n\r\n public clear(): void {\r\n this._minimaList.length = 0;\r\n this._vertexList.length = 0;\r\n }\r\n\r\n public addPaths(paths: Paths64, pt: PathType, isOpen: boolean): void {\r\n ClipperEngine.addPathsToVertexList(paths, pt, isOpen, this._minimaList, this._vertexList);\r\n }\r\n}\r\n\r\nclass SimpleNavigableSet {\r\n items: Array = []\r\n\r\n constructor() {\r\n this.items = [];\r\n }\r\n\r\n clear(): void { this.items.length = 0 }\r\n isEmpty(): boolean { return this.items.length == 0 }\r\n\r\n pollLast(): number | undefined {\r\n return this.items.pop();\r\n }\r\n\r\n add(item: number) {\r\n if (!this.items.includes(item)) {\r\n this.items.push(item);\r\n this.items.sort((a, b) => a - b);\r\n }\r\n }\r\n}\r\n\r\nexport class ClipperBase {\r\n private _cliptype: ClipType = ClipType.None\r\n private _fillrule: FillRule = FillRule.EvenOdd\r\n private _actives?: Active;\r\n private _sel?: Active;\r\n private readonly _minimaList: LocalMinima[];\r\n private readonly _intersectList: IntersectNode[];\r\n private readonly _vertexList: Vertex[];\r\n private readonly _outrecList: OutRec[];\r\n private readonly _scanlineList: SimpleNavigableSet;\r\n private readonly _horzSegList: HorzSegment[];\r\n private readonly _horzJoinList: HorzJoin[];\r\n private _currentLocMin: number = 0\r\n private _currentBotY: number = 0\r\n private _isSortedMinimaList: boolean = false\r\n private _hasOpenPaths: boolean = false\r\n protected _using_polytree: boolean = false\r\n protected _succeeded: boolean = false\r\n public preserveCollinear: boolean;\r\n public reverseSolution: boolean = false\r\n\r\n constructor() {\r\n this._minimaList = [];\r\n this._intersectList = [];\r\n this._vertexList = [];\r\n this._outrecList = [];\r\n this._scanlineList = new SimpleNavigableSet()\r\n this._horzSegList = [];\r\n this._horzJoinList = [];\r\n this.preserveCollinear = true;\r\n }\r\n\r\n private static isOdd(val: number): boolean {\r\n return ((val & 1) !== 0);\r\n }\r\n\r\n private static isHotEdgeActive(ae: Active): boolean {\r\n return ae.outrec !== undefined;\r\n }\r\n\r\n private static isOpen(ae: Active): boolean {\r\n return ae.localMin.isOpen;\r\n }\r\n\r\n private static isOpenEndActive(ae: Active): boolean {\r\n return ae.localMin.isOpen && ClipperBase.isOpenEnd(ae.vertexTop!);\r\n }\r\n\r\n private static isOpenEnd(v: Vertex): boolean {\r\n return (v.flags & (VertexFlags.OpenStart | VertexFlags.OpenEnd)) !== VertexFlags.None;\r\n }\r\n\r\n private static getPrevHotEdge(ae: Active): Active | undefined {\r\n let prev: Active | undefined = ae.prevInAEL;\r\n while (prev && (ClipperBase.isOpen(prev) || !ClipperBase.isHotEdgeActive(prev)))\r\n prev = prev.prevInAEL;\r\n return prev;\r\n }\r\n\r\n private static isFront(ae: Active): boolean {\r\n return ae === ae.outrec!.frontEdge;\r\n }\r\n\r\n /*******************************************************************************\r\n * Dx: 0(90deg) *\r\n * | *\r\n * +inf (180deg) <--- o --. -inf (0deg) *\r\n *******************************************************************************/\r\n\r\n private static getDx(pt1: IPoint64, pt2: IPoint64): number {\r\n const dy: number = pt2.y - pt1.y;\r\n if (dy !== 0)\r\n return (pt2.x - pt1.x) / dy;\r\n if (pt2.x > pt1.x)\r\n return Number.NEGATIVE_INFINITY;\r\n return Number.POSITIVE_INFINITY;\r\n }\r\n\r\n private static topX(ae: Active, currentY: number): number {\r\n if ((currentY === ae.top.y) || (ae.top.x === ae.bot.x)) return ae.top.x;\r\n if (currentY === ae.bot.y) return ae.bot.x;\r\n return ae.bot.x + Math.round(ae.dx * (currentY - ae.bot.y));\r\n }\r\n\r\n private static isHorizontal(ae: Active): boolean {\r\n return (ae.top.y === ae.bot.y);\r\n }\r\n\r\n private static isHeadingRightHorz(ae: Active): boolean {\r\n return (Number.NEGATIVE_INFINITY === ae.dx);\r\n }\r\n\r\n private static isHeadingLeftHorz(ae: Active): boolean {\r\n return (Number.POSITIVE_INFINITY === ae.dx);\r\n }\r\n\r\n private static swapActives(ae1: Active, ae2: Active): void {\r\n [ae2, ae1] = [ae1, ae2];\r\n }\r\n\r\n private static getPolyType(ae: Active): PathType {\r\n return ae.localMin.polytype;\r\n }\r\n\r\n private static isSamePolyType(ae1: Active, ae2: Active): boolean {\r\n return ae1.localMin.polytype === ae2.localMin.polytype;\r\n }\r\n\r\n private static setDx(ae: Active): void {\r\n ae.dx = ClipperBase.getDx(ae.bot, ae.top);\r\n }\r\n\r\n private static nextVertex(ae: Active): Vertex {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop!.next!;\r\n return ae.vertexTop!.prev!;\r\n }\r\n\r\n private static prevPrevVertex(ae: Active): Vertex {\r\n if (ae.windDx > 0)\r\n return ae.vertexTop!.prev!.prev!;\r\n return ae.vertexTop!.next!.next!;\r\n }\r\n\r\n private static isMaxima(vertex: Vertex): boolean {\r\n return (vertex.flags & VertexFlags.LocalMax) !== VertexFlags.None;\r\n }\r\n\r\n private static isMaximaActive(ae: Active): boolean {\r\n return ClipperBase.isMaxima(ae.vertexTop!);\r\n }\r\n\r\n private static getMaximaPair(ae: Active): Active | undefined {\r\n let ae2: Active | undefined = ae.nextInAEL;\r\n while (ae2) {\r\n if (ae2.vertexTop === ae.vertexTop) return ae2; // Found!\r\n ae2 = ae2.nextInAEL;\r\n }\r\n return undefined;\r\n }\r\n\r\n private static getCurrYMaximaVertex_Open(ae: Active): Vertex | undefined {\r\n let result: Vertex | undefined = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result!.next!.pt.y === result!.pt.y &&\r\n ((result!.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result!.next;\r\n } else {\r\n while (result!.prev!.pt.y === result!.pt.y &&\r\n ((result!.flags & (VertexFlags.OpenEnd |\r\n VertexFlags.LocalMax)) === VertexFlags.None))\r\n result = result!.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result!)) result = undefined; // not a maxima\r\n return result;\r\n }\r\n\r\n private static getCurrYMaximaVertex(ae: Active): Vertex | undefined {\r\n let result: Vertex | undefined = ae.vertexTop;\r\n if (ae.windDx > 0) {\r\n while (result!.next!.pt.y === result!.pt.y) result = result!.next;\r\n } else {\r\n while (result!.prev!.pt.y === result!.pt.y) result = result!.prev;\r\n }\r\n if (!ClipperBase.isMaxima(result!)) result = undefined; // not a maxima\r\n return result;\r\n }\r\n\r\n private static setSides(outrec: OutRec, startEdge: Active, endEdge: Active): void {\r\n outrec.frontEdge = startEdge;\r\n outrec.backEdge = endEdge;\r\n }\r\n\r\n private static swapOutrecs(ae1: Active, ae2: Active): void {\r\n const or1: OutRec | undefined = ae1.outrec;\r\n const or2: OutRec | undefined = ae2.outrec;\r\n if (or1 === or2) {\r\n const ae: Active | undefined = or1!.frontEdge;\r\n or1!.frontEdge = or1!.backEdge;\r\n or1!.backEdge = ae;\r\n return;\r\n }\r\n\r\n if (or1) {\r\n if (ae1 === or1.frontEdge)\r\n or1.frontEdge = ae2;\r\n else\r\n or1.backEdge = ae2;\r\n }\r\n\r\n if (or2) {\r\n if (ae2 === or2.frontEdge)\r\n or2.frontEdge = ae1;\r\n else\r\n or2.backEdge = ae1;\r\n }\r\n\r\n ae1.outrec = or2;\r\n ae2.outrec = or1;\r\n }\r\n\r\n private static setOwner(outrec: OutRec, newOwner: OutRec): void {\r\n while (newOwner.owner && !newOwner.owner.pts) {\r\n newOwner.owner = newOwner.owner.owner;\r\n }\r\n\r\n //make sure that outrec isn't an owner of newOwner\r\n let tmp: OutRec | undefined = newOwner;\r\n while (tmp && tmp !== outrec)\r\n tmp = tmp.owner;\r\n if (tmp)\r\n newOwner.owner = outrec.owner;\r\n outrec.owner = newOwner;\r\n }\r\n\r\n private static area(op: OutPt): number {\r\n // https://en.wikipedia.org/wiki/Shoelace_formula\r\n let area = 0.0;\r\n let op2 = op;\r\n do {\r\n area += (op2.prev.pt.y + op2.pt.y) *\r\n (op2.prev.pt.x - op2.pt.x);\r\n op2 = op2.next!;\r\n } while (op2 !== op);\r\n return area * 0.5;\r\n }\r\n\r\n private static areaTriangle(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return (pt3.y + pt1.y) * (pt3.x - pt1.x) +\r\n (pt1.y + pt2.y) * (pt1.x - pt2.x) +\r\n (pt2.y + pt3.y) * (pt2.x - pt3.x);\r\n }\r\n\r\n private static getRealOutRec(outRec: OutRec | undefined): OutRec | undefined {\r\n while (outRec !== undefined && outRec.pts === undefined) {\r\n outRec = outRec.owner;\r\n }\r\n return outRec;\r\n }\r\n\r\n private static isValidOwner(outRec: OutRec | undefined, testOwner: OutRec | undefined): boolean {\r\n while (testOwner !== undefined && testOwner !== outRec)\r\n testOwner = testOwner.owner;\r\n return testOwner === undefined;\r\n }\r\n\r\n private static uncoupleOutRec(ae: Active): void {\r\n const outrec = ae.outrec;\r\n if (outrec === undefined) return;\r\n outrec.frontEdge!.outrec = undefined;\r\n outrec.backEdge!.outrec = undefined;\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = undefined;\r\n }\r\n\r\n private static outrecIsAscending(hotEdge: Active): boolean {\r\n return (hotEdge === hotEdge.outrec!.frontEdge);\r\n }\r\n\r\n private static swapFrontBackSides(outrec: OutRec): void {\r\n // while this proc. is needed for open paths\r\n // it's almost never needed for closed paths\r\n const ae2 = outrec.frontEdge!;\r\n outrec.frontEdge = outrec.backEdge;\r\n outrec.backEdge = ae2;\r\n outrec.pts = outrec.pts!.next;\r\n }\r\n\r\n private static edgesAdjacentInAEL(inode: IntersectNode): boolean {\r\n return (inode.edge1.nextInAEL === inode.edge2) || (inode.edge1.prevInAEL === inode.edge2);\r\n }\r\n\r\n protected clearSolutionOnly(): void {\r\n while (this._actives) this.deleteFromAEL(this._actives);\r\n this._scanlineList.clear()\r\n this.disposeIntersectNodes();\r\n this._outrecList.length = 0\r\n this._horzSegList.length = 0\r\n this._horzJoinList.length = 0\r\n }\r\n\r\n public clear(): void {\r\n this.clearSolutionOnly();\r\n this._minimaList.length = 0\r\n this._vertexList.length = 0\r\n this._currentLocMin = 0;\r\n this._isSortedMinimaList = false;\r\n this._hasOpenPaths = false;\r\n }\r\n\r\n protected reset(): void {\r\n if (!this._isSortedMinimaList) {\r\n this._minimaList.sort((locMin1, locMin2) => locMin2.vertex.pt.y - locMin1.vertex.pt.y);\r\n this._isSortedMinimaList = true;\r\n }\r\n\r\n for (let i = this._minimaList.length - 1; i >= 0; i--) {\r\n this._scanlineList.add(this._minimaList[i].vertex.pt.y);\r\n }\r\n\r\n this._currentBotY = 0;\r\n this._currentLocMin = 0;\r\n this._actives = undefined;\r\n this._sel = undefined;\r\n this._succeeded = true;\r\n }\r\n\r\n private insertScanline(y: number): void {\r\n this._scanlineList.add(y)\r\n }\r\n\r\n private popScanline(): number | undefined {\r\n return this._scanlineList.pollLast();\r\n }\r\n\r\n private hasLocMinAtY(y: number): boolean {\r\n return (this._currentLocMin < this._minimaList.length && this._minimaList[this._currentLocMin].vertex.pt.y == y);\r\n }\r\n\r\n private popLocalMinima(): LocalMinima {\r\n return this._minimaList[this._currentLocMin++];\r\n }\r\n\r\n private addLocMin(vert: Vertex, polytype: PathType, isOpen: boolean): void {\r\n // make sure the vertex is added only once ...\r\n if ((vert.flags & VertexFlags.LocalMin) != VertexFlags.None) return\r\n\r\n vert.flags |= VertexFlags.LocalMin;\r\n\r\n const lm = new LocalMinima(vert, polytype, isOpen);\r\n this._minimaList.push(lm);\r\n }\r\n\r\n public addSubject(path: Path64): void {\r\n this.addPath(path, PathType.Subject);\r\n }\r\n\r\n public addOpenSubject(path: Path64): void {\r\n this.addPath(path, PathType.Subject, true);\r\n }\r\n\r\n public addClip(path: Path64): void {\r\n this.addPath(path, PathType.Clip);\r\n }\r\n\r\n protected addPath(path: Path64, polytype: PathType, isOpen = false): void {\r\n const tmp: Paths64 = [path];\r\n this.addPaths(tmp, polytype, isOpen);\r\n }\r\n\r\n protected addPaths(paths: Paths64, polytype: PathType, isOpen = false): void {\r\n if (isOpen) this._hasOpenPaths = true;\r\n this._isSortedMinimaList = false;\r\n ClipperEngine.addPathsToVertexList(paths, polytype, isOpen, this._minimaList, this._vertexList);\r\n }\r\n\r\n protected addReuseableData(reuseableData: ReuseableDataContainer64): void {\r\n if (reuseableData._minimaList.length === 0) return;\r\n\r\n this._isSortedMinimaList = false;\r\n for (const lm of reuseableData._minimaList) {\r\n this._minimaList.push(new LocalMinima(lm.vertex, lm.polytype, lm.isOpen));\r\n if (lm.isOpen) this._hasOpenPaths = true;\r\n }\r\n }\r\n\r\n private isContributingClosed(ae: Active): boolean {\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae.windCount !== 1) return false;\r\n break;\r\n case FillRule.Negative:\r\n if (ae.windCount !== -1) return false;\r\n break;\r\n case FillRule.NonZero:\r\n if (Math.abs(ae.windCount) !== 1) return false;\r\n break;\r\n }\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 > 0;\r\n case FillRule.Negative: return ae.windCount2 < 0;\r\n default: return ae.windCount2 !== 0;\r\n }\r\n case ClipType.Union:\r\n switch (this._fillrule) {\r\n case FillRule.Positive: return ae.windCount2 <= 0;\r\n case FillRule.Negative: return ae.windCount2 >= 0;\r\n default: return ae.windCount2 === 0;\r\n }\r\n case ClipType.Difference:\r\n const result = this._fillrule === FillRule.Positive ? (ae.windCount2 <= 0) :\r\n this._fillrule === FillRule.Negative ? (ae.windCount2 >= 0) :\r\n (ae.windCount2 === 0);\r\n return ClipperBase.getPolyType(ae) === PathType.Subject ? result : !result;\r\n\r\n case ClipType.Xor:\r\n return true;\r\n\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n private isContributingOpen(ae: Active): boolean {\r\n let isInClip: boolean, isInSubj: boolean;\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n isInSubj = ae.windCount > 0;\r\n isInClip = ae.windCount2 > 0;\r\n break;\r\n case FillRule.Negative:\r\n isInSubj = ae.windCount < 0;\r\n isInClip = ae.windCount2 < 0;\r\n break;\r\n default:\r\n isInSubj = ae.windCount !== 0;\r\n isInClip = ae.windCount2 !== 0;\r\n break;\r\n }\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Intersection:\r\n return isInClip;\r\n case ClipType.Union:\r\n return !isInSubj && !isInClip;\r\n default:\r\n return !isInClip;\r\n }\r\n }\r\n\r\n private setWindCountForClosedPathEdge(ae: Active): void {\r\n let ae2: Active | undefined = ae.prevInAEL;\r\n const pt: PathType = ClipperBase.getPolyType(ae);\r\n\r\n while (ae2 !== undefined && (ClipperBase.getPolyType(ae2) !== pt || ClipperBase.isOpen(ae2))) {\r\n ae2 = ae2.prevInAEL;\r\n }\r\n\r\n if (ae2 === undefined) {\r\n ae.windCount = ae.windDx;\r\n ae2 = this._actives;\r\n } else if (this._fillrule === FillRule.EvenOdd) {\r\n ae.windCount = ae.windDx;\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL;\r\n } else {\r\n // NonZero, positive, or negative filling here ...\r\n // when e2's WindCnt is in the SAME direction as its WindDx,\r\n // then polygon will fill on the right of 'e2' (and 'e' will be inside)\r\n // nb: neither e2.WindCnt nor e2.WindDx should ever be 0.\r\n if (ae2.windCount * ae2.windDx < 0) {\r\n // opposite directions so 'ae' is outside 'ae2' ...\r\n if (Math.abs(ae2.windCount) > 1) {\r\n // outside prev poly but still inside another.\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'reducing' the WC by 1 (i.e. towards 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n } else {\r\n // now outside all polys of same polytype so set own WC ...\r\n ae.windCount = (ClipperBase.isOpen(ae) ? 1 : ae.windDx);\r\n }\r\n } else {\r\n // 'ae' must be inside 'ae2'\r\n if (ae2.windDx * ae.windDx < 0)\r\n // reversing direction so use the same WC\r\n ae.windCount = ae2.windCount;\r\n else\r\n // otherwise keep 'increasing' the WC by 1 (i.e. away from 0) ...\r\n ae.windCount = ae2.windCount + ae.windDx;\r\n }\r\n\r\n ae.windCount2 = ae2.windCount2;\r\n ae2 = ae2.nextInAEL; // i.e. get ready to calc WindCnt2\r\n\r\n }\r\n\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) !== pt && !ClipperBase.isOpen(ae2!)) {\r\n ae.windCount2 = (ae.windCount2 === 0 ? 1 : 0);\r\n }\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n } else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) !== pt && !ClipperBase.isOpen(ae2!)) {\r\n ae.windCount2 += ae2!.windDx;\r\n }\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n }\r\n }\r\n\r\n private setWindCountForOpenPathEdge(ae: Active) {\r\n let ae2: Active | undefined = this._actives;\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n let cnt1 = 0, cnt2 = 0;\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) === PathType.Clip)\r\n cnt2++;\r\n else if (!ClipperBase.isOpen(ae2!))\r\n cnt1++;\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n\r\n ae.windCount = (ClipperBase.isOdd(cnt1) ? 1 : 0);\r\n ae.windCount2 = (ClipperBase.isOdd(cnt2) ? 1 : 0);\r\n }\r\n else {\r\n while (ae2 !== ae) {\r\n if (ClipperBase.getPolyType(ae2!) === PathType.Clip)\r\n ae.windCount2 += ae2!.windDx;\r\n else if (!ClipperBase.isOpen(ae2!))\r\n ae.windCount += ae2!.windDx;\r\n ae2 = ae2!.nextInAEL;\r\n }\r\n }\r\n }\r\n\r\n private static isValidAelOrder(resident: Active, newcomer: Active): boolean {\r\n if (newcomer.curX !== resident.curX)\r\n return newcomer.curX > resident.curX;\r\n\r\n // get the turning direction a1.top, a2.bot, a2.top\r\n const d: number = InternalClipper.crossProduct(resident.top, newcomer.bot, newcomer.top);\r\n if (d !== 0.0) return (d < 0);\r\n\r\n // edges must be collinear to get here\r\n\r\n // for starting open paths, place them according to\r\n // the direction they're about to turn\r\n if (!this.isMaximaActive(resident) && (resident.top.y > newcomer.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot,\r\n resident.top, this.nextVertex(resident).pt) <= 0;\r\n }\r\n\r\n if (!this.isMaximaActive(newcomer) && (newcomer.top.y > resident.top.y)) {\r\n return InternalClipper.crossProduct(newcomer.bot,\r\n newcomer.top, this.nextVertex(newcomer).pt) >= 0;\r\n }\r\n\r\n const y: number = newcomer.bot.y;\r\n const newcomerIsLeft: boolean = newcomer.isLeftBound;\r\n\r\n if (resident.bot.y !== y || resident.localMin.vertex.pt.y !== y)\r\n return newcomer.isLeftBound;\r\n // resident must also have just been inserted\r\n if (resident.isLeftBound !== newcomerIsLeft)\r\n return newcomerIsLeft;\r\n if (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt,\r\n resident.bot, resident.top) === 0) return true;\r\n // compare turning direction of the alternate bound\r\n return (InternalClipper.crossProduct(this.prevPrevVertex(resident).pt,\r\n newcomer.bot, this.prevPrevVertex(newcomer).pt) > 0) === newcomerIsLeft;\r\n }\r\n\r\n private insertLeftEdge(ae: Active): void {\r\n let ae2: Active;\r\n\r\n if (!this._actives) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = undefined;\r\n this._actives = ae;\r\n } else if (!ClipperBase.isValidAelOrder(this._actives, ae)) {\r\n ae.prevInAEL = undefined;\r\n ae.nextInAEL = this._actives;\r\n this._actives.prevInAEL = ae;\r\n this._actives = ae;\r\n } else {\r\n ae2 = this._actives;\r\n while (ae2.nextInAEL && ClipperBase.isValidAelOrder(ae2.nextInAEL, ae))\r\n ae2 = ae2.nextInAEL;\r\n //don't separate joined edges\r\n if (ae2.joinWith === JoinWith.Right) ae2 = ae2.nextInAEL!;\r\n ae.nextInAEL = ae2.nextInAEL;\r\n if (ae2.nextInAEL) ae2.nextInAEL.prevInAEL = ae;\r\n ae.prevInAEL = ae2;\r\n ae2.nextInAEL = ae;\r\n }\r\n }\r\n\r\n private static insertRightEdge(ae: Active, ae2: Active): void {\r\n ae2.nextInAEL = ae.nextInAEL;\r\n if (ae.nextInAEL) ae.nextInAEL.prevInAEL = ae2;\r\n ae2.prevInAEL = ae;\r\n ae.nextInAEL = ae2;\r\n }\r\n\r\n private insertLocalMinimaIntoAEL(botY: number): void {\r\n let localMinima: LocalMinima;\r\n let leftBound: Active | undefined;\r\n let rightBound: Active | undefined;\r\n\r\n // Add any local minima (if any) at BotY ...\r\n // NB horizontal local minima edges should contain locMin.vertex.prev\r\n while (this.hasLocMinAtY(botY)) {\r\n localMinima = this.popLocalMinima();\r\n\r\n if ((localMinima.vertex.flags & VertexFlags.OpenStart) !== VertexFlags.None) {\r\n leftBound = undefined;\r\n } else {\r\n leftBound = new Active()\r\n leftBound.bot = localMinima.vertex.pt\r\n leftBound.curX = localMinima.vertex.pt.x\r\n leftBound.windDx = -1\r\n leftBound.vertexTop = localMinima.vertex.prev\r\n leftBound.top = localMinima.vertex.prev!.pt\r\n leftBound.outrec = undefined\r\n leftBound.localMin = localMinima\r\n\r\n ClipperBase.setDx(leftBound);\r\n }\r\n\r\n if ((localMinima.vertex.flags & VertexFlags.OpenEnd) !== VertexFlags.None) {\r\n rightBound = undefined;\r\n } else {\r\n rightBound = new Active()\r\n rightBound.bot = localMinima.vertex.pt\r\n rightBound.curX = localMinima.vertex.pt.x\r\n rightBound.windDx = 1\r\n rightBound.vertexTop = localMinima.vertex.next\r\n rightBound.top = localMinima.vertex.next!.pt\r\n rightBound.outrec = undefined\r\n rightBound.localMin = localMinima\r\n\r\n ClipperBase.setDx(rightBound);\r\n }\r\n\r\n if (leftBound && rightBound) {\r\n if (ClipperBase.isHorizontal(leftBound)) {\r\n if (ClipperBase.isHeadingRightHorz(leftBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n } else if (ClipperBase.isHorizontal(rightBound)) {\r\n if (ClipperBase.isHeadingLeftHorz(rightBound)) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n } else if (leftBound.dx < rightBound.dx) {\r\n [rightBound, leftBound] = [leftBound, rightBound]\r\n }\r\n //so when leftBound has windDx == 1, the polygon will be oriented\r\n //counter-clockwise in Cartesian coords (clockwise with inverted Y).\r\n } else if (leftBound === undefined) {\r\n leftBound = rightBound;\r\n rightBound = undefined;\r\n }\r\n\r\n let contributing = false\r\n leftBound!.isLeftBound = true;\r\n this.insertLeftEdge(leftBound!);\r\n\r\n if (ClipperBase.isOpen(leftBound!)) {\r\n this.setWindCountForOpenPathEdge(leftBound!);\r\n contributing = this.isContributingOpen(leftBound!);\r\n } else {\r\n this.setWindCountForClosedPathEdge(leftBound!);\r\n contributing = this.isContributingClosed(leftBound!);\r\n }\r\n\r\n if (rightBound) {\r\n rightBound.windCount = leftBound!.windCount;\r\n rightBound.windCount2 = leftBound!.windCount2;\r\n ClipperBase.insertRightEdge(leftBound!, rightBound);\r\n\r\n if (contributing) {\r\n this.addLocalMinPoly(leftBound!, rightBound, leftBound!.bot, true);\r\n if (!ClipperBase.isHorizontal(leftBound!)) {\r\n this.checkJoinLeft(leftBound!, leftBound!.bot);\r\n }\r\n }\r\n\r\n while (rightBound.nextInAEL &&\r\n ClipperBase.isValidAelOrder(rightBound.nextInAEL, rightBound)) {\r\n this.intersectEdges(rightBound, rightBound.nextInAEL, rightBound.bot);\r\n this.swapPositionsInAEL(rightBound, rightBound.nextInAEL);\r\n }\r\n\r\n if (ClipperBase.isHorizontal(rightBound)) {\r\n this.pushHorz(rightBound);\r\n } else {\r\n this.checkJoinRight(rightBound, rightBound.bot);\r\n this.insertScanline(rightBound.top.y);\r\n }\r\n\r\n } else if (contributing) {\r\n this.startOpenPath(leftBound!, leftBound!.bot);\r\n }\r\n\r\n if (ClipperBase.isHorizontal(leftBound!)) {\r\n this.pushHorz(leftBound!);\r\n } else {\r\n this.insertScanline(leftBound!.top.y);\r\n }\r\n }\r\n }\r\n\r\n private pushHorz(ae: Active): void {\r\n ae.nextInSEL = this._sel;\r\n this._sel = ae;\r\n }\r\n\r\n private popHorz(): Active | undefined {\r\n const ae = this._sel;\r\n if (this._sel === undefined) return undefined;\r\n this._sel = this._sel.nextInSEL;\r\n return ae;\r\n }\r\n\r\n private addLocalMinPoly(ae1: Active, ae2: Active, pt: IPoint64, isNew: boolean = false): OutPt {\r\n const outrec: OutRec = this.newOutRec();\r\n ae1.outrec = outrec;\r\n ae2.outrec = outrec;\r\n\r\n if (ClipperBase.isOpen(ae1)) {\r\n outrec.owner = undefined;\r\n outrec.isOpen = true;\r\n if (ae1.windDx > 0)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n } else {\r\n outrec.isOpen = false;\r\n const prevHotEdge = ClipperBase.getPrevHotEdge(ae1);\r\n\r\n // e.windDx is the winding direction of the **input** paths\r\n // and unrelated to the winding direction of output polygons.\r\n // Output orientation is determined by e.outrec.frontE which is\r\n // the ascending edge (see AddLocalMinPoly).\r\n if (prevHotEdge) {\r\n if (this._using_polytree)\r\n ClipperBase.setOwner(outrec, prevHotEdge.outrec!);\r\n outrec.owner = prevHotEdge.outrec;\r\n\r\n if (ClipperBase.outrecIsAscending(prevHotEdge) === isNew)\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n else\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n } else {\r\n outrec.owner = undefined;\r\n if (isNew)\r\n ClipperBase.setSides(outrec, ae1, ae2);\r\n else\r\n ClipperBase.setSides(outrec, ae2, ae1);\r\n }\r\n }\r\n\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n\r\n private addLocalMaxPoly(ae1: Active, ae2: Active, pt: IPoint64): OutPt | undefined {\r\n if (ClipperBase.isJoined(ae1)) this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n if (ClipperBase.isFront(ae1) === ClipperBase.isFront(ae2)) {\r\n if (ClipperBase.isOpenEndActive(ae1))\r\n ClipperBase.swapFrontBackSides(ae1.outrec!);\r\n else if (ClipperBase.isOpenEndActive(ae2))\r\n ClipperBase.swapFrontBackSides(ae2.outrec!);\r\n else {\r\n this._succeeded = false;\r\n return undefined;\r\n }\r\n }\r\n\r\n const result = ClipperBase.addOutPt(ae1, pt);\r\n if (ae1.outrec === ae2.outrec) {\r\n const outrec = ae1.outrec!;\r\n outrec.pts = result;\r\n\r\n if (this._using_polytree) {\r\n const e = ClipperBase.getPrevHotEdge(ae1);\r\n if (e === undefined)\r\n outrec.owner = undefined;\r\n else\r\n ClipperBase.setOwner(outrec, e.outrec!);\r\n }\r\n ClipperBase.uncoupleOutRec(ae1);\r\n } else if (ClipperBase.isOpen(ae1)) {\r\n if (ae1.windDx < 0)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n } else if (ae1.outrec!.idx < ae2.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(ae1, ae2);\r\n else\r\n ClipperBase.joinOutrecPaths(ae2, ae1);\r\n return result;\r\n }\r\n\r\n private static joinOutrecPaths(ae1: Active, ae2: Active): void {\r\n // join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path\r\n // pointers. (NB Only very rarely do the joining ends share the same coords.)\r\n const p1Start: OutPt = ae1.outrec!.pts!;\r\n const p2Start: OutPt = ae2.outrec!.pts!;\r\n const p1End: OutPt = p1Start.next!;\r\n const p2End: OutPt = p2Start.next!;\r\n\r\n if (ClipperBase.isFront(ae1)) {\r\n p2End.prev = p1Start;\r\n p1Start.next = p2End;\r\n p2Start.next = p1End;\r\n p1End.prev = p2Start;\r\n\r\n ae1.outrec!.pts = p2Start;\r\n // nb: if IsOpen(e1) then e1 & e2 must be a 'maximaPair'\r\n ae1.outrec!.frontEdge = ae2.outrec!.frontEdge;\r\n if (ae1.outrec!.frontEdge)\r\n ae1.outrec!.frontEdge!.outrec = ae1.outrec;\r\n } else {\r\n p1End.prev = p2Start;\r\n p2Start.next = p1End;\r\n p1Start.next = p2End;\r\n p2End.prev = p1Start;\r\n\r\n ae1.outrec!.backEdge = ae2.outrec!.backEdge;\r\n if (ae1.outrec!.backEdge)\r\n ae1.outrec!.backEdge!.outrec = ae1.outrec;\r\n }\r\n\r\n // after joining, the ae2.OutRec must contains no vertices ...\r\n ae2.outrec!.frontEdge = undefined;\r\n ae2.outrec!.backEdge = undefined;\r\n ae2.outrec!.pts = undefined;\r\n ClipperBase.setOwner(ae2.outrec!, ae1.outrec!);\r\n\r\n if (ClipperBase.isOpenEndActive(ae1)) {\r\n ae2.outrec!.pts = ae1.outrec!.pts;\r\n ae1.outrec!.pts = undefined;\r\n }\r\n\r\n // and ae1 and ae2 are maxima and are about to be dropped from the Actives list.\r\n ae1.outrec = undefined;\r\n ae2.outrec = undefined;\r\n }\r\n\r\n private static addOutPt(ae: Active, pt: IPoint64): OutPt {\r\n const outrec: OutRec = ae.outrec!;\r\n const toFront: boolean = ClipperBase.isFront(ae);\r\n const opFront: OutPt = outrec.pts!;\r\n const opBack: OutPt = opFront.next!;\r\n\r\n if (toFront && (pt == opFront.pt)) return opFront;\r\n else if (!toFront && (pt == opBack.pt)) return opBack;\r\n\r\n const newOp = new OutPt(pt, outrec);\r\n opBack.prev = newOp;\r\n newOp.prev = opFront;\r\n newOp.next = opBack;\r\n opFront.next = newOp;\r\n\r\n if (toFront) outrec.pts = newOp;\r\n\r\n return newOp;\r\n }\r\n\r\n private newOutRec(): OutRec {\r\n const result = new OutRec(this._outrecList.length);\r\n this._outrecList.push(result);\r\n return result;\r\n }\r\n\r\n private startOpenPath(ae: Active, pt: IPoint64): OutPt {\r\n const outrec = this.newOutRec();\r\n outrec.isOpen = true;\r\n if (ae.windDx > 0) {\r\n outrec.frontEdge = ae;\r\n outrec.backEdge = undefined;\r\n } else {\r\n outrec.frontEdge = undefined;\r\n outrec.backEdge = ae;\r\n }\r\n\r\n ae.outrec = outrec;\r\n const op = new OutPt(pt, outrec);\r\n outrec.pts = op;\r\n return op;\r\n }\r\n\r\n private updateEdgeIntoAEL(ae: Active): void {\r\n ae.bot = ae.top!;\r\n ae.vertexTop = ClipperBase.nextVertex(ae);\r\n ae.top = ae.vertexTop!.pt;\r\n ae.curX = ae.bot.x;\r\n ClipperBase.setDx(ae);\r\n\r\n if (ClipperBase.isJoined(ae)) this.split(ae, ae.bot);\r\n\r\n if (ClipperBase.isHorizontal(ae)) return;\r\n this.insertScanline(ae.top.y);\r\n\r\n this.checkJoinLeft(ae, ae.bot);\r\n this.checkJoinRight(ae, ae.bot, true);\r\n }\r\n\r\n private static findEdgeWithMatchingLocMin(e: Active): Active | undefined {\r\n let result: Active | undefined = e.nextInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin) return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot) result = undefined;\r\n else result = result.nextInAEL;\r\n }\r\n\r\n result = e.prevInAEL;\r\n while (result) {\r\n if (result.localMin === e.localMin) return result;\r\n if (!ClipperBase.isHorizontal(result) && e.bot !== result.bot) return undefined;\r\n result = result.prevInAEL;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private intersectEdges(ae1: Active, ae2: Active, pt: IPoint64): OutPt | undefined {\r\n let resultOp: OutPt | undefined = undefined;\r\n\r\n // MANAGE OPEN PATH INTERSECTIONS SEPARATELY ...\r\n if (this._hasOpenPaths && (ClipperBase.isOpen(ae1) || ClipperBase.isOpen(ae2))) {\r\n if (ClipperBase.isOpen(ae1) && ClipperBase.isOpen(ae2)) return undefined;\r\n // the following line avoids duplicating quite a bit of code\r\n if (ClipperBase.isOpen(ae2)) ClipperBase.swapActives(ae1, ae2);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n if (this._cliptype === ClipType.Union) {\r\n if (!ClipperBase.isHotEdgeActive(ae2)) return undefined;\r\n } else if (ae2.localMin.polytype === PathType.Subject)\r\n return undefined;\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n if (ae2.windCount !== 1) return undefined;\r\n break;\r\n case FillRule.Negative:\r\n if (ae2.windCount !== -1) return undefined;\r\n break;\r\n default:\r\n if (Math.abs(ae2.windCount) !== 1) return undefined;\r\n break;\r\n }\r\n\r\n // toggle contribution ...\r\n if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n if (ClipperBase.isFront(ae1)) {\r\n ae1.outrec!.frontEdge = undefined;\r\n } else {\r\n ae1.outrec!.backEdge = undefined;\r\n }\r\n ae1.outrec = undefined;\r\n\r\n // horizontal edges can pass under open paths at a LocMins\r\n } else if (pt === ae1.localMin.vertex.pt && !ClipperBase.isOpenEnd(ae1.localMin.vertex)) {\r\n // find the other side of the LocMin and\r\n // if it's 'hot' join up with it ...\r\n const ae3: Active | undefined = ClipperBase.findEdgeWithMatchingLocMin(ae1);\r\n if (ae3 && ClipperBase.isHotEdgeActive(ae3)) {\r\n ae1.outrec = ae3.outrec;\r\n if (ae1.windDx > 0) {\r\n ClipperBase.setSides(ae3.outrec!, ae1, ae3);\r\n } else {\r\n ClipperBase.setSides(ae3.outrec!, ae3, ae1);\r\n }\r\n return ae3.outrec!.pts;\r\n }\r\n resultOp = this.startOpenPath(ae1, pt);\r\n } else {\r\n resultOp = this.startOpenPath(ae1, pt);\r\n }\r\n\r\n return resultOp;\r\n }\r\n\r\n // MANAGING CLOSED PATHS FROM HERE ON\r\n if (ClipperBase.isJoined(ae1)) this.split(ae1, pt);\r\n if (ClipperBase.isJoined(ae2)) this.split(ae2, pt);\r\n\r\n // UPDATE WINDING COUNTS...\r\n let oldE1WindCount: number;\r\n let oldE2WindCount: number;\r\n\r\n if (ae1.localMin.polytype === ae2.localMin.polytype) {\r\n if (this._fillrule === FillRule.EvenOdd) {\r\n oldE1WindCount = ae1.windCount;\r\n ae1.windCount = ae2.windCount;\r\n ae2.windCount = oldE1WindCount;\r\n } else {\r\n if (ae1.windCount + ae2.windDx === 0)\r\n ae1.windCount = -ae1.windCount;\r\n else\r\n ae1.windCount += ae2.windDx;\r\n if (ae2.windCount - ae1.windDx === 0)\r\n ae2.windCount = -ae2.windCount;\r\n else\r\n ae2.windCount -= ae1.windDx;\r\n }\r\n } else {\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae1.windCount2 += ae2.windDx;\r\n else\r\n ae1.windCount2 = (ae1.windCount2 === 0 ? 1 : 0);\r\n if (this._fillrule !== FillRule.EvenOdd)\r\n ae2.windCount2 -= ae1.windDx;\r\n else\r\n ae2.windCount2 = (ae2.windCount2 === 0 ? 1 : 0);\r\n }\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n oldE1WindCount = ae1.windCount;\r\n oldE2WindCount = ae2.windCount;\r\n break;\r\n case FillRule.Negative:\r\n oldE1WindCount = -ae1.windCount;\r\n oldE2WindCount = -ae2.windCount;\r\n break;\r\n default:\r\n oldE1WindCount = Math.abs(ae1.windCount);\r\n oldE2WindCount = Math.abs(ae2.windCount);\r\n break;\r\n }\r\n\r\n const e1WindCountIs0or1: boolean = oldE1WindCount === 0 || oldE1WindCount === 1;\r\n const e2WindCountIs0or1: boolean = oldE2WindCount === 0 || oldE2WindCount === 1;\r\n\r\n if ((!ClipperBase.isHotEdgeActive(ae1) && !e1WindCountIs0or1) || (!ClipperBase.isHotEdgeActive(ae2) && !e2WindCountIs0or1)) return undefined;\r\n\r\n // NOW PROCESS THE INTERSECTION ...\r\n\r\n // if both edges are 'hot' ...\r\n if (ClipperBase.isHotEdgeActive(ae1) && ClipperBase.isHotEdgeActive(ae2)) {\r\n if ((oldE1WindCount !== 0 && oldE1WindCount !== 1) ||\r\n (oldE2WindCount !== 0 && oldE2WindCount !== 1) ||\r\n (ae1.localMin.polytype !== ae2.localMin.polytype &&\r\n this._cliptype !== ClipType.Xor)) {\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n } else if (ClipperBase.isFront(ae1) || (ae1.outrec === ae2.outrec)) {\r\n // this 'else if' condition isn't strictly needed but\r\n // it's sensible to split polygons that only touch at\r\n // a common vertex (not at common edges).\r\n resultOp = this.addLocalMaxPoly(ae1, ae2, pt);\r\n this.addLocalMinPoly(ae1, ae2, pt);\r\n } else {\r\n // can't treat as maxima & minima\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n }\r\n // if one or the other edge is 'hot' ...\r\n else if (ClipperBase.isHotEdgeActive(ae1)) {\r\n resultOp = ClipperBase.addOutPt(ae1, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n } else if (ClipperBase.isHotEdgeActive(ae2)) {\r\n resultOp = ClipperBase.addOutPt(ae2, pt);\r\n ClipperBase.swapOutrecs(ae1, ae2);\r\n }\r\n\r\n // neither edge is 'hot'\r\n else {\r\n let e1Wc2: number;\r\n let e2Wc2: number;\r\n\r\n switch (this._fillrule) {\r\n case FillRule.Positive:\r\n e1Wc2 = ae1.windCount2;\r\n e2Wc2 = ae2.windCount2;\r\n break;\r\n case FillRule.Negative:\r\n e1Wc2 = -ae1.windCount2;\r\n e2Wc2 = -ae2.windCount2;\r\n break;\r\n default:\r\n e1Wc2 = Math.abs(ae1.windCount2);\r\n e2Wc2 = Math.abs(ae2.windCount2);\r\n break;\r\n }\r\n\r\n if (!ClipperBase.isSamePolyType(ae1, ae2)) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n } else if (oldE1WindCount === 1 && oldE2WindCount === 1) {\r\n resultOp = undefined;\r\n\r\n switch (this._cliptype) {\r\n case ClipType.Union:\r\n if (e1Wc2 > 0 && e2Wc2 > 0) return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n\r\n case ClipType.Difference:\r\n if (((ClipperBase.getPolyType(ae1) === PathType.Clip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||\r\n ((ClipperBase.getPolyType(ae1) === PathType.Subject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) {\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n }\r\n break;\r\n\r\n case ClipType.Xor:\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n\r\n default: // ClipType.Intersection:\r\n if (e1Wc2 <= 0 || e2Wc2 <= 0) return undefined;\r\n resultOp = this.addLocalMinPoly(ae1, ae2, pt);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return resultOp;\r\n }\r\n\r\n\r\n private deleteFromAEL(ae: Active): void {\r\n const prev: Active | undefined = ae.prevInAEL;\r\n const next: Active | undefined = ae.nextInAEL;\r\n if (!prev && !next && ae !== this._actives) return; // already deleted\r\n\r\n if (prev)\r\n prev.nextInAEL = next;\r\n else\r\n this._actives = next;\r\n\r\n if (next)\r\n next.prevInAEL = prev;\r\n }\r\n\r\n private adjustCurrXAndCopyToSEL(topY: number): void {\r\n let ae: Active | undefined = this._actives;\r\n this._sel = ae;\r\n while (ae) {\r\n ae.prevInSEL = ae.prevInAEL;\r\n ae.nextInSEL = ae.nextInAEL;\r\n ae.jump = ae.nextInSEL;\r\n if (ae.joinWith === JoinWith.Left)\r\n ae.curX = ae.prevInAEL!.curX; // This also avoids complications\r\n else\r\n ae.curX = ClipperBase.topX(ae, topY);\r\n // NB don't update ae.curr.Y yet (see AddNewIntersectNode)\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n\r\n protected executeInternal(ct: ClipType, fillRule: FillRule): void {\r\n if (ct === ClipType.None) return;\r\n this._fillrule = fillRule;\r\n this._cliptype = ct;\r\n this.reset();\r\n\r\n let y = this.popScanline()\r\n if (y === undefined) return\r\n\r\n while (this._succeeded) {\r\n this.insertLocalMinimaIntoAEL(y)\r\n let ae = this.popHorz()\r\n while (ae) {\r\n this.doHorizontal(ae)\r\n ae = this.popHorz()\r\n }\r\n\r\n if (this._horzSegList.length > 0) {\r\n this.convertHorzSegsToJoins();\r\n this._horzSegList.length = 0\r\n }\r\n this._currentBotY = y; // bottom of scanbeam\r\n\r\n y = this.popScanline()\r\n if (y === undefined) break; // y new top of scanbeam\r\n\r\n this.doIntersections(y);\r\n this.doTopOfScanbeam(y);\r\n\r\n ae = this.popHorz()\r\n while (ae) {\r\n this.doHorizontal(ae)\r\n ae = this.popHorz()\r\n }\r\n }\r\n if (this._succeeded) this.processHorzJoins();\r\n }\r\n\r\n private doIntersections(topY: number): void {\r\n if (this.buildIntersectList(topY)) {\r\n this.processIntersectList();\r\n this.disposeIntersectNodes();\r\n }\r\n }\r\n\r\n private disposeIntersectNodes(): void {\r\n this._intersectList.length = 0\r\n }\r\n\r\n private addNewIntersectNode(ae1: Active, ae2: Active, topY: number): void {\r\n const result = InternalClipper.getIntersectPt(ae1.bot, ae1.top, ae2.bot, ae2.top)\r\n let ip: IPoint64 = result.ip\r\n if (!result.success) {\r\n ip = new Point64(ae1.curX, topY);\r\n }\r\n\r\n if (ip.y > this._currentBotY || ip.y < topY) {\r\n const absDx1: number = Math.abs(ae1.dx);\r\n const absDx2: number = Math.abs(ae2.dx);\r\n if (absDx1 > 100 && absDx2 > 100) {\r\n if (absDx1 > absDx2) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n } else {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n }\r\n } else if (absDx1 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae1.bot, ae1.top);\r\n } else if (absDx2 > 100) {\r\n ip = InternalClipper.getClosestPtOnSegment(ip, ae2.bot, ae2.top);\r\n } else {\r\n if (ip.y < topY) {\r\n ip.y = topY;\r\n } else {\r\n ip.y = this._currentBotY;\r\n }\r\n if (absDx1 < absDx2) {\r\n ip.x = ClipperBase.topX(ae1, ip.y);\r\n } else {\r\n ip.x = ClipperBase.topX(ae2, ip.y);\r\n }\r\n }\r\n }\r\n const node: IntersectNode = new IntersectNode(ip, ae1, ae2);\r\n this._intersectList.push(node);\r\n }\r\n\r\n private static extractFromSEL(ae: Active): Active | undefined {\r\n const res: Active | undefined = ae.nextInSEL;\r\n if (res) {\r\n res.prevInSEL = ae.prevInSEL;\r\n }\r\n ae.prevInSEL!.nextInSEL = res;\r\n return res;\r\n }\r\n\r\n private static insert1Before2InSEL(ae1: Active, ae2: Active): void {\r\n ae1.prevInSEL = ae2.prevInSEL;\r\n if (ae1.prevInSEL) {\r\n ae1.prevInSEL.nextInSEL = ae1;\r\n }\r\n ae1.nextInSEL = ae2;\r\n ae2.prevInSEL = ae1;\r\n }\r\n\r\n private buildIntersectList(topY: number): boolean {\r\n if (!this._actives || !this._actives.nextInAEL) return false;\r\n\r\n // Calculate edge positions at the top of the current scanbeam, and from this\r\n // we will determine the intersections required to reach these new positions.\r\n this.adjustCurrXAndCopyToSEL(topY);\r\n\r\n // Find all edge intersections in the current scanbeam using a stable merge\r\n // sort that ensures only adjacent edges are intersecting. Intersect info is\r\n // stored in FIntersectList ready to be processed in ProcessIntersectList.\r\n // Re merge sorts see https://stackoverflow.com/a/46319131/359538\r\n\r\n let left: Active | undefined = this._sel,\r\n right: Active | undefined,\r\n lEnd: Active | undefined,\r\n rEnd: Active | undefined,\r\n currBase: Active | undefined,\r\n prevBase: Active | undefined,\r\n tmp: Active | undefined;\r\n\r\n while (left!.jump) {\r\n prevBase = undefined;\r\n while (left && left.jump) {\r\n currBase = left;\r\n right = left.jump;\r\n lEnd = right;\r\n rEnd = right!.jump;\r\n left.jump = rEnd;\r\n while (left !== lEnd && right !== rEnd) {\r\n if (right!.curX < left!.curX) {\r\n tmp = right!.prevInSEL!;\r\n for (; ;) {\r\n this.addNewIntersectNode(tmp, right!, topY);\r\n if (tmp === left) break;\r\n tmp = tmp.prevInSEL!;\r\n }\r\n\r\n tmp = right;\r\n right = ClipperBase.extractFromSEL(tmp!);\r\n lEnd = right;\r\n ClipperBase.insert1Before2InSEL(tmp!, left!);\r\n if (left === currBase) {\r\n currBase = tmp;\r\n currBase!.jump = rEnd;\r\n if (prevBase === undefined) this._sel = currBase;\r\n else prevBase.jump = currBase;\r\n }\r\n } else {\r\n left = left!.nextInSEL;\r\n }\r\n }\r\n\r\n prevBase = currBase;\r\n left = rEnd;\r\n }\r\n left = this._sel;\r\n }\r\n\r\n return this._intersectList.length > 0;\r\n }\r\n\r\n private processIntersectList(): void {\r\n // We now have a list of intersections required so that edges will be\r\n // correctly positioned at the top of the scanbeam. However, it's important\r\n // that edge intersections are processed from the bottom up, but it's also\r\n // crucial that intersections only occur between adjacent edges.\r\n\r\n // First we do a quicksort so intersections proceed in a bottom up order ...\r\n this._intersectList.sort((a, b) => {\r\n if (a.pt.y === b.pt.y) {\r\n if (a.pt.x === b.pt.x) return 0;\r\n return (a.pt.x < b.pt.x) ? -1 : 1;\r\n }\r\n return (a.pt.y > b.pt.y) ? -1 : 1;\r\n });\r\n\r\n // Now as we process these intersections, we must sometimes adjust the order\r\n // to ensure that intersecting edges are always adjacent ...\r\n for (let i = 0; i < this._intersectList.length; ++i) {\r\n if (!ClipperBase.edgesAdjacentInAEL(this._intersectList[i])) {\r\n let j = i + 1;\r\n while (!ClipperBase.edgesAdjacentInAEL(this._intersectList[j])) j++;\r\n // swap\r\n [this._intersectList[j], this._intersectList[i]] =\r\n [this._intersectList[i], this._intersectList[j]];\r\n }\r\n\r\n const node = this._intersectList[i];\r\n this.intersectEdges(node.edge1, node.edge2, node.pt);\r\n this.swapPositionsInAEL(node.edge1, node.edge2);\r\n\r\n node.edge1.curX = node.pt.x;\r\n node.edge2.curX = node.pt.x;\r\n this.checkJoinLeft(node.edge2, node.pt, true);\r\n this.checkJoinRight(node.edge1, node.pt, true);\r\n }\r\n }\r\n\r\n private swapPositionsInAEL(ae1: Active, ae2: Active): void {\r\n // preconditon: ae1 must be immediately to the left of ae2\r\n const next: Active | undefined = ae2.nextInAEL;\r\n if (next) next.prevInAEL = ae1;\r\n const prev: Active | undefined = ae1.prevInAEL;\r\n if (prev) prev.nextInAEL = ae2;\r\n ae2.prevInAEL = prev;\r\n ae2.nextInAEL = ae1;\r\n ae1.prevInAEL = ae2;\r\n ae1.nextInAEL = next;\r\n if (!ae2.prevInAEL) this._actives = ae2;\r\n }\r\n\r\n private static resetHorzDirection(horz: Active, vertexMax: Vertex | undefined): { isLeftToRight: boolean, leftX: number, rightX: number } {\r\n let leftX, rightX\r\n\r\n if (horz.bot.x === horz.top.x) {\r\n // the horizontal edge is going nowhere ...\r\n leftX = horz.curX;\r\n rightX = horz.curX;\r\n let ae: Active | undefined = horz.nextInAEL;\r\n while (ae && ae.vertexTop !== vertexMax)\r\n ae = ae.nextInAEL;\r\n return { isLeftToRight: ae !== undefined, leftX, rightX }\r\n }\r\n\r\n if (horz.curX < horz.top.x) {\r\n leftX = horz.curX;\r\n rightX = horz.top.x;\r\n return { isLeftToRight: true, leftX, rightX }\r\n }\r\n leftX = horz.top.x;\r\n rightX = horz.curX;\r\n return { isLeftToRight: false, leftX, rightX } // right to left\r\n }\r\n\r\n private static horzIsSpike(horz: Active): boolean {\r\n const nextPt: IPoint64 = ClipperBase.nextVertex(horz).pt;\r\n return (horz.bot.x < horz.top.x) !== (horz.top.x < nextPt.x);\r\n }\r\n\r\n private static trimHorz(horzEdge: Active, preserveCollinear: boolean): void {\r\n let wasTrimmed = false;\r\n let pt: IPoint64 = ClipperBase.nextVertex(horzEdge).pt;\r\n\r\n while (pt.y === horzEdge.top.y) {\r\n // always trim 180 deg. spikes (in closed paths)\r\n // but otherwise break if preserveCollinear = true\r\n if (preserveCollinear &&\r\n (pt.x < horzEdge.top.x) !== (horzEdge.bot.x < horzEdge.top.x)) {\r\n break;\r\n }\r\n\r\n horzEdge.vertexTop = ClipperBase.nextVertex(horzEdge);\r\n horzEdge.top = pt;\r\n wasTrimmed = true;\r\n if (ClipperBase.isMaximaActive(horzEdge)) break;\r\n pt = ClipperBase.nextVertex(horzEdge).pt;\r\n }\r\n if (wasTrimmed) ClipperBase.setDx(horzEdge); // +/-infinity\r\n }\r\n\r\n private addToHorzSegList(op: OutPt): void {\r\n if (op.outrec.isOpen) return;\r\n this._horzSegList.push(new HorzSegment(op));\r\n }\r\n\r\n private getLastOp(hotEdge: Active): OutPt {\r\n const outrec: OutRec = hotEdge.outrec!;\r\n return (hotEdge === outrec.frontEdge) ?\r\n outrec.pts! : outrec.pts!.next!;\r\n }\r\n\r\n /*******************************************************************************\r\n * Notes: Horizontal edges (HEs) at scanline intersections (i.e. at the top or *\r\n * bottom of a scanbeam) are processed as if layered.The order in which HEs *\r\n * are processed doesn't matter. HEs intersect with the bottom vertices of *\r\n * other HEs[#] and with non-horizontal edges [*]. Once these intersections *\r\n * are completed, intermediate HEs are 'promoted' to the next edge in their *\r\n * bounds, and they in turn may be intersected[%] by other HEs. *\r\n * *\r\n * eg: 3 horizontals at a scanline: / | / / *\r\n * | / | (HE3)o ========%========== o *\r\n * o ======= o(HE2) / | / / *\r\n * o ============#=========*======*========#=========o (HE1) *\r\n * / | / | / *\r\n *******************************************************************************/\r\n private doHorizontal(horz: Active): void {\r\n let pt: IPoint64;\r\n const horzIsOpen = ClipperBase.isOpen(horz);\r\n const Y = horz.bot.y;\r\n\r\n const vertex_max: Vertex | undefined = horzIsOpen ?\r\n ClipperBase.getCurrYMaximaVertex_Open(horz) :\r\n ClipperBase.getCurrYMaximaVertex(horz);\r\n\r\n // remove 180 deg.spikes and also simplify\r\n // consecutive horizontals when PreserveCollinear = true\r\n if (vertex_max && !horzIsOpen && vertex_max !== horz.vertexTop)\r\n ClipperBase.trimHorz(horz, this.preserveCollinear);\r\n\r\n let { isLeftToRight, leftX, rightX } =\r\n ClipperBase.resetHorzDirection(horz, vertex_max);\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, new Point64(horz.curX, Y));\r\n this.addToHorzSegList(op);\r\n }\r\n\r\n for (; ;) {\r\n // loops through consec. horizontal edges (if open)\r\n let ae: Active | undefined = isLeftToRight ? horz.nextInAEL : horz.prevInAEL;\r\n\r\n while (ae) {\r\n if (ae.vertexTop === vertex_max) {\r\n // do this first!!\r\n if (ClipperBase.isHotEdgeActive(horz) && ClipperBase.isJoined(ae)) this.split(ae, ae.top);\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n while (horz.vertexTop !== vertex_max) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n if (isLeftToRight)\r\n this.addLocalMaxPoly(horz, ae, horz.top);\r\n else\r\n this.addLocalMaxPoly(ae, horz, horz.top);\r\n }\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(horz);\r\n return;\r\n }\r\n\r\n // if horzEdge is a maxima, keep going until we reach\r\n // its maxima pair, otherwise check for break conditions\r\n if (vertex_max !== horz.vertexTop || ClipperBase.isOpenEndActive(horz)) {\r\n // otherwise stop when 'ae' is beyond the end of the horizontal line\r\n if ((isLeftToRight && ae.curX > rightX) || (!isLeftToRight && ae.curX < leftX)) break;\r\n\r\n if (ae.curX === horz.top.x && !ClipperBase.isHorizontal(ae)) {\r\n pt = ClipperBase.nextVertex(horz).pt;\r\n\r\n // to maximize the possibility of putting open edges into\r\n // solutions, we'll only break if it's past HorzEdge's end\r\n if (ClipperBase.isOpen(ae) && !ClipperBase.isSamePolyType(ae, horz) && !ClipperBase.isHotEdgeActive(ae)) {\r\n if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) > pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) < pt.x))) break;\r\n }\r\n // otherwise for edges at horzEdge's end, only stop when horzEdge's\r\n // outslope is greater than e's slope when heading right or when\r\n // horzEdge's outslope is less than e's slope when heading left.\r\n else if ((isLeftToRight && (ClipperBase.topX(ae, pt.y) >= pt.x)) || (!isLeftToRight && (ClipperBase.topX(ae, pt.y) <= pt.x))) break;\r\n }\r\n }\r\n\r\n pt = new Point64(ae.curX, Y);\r\n\r\n if (isLeftToRight) {\r\n this.intersectEdges(horz, ae, pt);\r\n this.swapPositionsInAEL(horz, ae);\r\n horz.curX = ae.curX;\r\n ae = horz.nextInAEL;\r\n } else {\r\n this.intersectEdges(ae, horz, pt);\r\n this.swapPositionsInAEL(ae, horz);\r\n horz.curX = ae.curX;\r\n ae = horz.prevInAEL;\r\n }\r\n\r\n if (ClipperBase.isHotEdgeActive(horz))\r\n this.addToHorzSegList(this.getLastOp(horz));\r\n } // we've reached the end of this horizontal\r\n\r\n // check if we've finished looping\r\n // through consecutive horizontals\r\n if (horzIsOpen && ClipperBase.isOpenEndActive(horz)) { // ie open at top\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n if (ClipperBase.isFront(horz))\r\n horz.outrec!.frontEdge = undefined;\r\n else\r\n horz.outrec!.backEdge = undefined;\r\n horz.outrec = undefined;\r\n }\r\n this.deleteFromAEL(horz);\r\n return;\r\n } else if (ClipperBase.nextVertex(horz).pt.y !== horz.top.y)\r\n break;\r\n\r\n // still more horizontals in bound to process ...\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n ClipperBase.addOutPt(horz, horz.top);\r\n }\r\n\r\n this.updateEdgeIntoAEL(horz);\r\n\r\n if (this.preserveCollinear && !horzIsOpen && ClipperBase.horzIsSpike(horz)) {\r\n ClipperBase.trimHorz(horz, true);\r\n }\r\n\r\n const result = ClipperBase.resetHorzDirection(horz, vertex_max);\r\n isLeftToRight = result.isLeftToRight\r\n leftX = result.leftX\r\n rightX = result.rightX\r\n }\r\n\r\n if (ClipperBase.isHotEdgeActive(horz)) {\r\n const op = ClipperBase.addOutPt(horz, horz.top);\r\n this.addToHorzSegList(op);\r\n }\r\n\r\n this.updateEdgeIntoAEL(horz);\r\n }\r\n\r\n private doTopOfScanbeam(y: number): void {\r\n this._sel = undefined; // _sel is reused to flag horizontals (see pushHorz below)\r\n let ae: Active | undefined = this._actives;\r\n\r\n while (ae) {\r\n // NB 'ae' will never be horizontal here\r\n if (ae.top.y === y) {\r\n ae.curX = ae.top.x;\r\n\r\n if (ClipperBase.isMaximaActive(ae)) {\r\n ae = this.doMaxima(ae); // TOP OF BOUND (MAXIMA)\r\n continue;\r\n }\r\n\r\n // INTERMEDIATE VERTEX ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n ClipperBase.addOutPt(ae, ae.top);\r\n\r\n this.updateEdgeIntoAEL(ae);\r\n\r\n if (ClipperBase.isHorizontal(ae))\r\n this.pushHorz(ae); // horizontals are processed later\r\n } else { // i.e. not the top of the edge\r\n ae.curX = ClipperBase.topX(ae, y);\r\n }\r\n\r\n ae = ae.nextInAEL;\r\n }\r\n }\r\n\r\n private doMaxima(ae: Active): Active | undefined {\r\n const prevE: Active | undefined = ae.prevInAEL\r\n let nextE: Active | undefined = ae.nextInAEL\r\n\r\n if (ClipperBase.isOpenEndActive(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) ClipperBase.addOutPt(ae, ae.top);\r\n if (!ClipperBase.isHorizontal(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae)) {\r\n if (ClipperBase.isFront(ae))\r\n ae.outrec!.frontEdge = undefined;\r\n else\r\n ae.outrec!.backEdge = undefined;\r\n ae.outrec = undefined;\r\n }\r\n this.deleteFromAEL(ae);\r\n }\r\n return nextE;\r\n }\r\n\r\n const maxPair: Active | undefined = ClipperBase.getMaximaPair(ae);\r\n if (!maxPair) return nextE; // eMaxPair is horizontal\r\n\r\n if (ClipperBase.isJoined(ae)) this.split(ae, ae.top);\r\n if (ClipperBase.isJoined(maxPair)) this.split(maxPair, maxPair.top);\r\n\r\n // only non-horizontal maxima here.\r\n // process any edges between maxima pair ...\r\n while (nextE !== maxPair) {\r\n this.intersectEdges(ae, nextE!, ae.top);\r\n this.swapPositionsInAEL(ae, nextE!);\r\n nextE = ae.nextInAEL\r\n }\r\n\r\n if (ClipperBase.isOpen(ae)) {\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n this.deleteFromAEL(maxPair);\r\n this.deleteFromAEL(ae);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n\r\n // here ae.nextInAel == ENext == EMaxPair ...\r\n if (ClipperBase.isHotEdgeActive(ae))\r\n this.addLocalMaxPoly(ae, maxPair, ae.top);\r\n\r\n this.deleteFromAEL(ae);\r\n this.deleteFromAEL(maxPair);\r\n return (prevE ? prevE.nextInAEL : this._actives);\r\n }\r\n\r\n private static isJoined(e: Active): boolean {\r\n return e.joinWith !== JoinWith.None;\r\n }\r\n\r\n private split(e: Active, currPt: IPoint64): void {\r\n if (e.joinWith === JoinWith.Right) {\r\n e.joinWith = JoinWith.None;\r\n e.nextInAEL!.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e, e.nextInAEL!, currPt, true);\r\n } else {\r\n e.joinWith = JoinWith.None;\r\n e.prevInAEL!.joinWith = JoinWith.None;\r\n this.addLocalMinPoly(e.prevInAEL!, e, currPt, true);\r\n }\r\n }\r\n\r\n private checkJoinLeft(e: Active, pt: IPoint64, checkCurrX: boolean = false): void {\r\n const prev = e.prevInAEL;\r\n if (!prev || ClipperBase.isOpen(e) || ClipperBase.isOpen(prev) ||\r\n !ClipperBase.isHotEdgeActive(e) || !ClipperBase.isHotEdgeActive(prev)) return;\r\n\r\n if ((pt.y < e.top.y + 2 || pt.y < prev.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (prev.bot.y > pt.y))) return; // (#490)\r\n\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, prev.bot, prev.top) > 0.25) return;\r\n } else if (e.curX !== prev.curX) return;\r\n if (InternalClipper.crossProduct(e.top, pt, prev.top) !== 0) return;\r\n\r\n if (e.outrec!.idx === prev.outrec!.idx)\r\n this.addLocalMaxPoly(prev, e, pt);\r\n else if (e.outrec!.idx < prev.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(e, prev);\r\n else\r\n ClipperBase.joinOutrecPaths(prev, e);\r\n prev.joinWith = JoinWith.Right;\r\n e.joinWith = JoinWith.Left;\r\n }\r\n\r\n private checkJoinRight(e: Active, pt: IPoint64, checkCurrX: boolean = false): void {\r\n const next = e.nextInAEL;\r\n if (ClipperBase.isOpen(e) || !ClipperBase.isHotEdgeActive(e) || ClipperBase.isJoined(e) ||\r\n !next || ClipperBase.isOpen(next) || !ClipperBase.isHotEdgeActive(next)) return;\r\n\r\n if ((pt.y < e.top.y + 2 || pt.y < next.top.y + 2) && // avoid trivial joins\r\n ((e.bot.y > pt.y) || (next.bot.y > pt.y))) return; // (#490)\r\n\r\n if (checkCurrX) {\r\n if (Clipper.perpendicDistFromLineSqrd(pt, next.bot, next.top) > 0.25) return;\r\n } else if (e.curX !== next.curX) return;\r\n if (InternalClipper.crossProduct(e.top, pt, next.top) !== 0) return;\r\n\r\n if (e.outrec!.idx === next.outrec!.idx)\r\n this.addLocalMaxPoly(e, next, pt);\r\n else if (e.outrec!.idx < next.outrec!.idx)\r\n ClipperBase.joinOutrecPaths(e, next);\r\n else\r\n ClipperBase.joinOutrecPaths(next, e);\r\n e.joinWith = JoinWith.Right;\r\n next.joinWith = JoinWith.Left;\r\n }\r\n\r\n private static fixOutRecPts(outrec: OutRec): void {\r\n let op = outrec.pts!;\r\n do {\r\n op!.outrec = outrec;\r\n op = op.next!;\r\n } while (op !== outrec.pts);\r\n }\r\n\r\n private static setHorzSegHeadingForward(hs: HorzSegment, opP: OutPt, opN: OutPt): boolean {\r\n if (opP.pt.x === opN.pt.x) return false;\r\n if (opP.pt.x < opN.pt.x) {\r\n hs.leftOp = opP;\r\n hs.rightOp = opN;\r\n hs.leftToRight = true;\r\n } else {\r\n hs.leftOp = opN;\r\n hs.rightOp = opP;\r\n hs.leftToRight = false;\r\n }\r\n return true;\r\n }\r\n\r\n private static updateHorzSegment(hs: HorzSegment): boolean {\r\n const op = hs.leftOp;\r\n const outrec = this.getRealOutRec(op.outrec)!;\r\n const outrecHasEdges = outrec.frontEdge !== undefined;\r\n const curr_y = op.pt.y;\r\n let opP = op, opN = op;\r\n\r\n if (outrecHasEdges) {\r\n const opA = outrec.pts!, opZ = opA.next!;\r\n while (opP !== opZ && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN !== opA && opN.next!.pt.y === curr_y)\r\n opN = opN.next!;\r\n } else {\r\n while (opP.prev !== opN && opP.prev.pt.y === curr_y)\r\n opP = opP.prev;\r\n while (opN.next !== opP && opN.next!.pt.y === curr_y)\r\n opN = opN.next!;\r\n }\r\n\r\n const result = this.setHorzSegHeadingForward(hs, opP, opN) && hs.leftOp!.horz === undefined;\r\n\r\n if (result)\r\n hs.leftOp!.horz = hs;\r\n else\r\n hs.rightOp = undefined; // (for sorting)\r\n\r\n return result;\r\n }\r\n\r\n private static duplicateOp(op: OutPt, insert_after: boolean): OutPt {\r\n const result = new OutPt(op.pt, op.outrec);\r\n if (insert_after) {\r\n result.next = op.next;\r\n result.next!.prev = result;\r\n result.prev = op;\r\n op.next = result;\r\n } else {\r\n result.prev = op.prev;\r\n result.prev.next = result;\r\n result.next = op;\r\n op.prev = result;\r\n }\r\n return result;\r\n }\r\n\r\n private convertHorzSegsToJoins(): void {\r\n let k = 0;\r\n for (const hs of this._horzSegList) {\r\n if (ClipperBase.updateHorzSegment(hs)) k++;\r\n }\r\n if (k < 2) return;\r\n this._horzSegList.sort((hs1, hs2) => {\r\n if (!hs1 || !hs2) return 0;\r\n if (!hs1.rightOp) {\r\n return !hs2.rightOp ? 0 : 1;\r\n } else if (!hs2.rightOp)\r\n return -1;\r\n else\r\n return hs1.leftOp!.pt.x - hs2.leftOp!.pt.x;\r\n });\r\n\r\n for (let i = 0; i < k - 1; i++) {\r\n const hs1 = this._horzSegList[i];\r\n // for each HorzSegment, find others that overlap\r\n for (let j = i + 1; j < k; j++) {\r\n const hs2 = this._horzSegList[j];\r\n if (hs2.leftOp!.pt.x >= hs1.rightOp!.pt.x ||\r\n hs2.leftToRight === hs1.leftToRight ||\r\n hs2.rightOp!.pt.x <= hs1.leftOp!.pt.x) continue;\r\n\r\n const curr_y = hs1.leftOp.pt.y;\r\n\r\n if (hs1.leftToRight) {\r\n while (hs1.leftOp.next!.pt.y === curr_y &&\r\n hs1.leftOp.next!.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.next!;\r\n }\r\n while (hs2.leftOp.prev.pt.y === curr_y &&\r\n hs2.leftOp.prev.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.prev;\r\n }\r\n const join = new HorzJoin(\r\n ClipperBase.duplicateOp(hs1.leftOp, true),\r\n ClipperBase.duplicateOp(hs2.leftOp, false)\r\n );\r\n this._horzJoinList.push(join);\r\n } else {\r\n while (hs1.leftOp.prev.pt.y === curr_y &&\r\n hs1.leftOp.prev.pt.x <= hs2.leftOp.pt.x) {\r\n hs1.leftOp = hs1.leftOp.prev;\r\n }\r\n while (hs2.leftOp.next!.pt.y === curr_y &&\r\n hs2.leftOp.next!.pt.x <= hs1.leftOp.pt.x) {\r\n hs2.leftOp = hs2.leftOp.next!;\r\n }\r\n const join = new HorzJoin(\r\n ClipperBase.duplicateOp(hs2.leftOp, true),\r\n ClipperBase.duplicateOp(hs1.leftOp, false)\r\n );\r\n this._horzJoinList.push(join);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static getCleanPath(op: OutPt): Path64 {\r\n const result = new Path64();\r\n let op2 = op;\r\n while (op2.next !== op &&\r\n ((op2.pt.x === op2.next!.pt.x && op2.pt.x === op2.prev.pt.x) ||\r\n (op2.pt.y === op2.next!.pt.y && op2.pt.y === op2.prev.pt.y))) {\r\n op2 = op2.next!;\r\n }\r\n result.push(op2.pt);\r\n let prevOp = op2;\r\n op2 = op2.next!;\r\n\r\n while (op2 !== op) {\r\n if ((op2.pt.x !== op2.next!.pt.x || op2.pt.x !== prevOp.pt.x) &&\r\n (op2.pt.y !== op2.next!.pt.y || op2.pt.y !== prevOp.pt.y)) {\r\n result.push(op2.pt);\r\n prevOp = op2;\r\n }\r\n op2 = op2.next!;\r\n }\r\n return result;\r\n }\r\n\r\n private static pointInOpPolygon(pt: IPoint64, op: OutPt): PointInPolygonResult {\r\n if (op === op.next || op.prev === op.next)\r\n return PointInPolygonResult.IsOutside;\r\n\r\n let op2 = op;\r\n do {\r\n if (op.pt.y !== pt.y) break;\r\n op = op.next!;\r\n } while (op !== op2);\r\n if (op.pt.y === pt.y) // not a proper polygon\r\n return PointInPolygonResult.IsOutside;\r\n\r\n let isAbove = op.pt.y < pt.y\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n\r\n op2 = op.next!;\r\n while (op2 !== op) {\r\n if (isAbove)\r\n while (op2 !== op && op2.pt.y < pt.y) op2 = op2.next!;\r\n else\r\n while (op2 !== op && op2.pt.y > pt.y) op2 = op2.next!;\r\n if (op2 === op) break;\r\n\r\n if (op2.pt.y === pt.y) {\r\n if (op2.pt.x === pt.x || (op2.pt.y === op2.prev.pt.y &&\r\n (pt.x < op2.prev.pt.x) !== (pt.x < op2.pt.x)))\r\n return PointInPolygonResult.IsOn;\r\n op2 = op2.next!;\r\n if (op2 === op) break;\r\n continue;\r\n }\r\n\r\n if (op2.pt.x <= pt.x || op2.prev.pt.x <= pt.x) {\r\n if (op2.prev.pt.x < pt.x && op2.pt.x < pt.x)\r\n val = 1 - val;\r\n else {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n }\r\n isAbove = !isAbove;\r\n op2 = op2.next!;\r\n }\r\n\r\n if (isAbove !== startingAbove) {\r\n const d = InternalClipper.crossProduct(op2.prev.pt, op2.pt, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n\r\n if (val === 0) return PointInPolygonResult.IsOutside;\r\n else return PointInPolygonResult.IsInside;\r\n }\r\n\r\n private static path1InsidePath2(op1: OutPt, op2: OutPt): boolean {\r\n let result: PointInPolygonResult;\r\n let outside_cnt = 0;\r\n let op = op1;\r\n do {\r\n result = this.pointInOpPolygon(op.pt, op2);\r\n if (result === PointInPolygonResult.IsOutside) ++outside_cnt;\r\n else if (result === PointInPolygonResult.IsInside) --outside_cnt;\r\n op = op.next!;\r\n } while (op !== op1 && Math.abs(outside_cnt) < 2);\r\n if (Math.abs(outside_cnt) > 1) return (outside_cnt < 0);\r\n\r\n const mp = ClipperBase.getBoundsPath(this.getCleanPath(op1)).midPoint();\r\n const path2 = this.getCleanPath(op2);\r\n return InternalClipper.pointInPolygon(mp, path2) !== PointInPolygonResult.IsOutside;\r\n }\r\n\r\n private moveSplits(fromOr: OutRec, toOr: OutRec): void {\r\n if (!fromOr.splits) return;\r\n toOr.splits = toOr.splits || [];\r\n for (const i of fromOr.splits) {\r\n toOr.splits.push(i);\r\n }\r\n fromOr.splits = undefined;\r\n }\r\n\r\n private processHorzJoins(): void {\r\n for (const j of this._horzJoinList) {\r\n const or1 = ClipperBase.getRealOutRec(j.op1!.outrec)!;\r\n let or2 = ClipperBase.getRealOutRec(j.op2!.outrec)!;\r\n\r\n const op1b = j.op1!.next!;\r\n const op2b = j.op2!.prev!;\r\n j.op1!.next = j.op2!;\r\n j.op2!.prev = j.op1!;\r\n op1b.prev = op2b;\r\n op2b.next = op1b;\r\n\r\n if (or1 === or2) {\r\n or2 = this.newOutRec();\r\n or2.pts = op1b;\r\n ClipperBase.fixOutRecPts(or2);\r\n\r\n if (or1.pts!.outrec === or2) {\r\n or1.pts = j.op1;\r\n or1.pts!.outrec = or1;\r\n }\r\n\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(or1.pts!, or2.pts)) {\r\n const tmp = or1.pts;\r\n or1.pts = or2.pts;\r\n or2.pts = tmp;\r\n ClipperBase.fixOutRecPts(or1);\r\n ClipperBase.fixOutRecPts(or2);\r\n or2.owner = or1.owner;\r\n } else if (ClipperBase.path1InsidePath2(or2.pts, or1.pts!)) {\r\n or2.owner = or1;\r\n } else {\r\n or2.owner = or1.owner;\r\n }\r\n\r\n or1.splits = or1.splits || [];\r\n or1.splits.push(or2.idx);\r\n } else {\r\n or2.owner = or1;\r\n }\r\n } else {\r\n or2.pts = undefined;\r\n if (this._using_polytree) {\r\n ClipperBase.setOwner(or2, or1);\r\n this.moveSplits(or2, or1);\r\n } else {\r\n or2.owner = or1;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static ptsReallyClose(pt1: IPoint64, pt2: IPoint64): boolean {\r\n return (Math.abs(pt1.x - pt2.x) < 2) && (Math.abs(pt1.y - pt2.y) < 2);\r\n }\r\n\r\n private static isVerySmallTriangle(op: OutPt): boolean {\r\n return op.next!.next === op.prev &&\r\n (this.ptsReallyClose(op.prev.pt, op.next!.pt) ||\r\n this.ptsReallyClose(op.pt, op.next!.pt) ||\r\n this.ptsReallyClose(op.pt, op.prev.pt));\r\n }\r\n\r\n\r\n private static isValidClosedPath(op: OutPt | undefined): boolean {\r\n return op !== undefined && op.next !== op &&\r\n (op.next !== op.prev || !this.isVerySmallTriangle(op));\r\n }\r\n\r\n private static disposeOutPt(op: OutPt): OutPt | undefined {\r\n const result = op.next === op ? undefined : op.next;\r\n op.prev.next = op.next;\r\n op.next!.prev = op.prev;\r\n return result;\r\n }\r\n\r\n private cleanCollinear(outrec: OutRec | undefined): void {\r\n outrec = ClipperBase.getRealOutRec(outrec);\r\n\r\n if (outrec === undefined || outrec.isOpen) return;\r\n\r\n if (!ClipperBase.isValidClosedPath(outrec.pts)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n\r\n let startOp: OutPt = outrec.pts!;\r\n let op2: OutPt | undefined = startOp;\r\n for (; ;) {\r\n // NB if preserveCollinear == true, then only remove 180 deg. spikes\r\n if (InternalClipper.crossProduct(op2!.prev.pt, op2!.pt, op2!.next!.pt) === 0 &&\r\n (op2!.pt === op2!.prev.pt || op2!.pt === op2!.next!.pt || !this.preserveCollinear ||\r\n InternalClipper.dotProduct(op2!.prev.pt, op2!.pt, op2!.next!.pt) < 0)) {\r\n\r\n if (op2 === outrec.pts) {\r\n outrec.pts = op2!.prev;\r\n }\r\n\r\n op2 = ClipperBase.disposeOutPt(op2!);\r\n if (!ClipperBase.isValidClosedPath(op2)) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n startOp = op2!;\r\n continue;\r\n }\r\n op2 = op2!.next;\r\n if (op2 === startOp) break;\r\n }\r\n this.fixSelfIntersects(outrec);\r\n }\r\n\r\n private doSplitOp(outrec: OutRec, splitOp: OutPt): void {\r\n // splitOp.prev <=> splitOp &&\r\n // splitOp.next <=> splitOp.next.next are intersecting\r\n const prevOp: OutPt = splitOp.prev;\r\n const nextNextOp: OutPt = splitOp.next!.next!;\r\n outrec.pts = prevOp;\r\n\r\n const ip: IPoint64 = InternalClipper.getIntersectPoint(\r\n prevOp.pt, splitOp.pt, splitOp.next!.pt, nextNextOp.pt).ip;\r\n\r\n const area1: number = ClipperBase.area(prevOp);\r\n const absArea1: number = Math.abs(area1);\r\n\r\n if (absArea1 < 2) {\r\n outrec.pts = undefined;\r\n return;\r\n }\r\n\r\n const area2: number = ClipperBase.areaTriangle(ip, splitOp.pt, splitOp.next!.pt);\r\n const absArea2: number = Math.abs(area2);\r\n\r\n // de-link splitOp and splitOp.next from the path\r\n // while inserting the intersection point\r\n if (ip === prevOp.pt || ip === nextNextOp.pt) {\r\n nextNextOp.prev = prevOp;\r\n prevOp.next = nextNextOp;\r\n } else {\r\n const newOp2 = new OutPt(ip, outrec);\r\n newOp2.prev = prevOp;\r\n newOp2.next = nextNextOp;\r\n nextNextOp.prev = newOp2;\r\n prevOp.next = newOp2;\r\n }\r\n\r\n // nb: area1 is the path's area *before* splitting, whereas area2 is\r\n // the area of the triangle containing splitOp & splitOp.next.\r\n // So the only way for these areas to have the same sign is if\r\n // the split triangle is larger than the path containing prevOp or\r\n // if there's more than one self=intersection.\r\n if (absArea2 > 1 &&\r\n (absArea2 > absArea1 || (area2 > 0) === (area1 > 0))) {\r\n\r\n const newOutRec: OutRec = this.newOutRec();\r\n newOutRec.owner = outrec.owner;\r\n splitOp.outrec = newOutRec;\r\n splitOp.next!.outrec = newOutRec;\r\n\r\n const newOp: OutPt = new OutPt(ip, newOutRec);\r\n newOp.prev = splitOp.next!;\r\n newOp.next = splitOp;\r\n newOutRec.pts = newOp;\r\n splitOp.prev = newOp;\r\n splitOp.next!.next = newOp;\r\n\r\n if (this._using_polytree) {\r\n if (ClipperBase.path1InsidePath2(prevOp, newOp)) {\r\n newOutRec.splits = newOutRec.splits || [];\r\n newOutRec.splits.push(outrec.idx);\r\n } else {\r\n outrec.splits = outrec.splits || [];\r\n outrec.splits.push(newOutRec.idx);\r\n }\r\n }\r\n }\r\n // else { splitOp = undefined; splitOp.next = undefined; }\r\n }\r\n\r\n private fixSelfIntersects(outrec: OutRec): void {\r\n let op2: OutPt = outrec.pts!;\r\n for (; ;) {\r\n if (op2.prev === op2.next!.next) break;\r\n if (InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next!.pt, op2.next!.next!.pt)) {\r\n this.doSplitOp(outrec, op2);\r\n if (!outrec.pts) return;\r\n op2 = outrec.pts;\r\n continue;\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n if (op2 === outrec.pts) break;\r\n }\r\n }\r\n\r\n static buildPath(op: OutPt | undefined, reverse: boolean, isOpen: boolean, path: Path64): boolean {\r\n if (op === undefined || op.next === op || (!isOpen && op.next === op.prev)) return false;\r\n path.length = 0\r\n\r\n let lastPt: IPoint64;\r\n let op2: OutPt;\r\n if (reverse) {\r\n lastPt = op.pt;\r\n op2 = op.prev;\r\n } else {\r\n op = op.next!;\r\n lastPt = op.pt;\r\n op2 = op.next!;\r\n }\r\n path.push(lastPt);\r\n\r\n while (op2 !== op) {\r\n if (op2.pt !== lastPt) {\r\n lastPt = op2.pt;\r\n path.push(lastPt);\r\n }\r\n if (reverse) {\r\n op2 = op2.prev;\r\n } else {\r\n op2 = op2.next!;\r\n }\r\n }\r\n\r\n if (path.length === 3 && this.isVerySmallTriangle(op2)) return false;\r\n else return true;\r\n }\r\n\r\n protected buildPaths(solutionClosed: Paths64, solutionOpen: Paths64): boolean {\r\n solutionClosed.length = 0\r\n solutionOpen.length = 0\r\n\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec = this._outrecList[i++];\r\n if (!outrec.pts) continue;\r\n\r\n const path = new Path64();\r\n if (outrec.isOpen) {\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, path)) {\r\n solutionOpen.push(path);\r\n }\r\n } else {\r\n this.cleanCollinear(outrec);\r\n // closed paths should always return a Positive orientation\r\n // except when reverseSolution == true\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, path)) {\r\n solutionClosed.push(path);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n private static getBoundsPath(path: Path64): Rect64 {\r\n if (path.length === 0) return new Rect64();\r\n const result = Clipper.InvalidRect64;\r\n for (const pt of path) {\r\n if (pt.x < result.left) result.left = pt.x;\r\n if (pt.x > result.right) result.right = pt.x;\r\n if (pt.y < result.top) result.top = pt.y;\r\n if (pt.y > result.bottom) result.bottom = pt.y;\r\n }\r\n return result;\r\n }\r\n\r\n private checkBounds(outrec: OutRec): boolean {\r\n if (outrec.pts === undefined) return false;\r\n if (!outrec.bounds.isEmpty()) return true;\r\n this.cleanCollinear(outrec);\r\n if (outrec.pts === undefined || !ClipperBase.buildPath(outrec.pts, this.reverseSolution, false, outrec.path))\r\n return false;\r\n outrec.bounds = ClipperBase.getBoundsPath(outrec.path);\r\n return true;\r\n }\r\n\r\n private checkSplitOwner(outrec: OutRec, splits: number[] | undefined): boolean {\r\n for (const i of splits!) {\r\n const split: OutRec | undefined = ClipperBase.getRealOutRec(this._outrecList[i]);\r\n if (split === undefined || split === outrec || split.recursiveSplit === outrec) continue;\r\n split.recursiveSplit = outrec; //#599\r\n if (split!.splits !== undefined && this.checkSplitOwner(outrec, split.splits)) return true;\r\n if (ClipperBase.isValidOwner(outrec, split) &&\r\n this.checkBounds(split) &&\r\n split.bounds.containsRect(outrec.bounds) &&\r\n ClipperBase.path1InsidePath2(outrec.pts!, split.pts!)) {\r\n outrec.owner = split; //found in split\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private recursiveCheckOwners(outrec: OutRec, polypath: PolyPathBase): void {\r\n // pre-condition: outrec will have valid bounds\r\n // post-condition: if a valid path, outrec will have a polypath\r\n\r\n if (outrec.polypath !== undefined || outrec.bounds.isEmpty()) return;\r\n\r\n while (outrec.owner !== undefined) {\r\n if (outrec.owner.splits !== undefined &&\r\n this.checkSplitOwner(outrec, outrec.owner.splits)) break;\r\n else if (outrec.owner.pts !== undefined && this.checkBounds(outrec.owner) &&\r\n ClipperBase.path1InsidePath2(outrec.pts!, outrec.owner.pts!)) break;\r\n outrec.owner = outrec.owner.owner;\r\n }\r\n\r\n if (outrec.owner !== undefined) {\r\n if (outrec.owner.polypath === undefined)\r\n this.recursiveCheckOwners(outrec.owner, polypath);\r\n outrec.polypath = outrec.owner.polypath!.addChild(outrec.path);\r\n } else {\r\n outrec.polypath = polypath.addChild(outrec.path);\r\n }\r\n }\r\n\r\n protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {\r\n polytree.clear();\r\n solutionOpen.length = 0\r\n\r\n let i = 0;\r\n while (i < this._outrecList.length) {\r\n const outrec: OutRec = this._outrecList[i++];\r\n if (outrec.pts === undefined) continue;\r\n\r\n if (outrec.isOpen) {\r\n const open_path = new Path64();\r\n if (ClipperBase.buildPath(outrec.pts, this.reverseSolution, true, open_path))\r\n solutionOpen.push(open_path);\r\n continue;\r\n }\r\n if (this.checkBounds(outrec))\r\n this.recursiveCheckOwners(outrec, polytree);\r\n }\r\n }\r\n\r\n public getBounds(): Rect64 {\r\n const bounds = Clipper.InvalidRect64;\r\n for (const t of this._vertexList) {\r\n let v = t;\r\n do {\r\n if (v.pt.x < bounds.left) bounds.left = v.pt.x;\r\n if (v.pt.x > bounds.right) bounds.right = v.pt.x;\r\n if (v.pt.y < bounds.top) bounds.top = v.pt.y;\r\n if (v.pt.y > bounds.bottom) bounds.bottom = v.pt.y;\r\n v = v.next!;\r\n } while (v !== t);\r\n }\r\n return bounds.isEmpty() ? new Rect64(0, 0, 0, 0) : bounds;\r\n }\r\n\r\n}\r\n\r\n\r\nexport class Clipper64 extends ClipperBase {\r\n\r\n override addPath(path: Path64, polytype: PathType, isOpen: boolean = false): void {\r\n super.addPath(path, polytype, isOpen);\r\n }\r\n\r\n addReusableData(reusableData: ReuseableDataContainer64): void {\r\n super.addReuseableData(reusableData);\r\n }\r\n\r\n override addPaths(paths: Paths64, polytype: PathType, isOpen: boolean = false): void {\r\n super.addPaths(paths, polytype, isOpen);\r\n }\r\n\r\n addSubjectPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Subject);\r\n }\r\n\r\n addOpenSubjectPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Subject, true);\r\n }\r\n\r\n addClipPaths(paths: Paths64): void {\r\n this.addPaths(paths, PathType.Clip);\r\n }\r\n\r\n execute(clipType: ClipType, fillRule: FillRule, solutionClosed: Paths64, solutionOpen = new Paths64()): boolean {\r\n solutionClosed.length = 0\r\n solutionOpen.length = 0\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildPaths(solutionClosed, solutionOpen);\r\n } catch (error) {\r\n this._succeeded = false;\r\n }\r\n\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n\r\n\r\n executePolyTree(clipType: ClipType, fillRule: FillRule, polytree: PolyTree64, openPaths = new Paths64()): boolean {\r\n polytree.clear();\r\n openPaths.length = 0\r\n this._using_polytree = true;\r\n try {\r\n this.executeInternal(clipType, fillRule);\r\n this.buildTree(polytree, openPaths);\r\n } catch (error) {\r\n this._succeeded = false;\r\n }\r\n\r\n this.clearSolutionOnly();\r\n return this._succeeded;\r\n }\r\n\r\n}\r\n\r\nexport abstract class PolyPathBase {\r\n protected _parent?: PolyPathBase;\r\n children: Array = [];\r\n public polygon?: Path64;\r\n\r\n get isHole(): boolean {\r\n return this.getIsHole();\r\n }\r\n\r\n constructor(parent?: PolyPathBase) {\r\n this._parent = parent;\r\n }\r\n\r\n private getLevel(): number {\r\n let result = 0;\r\n let pp: PolyPathBase | undefined = this._parent;\r\n while (pp !== undefined) {\r\n ++result;\r\n pp = pp._parent;\r\n }\r\n return result;\r\n }\r\n\r\n get level(): number {\r\n return this.getLevel();\r\n }\r\n\r\n private getIsHole(): boolean {\r\n const lvl = this.getLevel();\r\n return lvl !== 0 && (lvl & 1) === 0;\r\n }\r\n\r\n get count(): number {\r\n return this.children.length;\r\n }\r\n\r\n abstract addChild(p: Path64): PolyPathBase;\r\n\r\n clear(): void {\r\n this.children.length = 0\r\n }\r\n\r\n forEach = this.children.forEach\r\n\r\n} // end of PolyPathBase class\r\n\r\nexport class PolyPath64 extends PolyPathBase {\r\n\r\n constructor(parent?: PolyPathBase) {\r\n super(parent);\r\n }\r\n\r\n addChild(p: Path64): PolyPathBase {\r\n const newChild = new PolyPath64(this);\r\n (newChild as PolyPath64).polygon = p;\r\n this.children.push(newChild);\r\n return newChild;\r\n }\r\n\r\n get(index: number): PolyPath64 {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index] as PolyPath64;\r\n }\r\n\r\n child(index: number): PolyPath64 {\r\n if (index < 0 || index >= this.children.length) {\r\n throw new Error(\"InvalidOperationException\");\r\n }\r\n return this.children[index] as PolyPath64;\r\n }\r\n\r\n area(): number {\r\n let result = this.polygon ? Clipper.area(this.polygon) : 0;\r\n for (const polyPathBase of this.children) {\r\n const child = polyPathBase as PolyPath64;\r\n result += child.area();\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n\r\nexport class PolyTree64 extends PolyPath64 { }\r\n\r\n\r\nexport class ClipperLibException extends Error {\r\n constructor(description: string) {\r\n super(description);\r\n }\r\n}\r\n","/*******************************************************************************\r\n* Author : Angus Johnson *\r\n* Date : 26 July 2023 *\r\n* Website : http://www.angusj.com *\r\n* Copyright : Angus Johnson 2010-2023 *\r\n* Purpose : Core structures and functions for the Clipper Library *\r\n* License : http://www.boost.org/LICENSE_1_0.txt *\r\n*******************************************************************************/\r\n\r\nimport { PointInPolygonResult } from \"./engine\";\r\n\r\n//\r\n// Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs\r\n// Removed support for USINGZ\r\n//\r\n// Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes\r\n//\r\n\r\n// Note: all clipping operations except for Difference are commutative.\r\nexport enum ClipType {\r\n None,\r\n Intersection,\r\n Union,\r\n Difference,\r\n Xor\r\n}\r\n\r\nexport enum PathType {\r\n Subject,\r\n Clip\r\n}\r\n\r\n// By far the most widely used filling rules for polygons are EvenOdd\r\n// and NonZero, sometimes called Alternate and Winding respectively.\r\n// https://en.wikipedia.org/wiki/Nonzero-rule\r\nexport enum FillRule {\r\n EvenOdd,\r\n NonZero,\r\n Positive,\r\n Negative\r\n}\r\n\r\n// PointInPolygon\r\nexport enum PipResult {\r\n Inside,\r\n Outside,\r\n OnEdge\r\n}\r\n\r\nexport interface IPoint64 {\r\n x: number;\r\n y: number;\r\n}\r\n\r\nexport class Path64 extends Array { }\r\n\r\nexport class Paths64 extends Array { }\r\n\r\n\r\n\r\nexport class Rect64 {\r\n public left: number;\r\n public top: number;\r\n public right: number;\r\n public bottom: number;\r\n\r\n constructor(lOrIsValidOrRec?: number | boolean | Rect64, t?: number, r?: number, b?: number) {\r\n if (typeof lOrIsValidOrRec === 'boolean') {\r\n if (lOrIsValidOrRec) {\r\n this.left = 0;\r\n this.top = 0;\r\n this.right = 0;\r\n this.bottom = 0;\r\n } else {\r\n this.left = Number.MAX_SAFE_INTEGER;\r\n this.top = Number.MAX_SAFE_INTEGER;\r\n this.right = Number.MIN_SAFE_INTEGER;\r\n this.bottom = Number.MIN_SAFE_INTEGER;\r\n }\r\n } else if (typeof lOrIsValidOrRec === 'number') {\r\n this.left = lOrIsValidOrRec;\r\n this.top = t as number;\r\n this.right = r as number;\r\n this.bottom = b as number;\r\n } else {\r\n this.left = lOrIsValidOrRec!.left;\r\n this.top = lOrIsValidOrRec!.top;\r\n this.right = lOrIsValidOrRec!.right;\r\n this.bottom = lOrIsValidOrRec!.bottom;\r\n }\r\n }\r\n\r\n public get width(): number {\r\n return this.right - this.left;\r\n }\r\n\r\n public set width(value: number) {\r\n this.right = this.left + value;\r\n }\r\n\r\n public get height(): number {\r\n return this.bottom - this.top;\r\n }\r\n\r\n public set height(value: number) {\r\n this.bottom = this.top + value;\r\n }\r\n\r\n public isEmpty(): boolean {\r\n return this.bottom <= this.top || this.right <= this.left;\r\n }\r\n\r\n public midPoint(): Point64 {\r\n return new Point64((this.left + this.right) / 2, (this.top + this.bottom) / 2);\r\n }\r\n\r\n public contains(pt: IPoint64): boolean {\r\n return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom;\r\n }\r\n\r\n public containsRect(rec: Rect64): boolean {\r\n return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom;\r\n }\r\n\r\n public intersects(rec: Rect64): boolean {\r\n return (Math.max(this.left, rec.left) <= Math.min(this.right, rec.right)) &&\r\n (Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom));\r\n }\r\n\r\n public asPath(): Path64 {\r\n const result = new Path64();\r\n result.push(new Point64(this.left, this.top));\r\n result.push(new Point64(this.right, this.top));\r\n result.push(new Point64(this.right, this.bottom));\r\n result.push(new Point64(this.left, this.bottom));\r\n return result;\r\n }\r\n}\r\n\r\n\r\n\r\n\r\nexport class Point64 implements IPoint64 {\r\n public x: number;\r\n public y: number;\r\n\r\n constructor(xOrPt?: number | Point64, yOrScale?: number) {\r\n if (typeof xOrPt === 'number' && typeof yOrScale === 'number') {\r\n this.x = Math.round(xOrPt);\r\n this.y = Math.round(yOrScale);\r\n } else {\r\n const pt = xOrPt as Point64\r\n if (yOrScale !== undefined) {\r\n this.x = Math.round(pt.x * yOrScale);\r\n this.y = Math.round(pt.y * yOrScale);\r\n } else {\r\n this.x = pt.x;\r\n this.y = pt.y;\r\n }\r\n //} else {\r\n // const pt = xOrPt as Point64\r\n // this.x = Math.round((xOrPt).x * (yOrScale || 1));\r\n // this.y = Math.round((xOrPt).y * (yOrScale || 1));\r\n }\r\n }\r\n\r\n public static equals(lhs: Point64, rhs: Point64): boolean {\r\n return lhs.x === rhs.x && lhs.y === rhs.y;\r\n }\r\n\r\n public static notEquals(lhs: Point64, rhs: Point64): boolean {\r\n return lhs.x !== rhs.x || lhs.y !== rhs.y;\r\n }\r\n\r\n public static add(lhs: Point64, rhs: Point64): Point64 {\r\n return new Point64(lhs.x + rhs.x, lhs.y + rhs.y);\r\n }\r\n\r\n public static subtract(lhs: Point64, rhs: Point64): Point64 {\r\n return new Point64(lhs.x - rhs.x, lhs.y - rhs.y);\r\n }\r\n\r\n public toString(): string {\r\n return `${this.x},${this.y} `;\r\n }\r\n\r\n public equals(obj: Point64): boolean {\r\n if (obj instanceof Point64) {\r\n return Point64.equals(this, obj);\r\n }\r\n return false;\r\n }\r\n\r\n // public getHashCode(): number {\r\n // return this.X ^ this.Y; // Simple XOR-based hash combination. Adjust if needed.\r\n // }\r\n}\r\n\r\nexport class InternalClipper {\r\n static readonly MaxInt64: number = 9223372036854775807;\r\n static readonly MaxCoord: number = InternalClipper.MaxInt64 / 4;\r\n static readonly max_coord: number = InternalClipper.MaxCoord;\r\n static readonly min_coord: number = -InternalClipper.MaxCoord;\r\n static readonly Invalid64: number = InternalClipper.MaxInt64;\r\n\r\n static readonly defaultArcTolerance: number = 0.25;\r\n static readonly floatingPointTolerance: number = 1E-12;\r\n static readonly defaultMinimumEdgeLength: number = 0.1;\r\n\r\n private static readonly precision_range_error: string = \"Error: Precision is out of range.\";\r\n\r\n static checkPrecision(precision: number): void {\r\n if (precision < -8 || precision > 8)\r\n throw new Error(this.precision_range_error);\r\n }\r\n\r\n static isAlmostZero(value: number): boolean {\r\n return (Math.abs(value) <= this.floatingPointTolerance);\r\n }\r\n\r\n static crossProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return ((pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x));\r\n }\r\n\r\n static dotProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number {\r\n return ((pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y));\r\n }\r\n\r\n static checkCastInt64(val: number): number {\r\n if ((val >= this.max_coord) || (val <= this.min_coord)) return this.Invalid64;\r\n return Math.round(val);\r\n }\r\n\r\n\r\n public static getIntersectPt(ln1a: IPoint64, ln1b: IPoint64, ln2a: IPoint64, ln2b: IPoint64): { ip: IPoint64, success: boolean } {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n\r\n let ip: IPoint64;\r\n\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0) ip = ln1a;\r\n else if (t >= 1.0) ip = ln1b;\r\n else ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n\r\n public static getIntersectPoint(ln1a: IPoint64, ln1b: IPoint64, ln2a: IPoint64, ln2b: IPoint64): { ip: IPoint64, success: boolean } {\r\n const dy1 = ln1b.y - ln1a.y;\r\n const dx1 = ln1b.x - ln1a.x;\r\n const dy2 = ln2b.y - ln2a.y;\r\n const dx2 = ln2b.x - ln2a.x;\r\n const det = dy1 * dx2 - dy2 * dx1;\r\n\r\n let ip: IPoint64;\r\n\r\n if (det === 0.0) {\r\n ip = new Point64(0, 0);\r\n return { ip, success: false };\r\n }\r\n\r\n const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;\r\n if (t <= 0.0) ip = ln1a;\r\n else if (t >= 1.0) ip = ln2a;\r\n else ip = new Point64(ln1a.x + t * dx1, ln1a.y + t * dy1);\r\n return { ip, success: true };\r\n }\r\n\r\n public static segsIntersect(seg1a: IPoint64, seg1b: IPoint64, seg2a: IPoint64, seg2b: IPoint64, inclusive: boolean = false): boolean {\r\n if (inclusive) {\r\n const res1 = InternalClipper.crossProduct(seg1a, seg2a, seg2b);\r\n const res2 = InternalClipper.crossProduct(seg1b, seg2a, seg2b);\r\n if (res1 * res2 > 0) return false;\r\n const res3 = InternalClipper.crossProduct(seg2a, seg1a, seg1b);\r\n const res4 = InternalClipper.crossProduct(seg2b, seg1a, seg1b);\r\n if (res3 * res4 > 0) return false;\r\n return (res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0);\r\n } else {\r\n return (InternalClipper.crossProduct(seg1a, seg2a, seg2b) * InternalClipper.crossProduct(seg1b, seg2a, seg2b) < 0) &&\r\n (InternalClipper.crossProduct(seg2a, seg1a, seg1b) * InternalClipper.crossProduct(seg2b, seg1a, seg1b) < 0);\r\n }\r\n }\r\n\r\n public static getClosestPtOnSegment(offPt: IPoint64, seg1: IPoint64, seg2: IPoint64): IPoint64 {\r\n if (seg1.x === seg2.x && seg1.y === seg2.y) return seg1;\r\n const dx = seg2.x - seg1.x;\r\n const dy = seg2.y - seg1.y;\r\n let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / ((dx * dx) + (dy * dy));\r\n if (q < 0) q = 0; else if (q > 1) q = 1;\r\n return new Point64(seg1.x + Math.round(q * dx), seg1.y + Math.round(q * dy));\r\n }\r\n\r\n public static pointInPolygon(pt: IPoint64, polygon: Path64): PointInPolygonResult {\r\n const len = polygon.length;\r\n let start = 0;\r\n\r\n if (len < 3) return PointInPolygonResult.IsOutside;\r\n\r\n while (start < len && polygon[start].y === pt.y) start++;\r\n if (start === len) return PointInPolygonResult.IsOutside;\r\n\r\n let d: number = 0;\r\n let isAbove = polygon[start].y < pt.y;\r\n const startingAbove = isAbove;\r\n let val = 0;\r\n let i = start + 1;\r\n let end = len;\r\n\r\n for (; ;) {\r\n if (i === end) {\r\n if (end === 0 || start === 0) break;\r\n end = start;\r\n i = 0;\r\n }\r\n\r\n if (isAbove) {\r\n while (i < end && polygon[i].y < pt.y) i++;\r\n if (i === end) continue;\r\n } else {\r\n while (i < end && polygon[i].y > pt.y) i++;\r\n if (i === end) continue;\r\n }\r\n\r\n const curr = polygon[i];\r\n const prev = i > 0 ? polygon[i - 1] : polygon[len - 1];\r\n\r\n if (curr.y === pt.y) {\r\n if (curr.x === pt.x || (curr.y === prev.y && (pt.x < prev.x !== pt.x < curr.x))) return PointInPolygonResult.IsOn;\r\n i++;\r\n if (i === start) break;\r\n continue;\r\n }\r\n\r\n if (pt.x < curr.x && pt.x < prev.x) {\r\n // we're only interested in edges crossing on the left\r\n } else if (pt.x > prev.x && pt.x > curr.x) {\r\n val = 1 - val; // toggle val\r\n } else {\r\n d = InternalClipper.crossProduct(prev, curr, pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n isAbove = !isAbove;\r\n i++;\r\n }\r\n\r\n if (isAbove !== startingAbove) {\r\n if (i === len) i = 0;\r\n else d = InternalClipper.crossProduct(polygon[i - 1], polygon[i], pt);\r\n if (d === 0) return PointInPolygonResult.IsOn;\r\n if ((d < 0) === isAbove) val = 1 - val;\r\n }\r\n\r\n if (val === 0) return PointInPolygonResult.IsOutside;\r\n return PointInPolygonResult.IsInside;\r\n }\r\n}\r\n","/*\n * Public API Surface of clipper2-js\n */\n\nexport * from './lib/core';\nexport * from './lib/clipper';\nexport * from './lib/engine';\nexport * from './lib/minkowski';\nexport * from './lib/offset';\nexport * from './lib/rectclip';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n","const DIRECTION_EPSILON = 1e-3;\nconst DIST_EPSILON = 1e2;\n\nfunction sameDirection( p0, p1, p2 ) {\n\n\tconst dx1 = p1.x - p0.x;\n\tconst dy1 = p1.y - p0.y;\n\n\tconst dx2 = p2.x - p1.x;\n\tconst dy2 = p2.y - p1.y;\n\n\tconst s1 = dx1 / dy1;\n\tconst s2 = dx2 / dy2;\n\n\treturn Math.abs( s1 - s2 ) < DIRECTION_EPSILON;\n\n}\n\nfunction areClose( p0, p1 ) {\n\n\tconst dx = p1.x - p0.x;\n\tconst dy = p1.y - p0.y;\n\treturn Math.sqrt( dx * dx + dy * dy ) < DIST_EPSILON;\n\n}\n\nfunction areEqual( p0, p1 ) {\n\n\treturn p0.x === p1.x && p0.y === p1.y;\n\n}\n\nexport function compressPoints( points ) {\n\n\tfor ( let k = 0; k < points.length; k ++ ) {\n\n\t\t// remove points that are equal or very close to each other\n\t\tconst v = points[ k ];\n\t\twhile ( true ) {\n\n\t\t\tconst k1 = k + 1;\n\t\t\tif (\n\t\t\t\tpoints.length > k1 &&\n\t\t\t\t(\n\t\t\t\t\tareEqual( v, points[ k1 ] ) ||\n\t\t\t\t\tareClose( v, points[ k1 ] )\n\t\t\t\t)\n\t\t\t) {\n\n\t\t\t\tpoints.splice( k1, 1 );\n\n\t\t\t} else {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\n\t\t}\n\n\t\t// join lines that are almost the same direction\n\t\twhile ( true ) {\n\n\t\t\tconst k1 = k + 1;\n\t\t\tconst k2 = k + 2;\n\t\t\tif (\n\t\t\t\tpoints.length > k2 &&\n\t\t\t\tsameDirection( v, points[ k1 ], points[ k2 ] )\n\t\t\t) {\n\n\t\t\t\tpoints.splice( k + 1, 1 );\n\n\t\t\t} else {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n","import { Line3, Ray } from 'three';\n\nfunction xzToXzCopy( v, target ) {\n\n\ttarget.x = v.x;\n\ttarget.y = v.z;\n\n}\n\nfunction epsEquals( a, b ) {\n\n\treturn Math.abs( a - b ) <= 500;\n\n}\n\nfunction vectorEpsEquals( v0, v1 ) {\n\n\treturn epsEquals( v0.x, v1.x ) &&\n\t\tepsEquals( v0.y, v1.y ) &&\n\t\tepsEquals( v0.z, v1.z );\n\n}\n\nexport function triangleIsInsidePaths( tri, paths ) {\n\n\tconst indices = [ 'a', 'b', 'c' ];\n\tconst edges = [ new Line3(), new Line3(), new Line3() ];\n\tconst line = new Line3();\n\tconst ray = new Line3();\n\tray.start\n\t\t.set( 0, 0, 0 )\n\t\t.addScaledVector( tri.a, 1 / 3 )\n\t\t.addScaledVector( tri.b, 1 / 3 )\n\t\t.addScaledVector( tri.c, 1 / 3 );\n\n\txzToXzCopy( ray.start, ray.start );\n\tray.end.copy( ray.start );\n\tray.end.y += 1e10;\n\n\t// get all triangle edges\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst i1 = ( i + 1 ) % 3;\n\t\tconst p0 = tri[ indices[ i ] ];\n\t\tconst p1 = tri[ indices[ i1 ] ];\n\n\t\tconst edge = edges[ i ];\n\t\txzToXzCopy( p0, edge.start );\n\t\txzToXzCopy( p1, edge.end );\n\n\t}\n\n\tlet crossCount = 0;\n\tfor ( let p = 0, pl = paths.length; p < pl; p ++ ) {\n\n\t\tconst points = paths[ p ];\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst i1 = ( i + 1 ) % l;\n\t\t\tline.start.copy( points[ i ] );\n\t\t\tline.start.z = 0;\n\n\t\t\tline.end.copy( points[ i1 ] );\n\t\t\tline.end.z = 0;\n\n\t\t\tif ( lineCrossesLine( ray, line ) ) {\n\n\t\t\t\tcrossCount ++;\n\n\t\t\t}\n\n\t\t\tfor ( let e = 0; e < 3; e ++ ) {\n\n\t\t\t\tconst edge = edges[ e ];\n\t\t\t\tif (\n\t\t\t\t\tlineCrossesLine( edge, line ) ||\n\t\t\t\t\tvectorEpsEquals( edge.start, line.start ) ||\n\t\t\t\t\tvectorEpsEquals( edge.end, line.end ) ||\n\t\t\t\t\tvectorEpsEquals( edge.end, line.start ) ||\n\t\t\t\t\tvectorEpsEquals( edge.start, line.end )\n\t\t\t\t) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn crossCount % 2 === 1;\n\n}\n\n// https://stackoverflow.com/questions/3838329/how-can-i-check-if-two-segments-intersect\nfunction lineCrossesLine( l1, l2 ) {\n\n\tfunction ccw( A, B, C ) {\n\n\t\treturn ( C.y - A.y ) * ( B.x - A.x ) > ( B.y - A.y ) * ( C.x - A.x );\n\n\t}\n\n\tconst A = l1.start;\n\tconst B = l1.end;\n\n\tconst C = l2.start;\n\tconst D = l2.end;\n\n\treturn ccw( A, C, D ) !== ccw( B, C, D ) && ccw( A, B, C ) !== ccw( A, B, D );\n\n}\n","import { Triangle } from 'three';\nimport { getTriCount } from './geometryUtils.js';\n\nconst _tri = new Triangle();\nexport function getSizeSortedTriList( geometry ) {\n\n\tconst index = geometry.index;\n\tconst posAttr = geometry.attributes.position;\n\tconst triCount = getTriCount( geometry );\n\n\treturn new Array( triCount )\n\t\t.fill()\n\t\t.map( ( v, i ) => {\n\n\t\t\tlet i0 = i * 3 + 0;\n\t\t\tlet i1 = i * 3 + 1;\n\t\t\tlet i2 = i * 3 + 2;\n\t\t\tif ( index ) {\n\n\t\t\t\ti0 = index.getX( i0 );\n\t\t\t\ti1 = index.getX( i1 );\n\t\t\t\ti2 = index.getX( i2 );\n\n\t\t\t}\n\n\t\t\t_tri.a.fromBufferAttribute( posAttr, i0 );\n\t\t\t_tri.b.fromBufferAttribute( posAttr, i1 );\n\t\t\t_tri.c.fromBufferAttribute( posAttr, i2 );\n\n\t\t\t_tri.a.y = 0;\n\t\t\t_tri.b.y = 0;\n\t\t\t_tri.c.y = 0;\n\n\t\t\t// get the projected area of the triangle to sort largest triangles first\n\t\t\treturn {\n\t\t\t\tarea: _tri.getArea(),\n\t\t\t\tindex: i,\n\t\t\t};\n\n\t\t} )\n\t\t.sort( ( a, b ) => {\n\n\t\t\t// sort the triangles largest to smallest\n\t\t\treturn b.area - a.area;\n\n\t\t} )\n\t\t.map( o => {\n\n\t\t\t// map to the triangle index\n\t\t\treturn o.index;\n\n\t\t} );\n\n}\n","export function getTriCount( geometry ) {\n\n\tconst { index } = geometry;\n\tconst posAttr = geometry.attributes.position;\n\treturn index ? index.count / 3 : posAttr.count / 3;\n\n}\n"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$d5b33d7c30034067$var$_canvas","$d5b33d7c30034067$export$7177b3e430c2d7ca","$d5b33d7c30034067$export$d46bd3ead7cc759b","$d5b33d7c30034067$export$2ede184fc2998901","$d5b33d7c30034067$export$d9f0486e75b5ace","$d5b33d7c30034067$export$3b296b6f144d5b03","$d5b33d7c30034067$export$533346c8e8dac0f5","$d5b33d7c30034067$export$9d9334239a5a5e06","$d5b33d7c30034067$export$c7e7c00b14f51a4f","$d5b33d7c30034067$export$727aa5ec3fe39bf0","$d5b33d7c30034067$export$d129e38cf6feaa8c","$d5b33d7c30034067$export$d2327c1afe5bfdf2","$d5b33d7c30034067$export$8a72f490b25c56c8","$d5b33d7c30034067$export$19a719f377145a13","$d5b33d7c30034067$export$5d8599b6a933fb1b","$d5b33d7c30034067$export$995b32462a65e855","$d5b33d7c30034067$export$30fac1aace31cf4d","$d5b33d7c30034067$export$4c28c87c2dc84758","$d5b33d7c30034067$export$b23a071aa286eb29","$d5b33d7c30034067$export$f0d8293634f88842","$d5b33d7c30034067$export$561f394b24edfcaa","$d5b33d7c30034067$export$ec8b666c5fe2c75a","$d5b33d7c30034067$export$6a7ef315a0d1ef07","$d5b33d7c30034067$export$c977b3e384af9ae1","$d5b33d7c30034067$export$5431306cf43de24a","$d5b33d7c30034067$export$23d6a54f0bbc85a3","$d5b33d7c30034067$export$64b5c384219d3699","$d5b33d7c30034067$export$6f7d5a9418ab2aa3","$d5b33d7c30034067$export$805e8b72413ccaba","$d5b33d7c30034067$export$a186db52eed6d40e","$d5b33d7c30034067$export$2ae72fc923e5eb5","$d5b33d7c30034067$export$e4dd07dff30cc924","$d5b33d7c30034067$export$5a465592bfe74b48","$d5b33d7c30034067$export$a2d8b23205c25948","$d5b33d7c30034067$export$892596cec99bc70e","$d5b33d7c30034067$export$55cbcc9b622fe1f5","$d5b33d7c30034067$export$8dea267bd6bde117","$d5b33d7c30034067$export$cbe7a62641830ebd","$d5b33d7c30034067$export$b7be63a67df8959","$d5b33d7c30034067$export$e176487c05830cc5","$d5b33d7c30034067$export$74e4ae24825f68d7","$d5b33d7c30034067$export$7ff5ac152ef991b0","$d5b33d7c30034067$export$9ebf355ee4ed261b","$d5b33d7c30034067$export$eb2fcfdbd7ba97d4","$d5b33d7c30034067$export$f6cc00ef28d7cf97","$d5b33d7c30034067$export$38af1803e3442a7f","$d5b33d7c30034067$export$3d5cd879f108f53f","$d5b33d7c30034067$export$920b6d07334599c7","$d5b33d7c30034067$export$b303577035157ecf","$d5b33d7c30034067$export$b127726e56765aa4","$d5b33d7c30034067$export$8f31e4c4a37b8e9c","$d5b33d7c30034067$export$32ea87a8b54d744a","$d5b33d7c30034067$export$f3c979c331175ad7","$d5b33d7c30034067$export$fbaaa33907730a0c","$d5b33d7c30034067$export$17d680238e50603e","$d5b33d7c30034067$export$ff1ed10fedfdd604","$d5b33d7c30034067$export$f85a24d745e4f17d","$d5b33d7c30034067$export$a178c45366ce5d6b","$d5b33d7c30034067$export$1c787534cb11aa3e","$d5b33d7c30034067$export$6428a7f2611ef1fa","$d5b33d7c30034067$export$96bdf6d9c66d7ba8","$d5b33d7c30034067$export$57a29a1c803e9065","$d5b33d7c30034067$export$77e9bfadfb9ab8c8","$d5b33d7c30034067$export$f2980790215acccd","$d5b33d7c30034067$export$28d04986c4269c9f","$d5b33d7c30034067$export$b558baee9c0f72d3","$d5b33d7c30034067$export$d45f0d1a4d9a9314","$d5b33d7c30034067$export$b8043f12b5aafbd7","$d5b33d7c30034067$export$5ce2dcb4cc9f2bff","$d5b33d7c30034067$export$d942c706bf23829c","$d5b33d7c30034067$export$3b0d6d7590275603","$d5b33d7c30034067$export$98435a25b5cf7b2b","$d5b33d7c30034067$export$fd1bfc71f64c538c","$d5b33d7c30034067$export$81495cbb73897362","$d5b33d7c30034067$export$4c9c1cb3f0b6f455","$d5b33d7c30034067$export$3fea33cc9972c868","$d5b33d7c30034067$export$af279bfef9ec2c96","$d5b33d7c30034067$export$b5d2dc08d867e41a","$d5b33d7c30034067$export$52286b55c4a9b51f","$d5b33d7c30034067$export$7bf70fcf9f891893","$d5b33d7c30034067$export$d712cd887b4a00f7","$d5b33d7c30034067$export$e0ba6359f1954fd3","LEFT","MIDDLE","RIGHT","ROTATE","DOLLY","PAN","DOLLY_PAN","DOLLY_ROTATE","$d5b33d7c30034067$export$42429b3acfb233a4","$d5b33d7c30034067$export$626af19ae879bdf6","$d5b33d7c30034067$export$f63012db5506e7dd","addEventListener","type","listener","undefined","_listeners","listeners","indexOf","push","hasEventListener","removeEventListener","listenerArray","index","splice","dispatchEvent","event","target","array","slice","i","l","length","$d5b33d7c30034067$var$_lut","$d5b33d7c30034067$var$_seed","$d5b33d7c30034067$var$DEG2RAD","Math","PI","$d5b33d7c30034067$var$RAD2DEG","$d5b33d7c30034067$var$generateUUID","d0","random","d1","d2","d3","uuid","toLowerCase","$d5b33d7c30034067$var$clamp","value","min","max","$d5b33d7c30034067$var$euclideanModulo","m","$d5b33d7c30034067$var$lerp","x","y","t","$d5b33d7c30034067$var$isPowerOfTwo","$d5b33d7c30034067$var$ceilPowerOfTwo","pow","ceil","log","LN2","$d5b33d7c30034067$var$floorPowerOfTwo","floor","$d5b33d7c30034067$var$denormalize","constructor","Float32Array","Uint32Array","Uint16Array","Uint8Array","Int32Array","Int16Array","Int8Array","$d5b33d7c30034067$var$normalize","round","DEG2RAD","RAD2DEG","generateUUID","clamp","euclideanModulo","mapLinear","a1","a2","b1","b2","inverseLerp","lerp","damp","lambda","dt","exp","pingpong","abs","smoothstep","smootherstep","randInt","low","high","randFloat","randFloatSpread","range","seededRandom","imul","degToRad","degrees","radToDeg","radians","isPowerOfTwo","ceilPowerOfTwo","floorPowerOfTwo","setQuaternionFromProperEuler","q","a","b","c","order","cos","sin","c2","s2","c13","s13","c1_3","s1_3","c3_1","s3_1","console","warn","normalize","denormalize","prototype","isVector2","width","height","setScalar","scalar","setX","setY","setComponent","getComponent","clone","copy","add","addScalar","addVectors","addScaledVector","sub","subScalar","subVectors","multiply","multiplyScalar","divide","divideScalar","applyMatrix3","elements","clampScalar","minVal","maxVal","clampLength","roundToZero","negate","dot","cross","lengthSq","sqrt","manhattanLength","angle","atan2","angleTo","denominator","theta","acos","distanceTo","distanceToSquared","dx","dy","manhattanDistanceTo","setLength","alpha","lerpVectors","v1","v2","equals","fromArray","offset","toArray","fromBufferAttribute","attribute","getX","getY","rotateAround","center","Symbol","iterator","$d5b33d7c30034067$export$8ff26dafa08918","n11","n12","n13","n21","n22","n23","n31","n32","n33","isMatrix3","te","identity","me","extractBasis","xAxis","yAxis","zAxis","setFromMatrix3Column","setFromMatrix4","multiplyMatrices","premultiply","ae","be","a11","a12","a13","a21","a22","a23","a31","a32","a33","b11","b12","b13","b21","b22","b23","b31","b32","b33","determinant","d","f","g","h","invert","t11","t12","t13","det","detInv","transpose","tmp","getNormalMatrix","matrix4","transposeIntoArray","r","setUvTransform","tx","ty","sx","sy","rotation","cx","cy","scale","$d5b33d7c30034067$var$_m3","makeScale","rotate","makeRotation","translate","makeTranslation","matrix","$d5b33d7c30034067$var$arrayNeedsUint32","$d5b33d7c30034067$var$createElementNS","name","document","createElementNS","Uint8ClampedArray","Float64Array","$d5b33d7c30034067$var$_cache","$d5b33d7c30034067$var$warnOnce","message","$d5b33d7c30034067$var$SRGBToLinear","$d5b33d7c30034067$var$LinearToSRGB","$d5b33d7c30034067$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3","$d5b33d7c30034067$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB","$d5b33d7c30034067$var$TO_LINEAR","color","convertSRGBToLinear","$d5b33d7c30034067$var$FROM_LINEAR","convertLinearToSRGB","$d5b33d7c30034067$export$5e6fd513f44698c","enabled","legacyMode","workingColorSpace","colorSpace","convert","sourceColorSpace","targetColorSpace","sourceToLinear","targetFromLinear","fromWorkingColorSpace","toWorkingColorSpace","$d5b33d7c30034067$export$698882cf06df44aa","getDataURL","image","canvas","test","src","HTMLCanvasElement","context","getContext","ImageData","putImageData","drawImage","toDataURL","sRGBToLinear","HTMLImageElement","ImageBitmap","imageData","getImageData","data","$d5b33d7c30034067$var$sourceId","$d5b33d7c30034067$export$1d2df86270c81ecb","isSource","version","needsUpdate","toJSON","meta","isRootObject","images","output","url","Array","isArray","isDataTexture","$d5b33d7c30034067$var$serializeImage","from","$d5b33d7c30034067$var$textureId","DEFAULT_IMAGE","mapping","DEFAULT_MAPPING","wrapS","wrapT","magFilter","minFilter","format","anisotropy","DEFAULT_ANISOTROPY","colorSpace1","isTexture","source","mipmaps","channel","internalFormat","repeat","matrixAutoUpdate","generateMipmaps","premultiplyAlpha","flipY","unpackAlignment","userData","onUpdate","isRenderTargetTexture","needsPMREMUpdate","updateMatrix","JSON","parse","stringify","textures","metadata","generator","wrap","keys","dispose","transformUv","uv","encoding","$d5b33d7c30034067$export$fa7daccca11cdbe3","z","w","isVector4","setZ","setW","applyMatrix4","setAxisAngleFromQuaternion","setAxisAngleFromRotationMatrix","m11","m12","m13","m21","m22","m23","m31","m32","m33","xx","yy","zz","xy","xz","yz","getZ","getW","$d5b33d7c30034067$export$efcb1f8bf367cbfb","options","isRenderTarget","depth","scissor","scissorTest","viewport","texture","depthBuffer","stencilBuffer","depthTexture","samples","setSize","assign","$d5b33d7c30034067$export$3c052beb2e51e23f","isWebGLRenderTarget","$d5b33d7c30034067$export$dfac6c8e811406a3","isDataArrayTexture","wrapR","isQuaternion","_x","_y","_z","_w","slerpFlat","dst","dstOffset","src0","srcOffset0","src1","srcOffset1","x0","y0","z0","w0","x1","y1","z1","w1","dir","sqrSin","Number","EPSILON","len","tDir","multiplyQuaternionsFlat","_onChangeCallback","quaternion","setFromEuler","euler","update","_order","c1","c3","s1","s3","setFromAxisAngle","axis","halfAngle","setFromRotationMatrix","trace","setFromUnitVectors","vFrom","vTo","rotateTowards","step","slerp","conjugate","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","qb","cosHalfTheta","sqrSinHalfTheta","sinHalfTheta","halfTheta","ratioA","ratioB","slerpQuaternions","qa","u1","sqrt1u1","sqrtu1","u2","u3","_onChange","callback","isVector3","multiplyVectors","applyEuler","applyQuaternion","$d5b33d7c30034067$var$_quaternion$4","applyAxisAngle","applyNormalMatrix","qx","qy","qz","qw","ix","iy","iz","iw","project","camera","matrixWorldInverse","projectionMatrix","unproject","projectionMatrixInverse","matrixWorld","transformDirection","crossVectors","ax","ay","az","bx","by","bz","projectOnVector","projectOnPlane","planeNormal","$d5b33d7c30034067$var$_vector$b","reflect","normal","dz","setFromSpherical","setFromSphericalCoords","radius","phi","sinPhiRadius","setFromCylindrical","setFromCylindricalCoords","setFromMatrixPosition","setFromMatrixScale","setFromMatrixColumn","sz","setFromColor","randomDirection","u","Infinity","isBox3","setFromArray","makeEmpty","il","expandByPoint","$d5b33d7c30034067$var$_vector$a","setFromBufferAttribute","count","setFromPoints","points","setFromCenterAndSize","size","halfSize","setFromObject","object","precise","expandByObject","box","isEmpty","getCenter","getSize","point","expandByVector","vector","expandByScalar","updateWorldMatrix","boundingBox","computeBoundingBox","$d5b33d7c30034067$var$_box$3","union","geometry","attributes","position","children","containsPoint","containsBox","getParameter","intersectsBox","intersectsSphere","sphere","clampPoint","intersectsPlane","plane","constant","intersectsTriangle","triangle","$d5b33d7c30034067$var$_center","$d5b33d7c30034067$var$_extents","$d5b33d7c30034067$var$_v0$2","$d5b33d7c30034067$var$_v1$7","$d5b33d7c30034067$var$_v2$4","$d5b33d7c30034067$var$_f0","$d5b33d7c30034067$var$_f1","$d5b33d7c30034067$var$_f2","axes","$d5b33d7c30034067$var$satForAxes","$d5b33d7c30034067$var$_triangleNormal","distanceToPoint","getBoundingSphere","intersect","$d5b33d7c30034067$var$_points","$d5b33d7c30034067$var$_testAxis","v0","extents","j","p0","p1","p2","$d5b33d7c30034067$var$_box$2","$d5b33d7c30034067$var$_v1$6","$d5b33d7c30034067$var$_v2$3","optionalCenter","maxRadiusSq","radiusSum","deltaLengthSq","getBoundingBox","getMaxScaleOnAxis","delta","$d5b33d7c30034067$var$_vector$9","$d5b33d7c30034067$var$_segCenter","$d5b33d7c30034067$var$_segDir","$d5b33d7c30034067$var$_diff","$d5b33d7c30034067$var$_edge1","$d5b33d7c30034067$var$_edge2","$d5b33d7c30034067$var$_normal$1","origin","direction","ray","at","lookAt","recast","closestPointToPoint","directionDistance","distanceSqToPoint","distanceSqToSegment","optionalPointOnRay","optionalPointOnSegment","s0","sqrDist","extDet","segExtent","a01","b0","invDet","intersectSphere","tca","radius2","thc","t0","t1","distanceToPlane","intersectPlane","distToPoint","intersectBox","tmin","tmax","tymin","tymax","tzmin","tzmax","invdirx","invdiry","invdirz","isNaN","intersectTriangle","backfaceCulling","sign","DdN","DdQxE2","DdE1xQ","QdN","n14","n24","n34","n41","n42","n43","n44","isMatrix4","copyPosition","setFromMatrix3","makeBasis","extractRotation","scaleX","$d5b33d7c30034067$var$_v1$5","scaleY","scaleZ","makeRotationFromEuler","af","bf","ce","cf","de","df","ac","ad","bc","bd","makeRotationFromQuaternion","compose","$d5b33d7c30034067$var$_zero","$d5b33d7c30034067$var$_one","eye","up","$d5b33d7c30034067$var$_z","$d5b33d7c30034067$var$_x","$d5b33d7c30034067$var$_y","a14","a24","a34","a41","a42","a43","a44","b14","b24","b34","b41","b42","b43","b44","setPosition","t14","scaleXSq","scaleYSq","scaleZSq","makeRotationX","makeRotationY","makeRotationZ","makeRotationAxis","makeShear","yx","zx","zy","x2","y2","z2","wx","wy","wz","decompose","$d5b33d7c30034067$var$_m1$2","invSX","invSY","invSZ","makePerspective","left","right","top","bottom","near","far","coordinateSystem","makeOrthographic","zInv","p","$d5b33d7c30034067$var$_matrix","$d5b33d7c30034067$var$_quaternion$3","$d5b33d7c30034067$export$d93cc409a0768c5f","DEFAULT_ORDER","isEuler","asin","setFromQuaternion","setFromVector3","reorder","newOrder","$d5b33d7c30034067$export$89312ce47c0ca777","mask","enable","enableAll","toggle","disable","disableAll","layers","isEnabled","$d5b33d7c30034067$var$_object3DId","$d5b33d7c30034067$var$_v1$4","$d5b33d7c30034067$var$_q1","$d5b33d7c30034067$var$_m1$1","$d5b33d7c30034067$var$_target","$d5b33d7c30034067$var$_position$3","$d5b33d7c30034067$var$_scale$2","$d5b33d7c30034067$var$_quaternion$2","$d5b33d7c30034067$var$_xAxis","$d5b33d7c30034067$var$_yAxis","$d5b33d7c30034067$var$_zAxis","$d5b33d7c30034067$var$_addedEvent","$d5b33d7c30034067$var$_removedEvent","isObject3D","parent","DEFAULT_UP","defineProperties","modelViewMatrix","normalMatrix","DEFAULT_MATRIX_AUTO_UPDATE","matrixWorldNeedsUpdate","matrixWorldAutoUpdate","DEFAULT_MATRIX_WORLD_AUTO_UPDATE","visible","castShadow","receiveShadow","frustumCulled","renderOrder","animations","onBeforeRender","onAfterRender","setRotationFromAxisAngle","setRotationFromEuler","setRotationFromMatrix","setRotationFromQuaternion","rotateOnAxis","rotateOnWorldAxis","rotateX","rotateY","rotateZ","translateOnAxis","distance","translateX","translateY","translateZ","localToWorld","worldToLocal","isCamera","isLight","arguments","error","remove","removeFromParent","clear","attach","getObjectById","getObjectByProperty","getObjectByName","child","getObjectsByProperty","result","childResult","concat","getWorldPosition","getWorldQuaternion","getWorldScale","getWorldDirection","raycast","traverse","traverseVisible","traverseAncestors","updateMatrixWorld","force","updateParents","updateChildren","geometries","materials","shapes","skeletons","nodes","serialize","library","element","isInstancedMesh","instanceMatrix","instanceColor","isScene","background","isColor","environment","isMesh","isLine","isPoints","parameters","shape","isSkinnedMesh","bindMode","bindMatrix","skeleton","material","uuids","animation","extractFromCache","cache","values","key","recursive","$d5b33d7c30034067$var$_v0$1","$d5b33d7c30034067$var$_v1$3","$d5b33d7c30034067$var$_v2$2","$d5b33d7c30034067$var$_v3$1","$d5b33d7c30034067$var$_vab","$d5b33d7c30034067$var$_vac","$d5b33d7c30034067$var$_vbc","$d5b33d7c30034067$var$_vap","$d5b33d7c30034067$var$_vbp","$d5b33d7c30034067$var$_vcp","$d5b33d7c30034067$var$warnedGetUV","getNormal","targetLengthSq","getBarycoord","dot00","dot01","dot02","dot11","dot12","denom","invDenom","getUV","p3","uv1","uv2","uv3","getInterpolation","v3","isFrontFacing","setFromPointsAndIndices","i0","i1","i2","setFromAttributeAndIndices","getArea","getMidpoint","getPlane","setFromCoplanarPoints","d4","vc","d5","d6","vb","va","$d5b33d7c30034067$var$materialId","isMaterial","blending","side","vertexColors","opacity","transparent","alphaHash","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","depthFunc","depthTest","depthWrite","stencilWriteMask","stencilFunc","stencilRef","stencilFuncMask","stencilFail","stencilZFail","stencilZPass","stencilWrite","clippingPlanes","clipIntersection","clipShadows","shadowSide","colorWrite","precision","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","dithering","alphaToCoverage","premultipliedAlpha","forceSinglePass","toneMapped","_alphaTest","alphaTest","onBuild","onBeforeCompile","customProgramCacheKey","toString","setValues","newValue","currentValue","getHex","roughness","metalness","sheen","sheenColor","sheenRoughness","emissive","emissiveIntensity","specular","specularIntensity","specularColor","shininess","clearcoat","clearcoatRoughness","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","clearcoatNormalScale","iridescence","iridescenceIOR","iridescenceThicknessRange","iridescenceMap","iridescenceThicknessMap","anisotropyRotation","anisotropyMap","map","matcap","alphaMap","lightMap","lightMapIntensity","aoMap","aoMapIntensity","bumpMap","bumpScale","normalMap","normalMapType","normalScale","displacementMap","displacementScale","displacementBias","roughnessMap","metalnessMap","emissiveMap","specularMap","specularIntensityMap","specularColorMap","envMap","combine","envMapIntensity","reflectivity","refractionRatio","gradientMap","transmission","transmissionMap","thickness","thicknessMap","attenuationDistance","attenuationColor","sizeAttenuation","linewidth","dashSize","gapSize","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","flatShading","fog","srcPlanes","dstPlanes","$d5b33d7c30034067$var$_colorKeywords","$d5b33d7c30034067$var$_hslA","$d5b33d7c30034067$var$_hslB","$d5b33d7c30034067$var$hue2rgb","setHex","setStyle","setRGB","hex","setHSL","style","handleAlpha","string","parseFloat","exec","components","parseInt","charAt","setColorName","copySRGBToLinear","copyLinearToSRGB","$d5b33d7c30034067$var$_color","getHexString","getHSL","hue","saturation","lightness","getRGB","getStyle","toFixed","offsetHSL","addColors","color1","color2","lerpColors","lerpHSL","NAMES","isMeshBasicMaterial","$d5b33d7c30034067$var$_vector$8","$d5b33d7c30034067$var$_vector2$1","itemSize","normalized","TypeError","isBufferAttribute","usage","updateRange","gpuType","onUploadCallback","setUsage","copyAt","index1","index2","copyArray","setXY","setXYZ","component","setXYZW","onUpload","$d5b33d7c30034067$export$640a853f68025f2e","$d5b33d7c30034067$export$7eb8c9fa25cd5bd6","$d5b33d7c30034067$var$_id$1","$d5b33d7c30034067$var$_m1","$d5b33d7c30034067$var$_obj","$d5b33d7c30034067$var$_offset","$d5b33d7c30034067$var$_box$1","$d5b33d7c30034067$var$_boxMorphTargets","$d5b33d7c30034067$var$_vector$7","isBufferGeometry","morphAttributes","morphTargetsRelative","groups","boundingSphere","drawRange","start","getIndex","setIndex","getAttribute","setAttribute","deleteAttribute","hasAttribute","addGroup","materialIndex","clearGroups","setDrawRange","tangent","computeBoundingSphere","morphAttributesPosition","isGLBufferAttribute","morphAttribute","jl","computeTangents","indices","positions","normals","uvs","nVertices","tangents","tan1","tan2","vA","vB","vC","uvA","uvB","uvC","sdir","tdir","group","handleTriangle","isFinite","tmp2","n2","handleVertex","computeVertexNormals","positionAttribute","normalAttribute","pA","pB","pC","nA","nB","nC","cb","ab","normalizeNormals","toNonIndexed","convertBufferAttribute","array2","isInterleavedBufferAttribute","stride","geometry2","newAttribute","morphArray","hasMorphAttributes","attributeArray","$d5b33d7c30034067$var$_inverseMatrix$3","$d5b33d7c30034067$var$_ray$3","$d5b33d7c30034067$var$_sphere$5","$d5b33d7c30034067$var$_sphereHitAt","$d5b33d7c30034067$var$_vA$1","$d5b33d7c30034067$var$_vB$1","$d5b33d7c30034067$var$_vC$1","$d5b33d7c30034067$var$_tempA","$d5b33d7c30034067$var$_morphA","$d5b33d7c30034067$var$_uvA$1","$d5b33d7c30034067$var$_uvB$1","$d5b33d7c30034067$var$_uvC$1","$d5b33d7c30034067$var$_normalA","$d5b33d7c30034067$var$_normalB","$d5b33d7c30034067$var$_normalC","$d5b33d7c30034067$var$_intersectionPoint","$d5b33d7c30034067$var$_intersectionPointWorld","updateMorphTargets","morphTargetInfluences","morphTargetDictionary","ml","String","getVertexPosition","morphPosition","morphInfluences","influence","raycaster","intersects","_computeIntersections","rayLocalSpace","intersection","groupMaterial","end","$d5b33d7c30034067$var$checkGeometryIntersection","faceIndex","face","$d5b33d7c30034067$var$checkIntersection","$d5b33d7c30034067$export$33e43285f7406bd5","widthSegments","heightSegments","depthSegments","scope","vertices","numberOfVertices","groupStart","buildPlane","udir","vdir","gridX","gridY","segmentWidth","segmentHeight","widthHalf","heightHalf","depthHalf","gridX1","gridY1","vertexCounter","groupCount","fromJSON","$d5b33d7c30034067$var$cloneUniforms","property","$d5b33d7c30034067$var$mergeUniforms","uniforms","merged","$d5b33d7c30034067$var$getUnlitUniformColorSpace","renderer","getRenderTarget","outputColorSpace","$d5b33d7c30034067$export$d8ecdf8615bfea69","merge","$d5b33d7c30034067$export$83c7d75d550a8b0d","isShaderMaterial","defines","uniformsGroups","vertexShader","fragmentShader","lights","clipping","extensions","derivatives","fragDepth","drawBuffers","shaderTextureLOD","defaultAttributeValues","index0AttributeName","uniformsNeedUpdate","glslVersion","$d5b33d7c30034067$var$cloneUniformsGroups","uniform","$d5b33d7c30034067$export$79f141de891a5fed","fov","aspect","isPerspectiveCamera","zoom","focus","view","filmGauge","filmOffset","updateProjectionMatrix","setFocalLength","focalLength","vExtentSlope","getFilmHeight","atan","getFocalLength","tan","getEffectiveFOV","getFilmWidth","setViewOffset","fullWidth","fullHeight","offsetX","offsetY","clearViewOffset","skew","$d5b33d7c30034067$export$d0cdd0bd804995de","renderTarget","cameraPX","cameraNX","cameraPY","cameraNY","cameraPZ","cameraNZ","updateCoordinateSystem","cameras","scene","currentRenderTarget","currentXrEnabled","xr","setRenderTarget","render","$d5b33d7c30034067$export$ee2e5a18258a4049","isCubeTexture","$d5b33d7c30034067$export$ac386671d651941e","isWebGLCubeRenderTarget","fromEquirectangularTexture","shader","tEquirect","mesh","currentMinFilter","stencil","$d5b33d7c30034067$var$_vector1","$d5b33d7c30034067$var$_vector2","$d5b33d7c30034067$var$_normalMatrix","isPlane","setComponents","setFromNormalAndCoplanarPoint","inverseNormalLength","distanceToSphere","projectPoint","intersectLine","line","intersectsLine","startSign","endSign","coplanarPoint","optionalNormalMatrix","referencePoint","$d5b33d7c30034067$var$_sphere$4","$d5b33d7c30034067$var$_vector$6","$d5b33d7c30034067$export$35efe6f4c85463d2","p4","p5","planes","frustum","setFromProjectionMatrix","me0","me1","me2","me3","me4","me5","me6","me7","me8","me9","me10","me11","me12","me13","me14","me15","intersectsObject","intersectsSprite","sprite","negRadius","$d5b33d7c30034067$var$WebGLAnimation","isAnimating","animationLoop","requestId","onAnimationFrame","time","frame","requestAnimationFrame","stop","cancelAnimationFrame","setAnimationLoop","setContext","$d5b33d7c30034067$var$WebGLAttributes","gl","capabilities","isWebGL2","buffers","WeakMap","deleteBuffer","buffer","delete","bufferType","cached","bytesPerElement","elementSize","createBuffer","bindBuffer","bufferData","FLOAT","isFloat16BufferAttribute","HALF_FLOAT","UNSIGNED_SHORT","SHORT","UNSIGNED_INT","INT","BYTE","UNSIGNED_BYTE","BYTES_PER_ELEMENT","updateBuffer","bufferSubData","subarray","$d5b33d7c30034067$export$967d831af31f69ce","width_half","height_half","segment_width","segment_height","$d5b33d7c30034067$export$955f9f2e84c43c8b","alphahash_fragment","alphahash_pars_fragment","alphamap_fragment","alphamap_pars_fragment","alphatest_fragment","alphatest_pars_fragment","aomap_fragment","aomap_pars_fragment","begin_vertex","beginnormal_vertex","bsdfs","iridescence_fragment","bumpmap_pars_fragment","clipping_planes_fragment","clipping_planes_pars_fragment","clipping_planes_pars_vertex","clipping_planes_vertex","color_fragment","color_pars_fragment","color_pars_vertex","color_vertex","common","cube_uv_reflection_fragment","defaultnormal_vertex","displacementmap_pars_vertex","displacementmap_vertex","emissivemap_fragment","emissivemap_pars_fragment","colorspace_fragment","colorspace_pars_fragment","envmap_fragment","envmap_common_pars_fragment","envmap_pars_fragment","envmap_pars_vertex","envmap_physical_pars_fragment","envmap_vertex","fog_vertex","fog_pars_vertex","fog_fragment","fog_pars_fragment","gradientmap_pars_fragment","lightmap_fragment","lightmap_pars_fragment","lights_lambert_fragment","lights_lambert_pars_fragment","lights_pars_begin","lights_toon_fragment","lights_toon_pars_fragment","lights_phong_fragment","lights_phong_pars_fragment","lights_physical_fragment","lights_physical_pars_fragment","lights_fragment_begin","lights_fragment_maps","lights_fragment_end","logdepthbuf_fragment","logdepthbuf_pars_fragment","logdepthbuf_pars_vertex","logdepthbuf_vertex","map_fragment","map_pars_fragment","map_particle_fragment","map_particle_pars_fragment","metalnessmap_fragment","metalnessmap_pars_fragment","morphcolor_vertex","morphnormal_vertex","morphtarget_pars_vertex","morphtarget_vertex","normal_fragment_begin","normal_fragment_maps","normal_pars_fragment","normal_pars_vertex","normal_vertex","normalmap_pars_fragment","clearcoat_normal_fragment_begin","clearcoat_normal_fragment_maps","clearcoat_pars_fragment","iridescence_pars_fragment","opaque_fragment","packing","premultiplied_alpha_fragment","project_vertex","dithering_fragment","dithering_pars_fragment","roughnessmap_fragment","roughnessmap_pars_fragment","shadowmap_pars_fragment","shadowmap_pars_vertex","shadowmap_vertex","shadowmask_pars_fragment","skinbase_vertex","skinning_pars_vertex","skinning_vertex","skinnormal_vertex","specularmap_fragment","specularmap_pars_fragment","tonemapping_fragment","tonemapping_pars_fragment","transmission_fragment","transmission_pars_fragment","uv_pars_fragment","uv_pars_vertex","uv_vertex","worldpos_vertex","background_vert","background_frag","backgroundCube_vert","backgroundCube_frag","cube_vert","cube_frag","depth_vert","depth_frag","distanceRGBA_vert","distanceRGBA_frag","equirect_vert","equirect_frag","linedashed_vert","linedashed_frag","meshbasic_vert","meshbasic_frag","meshlambert_vert","meshlambert_frag","meshmatcap_vert","meshmatcap_frag","meshnormal_vert","meshnormal_frag","meshphong_vert","meshphong_frag","meshphysical_vert","meshphysical_frag","meshtoon_vert","meshtoon_frag","points_vert","points_frag","shadow_vert","shadow_frag","sprite_vert","sprite_frag","$d5b33d7c30034067$export$6643083551874bf5","diffuse","mapTransform","alphaMapTransform","specularmap","specularMapTransform","envmap","flipEnvMap","ior","aomap","aoMapTransform","lightmap","lightMapTransform","bumpmap","bumpMapTransform","normalmap","normalMapTransform","displacementmap","displacementMapTransform","emissivemap","emissiveMapTransform","metalnessmap","metalnessMapTransform","roughnessmap","roughnessMapTransform","gradientmap","fogDensity","fogNear","fogFar","fogColor","ambientLightColor","lightProbe","directionalLights","properties","directionalLightShadows","shadowBias","shadowNormalBias","shadowRadius","shadowMapSize","directionalShadowMap","directionalShadowMatrix","spotLights","coneCos","penumbraCos","decay","spotLightShadows","spotLightMap","spotShadowMap","spotLightMatrix","pointLights","pointLightShadows","shadowCameraNear","shadowCameraFar","pointShadowMap","pointShadowMatrix","hemisphereLights","skyColor","groundColor","rectAreaLights","ltc_1","ltc_2","uvTransform","$d5b33d7c30034067$export$bee4a7d47f8f5014","basic","lambert","phong","standard","toon","dashed","totalSize","t2D","backgroundIntensity","backgroundCube","backgroundBlurriness","cube","tCube","tFlip","equirect","distanceRGBA","referencePosition","nearDistance","farDistance","shadow","physical","clearcoatMapTransform","clearcoatNormalMapTransform","clearcoatRoughnessMapTransform","iridescenceMapTransform","iridescenceThicknessMinimum","iridescenceThicknessMaximum","iridescenceThicknessMapTransform","sheenColorMap","sheenColorMapTransform","sheenRoughnessMap","sheenRoughnessMapTransform","transmissionMapTransform","transmissionSamplerSize","transmissionSamplerMap","thicknessMapTransform","specularColorMapTransform","specularIntensityMapTransform","anisotropyVector","anisotropyMapTransform","$d5b33d7c30034067$var$_rgb","$d5b33d7c30034067$var$WebGLBackground","cubemaps","cubeuvmaps","state","objects","planeMesh","boxMesh","clearColor","clearAlpha","currentBackground","currentBackgroundVersion","currentTonemapping","setClear","getClearColor","setClearColor","getClearAlpha","setClearAlpha","renderList","forceClear","usePMREM","environmentBlendMode","getEnvironmentBlendMode","autoClear","autoClearColor","autoClearDepth","autoClearStencil","toneMapping","unshift","$d5b33d7c30034067$var$WebGLBindingStates","maxVertexAttributes","MAX_VERTEX_ATTRIBS","extension","vaoAvailable","bindingStates","defaultState","createBindingState","currentState","forceUpdate","bindVertexArrayObject","vao","bindVertexArray","bindVertexArrayOES","deleteVertexArrayObject","deleteVertexArray","deleteVertexArrayOES","newAttributes","enabledAttributes","attributeDivisors","program","initAttributes","enableAttribute","enableAttributeAndDivisor","meshPerAttribute","enableVertexAttribArray","disableUnusedAttributes","disableVertexAttribArray","vertexAttribPointer","integer","vertexAttribIPointer","reset","resetDefaultState","setup","updateBuffers","getBindingState","programMap","stateMap","createVertexArray","createVertexArrayOES","cachedAttributes","geometryAttributes","attributesNum","programAttributes","getAttributes","programAttribute","location","cachedAttribute","geometryAttribute","saveCache","ELEMENT_ARRAY_BUFFER","setupVertexAttributes","isInstancedBufferGeometry","materialDefaultAttributeValues","isInstancedInterleavedBuffer","locationSize","_maxInstanceCount","ARRAY_BUFFER","isInstancedBufferAttribute","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","vertexAttrib1fv","geometryId","programId","releaseStatesOfGeometry","releaseStatesOfProgram","$d5b33d7c30034067$var$WebGLBufferRenderer","info","mode","setMode","drawArrays","renderInstances","primcount","methodName","$d5b33d7c30034067$var$WebGLCapabilities","maxAnisotropy","getMaxPrecision","getShaderPrecisionFormat","VERTEX_SHADER","HIGH_FLOAT","FRAGMENT_SHADER","MEDIUM_FLOAT","WebGL2RenderingContext","maxPrecision","has","logarithmicDepthBuffer","maxTextures","MAX_TEXTURE_IMAGE_UNITS","maxVertexTextures","MAX_VERTEX_TEXTURE_IMAGE_UNITS","maxTextureSize","MAX_TEXTURE_SIZE","maxCubemapSize","MAX_CUBE_MAP_TEXTURE_SIZE","maxAttributes","maxVertexUniforms","MAX_VERTEX_UNIFORM_VECTORS","maxVaryings","MAX_VARYING_VECTORS","maxFragmentUniforms","MAX_FRAGMENT_UNIFORM_VECTORS","vertexTextures","floatFragmentTextures","maxSamples","MAX_SAMPLES","getMaxAnisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT","floatVertexTextures","$d5b33d7c30034067$var$WebGLClipping","globalState","numGlobalPlanes","localClippingEnabled","renderingShadows","viewNormalMatrix","projectPlanes","skipTransform","nPlanes","dstArray","flatSize","viewMatrix","i4","numPlanes","numIntersection","enableLocalClipping","beginShadows","endShadows","setGlobalState","setState","useCache","materialProperties","nGlobal","lGlobal","clippingState","$d5b33d7c30034067$var$WebGLCubeMaps","mapTextureMapping","onTextureDispose","cubemap","isOrthographicCamera","scaleW","scaleH","$d5b33d7c30034067$var$EXTRA_LOD_SIGMA","$d5b33d7c30034067$var$_flatCamera","$d5b33d7c30034067$var$_clearColor","$d5b33d7c30034067$var$_oldTarget","$d5b33d7c30034067$var$PHI","$d5b33d7c30034067$var$INV_PHI","$d5b33d7c30034067$var$_axisDirections","$d5b33d7c30034067$export$6add42717753e221","_renderer","_pingPongRenderTarget","_lodMax","_cubeSize","_lodPlanes","_sizeLods","_sigmas","_blurMaterial","_cubemapMaterial","_equirectMaterial","_compileMaterial","fromScene","sigma","_setSize","cubeUVRenderTarget","_allocateTargets","_sceneToCubeUV","_blur","_applyPMREM","_cleanup","fromEquirectangular","equirectangular","_fromTexture","fromCubemap","compileCubemapShader","$d5b33d7c30034067$var$_getCubemapMaterial","compileEquirectangularShader","$d5b33d7c30034067$var$_getEquirectMaterial","_dispose","cubeSize","log2","outputTarget","$d5b33d7c30034067$var$_setViewport","_textureToCubeUV","params","$d5b33d7c30034067$var$_createRenderTarget","sizeLods","lodPlanes","sigmas","$d5b33d7c30034067$var$_createPlanes","lodMax","lod","totalLods","sizeLod","texelSize","positionSize","uvSize","faceIndexSize","coordinates","fill","$d5b33d7c30034067$var$_getBlurShader","weights","poleAxis","shaderMaterial","$d5b33d7c30034067$var$_getCommonVertexShader","tmpMesh","compile","cubeCamera","upSign","forwardSign","originalAutoClear","backgroundMaterial","backgroundBox","useSolidColor","col","lodIn","lodOut","pingPongRenderTarget","_halfBlur","targetIn","targetOut","sigmaRadians","blurMaterial","blurMesh","blurUniforms","pixels","radiansPerPixel","sigmaPixels","STANDARD_DEVIATIONS","sum","weight","outputSize","$d5b33d7c30034067$var$WebGLCubeUVMaps","cubeUVmaps","pmremGenerator","cubemapUV","isEquirectMap","isCubeMap","isCubeTextureComplete","$d5b33d7c30034067$var$WebGLExtensions","getExtension","$d5b33d7c30034067$var$WebGLGeometries","wireframeAttributes","onGeometryDispose","memory","updateWireframeAttribute","geometryIndex","geometryPosition","previousAttribute","getWireframeAttribute","currentAttribute","$d5b33d7c30034067$var$WebGLIndexedBufferRenderer","drawElements","$d5b33d7c30034067$var$WebGLInfo","calls","triangles","lines","programs","autoReset","instanceCount","TRIANGLES","LINES","LINE_STRIP","LINE_LOOP","POINTS","$d5b33d7c30034067$var$numericalSort","$d5b33d7c30034067$var$absNumericalSort","$d5b33d7c30034067$var$WebGLMorphtargets","influencesList","morphTextures","morph","workInfluences","objectInfluences","morphTargetsCount","entry","hasMorphPosition","hasMorphNormals","hasMorphColors","morphTargets","morphNormals","morphColors","vertexDataCount","vertexDataStride","morphTarget","morphNormal","morphColor","disposeTexture","morphInfluencesSum","morphBaseInfluence","getUniforms","setValue","influences","sort","MAX_SAFE_INTEGER","$d5b33d7c30034067$var$WebGLObjects","updateMap","onInstancedMeshDispose","instancedMesh","buffergeometry","$d5b33d7c30034067$var$emptyTexture","$d5b33d7c30034067$var$emptyArrayTexture","$d5b33d7c30034067$var$empty3dTexture","isData3DTexture","$d5b33d7c30034067$var$emptyCubeTexture","$d5b33d7c30034067$var$arrayCacheF32","$d5b33d7c30034067$var$arrayCacheI32","$d5b33d7c30034067$var$mat4array","$d5b33d7c30034067$var$mat3array","$d5b33d7c30034067$var$mat2array","$d5b33d7c30034067$var$flatten","nBlocks","blockSize","firstElem","$d5b33d7c30034067$var$arraysEqual","$d5b33d7c30034067$var$copyArray","$d5b33d7c30034067$var$allocTexUnits","allocateTextureUnit","$d5b33d7c30034067$var$setValueV1f","uniform1f","addr","$d5b33d7c30034067$var$setValueV2f","uniform2f","uniform2fv","$d5b33d7c30034067$var$setValueV3f","uniform3f","uniform3fv","$d5b33d7c30034067$var$setValueV4f","uniform4f","uniform4fv","$d5b33d7c30034067$var$setValueM2","uniformMatrix2fv","$d5b33d7c30034067$var$setValueM3","uniformMatrix3fv","$d5b33d7c30034067$var$setValueM4","uniformMatrix4fv","$d5b33d7c30034067$var$setValueV1i","uniform1i","$d5b33d7c30034067$var$setValueV2i","uniform2i","uniform2iv","$d5b33d7c30034067$var$setValueV3i","uniform3i","uniform3iv","$d5b33d7c30034067$var$setValueV4i","uniform4i","uniform4iv","$d5b33d7c30034067$var$setValueV1ui","uniform1ui","$d5b33d7c30034067$var$setValueV2ui","uniform2ui","uniform2uiv","$d5b33d7c30034067$var$setValueV3ui","uniform3ui","uniform3uiv","$d5b33d7c30034067$var$setValueV4ui","uniform4ui","uniform4uiv","$d5b33d7c30034067$var$setValueT1","unit","setTexture2D","$d5b33d7c30034067$var$setValueT3D1","setTexture3D","$d5b33d7c30034067$var$setValueT6","setTextureCube","$d5b33d7c30034067$var$setValueT2DArray1","setTexture2DArray","$d5b33d7c30034067$var$setValueV1fArray","uniform1fv","$d5b33d7c30034067$var$setValueV2fArray","$d5b33d7c30034067$var$setValueV3fArray","$d5b33d7c30034067$var$setValueV4fArray","$d5b33d7c30034067$var$setValueM2Array","$d5b33d7c30034067$var$setValueM3Array","$d5b33d7c30034067$var$setValueM4Array","$d5b33d7c30034067$var$setValueV1iArray","uniform1iv","$d5b33d7c30034067$var$setValueV2iArray","$d5b33d7c30034067$var$setValueV3iArray","$d5b33d7c30034067$var$setValueV4iArray","$d5b33d7c30034067$var$setValueV1uiArray","uniform1uiv","$d5b33d7c30034067$var$setValueV2uiArray","$d5b33d7c30034067$var$setValueV3uiArray","$d5b33d7c30034067$var$setValueV4uiArray","$d5b33d7c30034067$var$setValueT1Array","units","$d5b33d7c30034067$var$setValueT3DArray","$d5b33d7c30034067$var$setValueT6Array","$d5b33d7c30034067$var$setValueT2DArrayArray","$d5b33d7c30034067$var$SingleUniform","activeInfo","$d5b33d7c30034067$var$getSingularSetter","$d5b33d7c30034067$var$PureArrayUniform","$d5b33d7c30034067$var$getPureArraySetter","$d5b33d7c30034067$var$StructuredUniform","seq","$d5b33d7c30034067$var$RePathPart","$d5b33d7c30034067$var$addUniform","container","uniformObject","$d5b33d7c30034067$var$WebGLUniforms","getProgramParameter","ACTIVE_UNIFORMS","getActiveUniform","getUniformLocation","$d5b33d7c30034067$var$parseUniform","path","pathLength","lastIndex","match","matchEnd","idIsIndex","subscript","next","setOptional","upload","seqWithValue","$d5b33d7c30034067$var$WebGLShader","createShader","shaderSource","compileShader","$d5b33d7c30034067$var$programIdCount","$d5b33d7c30034067$var$getShaderErrors","status","getShaderParameter","COMPILE_STATUS","errors","getShaderInfoLog","trim","errorMatches","errorLine","toUpperCase","$d5b33d7c30034067$var$handleSource","split","lines2","to","join","getShaderSource","$d5b33d7c30034067$var$filterEmptyLine","$d5b33d7c30034067$var$replaceLightNums","numSpotLightCoords","numSpotLightShadows","numSpotLightMaps","numSpotLightShadowsWithMaps","replace","numDirLights","numSpotLights","numRectAreaLights","numPointLights","numHemiLights","numDirLightShadows","numPointLightShadows","$d5b33d7c30034067$var$replaceClippingPlaneNums","numClippingPlanes","numClipIntersection","$d5b33d7c30034067$var$includePattern","$d5b33d7c30034067$var$resolveIncludes","$d5b33d7c30034067$var$includeReplacer","$d5b33d7c30034067$var$shaderChunkMap","Map","include","newInclude","$d5b33d7c30034067$var$unrollLoopPattern","$d5b33d7c30034067$var$unrollLoops","$d5b33d7c30034067$var$loopReplacer","snippet","$d5b33d7c30034067$var$generatePrecision","precisionstring","$d5b33d7c30034067$var$WebGLProgram","cacheKey","prefixVertex","prefixFragment","cachedUniforms","shadowMapTypeDefine","envMapModeDefine","shadowMapType","envMapTypeDefine","$d5b33d7c30034067$var$generateEnvMapTypeDefine","envMapMode","envMapBlendingDefine","$d5b33d7c30034067$var$generateEnvMapBlendingDefine","envMapCubeUVSize","$d5b33d7c30034067$var$generateCubeUVSize","imageHeight","envMapCubeUVHeight","maxMip","texelWidth","texelHeight","customExtensions","$d5b33d7c30034067$var$generateExtensions","chunks","extensionDerivatives","normalMapTangentSpace","shaderID","extensionFragDepth","rendererExtensionFragDepth","extensionDrawBuffers","rendererExtensionDrawBuffers","extensionShaderTextureLOD","rendererExtensionShaderTextureLod","filter","customDefines","$d5b33d7c30034067$var$generateDefines","createProgram","versionString","isRawShaderMaterial","shaderType","shaderName","instancing","instancingColor","useFog","fogExp2","normalMapObjectSpace","mapUv","alphaMapUv","lightMapUv","aoMapUv","emissiveMapUv","bumpMapUv","normalMapUv","displacementMapUv","metalnessMapUv","roughnessMapUv","anisotropyMapUv","clearcoatMapUv","clearcoatNormalMapUv","clearcoatRoughnessMapUv","iridescenceMapUv","iridescenceThicknessMapUv","sheenColorMapUv","sheenRoughnessMapUv","specularMapUv","specularColorMapUv","specularIntensityMapUv","transmissionMapUv","thicknessMapUv","vertexTangents","vertexAlphas","vertexUv1s","vertexUv2s","vertexUv3s","pointsUvs","skinning","morphTextureStride","doubleSided","flipSided","shadowMapEnabled","useLegacyLights","$d5b33d7c30034067$var$getToneMappingFunction","functionName","toneMappingName","opaque","$d5b33d7c30034067$var$getTexelEncodingFunction","$d5b33d7c30034067$var$getEncodingComponents","useDepthPacking","depthPacking","vertexGlsl","fragmentGlsl","glVertexShader","glFragmentShader","attachShader","bindAttribLocation","linkProgram","debug","checkShaderErrors","programLog","getProgramInfoLog","vertexLog","fragmentLog","runnable","haveDiagnostics","LINK_STATUS","onShaderError","vertexErrors","fragmentErrors","getError","VALIDATE_STATUS","diagnostics","prefix","deleteShader","$d5b33d7c30034067$var$fetchAttributeLocations","ACTIVE_ATTRIBUTES","getActiveAttrib","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","getAttribLocation","destroy","deleteProgram","usedTimes","$d5b33d7c30034067$var$_id","$d5b33d7c30034067$var$WebGLShaderCache","shaderCache","materialCache","vertexShaderStage","_getShaderStage","fragmentShaderStage","materialShaders","_getShaderCacheForMaterial","shaderStage","getVertexShaderID","getFragmentShaderID","Set","stage","$d5b33d7c30034067$var$WebGLShaderStage","$d5b33d7c30034067$var$WebGLPrograms","_programLayers","_customShaders","IS_WEBGL2","SUPPORTS_VERTEX_TEXTURES","shaderIDs","MeshDepthMaterial","MeshDistanceMaterial","MeshNormalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial","MeshStandardMaterial","MeshPhysicalMaterial","MeshMatcapMaterial","LineBasicMaterial","LineDashedMaterial","PointsMaterial","ShadowMaterial","SpriteMaterial","getChannel","getParameters","shadows","customVertexShaderID","customFragmentShaderID","isMeshStandardMaterial","IS_INSTANCEDMESH","HAS_MAP","HAS_MATCAP","HAS_ENVMAP","HAS_AOMAP","HAS_LIGHTMAP","HAS_BUMPMAP","HAS_NORMALMAP","HAS_DISPLACEMENTMAP","HAS_EMISSIVEMAP","HAS_METALNESSMAP","HAS_ROUGHNESSMAP","HAS_ANISOTROPY","HAS_CLEARCOAT","HAS_IRIDESCENCE","HAS_SHEEN","HAS_TRANSMISSION","HAS_ANISOTROPYMAP","HAS_CLEARCOATMAP","HAS_CLEARCOAT_NORMALMAP","HAS_CLEARCOAT_ROUGHNESSMAP","HAS_IRIDESCENCEMAP","HAS_IRIDESCENCE_THICKNESSMAP","HAS_SHEEN_COLORMAP","HAS_SHEEN_ROUGHNESSMAP","HAS_SPECULARMAP","HAS_SPECULAR_COLORMAP","HAS_SPECULAR_INTENSITYMAP","HAS_TRANSMISSIONMAP","HAS_THICKNESSMAP","HAS_GRADIENTMAP","HAS_ALPHAMAP","HAS_ALPHATEST","HAS_ALPHAHASH","HAS_EXTENSIONS","HAS_ATTRIBUTE_UV1","HAS_ATTRIBUTE_UV2","HAS_ATTRIBUTE_UV3","isXRRenderTarget","supportsVertexTextures","isFogExp2","directional","spot","rectArea","hemi","shadowMap","_useLegacyLights","getProgramCacheKey","morphAttributeCount","acquireProgram","pl","preexistingProgram","releaseProgram","pop","releaseShaderCache","$d5b33d7c30034067$var$WebGLProperties","$d5b33d7c30034067$var$painterSortStable","groupOrder","$d5b33d7c30034067$var$reversePainterSortStable","$d5b33d7c30034067$var$WebGLRenderList","renderItems","renderItemsIndex","transmissive","getNextRenderItem","renderItem","finish","customOpaqueSort","customTransparentSort","$d5b33d7c30034067$var$WebGLRenderLists","lists","renderCallDepth","list","listArray","$d5b33d7c30034067$var$UniformsCache","light","halfWidth","halfHeight","$d5b33d7c30034067$var$nextVersion","$d5b33d7c30034067$var$shadowCastingAndTexturingLightsFirst","lightA","lightB","$d5b33d7c30034067$var$WebGLLights","shadowCache","$d5b33d7c30034067$var$ShadowUniformsCache","hash","directionalLength","pointLength","spotLength","rectAreaLength","hemiLength","numDirectionalShadows","numPointShadows","numSpotShadows","numSpotMaps","ambient","probe","directionalShadow","spotShadow","rectAreaLTC1","rectAreaLTC2","pointShadow","vector3","matrix42","numSpotShadowsWithMaps","scaleFactor","intensity","isAmbientLight","isLightProbe","sh","coefficients","isDirectionalLight","shadowUniforms","bias","normalBias","mapSize","isSpotLight","penumbra","updateMatrices","isRectAreaLight","isPointLight","isHemisphereLight","LTC_FLOAT_1","LTC_FLOAT_2","LTC_HALF_1","LTC_HALF_2","setupView","$d5b33d7c30034067$var$WebGLRenderState","lightsArray","shadowsArray","setupLights","setupLightsView","pushLight","pushShadow","shadowLight","$d5b33d7c30034067$var$WebGLRenderStates","renderStates","renderState","renderStateArray","$d5b33d7c30034067$export$2698c22ec13825db","isMeshDepthMaterial","$d5b33d7c30034067$export$33e187ed002f2a19","isMeshDistanceMaterial","$d5b33d7c30034067$var$WebGLShadowMap","_objects","_capabilities","_frustum","_shadowMapSize","_viewportSize","_viewport","_depthMaterial","_distanceMaterial","_materialCache","_maxTextureSize","shadowMaterialVertical","VSM_SAMPLES","shadow_pass","resolution","shadowMaterialHorizontal","HORIZONTAL_PASS","fullScreenTri","fullScreenMesh","autoUpdate","_previousType","getDepthMaterial","customMaterial","customDistanceMaterial","customDepthMaterial","keyA","keyB","materialsForVariant","cachedMaterial","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","_state","setBlending","setTest","setScissorTest","toVSM","fromVSM","shadowFrameExtents","getFrameExtents","pars","viewportCount","getViewportCount","vp","getViewport","getFrustum","renderObject","shadowCamera","k","kl","depthMaterial","renderBufferDirect","isPointLightShadow","VSMPass","blurSamples","mapPass","$d5b33d7c30034067$var$WebGLState","colorBuffer","locked","currentColorMask","currentColorClear","setMask","colorMask","setLocked","lock","currentDepthMask","currentDepthFunc","currentDepthClear","DEPTH_TEST","depthMask","setFunc","NEVER","ALWAYS","LESS","LEQUAL","EQUAL","GEQUAL","GREATER","NOTEQUAL","clearDepth","currentStencilMask","currentStencilFunc","currentStencilRef","currentStencilFuncMask","currentStencilFail","currentStencilZFail","currentStencilZPass","currentStencilClear","stencilTest","STENCIL_TEST","stencilMask","setOp","stencilOp","clearStencil","uboBindings","uboProgramMap","enabledCapabilities","currentBoundFramebuffers","currentDrawbuffers","defaultDrawbuffers","currentProgram","currentBlendingEnabled","currentBlending","currentBlendEquation","currentBlendSrc","currentBlendDst","currentBlendEquationAlpha","currentBlendSrcAlpha","currentBlendDstAlpha","currentPremultipledAlpha","currentFlipSided","currentCullFace","currentLineWidth","currentPolygonOffsetFactor","currentPolygonOffsetUnits","MAX_COMBINED_TEXTURE_IMAGE_UNITS","lineWidthAvailable","glVersion","VERSION","currentTextureSlot","currentBoundTextures","scissorParam","SCISSOR_BOX","viewportParam","VIEWPORT","currentScissor","currentViewport","createTexture","dimensions","bindTexture","texParameteri","TEXTURE_MIN_FILTER","NEAREST","TEXTURE_MAG_FILTER","TEXTURE_3D","TEXTURE_2D_ARRAY","texImage3D","RGBA","texImage2D","emptyTextures","TEXTURE_2D","TEXTURE_CUBE_MAP","TEXTURE_CUBE_MAP_POSITIVE_X","setFlipSided","setCullFace","CULL_FACE","equationToGL","FUNC_ADD","FUNC_SUBTRACT","FUNC_REVERSE_SUBTRACT","MIN","MAX","MIN_EXT","MAX_EXT","factorToGL","ZERO","ONE","SRC_COLOR","SRC_ALPHA","SRC_ALPHA_SATURATE","DST_COLOR","DST_ALPHA","ONE_MINUS_SRC_COLOR","ONE_MINUS_SRC_ALPHA","ONE_MINUS_DST_COLOR","ONE_MINUS_DST_ALPHA","BLEND","blendFuncSeparate","blendFunc","blendEquationSeparate","frontFace","CW","CCW","cullFace","BACK","FRONT","FRONT_AND_BACK","setPolygonOffset","factor","POLYGON_OFFSET_FILL","bindFramebuffer","framebuffer","DRAW_FRAMEBUFFER","FRAMEBUFFER","isWebGLMultipleRenderTargets","COLOR_ATTACHMENT0","drawBuffersWEBGL","useProgram","setMaterial","frontFaceCW","SAMPLE_ALPHA_TO_COVERAGE","setLineWidth","lineWidth","SCISSOR_TEST","activeTexture","webglSlot","TEXTURE0","webglType","webglTexture","boundTexture","unbindTexture","compressedTexImage2D","apply","compressedTexImage3D","updateUBOMapping","uniformsGroup","blockIndex","getUniformBlockIndex","uniformBlockBinding","__bindingPointIndex","texStorage2D","texStorage3D","texSubImage2D","texSubImage3D","compressedTexSubImage2D","compressedTexSubImage3D","KEEP","READ_FRAMEBUFFER","$d5b33d7c30034067$var$WebGLTextures","_gl","utils","_canvas","multisampledRTTExt","supportsInvalidateFramebuffer","navigator","userAgent","_videoTextures","_sources","useOffscreenCanvas","OffscreenCanvas","createCanvas","resizeImage","needsPowerOfTwo","needsNewCanvas","maxSize","isPowerOfTwo$1","textureNeedsGenerateMipmaps","supportsMips","generateMipmap","getInternalFormat","internalFormatName","glFormat","glType","forceLinearTransfer","RED","R32F","R16F","R8","RED_INTEGER","R8UI","R16UI","R32UI","R8I","R16I","R32I","RG","RG32F","RG16F","RG8","RGBA32F","RGBA16F","SRGB8_ALPHA8","RGBA8","UNSIGNED_SHORT_4_4_4_4","RGBA4","UNSIGNED_SHORT_5_5_5_1","RGB5_A1","getMipLevels","isFramebufferTexture","isCompressedTexture","filterFallback","LINEAR","deallocateTexture","textureProperties","__webglInit","webglTextures","__cacheKey","deleteTexture","isVideoTexture","onRenderTargetDispose","deallocateRenderTarget","renderTargetProperties","__webglTexture","__webglFramebuffer","level","deleteFramebuffer","__webglDepthbuffer","deleteRenderbuffer","__webglMultisampledFramebuffer","__webglColorRenderbuffer","__webglDepthRenderbuffer","attachmentProperties","textureUnits","slot","updateVideoTexture","__version","complete","uploadTexture","wrappingToGL","REPEAT","CLAMP_TO_EDGE","MIRRORED_REPEAT","filterToGL","NEAREST_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","compareToGL","setTextureParameters","textureType","TEXTURE_WRAP_S","TEXTURE_WRAP_T","TEXTURE_WRAP_R","compareFunction","TEXTURE_COMPARE_MODE","COMPARE_REF_TO_TEXTURE","TEXTURE_COMPARE_FUNC","__currentAnisotropy","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","initTexture","forceUpload","textureCacheKey","getTextureCacheKey","isCompressedArrayTexture","sourceProperties","mipmap","pixelStorei","UNPACK_FLIP_Y_WEBGL","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK_ALIGNMENT","UNPACK_COLORSPACE_CONVERSION_WEBGL","NONE","verifyColorSpace","glInternalFormat","useTexStorage","allocateMemory","levels","isDepthTexture","DEPTH_COMPONENT","DEPTH_COMPONENT32F","DEPTH_COMPONENT24","DEPTH24_STENCIL8","DEPTH_COMPONENT16","DEPTH_STENCIL","setupFrameBufferTexture","attachment","textureTarget","__hasExternalTextures","useMultisampledRTT","framebufferTexture2DMultisampleEXT","getRenderTargetSamples","TEXTURE_CUBE_MAP_NEGATIVE_Z","framebufferTexture2D","setupRenderBufferStorage","renderbuffer","isMultisample","bindRenderbuffer","RENDERBUFFER","renderbufferStorageMultisampleEXT","renderbufferStorageMultisample","renderbufferStorage","framebufferRenderbuffer","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","setupDepthRenderbuffer","isCube","__autoAllocateDepthBuffer","setupDepthTexture","webglDepthTexture","createRenderbuffer","__useRenderToTexture","textureUnit","resetTextureUnits","uploadCubeTexture","isCompressed","cubeImage","mipmapImage","rebindTextures","colorTexture","setupRenderTarget","isMultipleRenderTargets","createFramebuffer","glTextureType","isWebGL3DRenderTarget","isWebGLArrayRenderTarget","updateRenderTargetMipmap","updateMultisampleRenderTarget","COLOR_BUFFER_BIT","invalidationArray","depthStyle","ignoreDepthValues","__ignoreDepthValues","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","invalidateFramebuffer","blitFramebuffer","$d5b33d7c30034067$export$ddaebcad857649a8","HALF_FLOAT_OES","ALPHA","LUMINANCE","LUMINANCE_ALPHA","SRGB_ALPHA_EXT","RG_INTEGER","RGBA_INTEGER","COMPRESSED_SRGB_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_PVRTC_4BPPV1_IMG","COMPRESSED_RGB_PVRTC_2BPPV1_IMG","COMPRESSED_RGBA_PVRTC_4BPPV1_IMG","COMPRESSED_RGBA_PVRTC_2BPPV1_IMG","COMPRESSED_RGB_ETC1_WEBGL","COMPRESSED_SRGB8_ETC2","COMPRESSED_RGB8_ETC2","COMPRESSED_SRGB8_ALPHA8_ETC2_EAC","COMPRESSED_RGBA8_ETC2_EAC","COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR","COMPRESSED_RGBA_ASTC_4x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR","COMPRESSED_RGBA_ASTC_5x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR","COMPRESSED_RGBA_ASTC_5x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR","COMPRESSED_RGBA_ASTC_6x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR","COMPRESSED_RGBA_ASTC_6x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR","COMPRESSED_RGBA_ASTC_8x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR","COMPRESSED_RGBA_ASTC_8x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR","COMPRESSED_RGBA_ASTC_8x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR","COMPRESSED_RGBA_ASTC_10x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR","COMPRESSED_RGBA_ASTC_10x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR","COMPRESSED_RGBA_ASTC_10x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR","COMPRESSED_RGBA_ASTC_10x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR","COMPRESSED_RGBA_ASTC_12x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR","COMPRESSED_RGBA_ASTC_12x12_KHR","COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT","COMPRESSED_RGBA_BPTC_UNORM_EXT","COMPRESSED_RED_RGTC1_EXT","COMPRESSED_SIGNED_RED_RGTC1_EXT","COMPRESSED_RED_GREEN_RGTC2_EXT","COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT","UNSIGNED_INT_24_8","UNSIGNED_INT_24_8_WEBGL","$d5b33d7c30034067$export$56b937d9e5581166","isArrayCamera","isGroup","$d5b33d7c30034067$var$_moveEvent","$d5b33d7c30034067$var$WebXRController","_targetRay","_grip","_hand","getHandSpace","joints","inputState","pinching","getTargetRaySpace","hasLinearVelocity","linearVelocity","hasAngularVelocity","angularVelocity","getGripSpace","connect","inputSource","hand","inputjoint","_getHandJoint","disconnect","referenceSpace","inputPose","gripPose","handPose","targetRay","grip","session","visibilityState","jointPose","getJointPose","joint","transform","jointRadius","indexTip","thumbTip","distanceToPinch","handedness","gripSpace","getPose","targetRaySpace","jointName","$d5b33d7c30034067$export$fc830aa069cc8c2f","$d5b33d7c30034067$var$WebXRManager","framebufferScaleFactor","referenceSpaceType","foveation","customReferenceSpace","pose","glBinding","glProjLayer","glBaseLayer","xrFrame","getContextAttributes","initialRenderTarget","newRenderTarget","controllers","controllerInputSources","cameraL","cameraR","cameraXR","_currentDepthNear","_currentDepthFar","onSessionEvent","controllerIndex","controller","onSessionEnd","onInputSourcesChange","isPresenting","removed","added","cameraAutoUpdate","getController","getControllerGrip","getHand","setFramebufferScaleFactor","setReferenceSpaceType","getReferenceSpace","setReferenceSpace","space","getBaseLayer","getBinding","getFrame","getSession","setSession","xrCompatible","makeXRCompatible","layerInit","antialias","XRWebGLLayer","updateRenderState","baseLayer","framebufferWidth","framebufferHeight","depthFormat","depthType","glDepthFormat","projectionlayerInit","colorFormat","XRWebGLBinding","createProjectionLayer","textureWidth","textureHeight","setFoveation","requestReferenceSpace","cameraLPos","cameraRPos","updateCamera","depthNear","depthFar","setProjectionFromUnion","ipd","projL","projR","topFov","bottomFov","leftFov","rightFov","zOffset","xOffset","near2","far2","left2","right2","top2","bottom2","updateUserCamera","getCamera","getFoveation","fixedFoveation","onAnimationFrameCallback","getViewerPose","views","setRenderTargetFramebuffer","cameraXRNeedsUpdate","glSubImage","getViewSubImage","setRenderTargetTextures","depthStencilTexture","detectedPlanes","$d5b33d7c30034067$var$WebGLMaterials","refreshTransformUniform","refreshUniformsCommon","refreshFogUniforms","isFog","density","refreshMaterialUniforms","pixelRatio","transmissionRenderTarget","isMeshLambertMaterial","isMeshToonMaterial","isMeshPhongMaterial","refreshUniformsStandard","isMeshPhysicalMaterial","isMeshMatcapMaterial","refreshUniformsDistance","isMeshNormalMaterial","isLineBasicMaterial","isLineDashedMaterial","isPointsMaterial","isSpriteMaterial","isShadowMaterial","$d5b33d7c30034067$var$WebGLUniformsGroups","updateList","allocatedBindingPoints","maxBindingPoints","MAX_UNIFORM_BUFFER_BINDINGS","getUniformSize","boundary","storage","onUniformsGroupsDispose","bind","webglProgram","prepareUniformsGroup","chunkOffset","infos","__data","__offset","remainingSizeInChunk","chunkSize","__size","__cache","bindingPointIndex","allocateBindingPointIndex","UNIFORM_BUFFER","bindBufferBase","updateBufferData","hasUniformChanged","tempValues","cachedObjects","cachedObject","arrayOffset","_alpha","programCache","renderLists","morphtargets","bufferRenderer","indexedBufferRenderer","$d5b33d7c30034067$var$createCanvasElement","display","preserveDrawingBuffer","powerPreference","failIfMajorPerformanceCaveat","isWebGLRenderer","uintClearColor","intClearColor","currentRenderList","currentRenderState","renderListStack","renderStateStack","domElement","sortObjects","toneMappingExposure","_this","_isContextLost","_currentActiveCubeFace","_currentActiveMipmapLevel","_currentRenderTarget","_currentMaterialId","_currentCamera","_currentViewport","_currentScissor","_currentScissorTest","_currentClearColor","_currentClearAlpha","_width","_height","_pixelRatio","_opaqueSort","_transparentSort","_scissor","_scissorTest","_clippingEnabled","_localClippingEnabled","_transmissionRenderTarget","_projScreenMatrix","_vector2","_vector3","_emptyScene","overrideMaterial","getTargetPixelRatio","contextNames","contextAttributes","contextName","onContextLost","onContextRestore","onContextCreationError","isWebGL1Renderer","shift","WebGLRenderingContext","initGLContext","preventDefault","infoAutoReset","shadowMapAutoUpdate","shadowMapNeedsUpdate","statusMessage","onMaterialDispose","releaseMaterialProgramReferences","forEach","forceContextLoss","loseContext","forceContextRestore","restoreContext","getPixelRatio","setPixelRatio","updateStyle","setViewport","getDrawingBufferSize","setDrawingBufferSize","getCurrentViewport","getScissor","setScissor","getScissorTest","boolean","setOpaqueSort","method","setTransparentSort","bits","isIntegerFormat","targetFormat","targetType","clearBufferuiv","COLOR","clearBufferiv","onXRSessionStart","onXRSessionEnd","setProgram","needsProgramChange","needsLights","lightsStateVersion","getProgram","refreshProgram","refreshMaterial","refreshLights","p_uniforms","m_uniforms","uCamPos","cameraPosition","boneTexture","computeBoneTexture","boneTextureSize","isMeshGouraudMaterial","uniformsList","rangeFactor","drawStart","drawEnd","drawCount","isLineSegments","isLineLoop","isSprite","maxInstanceCount","prepare","material2","renderScene","opaqueObjects","transmissiveObjects","transparentObjects","renderTransmissionPass","currentToneMapping","renderObjects","renderTargetNeedsUpdate","currentSide","programCacheKey","updateCommonMaterialProperties","progUniforms","projectObject","isLOD","camera2","defaultFramebuffer","__useDefaultFramebuffer","useDefaultFramebuffer","isRenderTarget3D","framebufferBound","layer","framebufferTextureLayer","readRenderTargetPixels","activeCubeFaceIndex","textureFormat","IMPLEMENTATION_COLOR_READ_FORMAT","halfFloatSupportedByExt","IMPLEMENTATION_COLOR_READ_TYPE","readPixels","copyFramebufferToTexture","levelScale","copyTexSubImage2D","copyTextureToTexture","srcTexture","dstTexture","copyTextureToTexture3D","sourceBox","glTarget","unpackRowLen","UNPACK_ROW_LENGTH","unpackImageHeight","UNPACK_IMAGE_HEIGHT","unpackSkipPixels","UNPACK_SKIP_PIXELS","unpackSkipRows","UNPACK_SKIP_ROWS","unpackSkipImages","UNPACK_SKIP_IMAGES","resetState","__THREE_DEVTOOLS__","CustomEvent","detail","physicallyCorrectLights","outputEncoding","$d5b33d7c30034067$export$a2f65229194348f9","isInterleavedBuffer","arrayBuffers","_uuid","ib","$d5b33d7c30034067$var$_vector$5","interleavedBuffer","interleavedBuffers","$d5b33d7c30034067$var$_basePosition","$d5b33d7c30034067$var$_skinIndex","$d5b33d7c30034067$var$_skinWeight","$d5b33d7c30034067$var$_vector3","$d5b33d7c30034067$var$_matrix4","$d5b33d7c30034067$var$_vertex","$d5b33d7c30034067$var$_sphere$3","$d5b33d7c30034067$var$_inverseMatrix$2","$d5b33d7c30034067$var$_ray$2","bindMatrixInverse","applyBoneTransform","calculateInverses","normalizeSkinWeights","skinWeight","skinIndex","boneIndex","bones","boneInverses","boneTransform","isBone","$d5b33d7c30034067$export$b691f601014eabe1","$d5b33d7c30034067$var$_offsetMatrix","$d5b33d7c30034067$var$_identityMatrix","boneMatrices","inverse","bone","getBoneByName","json","boneInverse","$d5b33d7c30034067$var$_instanceLocalMatrix","$d5b33d7c30034067$var$_instanceWorldMatrix","$d5b33d7c30034067$var$_instanceIntersects","$d5b33d7c30034067$var$_box3","$d5b33d7c30034067$var$_identity","$d5b33d7c30034067$var$_mesh","$d5b33d7c30034067$var$_sphere$2","setMatrixAt","getMatrixAt","getColorAt","raycastTimes","instanceId","setColorAt","linecap","linejoin","$d5b33d7c30034067$var$_start$1","$d5b33d7c30034067$var$_end$1","$d5b33d7c30034067$var$_inverseMatrix$1","$d5b33d7c30034067$var$_ray$1","$d5b33d7c30034067$var$_sphere$1","computeLineDistances","lineDistances","threshold","Line","localThreshold","localThresholdSq","vStart","vEnd","interSegment","interRay","distSq","$d5b33d7c30034067$var$_start","$d5b33d7c30034067$var$_end","$d5b33d7c30034067$var$_inverseMatrix","$d5b33d7c30034067$var$_ray","$d5b33d7c30034067$var$_sphere","$d5b33d7c30034067$var$_position$2","Points","$d5b33d7c30034067$var$testPoint","rayPointDistanceSq","intersectPoint","distanceToRay","$d5b33d7c30034067$export$b0e83c3ef8d2db1","arcLengthDivisions","getPoint","getPointAt","optionalTarget","getUtoTmapping","getPoints","divisions","getSpacedPoints","getLength","lengths","getLengths","cacheArcLengths","current","last","updateArcLengths","targetArcLength","arcLengths","comparison","lengthBefore","lengthAfter","getTangent","t2","pt1","pt2","getTangentAt","computeFrenetFrames","segments","closed","binormals","vec","mat","MAX_VALUE","tz","$d5b33d7c30034067$export$3f87a931616cde04","aX","aY","xRadius","yRadius","aStartAngle","aEndAngle","aClockwise","aRotation","isEllipseCurve","twoPi","deltaAngle","samePoints","$d5b33d7c30034067$var$CubicPoly","c0","initCatmullRom","x3","tension","initNonuniformCatmullRom","dt0","dt1","dt2","calc","$d5b33d7c30034067$var$tmp","$d5b33d7c30034067$var$px","$d5b33d7c30034067$var$py","$d5b33d7c30034067$var$pz","$d5b33d7c30034067$var$CatmullRom","$d5b33d7c30034067$var$QuadraticBezier","$d5b33d7c30034067$var$QuadraticBezierP0","$d5b33d7c30034067$var$CubicBezier","$d5b33d7c30034067$var$CubicBezierP0","$d5b33d7c30034067$var$CubicBezierP1","$d5b33d7c30034067$export$e36650d36468bb39","isCubicBezierCurve","$d5b33d7c30034067$export$ab2e07e76531a47e","isLineCurve","$d5b33d7c30034067$export$5938c4ee491a43ad","isQuadraticBezierCurve","$d5b33d7c30034067$export$bf3f4c7e459f90fc","isQuadraticBezierCurve3","$d5b33d7c30034067$export$d3bdd77da77afc1b","isSplineCurve","intPoint","$d5b33d7c30034067$var$Curves","freeze","__proto__","ArcCurve","aRadius","isArcCurve","CatmullRomCurve3","curveType","isCatmullRomCurve3","CubicBezierCurve","CubicBezierCurve3","isCubicBezierCurve3","EllipseCurve","LineCurve","LineCurve3","isLineCurve3","QuadraticBezierCurve","QuadraticBezierCurve3","SplineCurve","$d5b33d7c30034067$export$4aaf9b66af1bbf2c","curves","autoClose","curve","closePath","startPoint","endPoint","curveLengths","getCurveLengths","diff","segmentLength","lens","cacheLengths","sums","pts","$d5b33d7c30034067$export$4b2950bdac9b6ee9","currentPoint","moveTo","lineTo","quadraticCurveTo","aCPx","aCPy","bezierCurveTo","aCP1x","aCP1y","aCP2x","aCP2y","splineThru","npts","arc","absarc","absellipse","ellipse","firstPoint","lastPoint","$d5b33d7c30034067$export$6d839803fcd1882c","phiStart","phiLength","initNormals","inverseSegments","vertex","curNormal","prevNormal","base","$d5b33d7c30034067$export$41680e8551036033","capSegments","radialSegments","$d5b33d7c30034067$export$d5c0e8d607467193","thetaStart","thetaLength","segment","$d5b33d7c30034067$export$68f745719dbe5198","radiusTop","radiusBottom","openEnded","indexArray","generateCap","centerIndexStart","centerIndexEnd","cosTheta","sinTheta","generateTorso","slope","indexRow","$d5b33d7c30034067$export$a7a48974f285c9b3","$d5b33d7c30034067$export$60e57a7d3f20ff65","vertexBuffer","uvBuffer","pushVertex","getVertexByIndex","correctUV","azimuth","subdivide","subdivideFace","cols","aj","bj","rows","applyRadius","generateUVs","inclination","correctUVs","centroid","azi","correctSeam","details","$d5b33d7c30034067$export$c0babfeb8708fc9c","holes","getPointsHoles","holesPts","extractPoints","hole","$d5b33d7c30034067$var$Earcut","triangulate","holeIndices","dim","minX","minY","maxX","maxY","invSize","hasHoles","outerLen","outerNode","$d5b33d7c30034067$var$linkedList","prev","$d5b33d7c30034067$var$eliminateHoles","queue","steiner","$d5b33d7c30034067$var$getLeftmost","leftmost","$d5b33d7c30034067$var$compareX","$d5b33d7c30034067$var$eliminateHole","bridge","$d5b33d7c30034067$var$findHoleBridge","hx","hy","mx","my","tanMin","$d5b33d7c30034067$var$pointInTriangle","$d5b33d7c30034067$var$locallyInside","$d5b33d7c30034067$var$area","bridgeReverse","$d5b33d7c30034067$var$splitPolygon","$d5b33d7c30034067$var$filterPoints","$d5b33d7c30034067$var$earcutLinked","ear","pass","$d5b33d7c30034067$var$indexCurve","$d5b33d7c30034067$var$zOrder","prevZ","nextZ","$d5b33d7c30034067$var$sortLinked","tail","numMerges","pSize","qSize","inSize","$d5b33d7c30034067$var$isEarHashed","minZ","maxZ","$d5b33d7c30034067$var$isEar","$d5b33d7c30034067$var$removeNode","$d5b33d7c30034067$var$cureLocalIntersections","$d5b33d7c30034067$var$equals","$d5b33d7c30034067$var$intersects","$d5b33d7c30034067$var$splitEarcut","$d5b33d7c30034067$var$intersectsPolygon","$d5b33d7c30034067$var$middleInside","inside","px","py","clockwise","$d5b33d7c30034067$var$signedArea","$d5b33d7c30034067$var$insertNode","again","q1","q2","o1","$d5b33d7c30034067$var$sign","o2","o3","o4","$d5b33d7c30034067$var$onSegment","num","$d5b33d7c30034067$var$Node","an","bp","area","contour","isClockWise","triangulateShape","faces","$d5b33d7c30034067$var$removeDupEndPts","$d5b33d7c30034067$var$addContour","holeIndex","$d5b33d7c30034067$export$598697a1efa63ca7","verticesArray","uvArray","addShape","splineTube","binormal","position2","placeholder","curveSegments","steps","bevelEnabled","bevelThickness","bevelSize","bevelOffset","bevelSegments","extrudePath","uvgen","UVGenerator","$d5b33d7c30034067$var$WorldUVGenerator","extrudePts","extrudeByPath","shapePoints","reverse","hl","ahole","scalePt2","pt","vlen","flen","getBevelVec","inPt","inPrev","inNext","v_trans_x","v_trans_y","shrink_by","v_prev_x","v_prev_y","v_next_x","v_next_y","v_prev_lensq","collinear0","v_prev_len","v_next_len","ptPrevShift_x","ptPrevShift_y","ptNextShift_x","ptNextShift_y","sf","v_trans_lensq","direction_eq","contourMovements","holesMovements","oneHoleMovements","verticesMovements","bs","vert","sidewalls","layeroffset","sl","slen1","slen2","f4","addVertex","nextIndex","generateSideWallUV","addUV","f3","generateTopUV","vector2","buildLidFaces","buildSideFaces","$d5b33d7c30034067$var$toJSON$1","geometryShapes","indexA","indexB","indexC","a_x","a_y","b_x","b_y","c_x","c_y","indexD","a_z","b_z","c_z","d_x","d_y","d_z","$d5b33d7c30034067$export$9567cc828c9535da","$d5b33d7c30034067$export$1954e2b809fe361e","$d5b33d7c30034067$export$68cb731f50f614af","innerRadius","outerRadius","thetaSegments","phiSegments","radiusStep","thetaSegmentLevel","indexOffset","shapeVertices","shapeHoles","shapeHole","$d5b33d7c30034067$var$toJSON","$d5b33d7c30034067$export$1b417fc3b307a251","thetaEnd","grid","verticesRow","uOffset","$d5b33d7c30034067$export$fb3f7adc68bd6e02","$d5b33d7c30034067$export$a2312a2a1fa56495","tube","tubularSegments","P1","P2","B","T","N","calculatePositionOnCurve","quOverP","cs","$d5b33d7c30034067$export$7897d9d48904490c","frames","P","generateSegment","generateBufferData","generateIndices","_anisotropy","_clearcoat","_iridescence","_sheen","_transmission","$d5b33d7c30034067$var$arraySlice","$d5b33d7c30034067$var$isTypedArray","$d5b33d7c30034067$var$convertArray","forceClone","ArrayBuffer","isView","DataView","$d5b33d7c30034067$var$sortedArray","nValues","srcOffset","$d5b33d7c30034067$var$flattenJSON","jsonKeys","times","valuePropertyName","parameterPositions","sampleValues","sampleSize","resultBuffer","_cachedIndex","valueSize","settings","DefaultSettings_","evaluate","pp","validate_interval","seek","linear_scan","forward_scan","giveUpAt","copySampleValue_","t1global","mid","intervalChanged_","interpolate_","getSettings_","$d5b33d7c30034067$export$3646682e7a3959","_weightPrev","_offsetPrev","_weightNext","_offsetNext","endingStart","endingEnd","iPrev","iNext","tPrev","tNext","halfDt","o0","oP","oN","wP","wN","ppp","sP","sN","$d5b33d7c30034067$export$a8e6009059f51e1a","offset1","offset0","weight1","weight0","$d5b33d7c30034067$export$fb9758ef7ef8d5cc","$d5b33d7c30034067$export$b0e479f45b7006d6","interpolation","TimeBufferType","ValueBufferType","setInterpolation","DefaultInterpolation","track","trackType","ValueTypeName","InterpolantFactoryMethodDiscrete","getValueSize","InterpolantFactoryMethodLinear","InterpolantFactoryMethodSmooth","factoryMethod","createInterpolant","timeOffset","timeScale","startTime","endTime","nKeys","validate","valid","prevTime","currTime","optimize","smoothInterpolation","writeIndex","keep","timeNext","offsetP","offsetN","readOffset","writeOffset","TypedKeyframeTrack","$d5b33d7c30034067$export$d3a344b98cf0b775","$d5b33d7c30034067$export$83444c5d885347d8","$d5b33d7c30034067$export$2db1cfb7923d931e","$d5b33d7c30034067$export$6ce41d4f3a8df9cd","duration","tracks","blendMode","resetDuration","jsonTracks","frameTime","fps","$d5b33d7c30034067$var$parseKeyframeTrack","$d5b33d7c30034067$var$getTrackTypeForValueTypeName","typeName","clip","clipTracks","CreateFromMorphTargetSequence","morphTargetSequence","noLoop","numMorphTargets","$d5b33d7c30034067$var$getKeyframeOrder","findByName","objectOrClipArray","clipArray","o","CreateClipsFromMorphTargetSequences","animationToMorphTargets","pattern","parts","animationMorphTargets","clips","parseAnimation","addNonemptyTrack","trackName","animationKeys","propertyName","destTracks","clipName","hierarchyTracks","hierarchy","morphTargetNames","morphTargetName","animationKey","boneName","$d5b33d7c30034067$export$94affb487e701bf2","files","file","$d5b33d7c30034067$export$b033c3f9a95c6a16","onLoad","onProgress","onError","urlModifier","isLoading","itemsLoaded","itemsTotal","handlers","onStart","itemStart","itemEnd","itemError","resolveURL","setURLModifier","addHandler","regex","loader","removeHandler","getHandler","manager","crossOrigin","withCredentials","resourcePath","requestHeader","load","loadAsync","Promise","resolve","reject","setCrossOrigin","setWithCredentials","setPath","setResourcePath","setRequestHeader","DEFAULT_MATERIAL_NAME","$d5b33d7c30034067$var$loading","$d5b33d7c30034067$var$HttpError","response","setTimeout","req","Request","headers","Headers","credentials","mimeType","responseType","fetch","then","ReadableStream","body","getReader","callbacks","reader","contentLength","total","lengthComputable","loaded","stream","readData","read","done","close","byteLength","ProgressEvent","enqueue","Response","statusText","arrayBuffer","blob","text","parser","DOMParser","parseFromString","re","label","decoder","TextDecoder","decode","catch","finally","setResponseType","setMimeType","$d5b33d7c30034067$export$8905ce1c7a2464a1","onImageLoad","removeEventListeners","onImageError","$d5b33d7c30034067$export$6ecadb6ed240d696","$d5b33d7c30034067$var$_projScreenMatrix$1","$d5b33d7c30034067$var$_lightPositionWorld$1","$d5b33d7c30034067$var$_lookTarget$1","$d5b33d7c30034067$var$LightShadow","_frameExtents","_viewportCount","_viewports","shadowMatrix","viewportIndex","$d5b33d7c30034067$var$SpotLightShadow","isSpotLightShadow","power","$d5b33d7c30034067$var$_projScreenMatrix","$d5b33d7c30034067$var$_lightPositionWorld","$d5b33d7c30034067$var$_lookTarget","$d5b33d7c30034067$var$PointLightShadow","_cubeDirections","_cubeUps","$d5b33d7c30034067$var$DirectionalLightShadow","isDirectionalLightShadow","decodeText","fromCharCode","decodeURIComponent","escape","extractUrlBase","lastIndexOf","isImageBitmapLoader","createImageBitmap","setOptions","fetchOptions","res","colorSpaceConversion","imageBitmap","$d5b33d7c30034067$var$_RESERVED_CHARS_RE","$d5b33d7c30034067$var$_reservedRe","RegExp","$d5b33d7c30034067$var$_wordChar","$d5b33d7c30034067$var$_wordCharOrDot","$d5b33d7c30034067$var$_directoryRe","$d5b33d7c30034067$var$_nodeRe","$d5b33d7c30034067$var$_objectRe","$d5b33d7c30034067$var$_propertyRe","$d5b33d7c30034067$var$_trackRe","$d5b33d7c30034067$var$_supportedObjectNames","rootNode","parsedPath","parseTrackName","node","findNode","nodeName","getValue","_getValue_unbound","_setValue_unbound","create","root","isAnimationObjectGroup","Composite","sanitizeNodeName","matches","results","objectName","objectIndex","propertyIndex","lastDot","substring","searchNodeSubtree","childNode","subTreeNode","_getValue_unavailable","_setValue_unavailable","_getValue_direct","targetObject","_getValue_array","resolvedProperty","_getValue_arrayElement","_getValue_toArray","_setValue_direct","_setValue_direct_setNeedsUpdate","_setValue_direct_setMatrixWorldNeedsUpdate","_setValue_array","dest","_setValue_array_setNeedsUpdate","_setValue_array_setMatrixWorldNeedsUpdate","_setValue_arrayElement","_setValue_arrayElement_setNeedsUpdate","_setValue_arrayElement_setMatrixWorldNeedsUpdate","_setValue_fromArray","_setValue_fromArray_setNeedsUpdate","_setValue_fromArray_setMatrixWorldNeedsUpdate","targetArray","sourceArray","nodeProperty","versioning","Versioning","None","NeedsUpdate","MatrixWorldNeedsUpdate","bindingType","BindingType","Direct","ArrayElement","HasFromToArray","EntireArray","GetterByBindingType","SetterByBindingTypeAndVersioning","unbind","targetGroup","optionalParsedPath","_targetGroup","_bindings","subscribe_","firstValidIndex","nCachedObjects_","binding","bindings","other","makeSafe","setFromCartesianCoords","$d5b33d7c30034067$var$_startP","$d5b33d7c30034067$var$_startEnd","distanceSq","closestPointToPointParameter","clampToLine","startEnd2","startEnd_startP","revision","__THREE__","$443c013b983d0324$export$8ff7788029dfdf52","$ilwiq","$443c013b983d0324$var$_changeEvent","$443c013b983d0324$var$_startEvent","$443c013b983d0324$var$_endEvent","$443c013b983d0324$var$_ray","Ray","$443c013b983d0324$var$_plane","Plane","$443c013b983d0324$var$TILT_LIMIT","MathUtils","EventDispatcher","touchAction","Vector3","minDistance","maxDistance","minZoom","maxZoom","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","enableZoom","zoomSpeed","enableRotate","rotateSpeed","enablePan","panSpeed","screenSpacePanning","keyPanSpeed","zoomToCursor","autoRotate","autoRotateSpeed","UP","BOTTOM","mouseButtons","MOUSE","touches","TOUCH","TWO","target0","position0","zoom0","_domElementKeyEvents","getPolarAngle","spherical","getAzimuthalAngle","getDistance","listenToKeyEvents","onKeyDown","stopListenToKeyEvents","saveState","STATE","quat","Quaternion","quatInverse","lastPosition","lastQuaternion","lastTargetPosition","twoPI","rotateLeft","sphericalDelta","panOffset","performCursorZoom","clampDistance","zoomChanged","newRadius","prevRadius","radiusDelta","dollyDirection","mouseBefore","mouse","mouseAfter","EPS","onContextMenu","onPointerDown","onPointerUp","onMouseWheel","onPointerMove","TOUCH_ROTATE","TOUCH_PAN","TOUCH_DOLLY_PAN","TOUCH_DOLLY_ROTATE","Spherical","rotateStart","Vector2","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","pointers","pointerPositions","getZoomScale","rotateUp","panLeft","objectMatrix","panUp","pan","deltaX","deltaY","targetDistance","clientHeight","clientWidth","dollyOut","dollyScale","dollyIn","updateMouseParameters","rect","getBoundingClientRect","clientX","clientY","dist","handleMouseDownRotate","handleMouseDownPan","handleTouchStartRotate","pageX","pageY","handleTouchStartPan","handleTouchStartDolly","handleTouchMoveRotate","getSecondPointerPosition","handleTouchMovePan","handleTouchMoveDolly","setPointerCapture","pointerId","pointerType","onTouchStart","trackPointer","onMouseDown","mouseAction","button","ctrlKey","metaKey","shiftKey","onTouchMove","onMouseMove","handleMouseMoveRotate","removePointer","releasePointerCapture","handleKeyDown","pointer","passive","$5451ea62abbe5f68$export$f06f69b3bf41d25c","$5451ea62abbe5f68$export$5492ca6e5c0c7aa0","useGroups","isIndexed","attributesUsed","morphAttributesUsed","mergedGeometry","BufferGeometry","attributesCount","mergedIndex","mergedAttribute","$5451ea62abbe5f68$export$9f98db6234c4bd78","morphAttributesToMerge","mergedMorphAttribute","TypedArray","arrayLength","BufferAttribute","drawMode","TrianglesDrawMode","TriangleFanDrawMode","TriangleStripDrawMode","numberOfTriangles","newIndices","newGeometry","ProjectionGenerator","OUTPUT_BOTH","SilhouetteGenerator","$03ecc30c21a1bb08$export$4776387f3c0e5209","$6KVZ3","$bJKwC","$fNPnQ","$33ViW","$itkSV","$64zt3","$iQQnd","$5zNJG","$03ecc30c21a1bb08$var$UP_VECTOR","$03ecc30c21a1bb08$var$_beneathLine","Line3","$03ecc30c21a1bb08$var$_ray","$03ecc30c21a1bb08$var$_vec","$03ecc30c21a1bb08$var$_overlapLine","$03ecc30c21a1bb08$var$EdgeSet","edges","getLineGeometry","edgeArray","edgeGeom","edgeBuffer","sortEdges","iterationTime","angleThreshold","includeIntersectionEdges","generateAsync","signal","task","generate","run","aborted","bvh","MeshBVH","maxLeafTris","generateEdges","generateIntersectionEdges","finalEdges","performance","now","isYProjectedLineDegenerate","lowestLineY","highestLineY","hiddenOverlaps","shapecast","intersectsBounds","tri","highestTriangleY","isYProjectedTriangleDegenerate","isLineTriangleEdge","lowestTriangleY","trimToBeneathTriPlane","getProjectedLineOverlap","appendOverlapRange","compressEdgeOverlaps","overlapsToLines","progress","$4eb4044e12c26831$export$9d614b3bc2c4eacf","$alNGj","$knbvI","$lenTA","$eADNI","$7EZfU","$8hs00","$8VlEg","$9Kyri","$ayHng","$laUNa","$1SnJR","$dhXUU","$dnRHH","$7AkHD","$gDpfV","$iERXt","$kNP8c","$ZxvHI","$bD1WL","$gUrAj","$86OmO","$cSOJe","$4eb4044e12c26831$var$obb","OrientedBox","$4eb4044e12c26831$var$tempBox","Box3","cloneBuffers","rootData","_roots","indirectBuffer","_indirectBuffer","indexAttribute","roots","deserialize","indirect","Boolean","SKIP_GENERATION","newIndex","strategy","CENTER","maxDepth","verbose","useSharedArrayBuffer","setBoundingBox","isSharedArrayBufferSupported","buildPackedTree","resolveTriangleIndex","refit","nodeIndices","refitFunc","refit_indirect","rootIndex","uint32Array","uint16Array","_traverse","node32Index","node16Index","isLeaf","IS_LEAFNODE_FLAG","BYTES_PER_NODE","splitAxis","stopTraversal","materialOrSide","FrontSide","isArrayMaterial","raycastFunc","raycast_indirect","materialSide","startCount","raycastFirst","closestResult","raycastFirstFunc","raycastFirst_indirect","intersectsGeometry","otherGeometry","geomToMesh","intersectsGeometryFunc","intersectsGeometry_indirect","ExtendedTrianglePool","getPrimitive","iterateFunc","iterateOverTriangles_indirect","iterateOverTriangles","boundsTraverseOrder","intersectsRange","originalIntersectsRange","contained","nodeIndex","byteOffset","releasePrimitive","bvhcast","otherBvh","matrixToLocal","bvhcastFunc","bvhcast_indirect","boxToMesh","closestPointToGeometry","geometryToBvh","target1","target2","minThreshold","maxThreshold","closestPointToGeometryFunc","closestPointToGeometry_indirect","arrayToBox","$78926744db4a8a3e$export$91c2158bc24c63d4","$78926744db4a8a3e$export$d3bfe4097a2a8542","$78926744db4a8a3e$export$2b2cc3fb4f03d723","$78926744db4a8a3e$export$82ad94f0a038b67a","$78926744db4a8a3e$export$22e1995328fd3cd9","$78926744db4a8a3e$export$f4b101accf1b23d1","$78926744db4a8a3e$export$a08e7d18fbc53be5","$78926744db4a8a3e$export$661fddb62bfe0e42","$78926744db4a8a3e$export$859129fb5c8f4dc1","$78926744db4a8a3e$export$abef70518a11a6ba","$ed4ee2639a9fd94e$export$e63bca57f220b8e3","$5Gkg5","$6zZ33","$4rNvL","$O2f62","$8aRzr","$fe03E","float32Array","$ed4ee2639a9fd94e$var$generateIndirectBuffer","triCount","useUint32","byteCount","SharedArrayBuffer","hasGroupGaps","ensureIndex","$ed4ee2639a9fd94e$var$buildTree","totalTriangles","getTriCount","reachedMaxDepth","fullBounds","cacheCentroidBoundingData","triangleBounds","computeTriangleBounds","partionFunc","partition_indirect","partition","ranges","getFullGeometryRange","getRootIndexRanges","MeshBVHNode","boundingData","getCentroidBounds","splitNode","getBounds","triggerProgress","trianglesProcessed","centroidBoundingData","getOptimalSplit","splitOffset","lcount","rcount","packedRoots","BufferConstructor","nodeCount","countNodes","populateBuffer","stride4Offset","stride2Offset","nextUnusedPointer","$423096e95cd96e19$export$c56c51fae37b2d63","$423096e95cd96e19$export$90fd303420808ebb","$423096e95cd96e19$export$8c9d42783264c26e","$423096e95cd96e19$export$fd7a16c461f5043c","$423096e95cd96e19$export$d3cf4eabab21775d","geo","$423096e95cd96e19$export$bb010cc24ecaa644","vertexCount","$423096e95cd96e19$export$62808f0201824da2","rangeBoundaries","drawRangeStart","drawRangeEnd","groupEnd","sortedBoundaries","finalGroup","$4ca55de292e93eb1$export$becd1e645219fa23","$4ca55de292e93eb1$export$8eb05c58dc5aa2de","$4ca55de292e93eb1$export$b3cc4d5d5179e78c","centroidTarget","minx","miny","minz","maxx","maxy","maxz","cminx","cminy","cminz","cmaxx","cmaxy","cmaxz","includeCentroid","lx","rx","ly","ry","cz","hz","lz","rz","makeEmptyBounds","posAttr","posArr","bufferOffset","getters","tri3","tri6","ai","bi","ci","el","halfExtents","el2","FLOAT32_EPSILON","$a9f34d1ac25848aa$export$40b9a5e446bf11e0","nodeIndex32","$a9f34d1ac25848aa$export$8737d658f04762d3","$a9f34d1ac25848aa$export$dcdc414399b99746","bounds","splitDimIdx","splitDist","$a9f34d1ac25848aa$export$14b050a767b4a3a7","$a9f34d1ac25848aa$export$a8a7063dce01a911","aVal","bVal","$a9f34d1ac25848aa$export$c989e53c4b24c2f5","startIndex","tCenter","tHalf","tMin","tMax","$a9f34d1ac25848aa$export$dbf4320364dc239e","$33d016ef2ae8a9ff$export$9e40712018083c80","$33d016ef2ae8a9ff$var$binsSort","candidate","$33d016ef2ae8a9ff$var$sahBins","rightCacheBounds","leftCacheBounds","$33d016ef2ae8a9ff$var$leftBounds","nodeBoundingData","pos","getLongestEdgeIndex","AVERAGE","$33d016ef2ae8a9ff$var$getAverage","avg","SAH","rootSurfaceArea","computeSurfaceArea","bestCost","TRIANGLE_INTERSECT_COST","cStart","cEnd","axisLeft","axisRight","axisLength","binWidth","$33d016ef2ae8a9ff$var$BIN_COUNT","truncatedBins","bin","expandByTriangleBounds","splitCount","leftCount","rightCount","leftBounds","rightBounds","leftProb","rightProb","cost","TRAVERSAL_COST","triCenter","relativeCenter","binIndex","lastBin","copyBounds","nextBin","unionBounds","binCount","$096668f03fbb5645$export$6f473cc5f89b0a1c","$5f38cfeb5f7666c7$export$b29f828819edca8d","axisOffset","tb","$b1583556301b54a3$export$7cee363d477551d0","$f74d70f31e44d1f9$export$4ccecd8ac6ee0e58","$2OKGW","$8VYkb","$f56Km","isOrientedBox","Matrix4","invMatrix","satAxes","satBounds","SeparatingAxisBounds","alignedSatBounds","minVec","sb","pi","setFromPointsField","aabbBounds","isSeparated","setFromBox","saTri","ExtendedTriangle","pointsArr","cachedSatBounds","cachedSatBounds2","cachedAxis","isExtendedTriangle","sa","triSatBounds","triSatAxes","sa1","sa2","distanceToBox","xyzFields","segments1","segments2","point1","point2","threshold2","closestDistanceSq","nextIndex2","line1","f1","f2","line2","l1","l2","closestPointsSegmentToSegment","$20d478469c10be0c$export$f758e41ecdcd8e69","field","val","boxMin","boxMax","$681270c6f2e9ebff$export$a37f7ec1c23dfacf","$681270c6f2e9ebff$var$isNearZero","Triangle","args","Sphere","sphereIntersectTriangle","axis0","sab0","axis1","sab1","axis2","sab2","axis3","sab3","closestPointToSegment","edge","nexti","saTri2","arr1","arr2","dir1","dir2","tempDir","edge1","edge2","tempPoint","triIntersectPlane","targetEdge","startPointIntersection","startIntersects","doesIntersect","suppressLog","plane1","plane2","satBounds1","satAxes1","satBounds2","satAxes2","count1","count2","e1","e2","separated1","distanceToTriangle","cornerFields","lineTarget","otherVec","thisVec","f11","f12","f21","f22","$afac8e64b68760a8$export$b09f296caca7547a","$afac8e64b68760a8$export$eed3a6606b3adc41","$afac8e64b68760a8$export$479eef7c8f1b846c","v02","d0232","d3210","v32","d3232","d0210","d1010","v10","paramResult","temp1","temp2","closestPoint","closestPoint2","closestPointTemp","projectedPointTemp","planeTemp","lineTemp","closestPoint1","closestPoint3","dp","cp","$593bc8ef8d1a55fc$export$2622f4315304edad","$1l8b2","$593bc8ef8d1a55fc$var$ExtendedTrianglePoolBase","PrimitivePool","$0f9e1864656e7fae$export$bf300c504651112a","getNewPrimitive","_getNewPrimitive","_primitives","primitives","primitive","$6075a1513b66f4c0$var$_box1","$6075a1513b66f4c0$var$_box2","$6075a1513b66f4c0$export$963c78622ed2c172","$8x2iv","$xqrrD","$6075a1513b66f4c0$var$boxStack","$6075a1513b66f4c0$var$boxPool","BufferStack","setBuffer","$6075a1513b66f4c0$var$shapecastTraverse","intersectsBoundsFunc","intersectsRangeFunc","nodeScoreFunc","nodeIndexByteOffset","nodeIndex16","IS_LEAF","OFFSET","COUNT","BOUNDING_DATA_INDEX","score1","score2","box1","box2","c1StopTraversal","c2StopTraversal","LEFT_NODE","RIGHT_NODE","temp","isC1Leaf","c1Intersection","CONTAINED","getLeftOffset","getRightEndOffset","isC2Leaf","c2Intersection","clearBuffer","$6363300ccf15b961$export$bc7cbaf27fbe938e","n16","$6363300ccf15b961$export$3231e969238304f3","$6363300ccf15b961$export$d61684373eacdf61","$6363300ccf15b961$export$7a68bc00425859d","$6363300ccf15b961$export$4f44f52d9f75fa31","$6363300ccf15b961$export$b43717b3ca95505","$6363300ccf15b961$export$b5b7e27a1440579d","$064797f1cfb48450$export$7451c73ce907854f","stack","prevBuffer","$67f4708097c33efc$export$96ec44700e587d99","$67f4708097c33efc$var$temp","$67f4708097c33efc$var$temp1","minThresholdSq","maxThresholdSq","closestDistanceTriIndex","score","triIndex","closestDistance","$01d4f4206273ed95$export$6f0a8fc5d2775a51","$01d4f4206273ed95$export$4331f2604b0bca4","$01d4f4206273ed95$export$be1391b7aa79c0f6","$7pS02","$dRxiJ","intersections","intersectTri","intersectsTriangleFunc","setTriangle","$5664c169f49816c4$export$1a557053019a130b","$5664c169f49816c4$var$_vA","$5664c169f49816c4$var$_vB","$5664c169f49816c4$var$_vC","$5664c169f49816c4$var$_uvA","$5664c169f49816c4$var$_uvB","$5664c169f49816c4$var$_uvC","$5664c169f49816c4$var$_normalA","$5664c169f49816c4$var$_normalB","$5664c169f49816c4$var$_normalC","$5664c169f49816c4$var$_intersectionPoint","triOffset","$5664c169f49816c4$var$checkBufferGeometryIntersection","$5664c169f49816c4$var$checkIntersection","BackSide","DoubleSide","$a17a0e7ef0b826e6$export$32f7fa781964ae30","ta","tc","$7afeb992771d32d5$export$8eb1eda96b2e6d7a","indexArr","offsetLeft","offsetRight","forceChildren","includesLeft","includesRight","traverseLeft","traverseRight","leftChange","rightChange","didChange","lefti","righti","minLeftValue","maxLeftValue","minRightValue","maxRightValue","$f6a695dbb681b4c5$export$630e89aab3ddc1d6","$d4vta","$f6a695dbb681b4c5$var$_boxIntersection","$f6a695dbb681b4c5$var$_raycast","intersectTris","leftIndex","intersectRay","rightIndex","$98440f459aa220f3$export$d5a069a08bb68982","$98440f459aa220f3$var$_boundingBox","$15dd3f9915d1b1ff$export$1fa457bc72ef1a2a","$15dd3f9915d1b1ff$var$_boxIntersection","$15dd3f9915d1b1ff$var$_xyzFields","$15dd3f9915d1b1ff$var$_raycastFirst","intersectClosestTri","SPLIT_AXIS","xyzAxis","rayDir","leftToRight","c1Result","isOutside","c2Result","$9acb57256233c065$export$b2f96b0abaf94e0a","$9acb57256233c065$var$boundingBox","$9acb57256233c065$var$triangle","$9acb57256233c065$var$triangle2","$9acb57256233c065$var$invertedMat","$9acb57256233c065$var$obb","$9acb57256233c065$var$obb2","$9acb57256233c065$var$_intersectsGeometry","cachedObb","thisGeometry","thisIndex","thisPos","boundsTree","leftIntersection","rightIntersection","$9be714d2e19cc068$export$5912902c175a555e","$9be714d2e19cc068$var$tempMatrix","$9be714d2e19cc068$var$obb","$9be714d2e19cc068$var$obb2","$9be714d2e19cc068$var$temp1","$9be714d2e19cc068$var$temp2","$9be714d2e19cc068$var$temp3","$9be714d2e19cc068$var$temp4","otherPos","otherIndex","triangle2","tempTarget2","tempTargetDest2","closestDistanceOtherTriIndex","otherOffset","otherCount","tempTargetDest1","$585bf4558c86be92$export$a2253c6980b92559","$585bf4558c86be92$var$tempMatrix","$585bf4558c86be92$var$aabb","$585bf4558c86be92$var$aabb2","intersectsRanges","intersectsTriangles","indexAttr","positionAttr","otherIndexAttr","otherPositionAttr","iterateOverDoubleTriangles","offset2","depth1","depth2","originalIntersectsRanges","nodeIndex1","nodeIndex2","$c1c3e12524864241$export$7e7412b9f4f11a5c","$c1c3e12524864241$export$dddff414156655a1","$c1c3e12524864241$export$dae1f8efdced590b","vi","$d955d16ddee6d2e4$export$40f4af49b81ca898","$f2500bdd73784d92$export$1999205ebe856279","$f2500bdd73784d92$var$_boxIntersection","$f2500bdd73784d92$var$_raycast","intersectTris_indirect","$0b8fb114025d9d97$export$44e48d4cf2fe0609","$0b8fb114025d9d97$var$_boxIntersection","$0b8fb114025d9d97$var$_xyzFields","$0b8fb114025d9d97$var$_raycastFirst","intersectClosestTri_indirect","$8774d8cede10b4d0$export$80dca0df80ee0084","$8774d8cede10b4d0$var$boundingBox","$8774d8cede10b4d0$var$triangle","$8774d8cede10b4d0$var$triangle2","$8774d8cede10b4d0$var$invertedMat","$8774d8cede10b4d0$var$obb","$8774d8cede10b4d0$var$obb2","$8774d8cede10b4d0$var$_intersectsGeometry","ti","$c4f746093678aa23$export$334b669407b5ec06","$c4f746093678aa23$var$tempMatrix","$c4f746093678aa23$var$obb","$c4f746093678aa23$var$obb2","$c4f746093678aa23$var$temp1","$c4f746093678aa23$var$temp2","$c4f746093678aa23$var$temp3","$c4f746093678aa23$var$temp4","ti2","$5e75f41ad0049e3c$export$4e2970292710be2c","$5e75f41ad0049e3c$var$tempMatrix","$5e75f41ad0049e3c$var$aabb","$5e75f41ad0049e3c$var$aabb2","ti1","$9611e0cfae405faf$export$9c28fa8114adc339","$88b7fc9acd2941fb$export$cec4aea73fa71fc5","$88b7fc9acd2941fb$export$97cada60b6f00a63","$88b7fc9acd2941fb$export$6ce1ecae0cd1cc55","$88b7fc9acd2941fb$var$UP_VECTOR","$88b7fc9acd2941fb$var$_dir","triPoints","startMatches","endMatches","tp","$b8134a58754c7ea3$export$b2d7c053833d1662","$b8134a58754c7ea3$var$UP_VECTOR","$b8134a58754c7ea3$var$_v0","$b8134a58754c7ea3$var$_v1","$b8134a58754c7ea3$var$_normal","$b8134a58754c7ea3$var$_triangle","projectionDir","thresholdAngle","thresholdDot","indexCount","vertKeys","hashes","edgeData","jNext","vecHash0","vecHash1","reverseHash","otherNormal","meetsThreshold","normDot","otherDot","projectionThreshold","index0","$23ae1a62f6ba3037$export$84bed164e326c2f0","$23ae1a62f6ba3037$export$fbbde8a5b23b7b65","$23ae1a62f6ba3037$var$_line","overlaps","overlap","prevOverlap","invOverlaps","invOverlap","$d72b22c0d316ba07$export$3240a8dc8bb0ce4c","$d72b22c0d316ba07$var$UP_VECTOR","$d72b22c0d316ba07$var$_plane","$d72b22c0d316ba07$var$_planeHit","$d72b22c0d316ba07$var$_lineDirection","startDist","endDist","isStartOnPlane","isStartBelow","isEndBelow","didHit","$46bea0e9f6f7cdfa$export$87b006ababf09c4d","$46bea0e9f6f7cdfa$var$_orthoPlane","$46bea0e9f6f7cdfa$var$_edgeLine","$46bea0e9f6f7cdfa$var$_point","$46bea0e9f6f7cdfa$var$_vec","$46bea0e9f6f7cdfa$var$_tri","$46bea0e9f6f7cdfa$var$_line","$46bea0e9f6f7cdfa$var$_triLine","$46bea0e9f6f7cdfa$var$_dir","$46bea0e9f6f7cdfa$var$_triDir","intersectCount","endIntersects","edgeIntersects","$db95b59be4665d0e$export$23512680614f2620","$db95b59be4665d0e$var$_dir","$db95b59be4665d0e$var$_v0","$db95b59be4665d0e$var$_v1","overlapLine","overlapsTarget","$40f6cd1fbf8b2094$export$983ba676a1dedbe3","$40f6cd1fbf8b2094$var$_tri","$40f6cd1fbf8b2094$var$_line","vertCount","tri2","$f602264c1435a2aa$export$d2881bb52ea2a3ff","$f602264c1435a2aa$export$8f233aafe78e44af","$4Yai1","$9bB8r","$e5S3P","$2lMur","$ahD9r","$f602264c1435a2aa$var$UP_VECTOR","$f602264c1435a2aa$var$_tri","$f602264c1435a2aa$var$_normal","$f602264c1435a2aa$var$_center","$f602264c1435a2aa$var$_vec","$f602264c1435a2aa$var$convertPathToGeometry","vector2s","flatMap","holesShapes","ShapeUtils","Shape","solidShapes","ShapeGeometry","$f602264c1435a2aa$var$convertPathToLineSegments","arr","intScalar","sortTriangles","log10","extendMultiplier","overallPath","triList","getSizeSortedTriList","handle","getGeometry","Path64","Clipper","makePath","triangleIsInsidePaths","Union","FillRule","NonZero","compressPoints","$e6b3dc1fa027c309$export$738d8b3921c27063","$e6b3dc1fa027c309$export$38f58f6965412d86","$e6b3dc1fa027c309$var$Location","$e6b3dc1fa027c309$export$20896d302a4e5029","$e6b3dc1fa027c309$export$6bbe4490a892c1c5","$e6b3dc1fa027c309$export$290b84559c467a5c","$e6b3dc1fa027c309$export$c8278727b7a5228b","$e6b3dc1fa027c309$export$9e3ecdefb2438757","$e6b3dc1fa027c309$export$1ede5f4f7cadbc19","$e6b3dc1fa027c309$export$f26b42c94e8a4f95","$e6b3dc1fa027c309$export$6a3f4acf2fce52a0","JoinType","EndType","Location","PointInPolygonResult","VertexFlags","JoinWith","HorzPosition","ClipType","PathType","PipResult","$e6b3dc1fa027c309$export$47d6d5d06ccbc908","$e6b3dc1fa027c309$export$b12670b10302a8b7","$e6b3dc1fa027c309$export$d7b4df78e16216b1","minkowskiInternal","isSum","isClosed","patLen","pathLen","pathPt","path2","basePt","quad","isPositive","reversePath","$e6b3dc1fa027c309$var$Group","paths","joinType","endType","Polygon","inPaths","outPath","outPaths","pathsReversed","$e6b3dc1fa027c309$export$f7b22d527d83f4ad","xOrPt","yOrScale","lhs","rhs","$e6b3dc1fa027c309$export$9bad362b29d84293","isAlmostZero","notEquals","obj","$e6b3dc1fa027c309$export$8cbc02e4273c0b24","miterLimit","arcTolerance","preserveCollinear","reverseSolution","_groupList","_normals","_solution","MiterLimit","ArcTolerance","MergeGroups","PreserveCollinear","ReverseSolution","addPath","addPaths","executeInternal","_delta","_mitLimSqr","sqr","doGroupOffset","execute","solution","$e6b3dc1fa027c309$export$389255fe4ace408b","addSubjectPaths","Negative","Positive","executePolytree","polytree","executePolyTree","getUnitNormal","executeCallback","deltaCallback","DeltaCallback","getBoundsAndLowestPolyIdx","rec","$e6b3dc1fa027c309$export$e7ab2e89a2fb5a6f","lpX","MIN_SAFE_INTEGER","translatePoint","reflectPoint","pivot","almostZero","epsilon","hypotenuse","normalizeVector","inverseHypot","getAvgUnitVector","vec1","vec2","pt1a","pt1b","pt2a","pt2b","m2","m1","getPerpendic","norm","$e6b3dc1fa027c309$export$d379afd9763b528f","_groupDelta","getPerpendicD","doSquare","absDelta","ptQ","pt3","pt4","doMiter","cosA","doRound","arcTol","defaultArcTolerance","stepsPer360","_stepSin","_stepCos","_stepsPerRad","offsetVec","buildNormals","cnt","crossProduct","dotProduct","offsetPoint","sinA","Tolerance","_joinType","Miter","Square","offsetPolygon","offsetOpenJoined","offsetOpenPath","highI","_endType","Butt","Round","isJoined","Joined","stripDuplicates","asPath","$e6b3dc1fa027c309$export$a6dea2fac1e0b407","ownerIdx","$e6b3dc1fa027c309$export$ada4127871f05d7b","currIdx","mp","midPoint","rectPath","startingNewPath","prevOp","path1ContainsPath2","path1","ioCount","pip","pointInPolygon","IsInside","IsOutside","isClockwise","curr","prevPt","currPt","rectMidPoint","areOpposites","headingClockwise","getAdjacentLocation","loc","unlinkOp","op","unlinkOpBack","getEdgesForPt","isHeadingClockwise","edgeIdx","hasHorzOverlap","left1","right1","hasVertOverlap","top1","bottom1","addToEdge","uncoupleEdge","op2","setNewOwner","newIdx","addCorner","addCornerByRef","getLocation","success","getIntersection","ip","segsIntersect","getIntersectPt","getNextLocation","startLocs","firstCross","crossingLoc","startingLoc","prevCrossLoc","isClockw","ip2","pathBounds","containsRect","loc2","checkEdges","tidyEdgePair","getPath","edgeSet1","edgeSet2","combinedSet","idx","cw","ccw","p1a","p2a","isHorz","cwIsTowardLarger","opIsLarger","op2IsLarger","jLim","isRejoining","new_idx","$e6b3dc1fa027c309$export$b1d67b8e0b9a10d2","$e6b3dc1fa027c309$export$3a7c4895ca9e3ca9","InvalidRect64","invalidRect64","Intersect","subject","fillRule","BooleanOp","Intersection","EvenOdd","Difference","Xor","clipType","Subject","Clip","InflatePaths","co","RectClipPaths","rc","RectClip","RectClipLinesPaths","RectClipLines","MinkowskiSum","MinkowskiDiff","areaPaths","poly","path64ToString","paths64ToString","offsetPath","scalePoint64","scalePath","scalePaths","translatePath","translatePaths","reversePaths","getBoundsPaths","isClosedPath","lastPt","addPolyNodeToPaths","polyPath","polygon","polyTreeToPaths64","polyTree","perpendicDistFromLineSqrd","rdp","begin","epsSqrd","flags","max_d","ramerDouglasPeucker","ramerDouglasPeuckerPaths","getNext","getPrior","simplifyPath","prior2","next2","epsSqr","dsq","simplifyPaths","isClosedPaths","trimCollinear","isOpen","radiusX","radiusY","si","showPolyPathStructure","spaces","caption","isHole","showPolyTreeStructure","$e6b3dc1fa027c309$var$Vertex","$e6b3dc1fa027c309$var$LocalMinima","polytype","lm1","lm2","$e6b3dc1fa027c309$var$IntersectNode","$e6b3dc1fa027c309$var$OutPt","outrec","horz","$e6b3dc1fa027c309$export$1e0666df669b1ceb","$e6b3dc1fa027c309$var$HorzSegment","leftOp","rightOp","$e6b3dc1fa027c309$var$HorzJoin","ltor","rtol","op1","$e6b3dc1fa027c309$export$c3c7cbf43a3f0561","windCount","windCount2","isLeftBound","joinWith","$e6b3dc1fa027c309$export$467e9e338ef38141","addLocMin","minimaList","LocalMin","lm","addPathsToVertexList","vertexList","totalVertCnt","prev_v","curr_v","going_up","OpenStart","LocalMax","going_up0","OpenEnd","$e6b3dc1fa027c309$var$SimpleNavigableSet","items","pollLast","item","includes","$e6b3dc1fa027c309$export$33da2edff2b544f3","_cliptype","_fillrule","_currentLocMin","_currentBotY","_isSortedMinimaList","_hasOpenPaths","_using_polytree","_succeeded","_minimaList","_intersectList","_vertexList","_outrecList","_scanlineList","_horzSegList","_horzJoinList","isOdd","isHotEdgeActive","localMin","isOpenEndActive","isOpenEnd","vertexTop","getPrevHotEdge","prevInAEL","isFront","frontEdge","getDx","NEGATIVE_INFINITY","POSITIVE_INFINITY","topX","currentY","bot","isHorizontal","isHeadingRightHorz","isHeadingLeftHorz","swapActives","ae1","ae2","getPolyType","isSamePolyType","setDx","nextVertex","windDx","prevPrevVertex","isMaxima","isMaximaActive","getMaximaPair","nextInAEL","getCurrYMaximaVertex_Open","getCurrYMaximaVertex","setSides","startEdge","endEdge","backEdge","swapOutrecs","or1","or2","setOwner","newOwner","owner","areaTriangle","getRealOutRec","outRec","isValidOwner","testOwner","uncoupleOutRec","outrecIsAscending","hotEdge","swapFrontBackSides","edgesAdjacentInAEL","inode","clearSolutionOnly","_actives","deleteFromAEL","disposeIntersectNodes","locMin1","locMin2","_sel","insertScanline","popScanline","hasLocMinAtY","popLocalMinima","addSubject","addOpenSubject","addClip","addReuseableData","reuseableData","isContributingClosed","isContributingOpen","isInClip","isInSubj","setWindCountForClosedPathEdge","setWindCountForOpenPathEdge","cnt1","cnt2","isValidAelOrder","resident","newcomer","curX","newcomerIsLeft","insertLeftEdge","Right","insertRightEdge","insertLocalMinimaIntoAEL","botY","localMinima","leftBound","rightBound","contributing","addLocalMinPoly","checkJoinLeft","intersectEdges","swapPositionsInAEL","pushHorz","checkJoinRight","startOpenPath","nextInSEL","popHorz","isNew","newOutRec","prevHotEdge","addLocalMaxPoly","addOutPt","joinOutrecPaths","p1Start","p2Start","p1End","p2End","toFront","opFront","opBack","newOp","updateEdgeIntoAEL","findEdgeWithMatchingLocMin","oldE1WindCount","oldE2WindCount","resultOp","ae3","e1WindCountIs0or1","e2WindCountIs0or1","e1Wc2","e2Wc2","adjustCurrXAndCopyToSEL","topY","prevInSEL","jump","Left","ct","doHorizontal","convertHorzSegsToJoins","doIntersections","doTopOfScanbeam","processHorzJoins","buildIntersectList","processIntersectList","addNewIntersectNode","absDx1","absDx2","getClosestPtOnSegment","extractFromSEL","insert1Before2InSEL","lEnd","rEnd","currBase","prevBase","resetHorzDirection","vertexMax","leftX","rightX","isLeftToRight","horzIsSpike","nextPt","trimHorz","horzEdge","wasTrimmed","addToHorzSegList","getLastOp","horzIsOpen","Y","vertex_max","doMaxima","prevE","nextE","maxPair","checkCurrX","fixOutRecPts","setHorzSegHeadingForward","hs","opP","opN","updateHorzSegment","outrecHasEdges","curr_y","opA","opZ","duplicateOp","insert_after","hs1","hs2","getCleanPath","pointInOpPolygon","isAbove","startingAbove","IsOn","path1InsidePath2","outside_cnt","getBoundsPath","moveSplits","fromOr","toOr","splits","op1b","op2b","ptsReallyClose","isVerySmallTriangle","isValidClosedPath","disposeOutPt","cleanCollinear","startOp","fixSelfIntersects","doSplitOp","splitOp","nextNextOp","getIntersectPoint","area1","absArea1","area2","absArea2","newOp2","buildPath","buildPaths","solutionClosed","solutionOpen","checkBounds","checkSplitOwner","recursiveSplit","recursiveCheckOwners","polypath","addChild","buildTree","open_path","addReusableData","reusableData","addOpenSubjectPaths","addClipPaths","openPaths","lOrIsValidOrRec","contains","subtract","checkPrecision","precision_range_error","floatingPointTolerance","checkCastInt64","max_coord","min_coord","Invalid64","ln1a","ln1b","ln2a","ln2b","dy1","dx1","dy2","dx2","seg1a","seg1b","seg2a","seg2b","inclusive","res1","res2","res3","res4","offPt","seg1","seg2","MaxInt64","MaxCoord","defaultMinimumEdgeLength","$6b01f26c0fbb53df$export$a1384fe5bb05e0aa","k1","$6b01f26c0fbb53df$var$areEqual","$6b01f26c0fbb53df$var$areClose","k2","$6b01f26c0fbb53df$var$sameDirection","$a42b77ae67a84214$export$a4592ad7ee5e85f","$a42b77ae67a84214$var$xzToXzCopy","$a42b77ae67a84214$var$epsEquals","$a42b77ae67a84214$var$vectorEpsEquals","crossCount","$a42b77ae67a84214$var$lineCrossesLine","A","C","D","$1b63280c8944b3c2$export$22df3f56fb458152","$1b63280c8944b3c2$var$_tri","$77c9dc8b1808b43f$export$c56c51fae37b2d63"],"version":3,"file":"silhouetteProjection.4adac46b.js.map"} \ No newline at end of file diff --git a/example/bundle/silhouetteProjection.b08c1309.js b/example/bundle/silhouetteProjection.b08c1309.js new file mode 100644 index 0000000..72db7a2 --- /dev/null +++ b/example/bundle/silhouetteProjection.b08c1309.js @@ -0,0 +1,4 @@ +let e,t,r,o,i,n,s,l,a,d,u;function p(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},w={},f={},c=g.parcelRequire6c98;null==c&&((c=function(e){if(e in w)return w[e].exports;if(e in f){var t=f[e];delete f[e];var r={id:e,exports:{}};return w[e]=r,t.call(r.exports,r,r.exports),r.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){f[e]=t},g.parcelRequire6c98=c),c.register("27Lyk",function(e,t){p(e.exports,"register",()=>r,e=>r=e),p(e.exports,"resolve",()=>o,e=>o=e);var r,o,i={};r=function(e){for(var t=Object.keys(e),r=0;r{if(e.message)throw Error(`${v}: Could not create Web Worker with error "${e.message}"`);throw Error(`${v}: Could not create Web Worker.`)}}generate(e,t={}){if(this.running)throw Error(`${v}: Already running job.`);if(null===this.worker)throw Error(`${v}: Worker has been disposed.`);let{worker:r}=this;return this.running=!0,new Promise((o,i)=>{r.onerror=e=>{i(Error(`${v}: ${e.message}`)),this.running=!1},r.onmessage=e=>{this.running=!1;let{data:n}=e;if(n.error)i(Error(n.error)),r.onmessage=null;else if(n.result){if(t.output===O.OUTPUT_BOTH){let e=n.result.map(e=>{let t=new y.BufferGeometry;return t.setAttribute("position",new y.BufferAttribute(e.position,3,!1)),e.index&&t.setIndex(new y.BufferAttribute(e.index,1,!1)),t});o(e)}else{let e=new y.BufferGeometry;e.setAttribute("position",new y.BufferAttribute(n.result.position,3,!1)),e.setIndex(new y.BufferAttribute(n.result.index,1,!1)),o(e)}r.onmessage=null}else t.onProgress&&t.onProgress(n.progress)};let n=e.index?e.index.array.slice():null,s=e.attributes.position.array.slice(),l=[s.buffer];n&&l.push(n.buffer),r.postMessage({index:n,position:s,options:{...t,onProgress:null,includedProgressCallback:!!t.onProgress}},l)})}dispose(){this.worker.terminate(),this.worker=null}}const j={displaySilhouette:!0,displayWireframe:!1,displayOutline:!1,displayModel:!0,useWorker:!1,rotate:()=>{l.quaternion.random(),l.position.set(0,0,0),l.updateMatrixWorld(!0);let e=new y.Box3;e.setFromObject(i,!0),e.getCenter(l.position).multiplyScalar(-1),l.position.y=Math.max(0,-e.min.y)+1},regenerate:()=>{S=T()}};let S=null;function*T(e=30){d.innerText="processing: --";let t=window.performance.now(),r=[];i.updateWorldMatrix(!0,!0),i.traverse(e=>{if(e.geometry){let t=e.geometry.clone();for(let r in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==r&&t.deleteAttribute(r);r.push(t)}});let o=(0,b.mergeGeometries)(r,!1),l=window.performance.now()-t;yield,t=window.performance.now();let p=null;if(j.useWorker)for(u.generate(o,{output:x.OUTPUT_BOTH,onProgress:e=>{d.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`}}).then(e=>{p=e});null===p;)yield;else{let t=new x.SilhouetteGenerator;t.iterationTime=e,t.output=x.OUTPUT_BOTH;let r=t.generate(o,{onProgress:(e,t)=>{d.innerText=`processing: ${parseFloat((100*e).toFixed(2))}%`;let r=t.getGeometry();n.geometry.dispose(),n.geometry=r[0],s.geometry=r[0],a.geometry.dispose(),a.geometry=r[1],(j.displaySilhouette||j.displayWireframe||j.displayOutline)&&(n.geometry.dispose(),n.geometry=r[0],s.geometry=r[0],a.geometry.dispose(),a.geometry=r[1])}}),i=r.next();for(;!i.done;)i=r.next(),yield;p=i.value}let g=window.performance.now()-t;n.geometry.dispose(),n.geometry=p[0],s.geometry=p[0],a.geometry.dispose(),a.geometry=p[1],d.innerText=`merge geometry : ${l.toFixed(2)}ms +edge trimming : ${g.toFixed(2)}ms +triangles : ${n.geometry.index.count/3} tris`}!async function(){d=document.getElementById("output"),(e=new y.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(15658734,1),document.body.appendChild(e.domElement),r=new y.Scene;let p=new y.DirectionalLight(16777215,3.5);p.position.set(1,2,3),r.add(p);let g=new y.AmbientLight(11583173,.5);r.add(g),(l=new y.Group).position.y=2,r.add(l),(i=new y.Mesh(new y.TorusKnotGeometry(1,.4,120,30),new y.MeshStandardMaterial({polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}))).rotation.set(Math.PI/4,0,Math.PI/8),l.add(i),(n=new y.Mesh(void 0,new y.MeshBasicMaterial({color:15753874,side:y.DoubleSide,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}))).position.y=-2,r.add(n),(a=new y.LineSegments(void 0,new y.LineBasicMaterial({color:0}))).position.y=-2,r.add(a),(s=new y.Mesh(void 0,new y.MeshBasicMaterial({color:12720219,wireframe:!0}))).position.y=-2,r.add(s),(t=new y.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.01,50)).position.setScalar(4.5),t.updateProjectionMatrix(),new h.OrbitControls(t,e.domElement),(o=new m.GUI).add(j,"displayModel"),o.add(j,"displaySilhouette"),o.add(j,"displayOutline"),o.add(j,"displayWireframe"),o.add(j,"useWorker"),o.add(j,"rotate"),o.add(j,"regenerate"),u=new W,S=T(),function o(){if(requestAnimationFrame(o),S){let e=S.next();e.done&&(S=null)}i.visible=j.displayModel,n.visible=j.displaySilhouette,s.visible=j.displayWireframe,a.visible=j.displayOutline,e.render(r,t)}(),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}(); +//# sourceMappingURL=silhouetteProjection.b08c1309.js.map diff --git a/example/bundle/silhouetteProjection.b08c1309.js.map b/example/bundle/silhouetteProjection.b08c1309.js.map new file mode 100644 index 0000000..7b07882 --- /dev/null +++ b/example/bundle/silhouetteProjection.b08c1309.js.map @@ -0,0 +1 @@ +{"mappings":"IG+CI,EAAU,EAAQ,EAAO,EACzB,EAAO,EAAY,EAAqB,EAAO,EAC/C,EACA,E,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,Q,S,C,C,C,E,E,E,O,C,W,I,E,A,G,E,G,E,E,O,C,U,I,E,A,G,E,GFhDJ,IAcA,EACA,EAfI,EAAU,CAAC,EAcf,EAbA,SAAkB,CAAK,EAErB,IAAK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,GAAI,OAAO,UAAA,CAAa,OAAO,WAAA,CAAa,IAAM,GAAlF,EACO,QAAA,CAAS,SAAA,CAAW,KAC3B,EAAO,sBAAP,GAGW,IAAI,EAAA,aAAY,CAAG,EAAQ,EAAS,UAA/C,EAGA,AADA,CAAA,EAAM,IAAI,EAAA,GAAE,AAAZ,EACI,GAAA,CAAK,EAAQ,gBACjB,EAAI,GAAA,CAAK,EAAQ,qBACjB,EAAI,GAAA,CAAK,EAAQ,kBACjB,EAAI,GAAA,CAAK,EAAQ,oBACjB,EAAI,GAAA,CAAK,EAAQ,aACjB,EAAI,GAAA,CAAK,EAAQ,UACjB,EAAI,GAAA,CAAK,EAAQ,cAEjB,EAAS,IAAI,EAEb,EAAO,IAEP,AAuID,SAAS,IAIR,GAFA,sBAAuB,GAElB,EAAO,CAEX,IAAM,EAAM,EAAK,IAAjB,EACK,CAAA,EAAI,IAAA,EAER,CAAA,EAAO,IAFR,CAMD,CAEA,EAAM,OAAA,CAAU,EAAO,YAAvB,CACA,EAAW,OAAA,CAAU,EAAO,iBAA5B,CACA,EAAoB,OAAA,CAAU,EAAO,gBAArC,CACA,EAAM,OAAA,CAAU,EAAO,cAAvB,CACA,EAAS,MAAA,CAAQ,EAAO,EAEzB,IA1JC,OAAO,gBAAA,CAAkB,SAAU,WAElC,EAAO,MAAA,CAAS,OAAO,UAAA,CAAa,OAAO,WAA3C,CACA,EAAO,sBAAP,GAEA,EAAS,OAAA,CAAS,OAAO,UAAA,CAAY,OAAO,WAA5C,CAED,EAAG,CAAA,EAEJ","sources":["","node_modules/@parcel/runtime-js/lib/helpers/bundle-manifest.js","node_modules/@parcel/runtime-js/lib/runtime-48e07754cc2432c5.js","example/silhouetteProjection.js","src/worker/SilhouetteGeneratorWorker.js","node_modules/@parcel/runtime-js/lib/runtime-565271cc3a93207f.js","node_modules/@parcel/runtime-js/lib/helpers/get-worker-url.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"27Lyk\", function(module, exports) {\n\n$parcel$export(module.exports, \"register\", () => $18c11f3350a906ea$export$6503ec6e8aabbaf, (v) => $18c11f3350a906ea$export$6503ec6e8aabbaf = v);\n$parcel$export(module.exports, \"resolve\", () => $18c11f3350a906ea$export$f7ad0328861e2f03, (v) => $18c11f3350a906ea$export$f7ad0328861e2f03 = v);\nvar $18c11f3350a906ea$export$6503ec6e8aabbaf;\nvar $18c11f3350a906ea$export$f7ad0328861e2f03;\n\"use strict\";\nvar $18c11f3350a906ea$var$mapping = {};\nfunction $18c11f3350a906ea$var$register(pairs) {\n var keys = Object.keys(pairs);\n for(var i = 0; i < keys.length; i++)$18c11f3350a906ea$var$mapping[keys[i]] = pairs[keys[i]];\n}\nfunction $18c11f3350a906ea$var$resolve(id) {\n var resolved = $18c11f3350a906ea$var$mapping[id];\n if (resolved == null) throw new Error(\"Could not resolve bundle with id \" + id);\n return resolved;\n}\n$18c11f3350a906ea$export$6503ec6e8aabbaf = $18c11f3350a906ea$var$register;\n$18c11f3350a906ea$export$f7ad0328861e2f03 = $18c11f3350a906ea$var$resolve;\n\n});\n\nvar $958fdf726f833d6a$exports = {};\n\n(parcelRequire(\"27Lyk\")).register(JSON.parse('{\"8QGS7\":\"silhouetteProjection.b08c1309.js\",\"82ikj\":\"silhouetteAsync.worker.f555f2b4.js\",\"J4nAg\":\"projectionAsync.worker.15f44cdc.js\",\"4qUe1\":\"silhouetteProjection.4adac46b.js\",\"kElIp\":\"silhouetteProjection.e215f6e5.js\"}'));\n\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $jiuw3 = parcelRequire(\"jiuw3\");\n\nvar $5Rd1x = parcelRequire(\"5Rd1x\");\n\nvar $7ePFa = parcelRequire(\"7ePFa\");\n\nvar $4CEV9 = parcelRequire(\"4CEV9\");\n\nvar $ilwiq = parcelRequire(\"ilwiq\");\n\nvar $l7uOa = parcelRequire(\"l7uOa\");\nconst $6c7008b1813725e4$var$NAME = \"SilhouetteGeneratorWorker\";\nvar $d6de5c547c645488$exports = {};\nvar $56b621a6dd25b2cb$exports = {};\n\"use strict\";\n$56b621a6dd25b2cb$exports = function(workerUrl, origin, isESM) {\n if (origin === self.location.origin) // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? \"import \" + JSON.stringify(workerUrl) + \";\" : \"importScripts(\" + JSON.stringify(workerUrl) + \");\";\n return URL.createObjectURL(new Blob([\n source\n ], {\n type: \"application/javascript\"\n }));\n }\n};\n\n\n\nlet $d6de5c547c645488$var$url = new URL((parcelRequire(\"27Lyk\")).resolve(\"82ikj\"), import.meta.url);\n$d6de5c547c645488$exports = $56b621a6dd25b2cb$exports($d6de5c547c645488$var$url.toString(), $d6de5c547c645488$var$url.origin, true);\n\n\nclass $6c7008b1813725e4$export$86161294a4c08d30 {\n constructor(){\n this.running = false;\n this.worker = new Worker($d6de5c547c645488$exports);\n this.worker.onerror = (e)=>{\n if (e.message) throw new Error(`${$6c7008b1813725e4$var$NAME}: Could not create Web Worker with error \"${e.message}\"`);\n else throw new Error(`${$6c7008b1813725e4$var$NAME}: Could not create Web Worker.`);\n };\n }\n generate(geometry, options = {}) {\n if (this.running) throw new Error(`${$6c7008b1813725e4$var$NAME}: Already running job.`);\n if (this.worker === null) throw new Error(`${$6c7008b1813725e4$var$NAME}: Worker has been disposed.`);\n const { worker: worker } = this;\n this.running = true;\n return new Promise((resolve, reject)=>{\n worker.onerror = (e)=>{\n reject(new Error(`${$6c7008b1813725e4$var$NAME}: ${e.message}`));\n this.running = false;\n };\n worker.onmessage = (e)=>{\n this.running = false;\n const { data: data } = e;\n if (data.error) {\n reject(new Error(data.error));\n worker.onmessage = null;\n } else if (data.result) {\n if (options.output === (0, $l7uOa.OUTPUT_BOTH)) {\n const result = data.result.map((info)=>{\n const geometry = new (0, $ilwiq.BufferGeometry)();\n geometry.setAttribute(\"position\", new (0, $ilwiq.BufferAttribute)(info.position, 3, false));\n if (info.index) geometry.setIndex(new (0, $ilwiq.BufferAttribute)(info.index, 1, false));\n return geometry;\n });\n resolve(result);\n } else {\n const geometry = new (0, $ilwiq.BufferGeometry)();\n geometry.setAttribute(\"position\", new (0, $ilwiq.BufferAttribute)(data.result.position, 3, false));\n geometry.setIndex(new (0, $ilwiq.BufferAttribute)(data.result.index, 1, false));\n resolve(geometry);\n }\n worker.onmessage = null;\n } else if (options.onProgress) options.onProgress(data.progress);\n };\n const index = geometry.index ? geometry.index.array.slice() : null;\n const position = geometry.attributes.position.array.slice();\n const transfer = [\n position.buffer\n ];\n if (index) transfer.push(index.buffer);\n worker.postMessage({\n index: index,\n position: position,\n options: {\n ...options,\n onProgress: null,\n includedProgressCallback: Boolean(options.onProgress)\n }\n }, transfer);\n });\n }\n dispose() {\n this.worker.terminate();\n this.worker = null;\n }\n}\n\n\nconst $0d0b0cc2e69039e3$var$params = {\n displaySilhouette: true,\n displayWireframe: false,\n displayOutline: false,\n displayModel: true,\n useWorker: false,\n rotate: ()=>{\n $0d0b0cc2e69039e3$var$group.quaternion.random();\n $0d0b0cc2e69039e3$var$group.position.set(0, 0, 0);\n $0d0b0cc2e69039e3$var$group.updateMatrixWorld(true);\n const box = new (0, $ilwiq.Box3)();\n box.setFromObject($0d0b0cc2e69039e3$var$model, true);\n box.getCenter($0d0b0cc2e69039e3$var$group.position).multiplyScalar(-1);\n $0d0b0cc2e69039e3$var$group.position.y = Math.max(0, -box.min.y) + 1;\n },\n regenerate: ()=>{\n $0d0b0cc2e69039e3$var$task = $0d0b0cc2e69039e3$var$updateEdges();\n }\n};\nlet $0d0b0cc2e69039e3$var$renderer, $0d0b0cc2e69039e3$var$camera, $0d0b0cc2e69039e3$var$scene, $0d0b0cc2e69039e3$var$gui, $0d0b0cc2e69039e3$var$controls;\nlet $0d0b0cc2e69039e3$var$model, $0d0b0cc2e69039e3$var$projection, $0d0b0cc2e69039e3$var$projectionWireframe, $0d0b0cc2e69039e3$var$group, $0d0b0cc2e69039e3$var$edges;\nlet $0d0b0cc2e69039e3$var$outputContainer;\nlet $0d0b0cc2e69039e3$var$worker;\nlet $0d0b0cc2e69039e3$var$task = null;\n$0d0b0cc2e69039e3$var$init();\nasync function $0d0b0cc2e69039e3$var$init() {\n $0d0b0cc2e69039e3$var$outputContainer = document.getElementById(\"output\");\n const bgColor = 0xeeeeee;\n // renderer setup\n $0d0b0cc2e69039e3$var$renderer = new (0, $ilwiq.WebGLRenderer)({\n antialias: true\n });\n $0d0b0cc2e69039e3$var$renderer.setPixelRatio(window.devicePixelRatio);\n $0d0b0cc2e69039e3$var$renderer.setSize(window.innerWidth, window.innerHeight);\n $0d0b0cc2e69039e3$var$renderer.setClearColor(bgColor, 1);\n document.body.appendChild($0d0b0cc2e69039e3$var$renderer.domElement);\n // scene setup\n $0d0b0cc2e69039e3$var$scene = new (0, $ilwiq.Scene)();\n // lights\n const light = new (0, $ilwiq.DirectionalLight)(0xffffff, 3.5);\n light.position.set(1, 2, 3);\n $0d0b0cc2e69039e3$var$scene.add(light);\n const ambientLight = new (0, $ilwiq.AmbientLight)(0xb0bec5, 0.5);\n $0d0b0cc2e69039e3$var$scene.add(ambientLight);\n // load model\n $0d0b0cc2e69039e3$var$group = new (0, $ilwiq.Group)();\n $0d0b0cc2e69039e3$var$group.position.y = 2;\n $0d0b0cc2e69039e3$var$scene.add($0d0b0cc2e69039e3$var$group);\n $0d0b0cc2e69039e3$var$model = new (0, $ilwiq.Mesh)(new (0, $ilwiq.TorusKnotGeometry)(1, 0.4, 120, 30), new (0, $ilwiq.MeshStandardMaterial)({\n polygonOffset: true,\n polygonOffsetFactor: 1,\n polygonOffsetUnits: 1\n }));\n $0d0b0cc2e69039e3$var$model.rotation.set(Math.PI / 4, 0, Math.PI / 8);\n $0d0b0cc2e69039e3$var$group.add($0d0b0cc2e69039e3$var$model);\n // create projection display mesh\n $0d0b0cc2e69039e3$var$projection = new (0, $ilwiq.Mesh)(undefined, new (0, $ilwiq.MeshBasicMaterial)({\n color: 0xf06292,\n side: (0, $ilwiq.DoubleSide),\n polygonOffset: true,\n polygonOffsetFactor: 1,\n polygonOffsetUnits: 1\n }));\n $0d0b0cc2e69039e3$var$projection.position.y = -2;\n $0d0b0cc2e69039e3$var$scene.add($0d0b0cc2e69039e3$var$projection);\n $0d0b0cc2e69039e3$var$edges = new (0, $ilwiq.LineSegments)(undefined, new (0, $ilwiq.LineBasicMaterial)({\n color: 0\n }));\n $0d0b0cc2e69039e3$var$edges.position.y = -2;\n $0d0b0cc2e69039e3$var$scene.add($0d0b0cc2e69039e3$var$edges);\n $0d0b0cc2e69039e3$var$projectionWireframe = new (0, $ilwiq.Mesh)(undefined, new (0, $ilwiq.MeshBasicMaterial)({\n color: 0xc2185b,\n wireframe: true\n }));\n $0d0b0cc2e69039e3$var$projectionWireframe.position.y = -2;\n $0d0b0cc2e69039e3$var$scene.add($0d0b0cc2e69039e3$var$projectionWireframe);\n // camera setup\n $0d0b0cc2e69039e3$var$camera = new (0, $ilwiq.PerspectiveCamera)(75, window.innerWidth / window.innerHeight, 0.01, 50);\n $0d0b0cc2e69039e3$var$camera.position.setScalar(4.5);\n $0d0b0cc2e69039e3$var$camera.updateProjectionMatrix();\n // controls\n $0d0b0cc2e69039e3$var$controls = new (0, $5Rd1x.OrbitControls)($0d0b0cc2e69039e3$var$camera, $0d0b0cc2e69039e3$var$renderer.domElement);\n $0d0b0cc2e69039e3$var$gui = new (0, $jiuw3.GUI)();\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"displayModel\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"displaySilhouette\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"displayOutline\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"displayWireframe\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"useWorker\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"rotate\");\n $0d0b0cc2e69039e3$var$gui.add($0d0b0cc2e69039e3$var$params, \"regenerate\");\n $0d0b0cc2e69039e3$var$worker = new (0, $6c7008b1813725e4$export$86161294a4c08d30)();\n $0d0b0cc2e69039e3$var$task = $0d0b0cc2e69039e3$var$updateEdges();\n $0d0b0cc2e69039e3$var$render();\n window.addEventListener(\"resize\", function() {\n $0d0b0cc2e69039e3$var$camera.aspect = window.innerWidth / window.innerHeight;\n $0d0b0cc2e69039e3$var$camera.updateProjectionMatrix();\n $0d0b0cc2e69039e3$var$renderer.setSize(window.innerWidth, window.innerHeight);\n }, false);\n}\nfunction* $0d0b0cc2e69039e3$var$updateEdges(runTime = 30) {\n $0d0b0cc2e69039e3$var$outputContainer.innerText = \"processing: --\";\n // transform and merge geometries to project into a single model\n let timeStart = window.performance.now();\n const geometries = [];\n $0d0b0cc2e69039e3$var$model.updateWorldMatrix(true, true);\n $0d0b0cc2e69039e3$var$model.traverse((c)=>{\n if (c.geometry) {\n const clone = c.geometry.clone();\n clone.applyMatrix4(c.matrixWorld);\n for(const key in clone.attributes)if (key !== \"position\") clone.deleteAttribute(key);\n geometries.push(clone);\n }\n });\n const mergedGeometry = (0, $7ePFa.mergeGeometries)(geometries, false);\n const mergeTime = window.performance.now() - timeStart;\n yield;\n // generate the candidate edges\n timeStart = window.performance.now();\n let result = null;\n if (!$0d0b0cc2e69039e3$var$params.useWorker) {\n const generator = new (0, $4CEV9.SilhouetteGenerator)();\n generator.iterationTime = runTime;\n generator.output = (0, $4CEV9.OUTPUT_BOTH);\n const task = generator.generate(mergedGeometry, {\n onProgress: (p, info)=>{\n $0d0b0cc2e69039e3$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n const result = info.getGeometry();\n $0d0b0cc2e69039e3$var$projection.geometry.dispose();\n $0d0b0cc2e69039e3$var$projection.geometry = result[0];\n $0d0b0cc2e69039e3$var$projectionWireframe.geometry = result[0];\n $0d0b0cc2e69039e3$var$edges.geometry.dispose();\n $0d0b0cc2e69039e3$var$edges.geometry = result[1];\n if ($0d0b0cc2e69039e3$var$params.displaySilhouette || $0d0b0cc2e69039e3$var$params.displayWireframe || $0d0b0cc2e69039e3$var$params.displayOutline) {\n $0d0b0cc2e69039e3$var$projection.geometry.dispose();\n $0d0b0cc2e69039e3$var$projection.geometry = result[0];\n $0d0b0cc2e69039e3$var$projectionWireframe.geometry = result[0];\n $0d0b0cc2e69039e3$var$edges.geometry.dispose();\n $0d0b0cc2e69039e3$var$edges.geometry = result[1];\n }\n }\n });\n let res = task.next();\n while(!res.done){\n res = task.next();\n yield;\n }\n result = res.value;\n } else {\n $0d0b0cc2e69039e3$var$worker.generate(mergedGeometry, {\n output: (0, $4CEV9.OUTPUT_BOTH),\n onProgress: (p)=>{\n $0d0b0cc2e69039e3$var$outputContainer.innerText = `processing: ${parseFloat((p * 100).toFixed(2))}%`;\n }\n }).then((res)=>{\n result = res;\n });\n while(result === null)yield;\n }\n const trimTime = window.performance.now() - timeStart;\n $0d0b0cc2e69039e3$var$projection.geometry.dispose();\n $0d0b0cc2e69039e3$var$projection.geometry = result[0];\n $0d0b0cc2e69039e3$var$projectionWireframe.geometry = result[0];\n $0d0b0cc2e69039e3$var$edges.geometry.dispose();\n $0d0b0cc2e69039e3$var$edges.geometry = result[1];\n $0d0b0cc2e69039e3$var$outputContainer.innerText = `merge geometry : ${mergeTime.toFixed(2)}ms\\n` + `edge trimming : ${trimTime.toFixed(2)}ms\\n` + `triangles : ${$0d0b0cc2e69039e3$var$projection.geometry.index.count / 3} tris`;\n}\nfunction $0d0b0cc2e69039e3$var$render() {\n requestAnimationFrame($0d0b0cc2e69039e3$var$render);\n if ($0d0b0cc2e69039e3$var$task) {\n const res = $0d0b0cc2e69039e3$var$task.next();\n if (res.done) $0d0b0cc2e69039e3$var$task = null;\n }\n $0d0b0cc2e69039e3$var$model.visible = $0d0b0cc2e69039e3$var$params.displayModel;\n $0d0b0cc2e69039e3$var$projection.visible = $0d0b0cc2e69039e3$var$params.displaySilhouette;\n $0d0b0cc2e69039e3$var$projectionWireframe.visible = $0d0b0cc2e69039e3$var$params.displayWireframe;\n $0d0b0cc2e69039e3$var$edges.visible = $0d0b0cc2e69039e3$var$params.displayOutline;\n $0d0b0cc2e69039e3$var$renderer.render($0d0b0cc2e69039e3$var$scene, $0d0b0cc2e69039e3$var$camera);\n}\n\n\n//# sourceMappingURL=silhouetteProjection.b08c1309.js.map\n","\"use strict\";\n\nvar mapping = {};\nfunction register(pairs) {\n var keys = Object.keys(pairs);\n for (var i = 0; i < keys.length; i++) {\n mapping[keys[i]] = pairs[keys[i]];\n }\n}\nfunction resolve(id) {\n var resolved = mapping[id];\n if (resolved == null) {\n throw new Error('Could not resolve bundle with id ' + id);\n }\n return resolved;\n}\nmodule.exports.register = register;\nmodule.exports.resolve = resolve;","require('./helpers/bundle-manifest').register(JSON.parse(\"{\\\"8QGS7\\\":\\\"silhouetteProjection.b08c1309.js\\\",\\\"82ikj\\\":\\\"silhouetteAsync.worker.f555f2b4.js\\\",\\\"J4nAg\\\":\\\"projectionAsync.worker.15f44cdc.js\\\",\\\"4qUe1\\\":\\\"silhouetteProjection.4adac46b.js\\\",\\\"kElIp\\\":\\\"silhouetteProjection.e215f6e5.js\\\"}\"));","import {\n\tBox3,\n\tWebGLRenderer,\n\tScene,\n\tDirectionalLight,\n\tAmbientLight,\n\tGroup,\n\tMeshStandardMaterial,\n\tMeshBasicMaterial,\n\tPerspectiveCamera,\n\tMesh,\n\tTorusKnotGeometry,\n\tDoubleSide,\n\tLineSegments,\n\tLineBasicMaterial,\n} from 'three';\nimport { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js';\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';\nimport { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';\nimport { OUTPUT_BOTH, SilhouetteGenerator } from '../src';\nimport { SilhouetteGeneratorWorker } from '../src/worker/SilhouetteGeneratorWorker.js';\n\nconst params = {\n\tdisplaySilhouette: true,\n\tdisplayWireframe: false,\n\tdisplayOutline: false,\n\tdisplayModel: true,\n\tuseWorker: false,\n\trotate: () => {\n\n\t\tgroup.quaternion.random();\n\t\tgroup.position.set( 0, 0, 0 );\n\t\tgroup.updateMatrixWorld( true );\n\n\t\tconst box = new Box3();\n\t\tbox.setFromObject( model, true );\n\t\tbox.getCenter( group.position ).multiplyScalar( - 1 );\n\t\tgroup.position.y = Math.max( 0, - box.min.y ) + 1;\n\n\t},\n\tregenerate: () => {\n\n\t\ttask = updateEdges();\n\n\t},\n};\n\nlet renderer, camera, scene, gui, controls;\nlet model, projection, projectionWireframe, group, edges;\nlet outputContainer;\nlet worker;\nlet task = null;\n\ninit();\n\nasync function init() {\n\n\toutputContainer = document.getElementById( 'output' );\n\n\tconst bgColor = 0xeeeeee;\n\n\t// renderer setup\n\trenderer = new WebGLRenderer( { antialias: true } );\n\trenderer.setPixelRatio( window.devicePixelRatio );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\trenderer.setClearColor( bgColor, 1 );\n\tdocument.body.appendChild( renderer.domElement );\n\n\t// scene setup\n\tscene = new Scene();\n\n\t// lights\n\tconst light = new DirectionalLight( 0xffffff, 3.5 );\n\tlight.position.set( 1, 2, 3 );\n\tscene.add( light );\n\n\tconst ambientLight = new AmbientLight( 0xb0bec5, 0.5 );\n\tscene.add( ambientLight );\n\n\t// load model\n\tgroup = new Group();\n\tgroup.position.y = 2;\n\tscene.add( group );\n\n\tmodel = new Mesh( new TorusKnotGeometry( 1, 0.4, 120, 30 ), new MeshStandardMaterial( {\n\t\tpolygonOffset: true,\n\t\tpolygonOffsetFactor: 1,\n\t\tpolygonOffsetUnits: 1,\n\t} ) );\n\tmodel.rotation.set( Math.PI / 4, 0, Math.PI / 8 );\n\tgroup.add( model );\n\n\t// create projection display mesh\n\tprojection = new Mesh( undefined, new MeshBasicMaterial( {\n\t\tcolor: 0xf06292,\n\t\tside: DoubleSide,\n\t\tpolygonOffset: true,\n\t\tpolygonOffsetFactor: 1,\n\t\tpolygonOffsetUnits: 1,\n\t} ) );\n\tprojection.position.y = - 2;\n\tscene.add( projection );\n\n\tedges = new LineSegments( undefined, new LineBasicMaterial( { color: 0 } ) );\n\tedges.position.y = - 2;\n\tscene.add( edges );\n\n\tprojectionWireframe = new Mesh( undefined, new MeshBasicMaterial( { color: 0xc2185b, wireframe: true } ) );\n\tprojectionWireframe.position.y = - 2;\n\tscene.add( projectionWireframe );\n\n\t// camera setup\n\tcamera = new PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.01, 50 );\n\tcamera.position.setScalar( 4.5 );\n\tcamera.updateProjectionMatrix();\n\n\t// controls\n\tcontrols = new OrbitControls( camera, renderer.domElement );\n\n\tgui = new GUI();\n\tgui.add( params, 'displayModel' );\n\tgui.add( params, 'displaySilhouette' );\n\tgui.add( params, 'displayOutline' );\n\tgui.add( params, 'displayWireframe' );\n\tgui.add( params, 'useWorker' );\n\tgui.add( params, 'rotate' );\n\tgui.add( params, 'regenerate' );\n\n\tworker = new SilhouetteGeneratorWorker();\n\n\ttask = updateEdges();\n\n\trender();\n\n\twindow.addEventListener( 'resize', function () {\n\n\t\tcamera.aspect = window.innerWidth / window.innerHeight;\n\t\tcamera.updateProjectionMatrix();\n\n\t\trenderer.setSize( window.innerWidth, window.innerHeight );\n\n\t}, false );\n\n}\n\nfunction* updateEdges( runTime = 30 ) {\n\n\toutputContainer.innerText = 'processing: --';\n\n\t// transform and merge geometries to project into a single model\n\tlet timeStart = window.performance.now();\n\tconst geometries = [];\n\tmodel.updateWorldMatrix( true, true );\n\tmodel.traverse( c => {\n\n\t\tif ( c.geometry ) {\n\n\t\t\tconst clone = c.geometry.clone();\n\t\t\tclone.applyMatrix4( c.matrixWorld );\n\t\t\tfor ( const key in clone.attributes ) {\n\n\t\t\t\tif ( key !== 'position' ) {\n\n\t\t\t\t\tclone.deleteAttribute( key );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgeometries.push( clone );\n\n\t\t}\n\n\t} );\n\tconst mergedGeometry = mergeGeometries( geometries, false );\n\tconst mergeTime = window.performance.now() - timeStart;\n\n\tyield;\n\n\t// generate the candidate edges\n\ttimeStart = window.performance.now();\n\n\tlet result = null;\n\tif ( ! params.useWorker ) {\n\n\t\tconst generator = new SilhouetteGenerator();\n\t\tgenerator.iterationTime = runTime;\n\t\tgenerator.output = OUTPUT_BOTH;\n\t\tconst task = generator.generate( mergedGeometry, {\n\n\t\t\tonProgress: ( p, info ) => {\n\n\t\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\n\t\t\t\tconst result = info.getGeometry();\n\t\t\t\tprojection.geometry.dispose();\n\t\t\t\tprojection.geometry = result[ 0 ];\n\t\t\t\tprojectionWireframe.geometry = result[ 0 ];\n\n\t\t\t\tedges.geometry.dispose();\n\t\t\t\tedges.geometry = result[ 1 ];\n\n\t\t\t\tif ( params.displaySilhouette || params.displayWireframe || params.displayOutline ) {\n\n\t\t\t\t\tprojection.geometry.dispose();\n\t\t\t\t\tprojection.geometry = result[ 0 ];\n\t\t\t\t\tprojectionWireframe.geometry = result[ 0 ];\n\n\t\t\t\t\tedges.geometry.dispose();\n\t\t\t\t\tedges.geometry = result[ 1 ];\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t} );\n\n\t\tlet res = task.next();\n\t\twhile ( ! res.done ) {\n\n\t\t\tres = task.next();\n\t\t\tyield;\n\n\t\t}\n\n\t\tresult = res.value;\n\n\t} else {\n\n\t\tworker\n\t\t\t.generate( mergedGeometry, {\n\t\t\t\toutput: OUTPUT_BOTH,\n\t\t\t\tonProgress: p => {\n\n\t\t\t\t\toutputContainer.innerText = `processing: ${ parseFloat( ( p * 100 ).toFixed( 2 ) ) }%`;\n\n\t\t\t\t},\n\t\t\t} )\n\t\t\t.then( res => {\n\n\t\t\t\tresult = res;\n\n\t\t\t} );\n\n\t\twhile ( result === null ) {\n\n\t\t\tyield;\n\n\t\t}\n\n\t}\n\n\tconst trimTime = window.performance.now() - timeStart;\n\tprojection.geometry.dispose();\n\tprojection.geometry = result[ 0 ];\n\tprojectionWireframe.geometry = result[ 0 ];\n\n\tedges.geometry.dispose();\n\tedges.geometry = result[ 1 ];\n\n\toutputContainer.innerText =\n\t\t`merge geometry : ${ mergeTime.toFixed( 2 ) }ms\\n` +\n\t\t`edge trimming : ${ trimTime.toFixed( 2 ) }ms\\n` +\n\t\t`triangles : ${ projection.geometry.index.count / 3 } tris`;\n\n}\n\nfunction render() {\n\n\trequestAnimationFrame( render );\n\n\tif ( task ) {\n\n\t\tconst res = task.next();\n\t\tif ( res.done ) {\n\n\t\t\ttask = null;\n\n\t\t}\n\n\t}\n\n\tmodel.visible = params.displayModel;\n\tprojection.visible = params.displaySilhouette;\n\tprojectionWireframe.visible = params.displayWireframe;\n\tedges.visible = params.displayOutline;\n\trenderer.render( scene, camera );\n\n}\n","import { BufferAttribute, BufferGeometry } from 'three';\nimport { OUTPUT_BOTH } from '../SilhouetteGenerator';\n\nconst NAME = 'SilhouetteGeneratorWorker';\nexport class SilhouetteGeneratorWorker {\n\n\tconstructor() {\n\n\t\tthis.running = false;\n\t\tthis.worker = new Worker( new URL( './silhouetteAsync.worker.js', import.meta.url ), { type: 'module' } );\n\t\tthis.worker.onerror = e => {\n\n\t\t\tif ( e.message ) {\n\n\t\t\t\tthrow new Error( `${ NAME }: Could not create Web Worker with error \"${ e.message }\"` );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( `${ NAME }: Could not create Web Worker.` );\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tgenerate( geometry, options = {} ) {\n\n\t\tif ( this.running ) {\n\n\t\t\tthrow new Error( `${ NAME }: Already running job.` );\n\n\t\t}\n\n\t\tif ( this.worker === null ) {\n\n\t\t\tthrow new Error( `${ NAME }: Worker has been disposed.` );\n\n\t\t}\n\n\t\tconst { worker } = this;\n\t\tthis.running = true;\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\n\t\t\tworker.onerror = e => {\n\n\t\t\t\treject( new Error( `${ NAME }: ${ e.message }` ) );\n\t\t\t\tthis.running = false;\n\n\t\t\t};\n\n\t\t\tworker.onmessage = e => {\n\n\t\t\t\tthis.running = false;\n\t\t\t\tconst { data } = e;\n\n\t\t\t\tif ( data.error ) {\n\n\t\t\t\t\treject( new Error( data.error ) );\n\t\t\t\t\tworker.onmessage = null;\n\n\t\t\t\t} else if ( data.result ) {\n\n\t\t\t\t\tif ( options.output === OUTPUT_BOTH ) {\n\n\t\t\t\t\t\tconst result = data.result.map( info => {\n\n\t\t\t\t\t\t\tconst geometry = new BufferGeometry();\n\t\t\t\t\t\t\tgeometry.setAttribute( 'position', new BufferAttribute( info.position, 3, false ) );\n\t\t\t\t\t\t\tif ( info.index ) {\n\n\t\t\t\t\t\t\t\tgeometry.setIndex( new BufferAttribute( info.index, 1, false ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn geometry;\n\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tresolve( result );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst geometry = new BufferGeometry();\n\t\t\t\t\t\tgeometry.setAttribute( 'position', new BufferAttribute( data.result.position, 3, false ) );\n\t\t\t\t\t\tgeometry.setIndex( new BufferAttribute( data.result.index, 1, false ) );\n\t\t\t\t\t\tresolve( geometry );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tworker.onmessage = null;\n\n\t\t\t\t} else if ( options.onProgress ) {\n\n\t\t\t\t\toptions.onProgress( data.progress );\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t\tconst index = geometry.index ? geometry.index.array.slice() : null;\n\t\t\tconst position = geometry.attributes.position.array.slice();\n\t\t\tconst transfer = [ position.buffer ];\n\t\t\tif ( index ) {\n\n\t\t\t\ttransfer.push( index.buffer );\n\n\t\t\t}\n\n\t\t\tworker.postMessage( {\n\t\t\t\tindex,\n\t\t\t\tposition,\n\t\t\t\toptions: {\n\t\t\t\t\t...options,\n\t\t\t\t\tonProgress: null,\n\t\t\t\t\tincludedProgressCallback: Boolean( options.onProgress ),\n\t\t\t\t},\n\t\t\t}, transfer );\n\n\t\t} );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.worker.terminate();\n\t\tthis.worker = null;\n\n\t}\n\n}\n","let workerURL = require('./helpers/get-worker-url');\nlet url = new __parcel__URL__(require('./helpers/bundle-manifest').resolve(\"82ikj\"));\nmodule.exports = workerURL(url.toString(), url.origin, true);","\"use strict\";\n\nmodule.exports = function (workerUrl, origin, isESM) {\n if (origin === self.location.origin) {\n // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n } else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? 'import ' + JSON.stringify(workerUrl) + ';' : 'importScripts(' + JSON.stringify(workerUrl) + ');';\n return URL.createObjectURL(new Blob([source], {\n type: 'application/javascript'\n }));\n }\n};"],"names":["$0d0b0cc2e69039e3$var$renderer","$0d0b0cc2e69039e3$var$camera","$0d0b0cc2e69039e3$var$scene","$0d0b0cc2e69039e3$var$gui","$0d0b0cc2e69039e3$var$model","$0d0b0cc2e69039e3$var$projection","$0d0b0cc2e69039e3$var$projectionWireframe","$0d0b0cc2e69039e3$var$group","$0d0b0cc2e69039e3$var$edges","$0d0b0cc2e69039e3$var$outputContainer","$0d0b0cc2e69039e3$var$worker","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$18c11f3350a906ea$export$6503ec6e8aabbaf","$18c11f3350a906ea$export$f7ad0328861e2f03","$18c11f3350a906ea$var$mapping","pairs","keys","i","length","resolved","JSON","parse","$ilwiq","$jiuw3","$5Rd1x","$7ePFa","$4CEV9","$l7uOa","$6c7008b1813725e4$var$NAME","$d6de5c547c645488$exports","$56b621a6dd25b2cb$exports","workerUrl","origin","isESM","location","source","stringify","URL","createObjectURL","Blob","type","$d6de5c547c645488$var$url","resolve","url","toString","$6c7008b1813725e4$export$86161294a4c08d30","constructor","running","worker","Worker","onerror","message","generate","geometry","options","Promise","reject","onmessage","data","error","result","output","OUTPUT_BOTH","map","info","BufferGeometry","setAttribute","BufferAttribute","position","index","setIndex","onProgress","progress","array","slice","attributes","transfer","buffer","push","postMessage","includedProgressCallback","Boolean","dispose","terminate","$0d0b0cc2e69039e3$var$params","displaySilhouette","displayWireframe","displayOutline","displayModel","useWorker","rotate","quaternion","random","updateMatrixWorld","box","Box3","setFromObject","getCenter","multiplyScalar","y","Math","max","min","regenerate","$0d0b0cc2e69039e3$var$task","$0d0b0cc2e69039e3$var$updateEdges","runTime","innerText","timeStart","performance","now","geometries","updateWorldMatrix","traverse","c","clone","key","applyMatrix4","matrixWorld","deleteAttribute","mergedGeometry","mergeGeometries","mergeTime","p","parseFloat","toFixed","then","res","generator","SilhouetteGenerator","iterationTime","task","getGeometry","next","done","value","trimTime","count","$0d0b0cc2e69039e3$var$init","document","getElementById","WebGLRenderer","antialias","setPixelRatio","devicePixelRatio","setSize","innerWidth","innerHeight","setClearColor","body","appendChild","domElement","Scene","light","DirectionalLight","add","ambientLight","AmbientLight","Group","Mesh","TorusKnotGeometry","MeshStandardMaterial","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","rotation","PI","undefined","MeshBasicMaterial","color","side","DoubleSide","LineSegments","LineBasicMaterial","wireframe","PerspectiveCamera","setScalar","updateProjectionMatrix","OrbitControls","GUI","$0d0b0cc2e69039e3$var$render","requestAnimationFrame","visible","render","addEventListener","aspect"],"version":3,"file":"silhouetteProjection.b08c1309.js.map"} \ No newline at end of file diff --git a/example/bundle/silhouetteProjection.e215f6e5.js b/example/bundle/silhouetteProjection.e215f6e5.js new file mode 100644 index 0000000..1ec3063 --- /dev/null +++ b/example/bundle/silhouetteProjection.e215f6e5.js @@ -0,0 +1,2 @@ +var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},e={},i={},s=t.parcelRequire6c98;null==s&&((s=function(t){if(t in e)return e[t].exports;if(t in i){var s=i[t];delete i[t];var n={id:t,exports:{}};return e[t]=n,s.call(n.exports,n,n.exports),n.exports}var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}).register=function(t,e){i[t]=e},t.parcelRequire6c98=s),s.register("jiuw3",function(t,e){Object.defineProperty(t.exports,"GUI",{get:()=>m,set:void 0,enumerable:!0,configurable:!0});class i{constructor(t,e,s,n,l="div"){this.parent=t,this.object=e,this.property=s,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(n),this.$name=document.createElement("div"),this.$name.classList.add("name"),i.nextNameID=i.nextNameID||0,this.$name.id="lil-gui-name-"+ ++i.nextNameID,this.$widget=document.createElement(l),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(s)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t)),this}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){let e=this.parent.add(this.object,this.property,t);return e.name(this._name),this.destroy(),e}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);let t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class s extends i{constructor(t,e,i){super(t,e,i,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function n(t){let e,i;return(e=t.match(/(#|0x)?([a-f0-9]{6})/i))?i=e[2]:(e=t.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?i=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!i&&"#"+i}let l={isPrimitive:!0,match:t=>"number"==typeof t,fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},r={isPrimitive:!1,match:Array.isArray,fromHexString(t,e,i=1){let s=l.fromHexString(t);e[0]=(s>>16&255)/255*i,e[1]=(s>>8&255)/255*i,e[2]=(255&s)/255*i},toHexString:([t,e,i],s=1)=>l.toHexString(t*(s=255/s)<<16^e*s<<8^i*s<<0)},o={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,i=1){let s=l.fromHexString(t);e.r=(s>>16&255)/255*i,e.g=(s>>8&255)/255*i,e.b=(255&s)/255*i},toHexString:({r:t,g:e,b:i},s=1)=>l.toHexString(t*(s=255/s)<<16^e*s<<8^i*s<<0)},a=[{isPrimitive:!0,match:t=>"string"==typeof t,fromHexString:n,toHexString:n},l,r,o];class h extends i{constructor(t,e,i,s){var l;super(t,e,i,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(l=this.initialValue,a.find(t=>t.match(l))),this._rgbScale=s,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{let t=n(this.$text.value);t&&this._setValueFromHexString(t)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){let e=this._format.fromHexString(t);this.setValue(e)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class d extends i{constructor(t,e,i){super(t,e,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",t=>{t.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class c extends i{constructor(t,e,i,s,n,l){super(t,e,i,"number"),this._initInput(),this.min(s),this.max(n);let r=void 0!==l;this.step(r?l:this._getImplicitStep(),r),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,e=!0){return this._step=t,this._stepExplicit=e,this}updateDisplay(){let t=this.getValue();if(this._hasSlider){let e=(t-this._min)/(this._max-this._min);e=Math.max(0,Math.min(e,1)),this.$fill.style.width=100*e+"%"}return this._inputFocused||(this.$input.value=void 0===this._decimals?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;let t=t=>{let e=parseFloat(this.$input.value);isNaN(e)||(this._snapClampSetValue(e+t),this.$input.value=this.getValue())},e,i,s,n,l,r=!1,o=t=>{if(r){let s=t.clientX-e,n=t.clientY-i;Math.abs(n)>5?(t.preventDefault(),this.$input.blur(),r=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(s)>5&&a()}if(!r){let e=t.clientY-s;l-=e*this._step*this._arrowKeyMultiplier(t),n+l>this._max?l=this._max-n:n+l{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",a)};this.$input.addEventListener("input",()=>{let t=parseFloat(this.$input.value);isNaN(t)||(this._stepExplicit&&(t=this._snap(t)),this.setValue(this._clamp(t)))}),this.$input.addEventListener("keydown",e=>{"Enter"===e.code&&this.$input.blur(),"ArrowUp"===e.code&&(e.preventDefault(),t(this._step*this._arrowKeyMultiplier(e))),"ArrowDown"===e.code&&(e.preventDefault(),t(-(this._step*this._arrowKeyMultiplier(e)*1)))}),this.$input.addEventListener("wheel",e=>{this._inputFocused&&(e.preventDefault(),t(this._step*this._normalizeMouseWheel(e)))},{passive:!1}),this.$input.addEventListener("mousedown",t=>{e=t.clientX,i=s=t.clientY,r=!0,n=this.getValue(),l=0,window.addEventListener("mousemove",o),window.addEventListener("mouseup",a)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){let t;this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");let e=t=>{var e,i,s;let n=this.$slider.getBoundingClientRect(),l=(e=n.left,i=n.right,s=this._min,(t-e)/(i-e)*(this._max-s)+s);this._snapClampSetValue(l)},i=t=>{e(t.clientX)},s=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",s)},n,l,r=!1,o=t=>{t.preventDefault(),this._setDraggingStyle(!0),e(t.touches[0].clientX),r=!1},a=t=>{if(r){let e=t.touches[0].clientX-n,i=t.touches[0].clientY-l;Math.abs(e)>Math.abs(i)?o(t):(window.removeEventListener("touchmove",a),window.removeEventListener("touchend",h))}else t.preventDefault(),e(t.touches[0].clientX)},h=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",a),window.removeEventListener("touchend",h)},d=this._callOnFinishChange.bind(this);this.$slider.addEventListener("mousedown",t=>{this._setDraggingStyle(!0),e(t.clientX),window.addEventListener("mousemove",i),window.addEventListener("mouseup",s)}),this.$slider.addEventListener("touchstart",t=>{t.touches.length>1||(this._hasScrollBar?(n=t.touches[0].clientX,l=t.touches[0].clientY,r=!0):o(t),window.addEventListener("touchmove",a,{passive:!1}),window.addEventListener("touchend",h))},{passive:!1}),this.$slider.addEventListener("wheel",e=>{if(Math.abs(e.deltaX)this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){let t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class u extends i{constructor(t,e,i,s){super(t,e,i,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(s)?s:Object.values(s),this._names=Array.isArray(s)?s:Object.keys(s),this._names.forEach(t=>{let e=document.createElement("option");e.innerHTML=t,this.$select.appendChild(e)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){let t=this.getValue(),e=this._values.indexOf(t);return this.$select.selectedIndex=e,this.$display.innerHTML=-1===e?t:this._names[e],this}}class p extends i{constructor(t,e,i){super(t,e,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",t=>{"Enter"===t.code&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let g=!1;class m{constructor({parent:t,autoPlace:e=void 0===t,container:i,width:s,title:n="Controls",injectStyles:l=!0,touchStyles:r=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",t=>{"Enter"!==t.code&&"Space"!==t.code||(t.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(n),r&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!g&&l&&(function(t){let e=document.createElement("style");e.innerHTML=t;let i=document.querySelector("head link[rel=stylesheet], head style");i?document.head.insertBefore(e,i):document.head.appendChild(e)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZ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IB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),g=!0),i?i.appendChild(this.domElement):e&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),s&&this.domElement.style.setProperty("--width",s+"px"),this.domElement.addEventListener("keydown",t=>t.stopPropagation()),this.domElement.addEventListener("keyup",t=>t.stopPropagation())}add(t,e,i,n,l){if(Object(i)===i)return new u(this,t,e,i);let r=t[e];switch(typeof r){case"number":return new c(this,t,e,i,n,l);case"boolean":return new s(this,t,e);case"string":return new p(this,t,e);case"function":return new d(this,t,e)}console.error("gui.add failed\n property:",e,"\n object:",t,"\n value:",r)}addColor(t,e,i=1){return new h(this,t,e,i)}addFolder(t){return new m({parent:this,title:t})}load(t,e=!0){return t.controllers&&this.controllers.forEach(e=>{e instanceof d||e._name in t.controllers&&e.load(t.controllers[e._name])}),e&&t.folders&&this.folders.forEach(e=>{e._title in t.folders&&e.load(t.folders[e._title])}),this}save(t=!0){let e={controllers:{},folders:{}};return this.controllers.forEach(t=>{if(!(t instanceof d)){if(t._name in e.controllers)throw Error(`Cannot save GUI with duplicate property "${t._name}"`);e.controllers[t._name]=t.save()}}),t&&this.folders.forEach(t=>{if(t._title in e.folders)throw Error(`Cannot save GUI with duplicate folder "${t._title}"`);e.folders[t._title]=t.save()}),e}open(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{let e=this.$children.clientHeight;this.$children.style.height=e+"px",this.domElement.classList.add("transition");let i=t=>{t.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))};this.$children.addEventListener("transitionend",i);let s=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=s+"px"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),void 0!==this._onChange&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(e=>{t=t.concat(e.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(e=>{t=t.concat(e.foldersRecursive())}),t}}}); +//# sourceMappingURL=silhouetteProjection.e215f6e5.js.map diff --git a/example/bundle/silhouetteProjection.e215f6e5.js.map b/example/bundle/silhouetteProjection.e215f6e5.js.map new file mode 100644 index 0000000..d076261 --- /dev/null +++ b/example/bundle/silhouetteProjection.e215f6e5.js.map @@ -0,0 +1 @@ +{"mappings":"A,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,Q,S,C,C,C,E,O,c,C,E,O,C,M,C,I,I,E,I,K,E,W,C,E,a,C,C,ECOA,OAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,MAAA,CAAO,EAAE,IAAI,CAAC,MAAA,CAAO,EAAE,IAAI,CAAC,QAAA,CAAS,EAAE,IAAI,CAAC,SAAA,CAAU,CAAC,EAAE,IAAI,CAAC,OAAA,CAAQ,CAAC,EAAE,IAAI,CAAC,YAAA,CAAa,IAAI,CAAC,QAAA,GAAW,IAAI,CAAC,UAAA,CAAW,SAAS,aAAA,CAAc,OAAO,IAAI,CAAC,UAAA,CAAW,SAAA,CAAU,GAAA,CAAI,cAAc,IAAI,CAAC,UAAA,CAAW,SAAA,CAAU,GAAA,CAAI,GAAG,IAAI,CAAC,KAAA,CAAM,SAAS,aAAA,CAAc,OAAO,IAAI,CAAC,KAAA,CAAM,SAAA,CAAU,GAAA,CAAI,QAAQ,EAAE,UAAA,CAAW,EAAE,UAAA,EAAY,EAAE,IAAI,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AAI,CAAC,QAAA,EAAU,OAAA,CAAQ,AAAA,GAAG,EAAE,OAAlR,GAA4R,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,WAAtB,EAAmC,OAAO,IAAI,CAAC,OAAA,CAAQ,OAAA,CAAQ,AAAA,IAAI,EAAE,EAAE,MAAA,CAAO,EAAE,oBAAb,GAAoC,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,OAAtB,EAA+B,OAAO,IAAI,CAAC,OAAA,CAAQ,OAAA,CAAQ,AAAA,IAAI,EAAE,EAAE,MAAA,CAAO,EAAE,gBAAb,GAAgC,GAAG,CAAC,CAAC,C","sources":["","node_modules/three/examples/jsm/libs/lil-gui.module.min.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire6c98\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire6c98\"] = parcelRequire;\n}\nparcelRequire.register(\"jiuw3\", function(module, exports) {\n\n$parcel$export(module.exports, \"GUI\", () => $e0c75e95e2166c4b$export$983832d820c96993);\n/**\n * lil-gui\n * https://lil-gui.georgealways.com\n * @version 0.17.0\n * @author George Michael Brower\n * @license MIT\n */ class $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(i, e, s, n, l = \"div\"){\n this.parent = i, this.object = e, this.property = s, this._disabled = !1, this._hidden = !1, this.initialValue = this.getValue(), this.domElement = document.createElement(\"div\"), this.domElement.classList.add(\"controller\"), this.domElement.classList.add(n), this.$name = document.createElement(\"div\"), this.$name.classList.add(\"name\"), $e0c75e95e2166c4b$export$bd0bf19f25da8474.nextNameID = $e0c75e95e2166c4b$export$bd0bf19f25da8474.nextNameID || 0, this.$name.id = \"lil-gui-name-\" + ++$e0c75e95e2166c4b$export$bd0bf19f25da8474.nextNameID, this.$widget = document.createElement(l), this.$widget.classList.add(\"widget\"), this.$disable = this.$widget, this.domElement.appendChild(this.$name), this.domElement.appendChild(this.$widget), this.parent.children.push(this), this.parent.controllers.push(this), this.parent.$children.appendChild(this.domElement), this._listenCallback = this._listenCallback.bind(this), this.name(s);\n }\n name(t) {\n return this._name = t, this.$name.innerHTML = t, this;\n }\n onChange(t) {\n return this._onChange = t, this;\n }\n _callOnChange() {\n this.parent._callOnChange(this), void 0 !== this._onChange && this._onChange.call(this, this.getValue()), this._changed = !0;\n }\n onFinishChange(t) {\n return this._onFinishChange = t, this;\n }\n _callOnFinishChange() {\n this._changed && (this.parent._callOnFinishChange(this), void 0 !== this._onFinishChange && this._onFinishChange.call(this, this.getValue())), this._changed = !1;\n }\n reset() {\n return this.setValue(this.initialValue), this._callOnFinishChange(), this;\n }\n enable(t = !0) {\n return this.disable(!t);\n }\n disable(t = !0) {\n return t === this._disabled || (this._disabled = t, this.domElement.classList.toggle(\"disabled\", t), this.$disable.toggleAttribute(\"disabled\", t)), this;\n }\n show(t = !0) {\n return this._hidden = !t, this.domElement.style.display = this._hidden ? \"none\" : \"\", this;\n }\n hide() {\n return this.show(!1);\n }\n options(t) {\n const i = this.parent.add(this.object, this.property, t);\n return i.name(this._name), this.destroy(), i;\n }\n min(t) {\n return this;\n }\n max(t) {\n return this;\n }\n step(t) {\n return this;\n }\n decimals(t) {\n return this;\n }\n listen(t = !0) {\n return this._listening = t, void 0 !== this._listenCallbackID && (cancelAnimationFrame(this._listenCallbackID), this._listenCallbackID = void 0), this._listening && this._listenCallback(), this;\n }\n _listenCallback() {\n this._listenCallbackID = requestAnimationFrame(this._listenCallback);\n const t = this.save();\n t !== this._listenPrevValue && this.updateDisplay(), this._listenPrevValue = t;\n }\n getValue() {\n return this.object[this.property];\n }\n setValue(t) {\n return this.object[this.property] = t, this._callOnChange(), this.updateDisplay(), this;\n }\n updateDisplay() {\n return this;\n }\n load(t) {\n return this.setValue(t), this._callOnFinishChange(), this;\n }\n save() {\n return this.getValue();\n }\n destroy() {\n this.listen(!1), this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.controllers.splice(this.parent.controllers.indexOf(this), 1), this.parent.$children.removeChild(this.domElement);\n }\n}\nclass $e0c75e95e2166c4b$export$c6f57966aed3cc84 extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, e){\n super(t, i, e, \"boolean\", \"label\"), this.$input = document.createElement(\"input\"), this.$input.setAttribute(\"type\", \"checkbox\"), this.$input.setAttribute(\"aria-labelledby\", this.$name.id), this.$widget.appendChild(this.$input), this.$input.addEventListener(\"change\", ()=>{\n this.setValue(this.$input.checked), this._callOnFinishChange();\n }), this.$disable = this.$input, this.updateDisplay();\n }\n updateDisplay() {\n return this.$input.checked = this.getValue(), this;\n }\n}\nfunction $e0c75e95e2166c4b$var$e(t) {\n let i, e;\n return (i = t.match(/(#|0x)?([a-f0-9]{6})/i)) ? e = i[2] : (i = t.match(/rgb\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)/)) ? e = parseInt(i[1]).toString(16).padStart(2, 0) + parseInt(i[2]).toString(16).padStart(2, 0) + parseInt(i[3]).toString(16).padStart(2, 0) : (i = t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i)) && (e = i[1] + i[1] + i[2] + i[2] + i[3] + i[3]), !!e && \"#\" + e;\n}\nconst $e0c75e95e2166c4b$var$s = {\n isPrimitive: !0,\n match: (t)=>\"string\" == typeof t,\n fromHexString: $e0c75e95e2166c4b$var$e,\n toHexString: $e0c75e95e2166c4b$var$e\n}, $e0c75e95e2166c4b$var$n = {\n isPrimitive: !0,\n match: (t)=>\"number\" == typeof t,\n fromHexString: (t)=>parseInt(t.substring(1), 16),\n toHexString: (t)=>\"#\" + t.toString(16).padStart(6, 0)\n}, $e0c75e95e2166c4b$var$l = {\n isPrimitive: !1,\n match: Array.isArray,\n fromHexString (t, i, e = 1) {\n const s = $e0c75e95e2166c4b$var$n.fromHexString(t);\n i[0] = (s >> 16 & 255) / 255 * e, i[1] = (s >> 8 & 255) / 255 * e, i[2] = (255 & s) / 255 * e;\n },\n toHexString: ([t, i, e], s = 1)=>$e0c75e95e2166c4b$var$n.toHexString(t * (s = 255 / s) << 16 ^ i * s << 8 ^ e * s << 0)\n}, $e0c75e95e2166c4b$var$r = {\n isPrimitive: !1,\n match: (t)=>Object(t) === t,\n fromHexString (t, i, e = 1) {\n const s = $e0c75e95e2166c4b$var$n.fromHexString(t);\n i.r = (s >> 16 & 255) / 255 * e, i.g = (s >> 8 & 255) / 255 * e, i.b = (255 & s) / 255 * e;\n },\n toHexString: ({ r: t, g: i, b: e }, s = 1)=>$e0c75e95e2166c4b$var$n.toHexString(t * (s = 255 / s) << 16 ^ i * s << 8 ^ e * s << 0)\n}, $e0c75e95e2166c4b$var$o = [\n $e0c75e95e2166c4b$var$s,\n $e0c75e95e2166c4b$var$n,\n $e0c75e95e2166c4b$var$l,\n $e0c75e95e2166c4b$var$r\n];\nclass $e0c75e95e2166c4b$export$3a401c49038ca28a extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, s, n){\n var l;\n super(t, i, s, \"color\"), this.$input = document.createElement(\"input\"), this.$input.setAttribute(\"type\", \"color\"), this.$input.setAttribute(\"tabindex\", -1), this.$input.setAttribute(\"aria-labelledby\", this.$name.id), this.$text = document.createElement(\"input\"), this.$text.setAttribute(\"type\", \"text\"), this.$text.setAttribute(\"spellcheck\", \"false\"), this.$text.setAttribute(\"aria-labelledby\", this.$name.id), this.$display = document.createElement(\"div\"), this.$display.classList.add(\"display\"), this.$display.appendChild(this.$input), this.$widget.appendChild(this.$display), this.$widget.appendChild(this.$text), this._format = (l = this.initialValue, $e0c75e95e2166c4b$var$o.find((t)=>t.match(l))), this._rgbScale = n, this._initialValueHexString = this.save(), this._textFocused = !1, this.$input.addEventListener(\"input\", ()=>{\n this._setValueFromHexString(this.$input.value);\n }), this.$input.addEventListener(\"blur\", ()=>{\n this._callOnFinishChange();\n }), this.$text.addEventListener(\"input\", ()=>{\n const t = $e0c75e95e2166c4b$var$e(this.$text.value);\n t && this._setValueFromHexString(t);\n }), this.$text.addEventListener(\"focus\", ()=>{\n this._textFocused = !0, this.$text.select();\n }), this.$text.addEventListener(\"blur\", ()=>{\n this._textFocused = !1, this.updateDisplay(), this._callOnFinishChange();\n }), this.$disable = this.$text, this.updateDisplay();\n }\n reset() {\n return this._setValueFromHexString(this._initialValueHexString), this;\n }\n _setValueFromHexString(t) {\n if (this._format.isPrimitive) {\n const i = this._format.fromHexString(t);\n this.setValue(i);\n } else this._format.fromHexString(t, this.getValue(), this._rgbScale), this._callOnChange(), this.updateDisplay();\n }\n save() {\n return this._format.toHexString(this.getValue(), this._rgbScale);\n }\n load(t) {\n return this._setValueFromHexString(t), this._callOnFinishChange(), this;\n }\n updateDisplay() {\n return this.$input.value = this._format.toHexString(this.getValue(), this._rgbScale), this._textFocused || (this.$text.value = this.$input.value.substring(1)), this.$display.style.backgroundColor = this.$input.value, this;\n }\n}\nclass $e0c75e95e2166c4b$export$2d7dcf9d07c8b352 extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, e){\n super(t, i, e, \"function\"), this.$button = document.createElement(\"button\"), this.$button.appendChild(this.$name), this.$widget.appendChild(this.$button), this.$button.addEventListener(\"click\", (t)=>{\n t.preventDefault(), this.getValue().call(this.object);\n }), this.$button.addEventListener(\"touchstart\", ()=>{}, {\n passive: !0\n }), this.$disable = this.$button;\n }\n}\nclass $e0c75e95e2166c4b$export$ee52b68072d314b9 extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, e, s, n, l){\n super(t, i, e, \"number\"), this._initInput(), this.min(s), this.max(n);\n const r = void 0 !== l;\n this.step(r ? l : this._getImplicitStep(), r), this.updateDisplay();\n }\n decimals(t) {\n return this._decimals = t, this.updateDisplay(), this;\n }\n min(t) {\n return this._min = t, this._onUpdateMinMax(), this;\n }\n max(t) {\n return this._max = t, this._onUpdateMinMax(), this;\n }\n step(t, i = !0) {\n return this._step = t, this._stepExplicit = i, this;\n }\n updateDisplay() {\n const t = this.getValue();\n if (this._hasSlider) {\n let i = (t - this._min) / (this._max - this._min);\n i = Math.max(0, Math.min(i, 1)), this.$fill.style.width = 100 * i + \"%\";\n }\n return this._inputFocused || (this.$input.value = void 0 === this._decimals ? t : t.toFixed(this._decimals)), this;\n }\n _initInput() {\n this.$input = document.createElement(\"input\"), this.$input.setAttribute(\"type\", \"number\"), this.$input.setAttribute(\"step\", \"any\"), this.$input.setAttribute(\"aria-labelledby\", this.$name.id), this.$widget.appendChild(this.$input), this.$disable = this.$input;\n const t = (t)=>{\n const i = parseFloat(this.$input.value);\n isNaN(i) || (this._snapClampSetValue(i + t), this.$input.value = this.getValue());\n };\n let i, e, s, n, l, r = !1;\n const o = (t)=>{\n if (r) {\n const s = t.clientX - i, n = t.clientY - e;\n Math.abs(n) > 5 ? (t.preventDefault(), this.$input.blur(), r = !1, this._setDraggingStyle(!0, \"vertical\")) : Math.abs(s) > 5 && a();\n }\n if (!r) {\n const i = t.clientY - s;\n l -= i * this._step * this._arrowKeyMultiplier(t), n + l > this._max ? l = this._max - n : n + l < this._min && (l = this._min - n), this._snapClampSetValue(n + l);\n }\n s = t.clientY;\n }, a = ()=>{\n this._setDraggingStyle(!1, \"vertical\"), this._callOnFinishChange(), window.removeEventListener(\"mousemove\", o), window.removeEventListener(\"mouseup\", a);\n };\n this.$input.addEventListener(\"input\", ()=>{\n let t = parseFloat(this.$input.value);\n isNaN(t) || (this._stepExplicit && (t = this._snap(t)), this.setValue(this._clamp(t)));\n }), this.$input.addEventListener(\"keydown\", (i)=>{\n \"Enter\" === i.code && this.$input.blur(), \"ArrowUp\" === i.code && (i.preventDefault(), t(this._step * this._arrowKeyMultiplier(i))), \"ArrowDown\" === i.code && (i.preventDefault(), t(this._step * this._arrowKeyMultiplier(i) * -1));\n }), this.$input.addEventListener(\"wheel\", (i)=>{\n this._inputFocused && (i.preventDefault(), t(this._step * this._normalizeMouseWheel(i)));\n }, {\n passive: !1\n }), this.$input.addEventListener(\"mousedown\", (t)=>{\n i = t.clientX, e = s = t.clientY, r = !0, n = this.getValue(), l = 0, window.addEventListener(\"mousemove\", o), window.addEventListener(\"mouseup\", a);\n }), this.$input.addEventListener(\"focus\", ()=>{\n this._inputFocused = !0;\n }), this.$input.addEventListener(\"blur\", ()=>{\n this._inputFocused = !1, this.updateDisplay(), this._callOnFinishChange();\n });\n }\n _initSlider() {\n this._hasSlider = !0, this.$slider = document.createElement(\"div\"), this.$slider.classList.add(\"slider\"), this.$fill = document.createElement(\"div\"), this.$fill.classList.add(\"fill\"), this.$slider.appendChild(this.$fill), this.$widget.insertBefore(this.$slider, this.$input), this.domElement.classList.add(\"hasSlider\");\n const t = (t)=>{\n const i = this.$slider.getBoundingClientRect();\n let e = (s = t, n = i.left, l = i.right, r = this._min, o = this._max, (s - n) / (l - n) * (o - r) + r);\n var s, n, l, r, o;\n this._snapClampSetValue(e);\n }, i = (i)=>{\n t(i.clientX);\n }, e = ()=>{\n this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener(\"mousemove\", i), window.removeEventListener(\"mouseup\", e);\n };\n let s, n, l = !1;\n const r = (i)=>{\n i.preventDefault(), this._setDraggingStyle(!0), t(i.touches[0].clientX), l = !1;\n }, o = (i)=>{\n if (l) {\n const t = i.touches[0].clientX - s, e = i.touches[0].clientY - n;\n Math.abs(t) > Math.abs(e) ? r(i) : (window.removeEventListener(\"touchmove\", o), window.removeEventListener(\"touchend\", a));\n } else i.preventDefault(), t(i.touches[0].clientX);\n }, a = ()=>{\n this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener(\"touchmove\", o), window.removeEventListener(\"touchend\", a);\n }, h = this._callOnFinishChange.bind(this);\n let d;\n this.$slider.addEventListener(\"mousedown\", (s)=>{\n this._setDraggingStyle(!0), t(s.clientX), window.addEventListener(\"mousemove\", i), window.addEventListener(\"mouseup\", e);\n }), this.$slider.addEventListener(\"touchstart\", (t)=>{\n t.touches.length > 1 || (this._hasScrollBar ? (s = t.touches[0].clientX, n = t.touches[0].clientY, l = !0) : r(t), window.addEventListener(\"touchmove\", o, {\n passive: !1\n }), window.addEventListener(\"touchend\", a));\n }, {\n passive: !1\n }), this.$slider.addEventListener(\"wheel\", (t)=>{\n if (Math.abs(t.deltaX) < Math.abs(t.deltaY) && this._hasScrollBar) return;\n t.preventDefault();\n const i = this._normalizeMouseWheel(t) * this._step;\n this._snapClampSetValue(this.getValue() + i), this.$input.value = this.getValue(), clearTimeout(d), d = setTimeout(h, 400);\n }, {\n passive: !1\n });\n }\n _setDraggingStyle(t, i = \"horizontal\") {\n this.$slider && this.$slider.classList.toggle(\"active\", t), document.body.classList.toggle(\"lil-gui-dragging\", t), document.body.classList.toggle(\"lil-gui-\" + i, t);\n }\n _getImplicitStep() {\n return this._hasMin && this._hasMax ? (this._max - this._min) / 1e3 : .1;\n }\n _onUpdateMinMax() {\n !this._hasSlider && this._hasMin && this._hasMax && (this._stepExplicit || this.step(this._getImplicitStep(), !1), this._initSlider(), this.updateDisplay());\n }\n _normalizeMouseWheel(t) {\n let { deltaX: i, deltaY: e } = t;\n Math.floor(t.deltaY) !== t.deltaY && t.wheelDelta && (i = 0, e = -t.wheelDelta / 120, e *= this._stepExplicit ? 1 : 10);\n return i + -e;\n }\n _arrowKeyMultiplier(t) {\n let i = this._stepExplicit ? 1 : 10;\n return t.shiftKey ? i *= 10 : t.altKey && (i /= 10), i;\n }\n _snap(t) {\n const i = Math.round(t / this._step) * this._step;\n return parseFloat(i.toPrecision(15));\n }\n _clamp(t) {\n return t < this._min && (t = this._min), t > this._max && (t = this._max), t;\n }\n _snapClampSetValue(t) {\n this.setValue(this._clamp(this._snap(t)));\n }\n get _hasScrollBar() {\n const t = this.parent.root.$children;\n return t.scrollHeight > t.clientHeight;\n }\n get _hasMin() {\n return void 0 !== this._min;\n }\n get _hasMax() {\n return void 0 !== this._max;\n }\n}\nclass $e0c75e95e2166c4b$export$25f00c724c27c8b4 extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, e, s){\n super(t, i, e, \"option\"), this.$select = document.createElement(\"select\"), this.$select.setAttribute(\"aria-labelledby\", this.$name.id), this.$display = document.createElement(\"div\"), this.$display.classList.add(\"display\"), this._values = Array.isArray(s) ? s : Object.values(s), this._names = Array.isArray(s) ? s : Object.keys(s), this._names.forEach((t)=>{\n const i = document.createElement(\"option\");\n i.innerHTML = t, this.$select.appendChild(i);\n }), this.$select.addEventListener(\"change\", ()=>{\n this.setValue(this._values[this.$select.selectedIndex]), this._callOnFinishChange();\n }), this.$select.addEventListener(\"focus\", ()=>{\n this.$display.classList.add(\"focus\");\n }), this.$select.addEventListener(\"blur\", ()=>{\n this.$display.classList.remove(\"focus\");\n }), this.$widget.appendChild(this.$select), this.$widget.appendChild(this.$display), this.$disable = this.$select, this.updateDisplay();\n }\n updateDisplay() {\n const t = this.getValue(), i = this._values.indexOf(t);\n return this.$select.selectedIndex = i, this.$display.innerHTML = -1 === i ? t : this._names[i], this;\n }\n}\nclass $e0c75e95e2166c4b$export$786d0ebe8f71368e extends $e0c75e95e2166c4b$export$bd0bf19f25da8474 {\n constructor(t, i, e){\n super(t, i, e, \"string\"), this.$input = document.createElement(\"input\"), this.$input.setAttribute(\"type\", \"text\"), this.$input.setAttribute(\"aria-labelledby\", this.$name.id), this.$input.addEventListener(\"input\", ()=>{\n this.setValue(this.$input.value);\n }), this.$input.addEventListener(\"keydown\", (t)=>{\n \"Enter\" === t.code && this.$input.blur();\n }), this.$input.addEventListener(\"blur\", ()=>{\n this._callOnFinishChange();\n }), this.$widget.appendChild(this.$input), this.$disable = this.$input, this.updateDisplay();\n }\n updateDisplay() {\n return this.$input.value = this.getValue(), this;\n }\n}\nlet $e0c75e95e2166c4b$var$p = !1;\nclass $e0c75e95e2166c4b$export$983832d820c96993 {\n constructor({ parent: t, autoPlace: i = void 0 === t, container: e, width: s, title: n = \"Controls\", injectStyles: l = !0, touchStyles: r = !0 } = {}){\n if (this.parent = t, this.root = t ? t.root : this, this.children = [], this.controllers = [], this.folders = [], this._closed = !1, this._hidden = !1, this.domElement = document.createElement(\"div\"), this.domElement.classList.add(\"lil-gui\"), this.$title = document.createElement(\"div\"), this.$title.classList.add(\"title\"), this.$title.setAttribute(\"role\", \"button\"), this.$title.setAttribute(\"aria-expanded\", !0), this.$title.setAttribute(\"tabindex\", 0), this.$title.addEventListener(\"click\", ()=>this.openAnimated(this._closed)), this.$title.addEventListener(\"keydown\", (t)=>{\n \"Enter\" !== t.code && \"Space\" !== t.code || (t.preventDefault(), this.$title.click());\n }), this.$title.addEventListener(\"touchstart\", ()=>{}, {\n passive: !0\n }), this.$children = document.createElement(\"div\"), this.$children.classList.add(\"children\"), this.domElement.appendChild(this.$title), this.domElement.appendChild(this.$children), this.title(n), r && this.domElement.classList.add(\"allow-touch-styles\"), this.parent) return this.parent.children.push(this), this.parent.folders.push(this), void this.parent.$children.appendChild(this.domElement);\n this.domElement.classList.add(\"root\"), !$e0c75e95e2166c4b$var$p && l && (!function(t) {\n const i = document.createElement(\"style\");\n i.innerHTML = t;\n const e = document.querySelector(\"head link[rel=stylesheet], head style\");\n e ? document.head.insertBefore(i, e) : document.head.appendChild(i);\n }('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,\"Droid Sans Mono\",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:\"↕\";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:\"▾\";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:\"▸\"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:\"Empty\";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:\"✓\";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIo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(\"woff\")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:\" \";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'), $e0c75e95e2166c4b$var$p = !0), e ? e.appendChild(this.domElement) : i && (this.domElement.classList.add(\"autoPlace\"), document.body.appendChild(this.domElement)), s && this.domElement.style.setProperty(\"--width\", s + \"px\"), this.domElement.addEventListener(\"keydown\", (t)=>t.stopPropagation()), this.domElement.addEventListener(\"keyup\", (t)=>t.stopPropagation());\n }\n add(t, e, s, n, l) {\n if (Object(s) === s) return new $e0c75e95e2166c4b$export$25f00c724c27c8b4(this, t, e, s);\n const r = t[e];\n switch(typeof r){\n case \"number\":\n return new $e0c75e95e2166c4b$export$ee52b68072d314b9(this, t, e, s, n, l);\n case \"boolean\":\n return new $e0c75e95e2166c4b$export$c6f57966aed3cc84(this, t, e);\n case \"string\":\n return new $e0c75e95e2166c4b$export$786d0ebe8f71368e(this, t, e);\n case \"function\":\n return new $e0c75e95e2166c4b$export$2d7dcf9d07c8b352(this, t, e);\n }\n console.error(\"gui.add failed\\n\tproperty:\", e, \"\\n\tobject:\", t, \"\\n\tvalue:\", r);\n }\n addColor(t, i, e = 1) {\n return new $e0c75e95e2166c4b$export$3a401c49038ca28a(this, t, i, e);\n }\n addFolder(t) {\n return new $e0c75e95e2166c4b$export$983832d820c96993({\n parent: this,\n title: t\n });\n }\n load(t, i = !0) {\n return t.controllers && this.controllers.forEach((i)=>{\n i instanceof $e0c75e95e2166c4b$export$2d7dcf9d07c8b352 || i._name in t.controllers && i.load(t.controllers[i._name]);\n }), i && t.folders && this.folders.forEach((i)=>{\n i._title in t.folders && i.load(t.folders[i._title]);\n }), this;\n }\n save(t = !0) {\n const i = {\n controllers: {},\n folders: {}\n };\n return this.controllers.forEach((t)=>{\n if (!(t instanceof $e0c75e95e2166c4b$export$2d7dcf9d07c8b352)) {\n if (t._name in i.controllers) throw new Error(`Cannot save GUI with duplicate property \"${t._name}\"`);\n i.controllers[t._name] = t.save();\n }\n }), t && this.folders.forEach((t)=>{\n if (t._title in i.folders) throw new Error(`Cannot save GUI with duplicate folder \"${t._title}\"`);\n i.folders[t._title] = t.save();\n }), i;\n }\n open(t = !0) {\n return this._closed = !t, this.$title.setAttribute(\"aria-expanded\", !this._closed), this.domElement.classList.toggle(\"closed\", this._closed), this;\n }\n close() {\n return this.open(!1);\n }\n show(t = !0) {\n return this._hidden = !t, this.domElement.style.display = this._hidden ? \"none\" : \"\", this;\n }\n hide() {\n return this.show(!1);\n }\n openAnimated(t = !0) {\n return this._closed = !t, this.$title.setAttribute(\"aria-expanded\", !this._closed), requestAnimationFrame(()=>{\n const i = this.$children.clientHeight;\n this.$children.style.height = i + \"px\", this.domElement.classList.add(\"transition\");\n const e = (t)=>{\n t.target === this.$children && (this.$children.style.height = \"\", this.domElement.classList.remove(\"transition\"), this.$children.removeEventListener(\"transitionend\", e));\n };\n this.$children.addEventListener(\"transitionend\", e);\n const s = t ? this.$children.scrollHeight : 0;\n this.domElement.classList.toggle(\"closed\", !t), requestAnimationFrame(()=>{\n this.$children.style.height = s + \"px\";\n });\n }), this;\n }\n title(t) {\n return this._title = t, this.$title.innerHTML = t, this;\n }\n reset(t = !0) {\n return (t ? this.controllersRecursive() : this.controllers).forEach((t)=>t.reset()), this;\n }\n onChange(t) {\n return this._onChange = t, this;\n }\n _callOnChange(t) {\n this.parent && this.parent._callOnChange(t), void 0 !== this._onChange && this._onChange.call(this, {\n object: t.object,\n property: t.property,\n value: t.getValue(),\n controller: t\n });\n }\n onFinishChange(t) {\n return this._onFinishChange = t, this;\n }\n _callOnFinishChange(t) {\n this.parent && this.parent._callOnFinishChange(t), void 0 !== this._onFinishChange && this._onFinishChange.call(this, {\n object: t.object,\n property: t.property,\n value: t.getValue(),\n controller: t\n });\n }\n destroy() {\n this.parent && (this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.folders.splice(this.parent.folders.indexOf(this), 1)), this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement), Array.from(this.children).forEach((t)=>t.destroy());\n }\n controllersRecursive() {\n let t = Array.from(this.controllers);\n return this.folders.forEach((i)=>{\n t = t.concat(i.controllersRecursive());\n }), t;\n }\n foldersRecursive() {\n let t = Array.from(this.folders);\n return this.folders.forEach((i)=>{\n t = t.concat(i.foldersRecursive());\n }), t;\n }\n}\nvar $e0c75e95e2166c4b$export$2e2bcd8739ae039 = $e0c75e95e2166c4b$export$983832d820c96993;\n\n});\n\n\n//# sourceMappingURL=silhouetteProjection.e215f6e5.js.map\n","/**\n * lil-gui\n * https://lil-gui.georgealways.com\n * @version 0.17.0\n * @author George Michael Brower\n * @license MIT\n */\nclass t{constructor(i,e,s,n,l=\"div\"){this.parent=i,this.object=e,this.property=s,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(\"div\"),this.domElement.classList.add(\"controller\"),this.domElement.classList.add(n),this.$name=document.createElement(\"div\"),this.$name.classList.add(\"name\"),t.nextNameID=t.nextNameID||0,this.$name.id=\"lil-gui-name-\"+ ++t.nextNameID,this.$widget=document.createElement(l),this.$widget.classList.add(\"widget\"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(s)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle(\"disabled\",t),this.$disable.toggleAttribute(\"disabled\",t)),this}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?\"none\":\"\",this}hide(){return this.show(!1)}options(t){const i=this.parent.add(this.object,this.property,t);return i.name(this._name),this.destroy(),i}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class i extends t{constructor(t,i,e){super(t,i,e,\"boolean\",\"label\"),this.$input=document.createElement(\"input\"),this.$input.setAttribute(\"type\",\"checkbox\"),this.$input.setAttribute(\"aria-labelledby\",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener(\"change\",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function e(t){let i,e;return(i=t.match(/(#|0x)?([a-f0-9]{6})/i))?e=i[2]:(i=t.match(/rgb\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)/))?e=parseInt(i[1]).toString(16).padStart(2,0)+parseInt(i[2]).toString(16).padStart(2,0)+parseInt(i[3]).toString(16).padStart(2,0):(i=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(e=i[1]+i[1]+i[2]+i[2]+i[3]+i[3]),!!e&&\"#\"+e}const s={isPrimitive:!0,match:t=>\"string\"==typeof t,fromHexString:e,toHexString:e},n={isPrimitive:!0,match:t=>\"number\"==typeof t,fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>\"#\"+t.toString(16).padStart(6,0)},l={isPrimitive:!1,match:Array.isArray,fromHexString(t,i,e=1){const s=n.fromHexString(t);i[0]=(s>>16&255)/255*e,i[1]=(s>>8&255)/255*e,i[2]=(255&s)/255*e},toHexString:([t,i,e],s=1)=>n.toHexString(t*(s=255/s)<<16^i*s<<8^e*s<<0)},r={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,i,e=1){const s=n.fromHexString(t);i.r=(s>>16&255)/255*e,i.g=(s>>8&255)/255*e,i.b=(255&s)/255*e},toHexString:({r:t,g:i,b:e},s=1)=>n.toHexString(t*(s=255/s)<<16^i*s<<8^e*s<<0)},o=[s,n,l,r];class a extends t{constructor(t,i,s,n){var l;super(t,i,s,\"color\"),this.$input=document.createElement(\"input\"),this.$input.setAttribute(\"type\",\"color\"),this.$input.setAttribute(\"tabindex\",-1),this.$input.setAttribute(\"aria-labelledby\",this.$name.id),this.$text=document.createElement(\"input\"),this.$text.setAttribute(\"type\",\"text\"),this.$text.setAttribute(\"spellcheck\",\"false\"),this.$text.setAttribute(\"aria-labelledby\",this.$name.id),this.$display=document.createElement(\"div\"),this.$display.classList.add(\"display\"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(l=this.initialValue,o.find(t=>t.match(l))),this._rgbScale=n,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener(\"input\",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener(\"blur\",()=>{this._callOnFinishChange()}),this.$text.addEventListener(\"input\",()=>{const t=e(this.$text.value);t&&this._setValueFromHexString(t)}),this.$text.addEventListener(\"focus\",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener(\"blur\",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const i=this._format.fromHexString(t);this.setValue(i)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class h extends t{constructor(t,i,e){super(t,i,e,\"function\"),this.$button=document.createElement(\"button\"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener(\"click\",t=>{t.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener(\"touchstart\",()=>{},{passive:!0}),this.$disable=this.$button}}class d extends t{constructor(t,i,e,s,n,l){super(t,i,e,\"number\"),this._initInput(),this.min(s),this.max(n);const r=void 0!==l;this.step(r?l:this._getImplicitStep(),r),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,i=!0){return this._step=t,this._stepExplicit=i,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let i=(t-this._min)/(this._max-this._min);i=Math.max(0,Math.min(i,1)),this.$fill.style.width=100*i+\"%\"}return this._inputFocused||(this.$input.value=void 0===this._decimals?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement(\"input\"),this.$input.setAttribute(\"type\",\"number\"),this.$input.setAttribute(\"step\",\"any\"),this.$input.setAttribute(\"aria-labelledby\",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=t=>{const i=parseFloat(this.$input.value);isNaN(i)||(this._snapClampSetValue(i+t),this.$input.value=this.getValue())};let i,e,s,n,l,r=!1;const o=t=>{if(r){const s=t.clientX-i,n=t.clientY-e;Math.abs(n)>5?(t.preventDefault(),this.$input.blur(),r=!1,this._setDraggingStyle(!0,\"vertical\")):Math.abs(s)>5&&a()}if(!r){const i=t.clientY-s;l-=i*this._step*this._arrowKeyMultiplier(t),n+l>this._max?l=this._max-n:n+l{this._setDraggingStyle(!1,\"vertical\"),this._callOnFinishChange(),window.removeEventListener(\"mousemove\",o),window.removeEventListener(\"mouseup\",a)};this.$input.addEventListener(\"input\",()=>{let t=parseFloat(this.$input.value);isNaN(t)||(this._stepExplicit&&(t=this._snap(t)),this.setValue(this._clamp(t)))}),this.$input.addEventListener(\"keydown\",i=>{\"Enter\"===i.code&&this.$input.blur(),\"ArrowUp\"===i.code&&(i.preventDefault(),t(this._step*this._arrowKeyMultiplier(i))),\"ArrowDown\"===i.code&&(i.preventDefault(),t(this._step*this._arrowKeyMultiplier(i)*-1))}),this.$input.addEventListener(\"wheel\",i=>{this._inputFocused&&(i.preventDefault(),t(this._step*this._normalizeMouseWheel(i)))},{passive:!1}),this.$input.addEventListener(\"mousedown\",t=>{i=t.clientX,e=s=t.clientY,r=!0,n=this.getValue(),l=0,window.addEventListener(\"mousemove\",o),window.addEventListener(\"mouseup\",a)}),this.$input.addEventListener(\"focus\",()=>{this._inputFocused=!0}),this.$input.addEventListener(\"blur\",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement(\"div\"),this.$slider.classList.add(\"slider\"),this.$fill=document.createElement(\"div\"),this.$fill.classList.add(\"fill\"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add(\"hasSlider\");const t=t=>{const i=this.$slider.getBoundingClientRect();let e=(s=t,n=i.left,l=i.right,r=this._min,o=this._max,(s-n)/(l-n)*(o-r)+r);var s,n,l,r,o;this._snapClampSetValue(e)},i=i=>{t(i.clientX)},e=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener(\"mousemove\",i),window.removeEventListener(\"mouseup\",e)};let s,n,l=!1;const r=i=>{i.preventDefault(),this._setDraggingStyle(!0),t(i.touches[0].clientX),l=!1},o=i=>{if(l){const t=i.touches[0].clientX-s,e=i.touches[0].clientY-n;Math.abs(t)>Math.abs(e)?r(i):(window.removeEventListener(\"touchmove\",o),window.removeEventListener(\"touchend\",a))}else i.preventDefault(),t(i.touches[0].clientX)},a=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener(\"touchmove\",o),window.removeEventListener(\"touchend\",a)},h=this._callOnFinishChange.bind(this);let d;this.$slider.addEventListener(\"mousedown\",s=>{this._setDraggingStyle(!0),t(s.clientX),window.addEventListener(\"mousemove\",i),window.addEventListener(\"mouseup\",e)}),this.$slider.addEventListener(\"touchstart\",t=>{t.touches.length>1||(this._hasScrollBar?(s=t.touches[0].clientX,n=t.touches[0].clientY,l=!0):r(t),window.addEventListener(\"touchmove\",o,{passive:!1}),window.addEventListener(\"touchend\",a))},{passive:!1}),this.$slider.addEventListener(\"wheel\",t=>{if(Math.abs(t.deltaX)this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class c extends t{constructor(t,i,e,s){super(t,i,e,\"option\"),this.$select=document.createElement(\"select\"),this.$select.setAttribute(\"aria-labelledby\",this.$name.id),this.$display=document.createElement(\"div\"),this.$display.classList.add(\"display\"),this._values=Array.isArray(s)?s:Object.values(s),this._names=Array.isArray(s)?s:Object.keys(s),this._names.forEach(t=>{const i=document.createElement(\"option\");i.innerHTML=t,this.$select.appendChild(i)}),this.$select.addEventListener(\"change\",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener(\"focus\",()=>{this.$display.classList.add(\"focus\")}),this.$select.addEventListener(\"blur\",()=>{this.$display.classList.remove(\"focus\")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const t=this.getValue(),i=this._values.indexOf(t);return this.$select.selectedIndex=i,this.$display.innerHTML=-1===i?t:this._names[i],this}}class u extends t{constructor(t,i,e){super(t,i,e,\"string\"),this.$input=document.createElement(\"input\"),this.$input.setAttribute(\"type\",\"text\"),this.$input.setAttribute(\"aria-labelledby\",this.$name.id),this.$input.addEventListener(\"input\",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener(\"keydown\",t=>{\"Enter\"===t.code&&this.$input.blur()}),this.$input.addEventListener(\"blur\",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let p=!1;class g{constructor({parent:t,autoPlace:i=void 0===t,container:e,width:s,title:n=\"Controls\",injectStyles:l=!0,touchStyles:r=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement(\"div\"),this.domElement.classList.add(\"lil-gui\"),this.$title=document.createElement(\"div\"),this.$title.classList.add(\"title\"),this.$title.setAttribute(\"role\",\"button\"),this.$title.setAttribute(\"aria-expanded\",!0),this.$title.setAttribute(\"tabindex\",0),this.$title.addEventListener(\"click\",()=>this.openAnimated(this._closed)),this.$title.addEventListener(\"keydown\",t=>{\"Enter\"!==t.code&&\"Space\"!==t.code||(t.preventDefault(),this.$title.click())}),this.$title.addEventListener(\"touchstart\",()=>{},{passive:!0}),this.$children=document.createElement(\"div\"),this.$children.classList.add(\"children\"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(n),r&&this.domElement.classList.add(\"allow-touch-styles\"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add(\"root\"),!p&&l&&(!function(t){const i=document.createElement(\"style\");i.innerHTML=t;const e=document.querySelector(\"head link[rel=stylesheet], head style\");e?document.head.insertBefore(i,e):document.head.appendChild(i)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,\"Droid Sans Mono\",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:\"↕\";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:\"▾\";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:\"▸\"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:\"Empty\";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:\"✓\";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4c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zF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==\") format(\"woff\")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:\" \";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),p=!0),e?e.appendChild(this.domElement):i&&(this.domElement.classList.add(\"autoPlace\"),document.body.appendChild(this.domElement)),s&&this.domElement.style.setProperty(\"--width\",s+\"px\"),this.domElement.addEventListener(\"keydown\",t=>t.stopPropagation()),this.domElement.addEventListener(\"keyup\",t=>t.stopPropagation())}add(t,e,s,n,l){if(Object(s)===s)return new c(this,t,e,s);const r=t[e];switch(typeof r){case\"number\":return new d(this,t,e,s,n,l);case\"boolean\":return new i(this,t,e);case\"string\":return new u(this,t,e);case\"function\":return new h(this,t,e)}console.error(\"gui.add failed\\n\\tproperty:\",e,\"\\n\\tobject:\",t,\"\\n\\tvalue:\",r)}addColor(t,i,e=1){return new a(this,t,i,e)}addFolder(t){return new g({parent:this,title:t})}load(t,i=!0){return t.controllers&&this.controllers.forEach(i=>{i instanceof h||i._name in t.controllers&&i.load(t.controllers[i._name])}),i&&t.folders&&this.folders.forEach(i=>{i._title in t.folders&&i.load(t.folders[i._title])}),this}save(t=!0){const i={controllers:{},folders:{}};return this.controllers.forEach(t=>{if(!(t instanceof h)){if(t._name in i.controllers)throw new Error(`Cannot save GUI with duplicate property \"${t._name}\"`);i.controllers[t._name]=t.save()}}),t&&this.folders.forEach(t=>{if(t._title in i.folders)throw new Error(`Cannot save GUI with duplicate folder \"${t._title}\"`);i.folders[t._title]=t.save()}),i}open(t=!0){return this._closed=!t,this.$title.setAttribute(\"aria-expanded\",!this._closed),this.domElement.classList.toggle(\"closed\",this._closed),this}close(){return this.open(!1)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?\"none\":\"\",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._closed=!t,this.$title.setAttribute(\"aria-expanded\",!this._closed),requestAnimationFrame(()=>{const i=this.$children.clientHeight;this.$children.style.height=i+\"px\",this.domElement.classList.add(\"transition\");const e=t=>{t.target===this.$children&&(this.$children.style.height=\"\",this.domElement.classList.remove(\"transition\"),this.$children.removeEventListener(\"transitionend\",e))};this.$children.addEventListener(\"transitionend\",e);const s=t?this.$children.scrollHeight:0;this.domElement.classList.toggle(\"closed\",!t),requestAnimationFrame(()=>{this.$children.style.height=s+\"px\"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),void 0!==this._onChange&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(i=>{t=t.concat(i.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(i=>{t=t.concat(i.foldersRecursive())}),t}}export default g;export{i as BooleanController,a as ColorController,t as Controller,h as FunctionController,g as GUI,d as NumberController,c as OptionController,u as StringController};\n"],"names":["$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","Object","defineProperty","get","$e0c75e95e2166c4b$export$983832d820c96993","set","s","enumerable","configurable","$e0c75e95e2166c4b$export$bd0bf19f25da8474","constructor","i","e","n","l","parent","object","property","_disabled","_hidden","initialValue","getValue","domElement","document","createElement","classList","add","$name","nextNameID","$widget","$disable","appendChild","children","push","controllers","$children","_listenCallback","bind","name","t","_name","innerHTML","onChange","_onChange","_callOnChange","_changed","onFinishChange","_onFinishChange","_callOnFinishChange","reset","setValue","enable","disable","toggle","toggleAttribute","show","style","display","hide","options","destroy","min","max","step","decimals","listen","_listening","_listenCallbackID","cancelAnimationFrame","requestAnimationFrame","save","_listenPrevValue","updateDisplay","load","splice","indexOf","removeChild","$e0c75e95e2166c4b$export$c6f57966aed3cc84","$input","setAttribute","addEventListener","checked","$e0c75e95e2166c4b$var$e","match","parseInt","toString","padStart","$e0c75e95e2166c4b$var$n","isPrimitive","fromHexString","substring","toHexString","$e0c75e95e2166c4b$var$l","Array","isArray","$e0c75e95e2166c4b$var$r","r","g","b","$e0c75e95e2166c4b$var$o","$e0c75e95e2166c4b$export$3a401c49038ca28a","$text","$display","_format","find","_rgbScale","_initialValueHexString","_textFocused","_setValueFromHexString","value","select","backgroundColor","$e0c75e95e2166c4b$export$2d7dcf9d07c8b352","$button","preventDefault","passive","$e0c75e95e2166c4b$export$ee52b68072d314b9","_initInput","_getImplicitStep","_decimals","_min","_onUpdateMinMax","_max","_step","_stepExplicit","_hasSlider","Math","$fill","width","_inputFocused","toFixed","parseFloat","isNaN","_snapClampSetValue","o","clientX","clientY","abs","blur","_setDraggingStyle","a","_arrowKeyMultiplier","removeEventListener","_snap","_clamp","_normalizeMouseWheel","_initSlider","d","$slider","insertBefore","getBoundingClientRect","left","right","touches","h","length","_hasScrollBar","deltaX","deltaY","clearTimeout","setTimeout","body","_hasMin","_hasMax","floor","wheelDelta","shiftKey","altKey","round","toPrecision","root","scrollHeight","clientHeight","$e0c75e95e2166c4b$export$25f00c724c27c8b4","$select","_values","values","_names","keys","forEach","selectedIndex","remove","$e0c75e95e2166c4b$export$786d0ebe8f71368e","$e0c75e95e2166c4b$var$p","autoPlace","container","title","injectStyles","touchStyles","folders","_closed","$title","openAnimated","click","querySelector","head","setProperty","stopPropagation","console","error","addColor","addFolder","_title","open","close","height","target","controllersRecursive","controller","parentElement","from","concat","foldersRecursive"],"version":3,"file":"silhouetteProjection.e215f6e5.js.map"} \ No newline at end of file diff --git a/example/bundle/silhouetteProjection.html b/example/bundle/silhouetteProjection.html new file mode 100644 index 0000000..cee9ba4 --- /dev/null +++ b/example/bundle/silhouetteProjection.html @@ -0,0 +1 @@ +three-edge-projection - Projected Edge Generation
Projected silhouette generation using the "clipper2-js" package.
\ No newline at end of file